src/lib/lex.c
int lex_get_char(LEX *lf)
{
   if (lf->ch == L_EOF) {
      Emsg0(M_ABORT, 0, _("get_char: called after EOF."
         " You may have a open double quote without the closing double quote.\n"));
   }
   if (lf->fd && lf->ch == L_EOL) {
      if (bfgets(lf->line, lf->fd) == NULL) {
         lf->ch = L_EOF;
         if (lf->next) {
            lex_close_file(lf);
         }
         return lf->ch;
      }
      lf->line_no++;
      lf->col_no = 0;
      Dmsg2(1000, "fget line=%d %s", lf->line_no, lf->line);
   } else if (lf->ch == L_EOL) {
      lf->line_no++;
      lf->col_no++;
   }
   lf->ch = (uint8_t)lf->line[lf->col_no];
   if (lf->fd) {
      if (lf->ch == 0) {
         lf->ch = L_EOL;           /* reached end of line, force bfgets */
      } else {
         lf->col_no++;
      }
   } else {
      if (lf->ch == 0) {           /* End of buffer, stop scan */
         lf->ch = L_EOF;
         if (lf->next) {
            lex_close_file(lf);
         }
         return lf->ch;
      } else if (lf->ch == '\n') {  /* End of line */
         Dmsg0(dbglvl, "Found newline return L_EOL\n");
         lf->ch = L_EOL;
      } else {
         lf->col_no++;
      }
   }
   Dmsg3(dbglvl, "lex_get_char: %c %d col=%d\n", lf->ch, lf->ch, lf->col_no);
   return lf->ch;
}
/*
 * Get the next character from the input.
 *  Returns the character or
 *    L_EOF if end of file
 *    L_EOL if end of line
 */
Get the next character from the input.
Returns the character or
L_EOF if end of file
L_EOL if end of line
Get the next character from the input . Returns the character or L_EOF if end of file L_EOL if end of line
int lex_get_char(LEX *lf)
{
   if (lf->ch == L_EOF) {
      Emsg0(M_ABORT, 0, _("get_char: called after EOF."
         " You may have a open double quote without the closing double quote.\n"));
   }
   if (lf->fd && lf->ch == L_EOL) {
      if (bfgets(lf->line, lf->fd) == NULL) {
         lf->ch = L_EOF;
         if (lf->next) {
            lex_close_file(lf);
         }
         return lf->ch;
      }
      lf->line_no++;
      lf->col_no = 0;
      Dmsg2(1000, "fget line=%d %s", lf->line_no, lf->line);
   } else if (lf->ch == L_EOL) {
      lf->line_no++;
      lf->col_no++;
   }
   lf->ch = (uint8_t)lf->line[lf->col_no];
   if (lf->fd) {
      if (lf->ch == 0) {
         lf->ch = L_EOL;           
      } else {
         lf->col_no++;
      }
   } else {
      if (lf->ch == 0) {           
         lf->ch = L_EOF;
         if (lf->next) {
            lex_close_file(lf);
         }
         return lf->ch;
      } else if (lf->ch == '\n') {  
         Dmsg0(dbglvl, "Found newline return L_EOL\n");
         lf->ch = L_EOL;
      } else {
         lf->col_no++;
      }
   }
   Dmsg3(dbglvl, "lex_get_char: %c %d col=%d\n", lf->ch, lf->ch, lf->col_no);
   return lf->ch;
}
int lex_get_char ( LEX * lf ) { if ( lf -> ch == L_EOF ) { Emsg0 ( M_ABORT , 0 , _ ( " " " \n " ) ) ; } if ( lf -> fd && lf -> ch == L_EOL ) { if ( bfgets ( lf -> line , lf -> fd ) == NULL ) { lf -> ch = L_EOF ; if ( lf -> next ) { lex_close_file ( lf ) ; } return lf -> ch ; } lf -> line_no ++ ; lf -> col_no = 0 ; Dmsg2 ( 1000 , " " , lf -> line_no , lf -> line ) ; } else if ( lf -> ch == L_EOL ) { lf -> line_no ++ ; lf -> col_no ++ ; } lf -> ch = ( uint8_t ) lf -> line [ lf -> col_no ] ; if ( lf -> fd ) { if ( lf -> ch == 0 ) { lf -> ch = L_EOL ; } else { lf -> col_no ++ ; } } else { if ( lf -> ch == 0 ) { lf -> ch = L_EOF ; if ( lf -> next ) { lex_close_file ( lf ) ; } return lf -> ch ; } else if ( lf -> ch == ' \n ' ) { Dmsg0 ( dbglvl , " \n " ) ; lf -> ch = L_EOL ; } else { lf -> col_no ++ ; } } Dmsg3 ( dbglvl , " \n " , lf -> ch , lf -> ch , lf -> col_no ) ; return lf -> ch ; }
Get the next character from the input.
Get the next character from the input .
/* reached end of line, force bfgets */ /* End of buffer, stop scan */ /* End of line */