/* fild_8up.c */ /* 8 = 1+3+4 Target */ /* 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; * And tandem numbers of WHILE-loops becomes the field Number. * Now, here comes the first prototype of Field Number Controlled * given word Capture Recycable Object. * * I tested this for Win3.1 "DIR.Txt" by 'Pro134E.prj', and works fine. */ /* I wanted to make this one to be a geneic Based-on Field Number, Read and * Write control. Then it may be useful at various situations. * By a quick test, this did exactly what I wanted. */ /* 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). */ /* By this "Field_No2.c" version, suppose No Details of output control * is necessary, but just Field Number level control. * Column position Counter "i" is deleted. * -> Yes, this is working. When I applied to Win3.1 "DIR.txt" * It printed Field Shift in a few sporadic rows, since some of * them don't have the 2nd Field "Extention" Word. */ /* This way is out of 'main.c', but rather Recycling Object Control. * The 'main.c' can't control anything about. I already have * the 'Main.c' Control version by Column Position, so this would * be the best complement to it. Recycling Object like this is * so tiny, and go anywhere, and so easy to read and modify. Thus, * in this point of view, also the best complement to 'Main.c' * control. So, use this conveniently. */ /* This was originally, Liquid Paper on 4th Field. Now, with * 'upField', 'downField' variables, Liquid Paper is moved into * 'main.c'. Therefore, at here, I just need to, * UpField control OR * DownField control * This one is for 'UpField' from 1st to 2nd. * Again here, I have Options for I do choose for mute-mode on 4th to end, * OR, do something else such 'break' to get out of While-loop. * Let me see. */ /* Break down of 8UP = Erase 1+3+4 Fields */ /* 8UP -> 1 mute; * 2 print; * to end mute; * 8Down -> 1-to-4 mute; * to end All print; */ #include <ctype.h> extern char *fild_8up (char *to, char *from) { /* 1st: Capturing 1st Field(Word) */ /* This one is mute. */ while (isspace(*from) && *from!='\0') { ++from; } while ( !isspace(*from) && *from!='\0' && *from!='.' ) { ++from; } /* Between Words, Read and Write "Blank(' ')" Space" (or similar) */ while (isspace(*from) && *from!='\0' ) { *to++ = *from++ = ' '; } /* 2nd: Capturing 2nd Field(Word) */ while ( !isspace(*from) && *from!='\0' && *from!='.' ) { *to++ = *from++; } /* Now, to the end of line, all mute-mode. */ while ( *from!='\0' ) { ++from; } // *to = '\0'; return (from); }