static void usage() { fprintf (stderr,"cgi --host linuxconf_host --port tcp_port\n"); fprintf (stderr," default is 127.0.0.1 on port 98\n"); } int main (int argc, char *argv[]) { int i; for (i=1; i 0){ char *pt = buf; buf[nb] = '\0'; while (*pt != '\0'){ char *start = pt; pt = strchr(pt,'\n'); if (pt != NULL){ *pt++ = '\0'; strcat (line,start); if (noline < head){ printf ("%s\n",line); noline ++; if (noline == head) done = 1; }else if (tail > 0){ }else{ printf ("%s\n",line); } line[0] = '\0'; }else{ strcat (line,start); break; } } } if (head > 0){ if (noline < head) printf ("%s\n",line); }else if (tail > 0){ }else{ printf ("%s",line); } ret = 0; } return ret; }