/* copy_f_1_and_3_and_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.  */

//  (2008-03-27)
//
//  When I was erasing words of 4th and 5th fields, at first I applied the 
//  the blank spaces while erasing, but that left the different number of blank spaces
//  between 3rd and 6th fields in the files in /SDW/Erased/ and in /ZIP_FLASH/Erased/.   
//  To adjust blank space to be the same length, I decided to use DELETING  4th, in-between,  
//  and 5th fields, by plain pointer advancement like, 
//     
//       while ( in 4th, in-between, OR 5th field )    {  ++from;  }
//
//  It worked just perfectly.
//  


#include <ctype.h>

extern char *copy_f_1_and_3_and_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), Put Blanks.  */
   while ( !isspace(*from) && *from!='\0' )                  {  *to++ = *from++ = ' ';  }

   /* Between Words, PRINT OUT AS "Blank(' ') Space". */
   while ( isspace(*from)  && *from!='\0' )                  {  *to++ = *from++ = ' ';   }

   /* 3rd:  Capturing 3rd Field(Word), COPY IT OUT.  */
   while ( !isspace(*from) && *from!='\0' )                  {  *to++ = *from++;  }

   /* Between Words, PRINT OUT AS "Blank(' ') Space". */
   while ( isspace(*from)  && *from!='\0' )                  {  *to++ = *from++ = ' ';   }

   /* 4th:  Capturing 4th Field(Word), OUTPUT NOTHING, namely, deleting.  */
   while ( !isspace(*from) && *from!='\0' )                    {  ++from;  }

   /* Between Words, OUTPUT NOTHING, namely, deleting. */
   while ( isspace(*from)  && *from!='\0' )                    {  ++from;  }

   /* 5th:  Capturing 5th Field(Word), OUTPUT NOTHING, namely, deleting.  */
   while ( !isspace(*from) && *from!='\0' )                    {  ++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);
}