/* copy_b_1_2_3_and_5_6_7_8_9.c */ /* Take a Control by the Number of Field. */ /* Modified Recyclable Object << 'firstwd()'. */ /* As I saw below, by using * isspace OR *from==' ', I can recognize field delimiter Blank (' '); * while by using * !isspace (NOT is space), I can capture the words at given field; */ /* Now, at any given field, I can skip or make it blank. * while () ++from; -> skip the field as if not exist. * while () *to++ = *from++ = ' ' -> make it erased (by white liquid paper). */ /* Practically speaking, from fields 5 to 9(end), I can put it altogether. */ /* That is whatever characters come, space or not_space, just COPY-IT-OUT. */ /* But I haven't implemented this. */ #include <ctype.h> extern char *copy_b_1_2_3_and_5_6_7_8_9 (char *to, char *from) { /* 1st: Capturing 1st Field(Word), COPY IT OUT */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } while ( !isspace(*from) && *from!='\0' ) { *to++ = *from++; } /* Between Words, Print out as "Blank(' ') Space" */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 2nd: Capturing 2nd Field(Word), COPY IT OUT */ while ( !isspace(*from) && *from!='\0' ) { *to++ = *from++; } /* Between Words, Read and Write "Blank(' ') Space" */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 3rd: Capturing 3rd Field(Word), COPY IY OUT */ while ( !isspace(*from) && *from!='\0' ) { *to++ = *from++; } /* Between Words, Print out as "Blank(' ') Space" */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 4th: Capturing 2nd Field(Word), Put Blanks */ while ( !isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* Between Words, PRINT OUT AS "Blank(' ') Space" */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 5th: Capturing 2nd Field(Word), COPY IT OUT. */ while ( !isspace(*from) && *from!='\0' ) { *to++ = *from++; } /* Between Words, Read Blank(' ') or similar */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 6th: Capturing 6th Field(Word), COPY IT OUT. */ while ( !isspace(*from) && *from!='\0' ) { *to++ = *from++; } /* Between Words, Read Blank(' ') or similar */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 7th: Capturing 7th Field(Word), COPY IT OUT. */ while ( !isspace(*from) && *from!='\0' ) { *to++ = *from++; } /* Between Words, Read Blank(' ') or similar */ while ( isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 8th: Capturing 8th Field(Word), COPY IT OUT. */ while ( !isspace(*from) && *from!='\0' && *from!='.' ) { *to++ = *from++; } /* To-the-end: Until end of line, COPY IT OUT. */ while ( *from!='\0' ) { *to++ = *from++; } *to = '\0'; return (from); }