#include #include #include main( int argc, char *argv[] ) { char theString[512]; char theSeparator[512]; char *argt; extern char *optarg; extern int optind,opterr,optopt; int opcion; unsigned char theError=0; while ( (opcion=getopt(argc,argv,"c:")) != EOF ) { switch(opcion) { case 'c': theError += ( *optarg==0x00 ); strcpy( theSeparator,optarg); break; default: theError ++; break; } } if ( theError != 0 ) { fprintf( stderr, "Usage: %s -c separator\n", argv[0]); exit(-1); } while ( gets(theString) != NULL ) { argt = strtok( theString, theSeparator ); while( argt != NULL ) { puts( argt ); argt=strtok( NULL, theSeparator ); } } }