![]() |
Icinga-core 1.4.0
next gen monitoring
|
00001 #include <string.h> 00002 #include <stdio.h> 00003 #include <stdlib.h> 00004 #include <unistd.h> 00005 00006 int main(int argc, char **argv){ 00007 int fd=STDIN_FILENO; 00008 FILE *fp; 00009 int x=0; 00010 char temp_buffer[1024]; 00011 char *ptr1=NULL; 00012 char *ptr2=NULL; 00013 00014 00015 if(argc<2) 00016 exit(1); 00017 00018 x=atoi(argv[1]); 00019 00020 fp=fdopen(fd,"r"); 00021 while(fgets(temp_buffer,sizeof(temp_buffer),fp)){ 00022 00023 ptr1=strtok(temp_buffer," "); 00024 ptr2=strtok(NULL," "); 00025 00026 printf("%s %-44s %d\n",(ptr1==NULL)?"NULL":ptr1,(ptr2==NULL)?"NULL":ptr2,x); 00027 00028 x++; 00029 } 00030 00031 00032 exit(1); 00033 }