int main(int argc, char **argv){ #if DBG int l; #endif parse_args(argc,argv); if (OPTL){ if(DEBUG){printf("case-wise subsetting is requested\n\n");} parse_list_g(RSSET); } if ((RECNUM>0) && (RECLEN<1)) { /* no reclen specified must determine reclength from data*/ char input[NBUFSIZ]; fgets(input, NBUFSIZ, stdin); /* contents of input after fgets: data themselve + '\n' + '\0'*/ RECLEN = strlen(input)-1;/*RECLEN includes a new line character */ if (RECLEN<1) { fprintf(stderr,"can't determine record length\n"); usage(); } /* offset=ftell(stdin); if(DEBUG){printf("++++++ ftell=%d ++++++\n",offset);} */ /* move back the origin of th stream */ /* fseek(stdin, 0,SEEK_SET); */ strcpy ( LINE_BUFFERED, input ); /*bytes_buffered = RECLEN; */ parse_lists(LINE); cut_col(stdin); } else { parse_lists(LINE); } if (OPTC==1) { cut_col(stdin); #if DBG if (DEBUG){ printf("\ncontents of args array\n"); for (l=0;args[l] != 0 ;l++){ printf("%d-%d\n",l, args[l]); } printf("\n"); } #endif } else { if (PIDNO == -1) { cut_fields(stdin); } else if (PIDNO >= 0) { fcut_fields(stdin, PIDNO); } } if(DEBUG){printf("last row number=%d\n", crrntRN);} return(0); }
static void cut_stream(FILE *stream ) { { if ((unsigned int )operating_mode == 1U) { cut_bytes(stream); } else { cut_fields(stream); } return; } }