8 post-process ext files

<..post-process ext files..>
 if( <.ext-script.> ){
   eoln_ch = (int) ’x’;
   while( eoln_ch != EOF ) {
      status = scan_str("File: ", TRUE, lg_file);
      status = scan_until_str(".", 1, status, lg_file);
      status = scan_until_end_str("", 2, status, lg_file);
      if( status ){                  Q_CHAR *ext;
                       struct script_struct *cur_script;
         ext = match[1];
         (IGNORED) strct( ext, match[2] );
         ext += strlen((char *) ext);
         while( *(--ext) != ’.’ ){ ; }
         *ext = ’\0’; ext++;
         <.get script for ext.>
         (void) execute_script(cur_script,
                  match[1], Dotfield? Dotfield : "", "", "");
         <.release script for ext.>
 } }  }
 -_-_-

<..get script for ext..>
 {
             struct script_struct *cur, *add, *temp;
             Q_CHAR extPlus[256];
   cur = <.ext-script.>;
   add = cur_script = NULL_SCRIPT;
   while( cur ){
      <.ext = ext + choise.>
      if( strpre(extPlus, cur->command) ){
         <.temp = ext command.>
         if( cur_script == NULL_SCRIPT ){
            cur_script = add = temp;
         } else {
            add = add->next = temp;
      }  }
      cur = cur->next;
 } }
 -_-_-

<..ext = ext + choise..>
 (IGNORED) strcpy((char *) extPlus, (char *) ext);
 /*
    if ( envChoice ) {
       (IGNORED) strct ( extPlus, envChoice );
    }
 */
 (IGNORED) strct ( extPlus, " " );
 -_-_-

<..temp = ext command..>
 temp = (struct script_struct *)
             m_alloc(struct script_struct, (int) 1);
 temp->command = m_alloc(char, (int) strlen((char *) cur->command) + 1);
 temp->next =  NULL_SCRIPT;
 (IGNORED) strcpy((char *) temp->command,
                  (char *) cur->command + (int) strlen((char *) extPlus) );
 -_-_-

<..release script for ext..>
 while(  cur_script != (struct script_struct*) 0 ){
                           struct script_struct *temp;
   temp = cur_script; cur_script = cur_script->next; free((void *) temp);
 }
 -_-_-

<..header functions..>+
 static BOOL strpre( ARG_II(char *,char *) );
 -_-_-

<..functions..>+
 
 static BOOL strpre(s1,s2)
                     char * s1;
                     char * s2
 ;{                   int i;
   for( i=0; i < (int) strlen((char *) s1); i++){
     if( *(s1+i) != *(s2+i) ){ return FALSE; }
   }
   return TRUE;
 }
 -_-_-

<..ext-script..>
 ext_script
 -_-_-

<..defines..>+
 struct env_c_rec{
   Q_CHAR *option;
   struct env_c_rec  *next;
 };
 -_-_-

<..vars..>+
 static struct env_c_rec *envChoice
        = (struct env_c_rec*) 0;
 -_-_-

<..env blocks selector..>
 struct env_c_rec *temp = (struct env_c_rec*)
                    m_alloc(struct env_c_rec, (int) 1);
 temp->option = q;
 temp->next = envChoice;
 envChoice = temp;
 -_-_-

<..env-skip = skip segment match[1]..>
 if( envChoice == (struct env_c_rec*) 0  ){
   env_skip = !eq_str(match[1], "default" );
 } else {
                struct env_c_rec *p;
   env_skip = TRUE;
   for( p=envChoice; p!=(struct env_c_rec*) 0 ; p = p->next ){
     if( eq_str(match[1], p->option ) ){ env_skip = FALSE; }
 } }
 -_-_-