src/lib/lex.c
LEX *lex_close_file(LEX *lf)
{
   LEX *of;

   if (lf == NULL) {
      Emsg0(M_ABORT, 0, _("Close of NULL file\n"));
   }
   Dmsg1(dbglvl, "Close lex file: %s\n", lf->fname);

   of = lf->next;
   if (lf->bpipe) {
      close_bpipe(lf->bpipe);
      lf->bpipe = NULL;
   } else if (lf->fd) {
      fclose(lf->fd);
   }
   Dmsg1(dbglvl, "Close cfg file %s\n", lf->fname);
   if (lf->fname) {
      free(lf->fname);
   }
   free_memory(lf->line);
   lf->line = NULL;
   free_memory(lf->str);
   lf->str = NULL;
   if (of) {
      of->options = lf->options;      /* preserve options */
      memcpy(lf, of, sizeof(LEX));
      Dmsg1(dbglvl, "Restart scan of cfg file %s\n", of->fname);
   } else {
      of = lf;
      lf = NULL;
   }
   if (of) {
      free(of);
   }
   return lf;
}
/*
 * Free the current file, and retrieve the contents
 * of the previous packet if any.
 */
Free the current file, and retrieve the contents
of the previous packet if any.
Free the current file and retrieve the contents of the previous packet if any .
LEX *lex_close_file(LEX *lf)
{
   LEX *of;
   if (lf == NULL) {
      Emsg0(M_ABORT, 0, _("Close of NULL file\n"));
   }
   Dmsg1(dbglvl, "Close lex file: %s\n", lf->fname);
   of = lf->next;
   if (lf->bpipe) {
      close_bpipe(lf->bpipe);
      lf->bpipe = NULL;
   } else if (lf->fd) {
      fclose(lf->fd);
   }
   Dmsg1(dbglvl, "Close cfg file %s\n", lf->fname);
   if (lf->fname) {
      free(lf->fname);
   }
   free_memory(lf->line);
   lf->line = NULL;
   free_memory(lf->str);
   lf->str = NULL;
   if (of) {
      of->options = lf->options;      
      memcpy(lf, of, sizeof(LEX));
      Dmsg1(dbglvl, "Restart scan of cfg file %s\n", of->fname);
   } else {
      of = lf;
      lf = NULL;
   }
   if (of) {
      free(of);
   }
   return lf;
}
LEX * lex_close_file ( LEX * lf ) { LEX * of ; if ( lf == NULL ) { Emsg0 ( M_ABORT , 0 , _ ( " \n " ) ) ; } Dmsg1 ( dbglvl , " \n " , lf -> fname ) ; of = lf -> next ; if ( lf -> bpipe ) { close_bpipe ( lf -> bpipe ) ; lf -> bpipe = NULL ; } else if ( lf -> fd ) { fclose ( lf -> fd ) ; } Dmsg1 ( dbglvl , " \n " , lf -> fname ) ; if ( lf -> fname ) { free ( lf -> fname ) ; } free_memory ( lf -> line ) ; lf -> line = NULL ; free_memory ( lf -> str ) ; lf -> str = NULL ; if ( of ) { of -> options = lf -> options ; memcpy ( lf , of , sizeof ( LEX ) ) ; Dmsg1 ( dbglvl , " \n " , of -> fname ) ; } else { of = lf ; lf = NULL ; } if ( of ) { free ( of ) ; } return lf ; }
Free the current file, and retrieve the contents
 of the previous packet if any.
Free the current file and retrieve the contents of the previous packet if any .
/* preserve options */