src/dird/ua_restore.c
static void insert_one_file_or_dir(UAContext *ua, RESTORE_CTX *rx, char *date, bool dir)
{
   FILE *ffd;
   char file[5000];
   char *p = ua->cmd;
   int line = 0;

   switch (*p) {
   case '<':
      p++;
      if ((ffd = bfopen(p, "rb")) == NULL) {
         berrno be;
         ua->error_msg(_("Cannot open file %s: ERR=%s\n"),
            p, be.bstrerror());
         break;
      }
      while (fgets(file, sizeof(file), ffd)) {
         line++;
         if (dir) {
            if (!insert_dir_into_findex_list(ua, rx, file, date)) {
               ua->error_msg(_("Error occurred on line %d of file \"%s\"\n"), line, p);
            }
         } else {
            if (!insert_file_into_findex_list(ua, rx, file, date)) {
               ua->error_msg(_("Error occurred on line %d of file \"%s\"\n"), line, p);
            }
         }
      }
      fclose(ffd);
      break;
   case '?':
      p++;
      insert_table_into_findex_list(ua, rx, p);
      break;
   default:
      if (dir) {
         insert_dir_into_findex_list(ua, rx, ua->cmd, date);
      } else {
         insert_file_into_findex_list(ua, rx, ua->cmd, date);
      }
      break;
   }
}
/*
 * Insert a single file, or read a list of files from a file
 */
Insert a single file, or read a list of files from a file
Insert a single file or read a list of files from a file
static void insert_one_file_or_dir(UAContext *ua, RESTORE_CTX *rx, char *date, bool dir)
{
   FILE *ffd;
   char file[5000];
   char *p = ua->cmd;
   int line = 0;
   switch (*p) {
   case '<':
      p++;
      if ((ffd = bfopen(p, "rb")) == NULL) {
         berrno be;
         ua->error_msg(_("Cannot open file %s: ERR=%s\n"),
            p, be.bstrerror());
         break;
      }
      while (fgets(file, sizeof(file), ffd)) {
         line++;
         if (dir) {
            if (!insert_dir_into_findex_list(ua, rx, file, date)) {
               ua->error_msg(_("Error occurred on line %d of file \"%s\"\n"), line, p);
            }
         } else {
            if (!insert_file_into_findex_list(ua, rx, file, date)) {
               ua->error_msg(_("Error occurred on line %d of file \"%s\"\n"), line, p);
            }
         }
      }
      fclose(ffd);
      break;
   case '?':
      p++;
      insert_table_into_findex_list(ua, rx, p);
      break;
   default:
      if (dir) {
         insert_dir_into_findex_list(ua, rx, ua->cmd, date);
      } else {
         insert_file_into_findex_list(ua, rx, ua->cmd, date);
      }
      break;
   }
}
static void insert_one_file_or_dir ( UAContext * ua , RESTORE_CTX * rx , char * date , bool dir ) { FILE * ffd ; char file [ 5000 ] ; char * p = ua -> cmd ; int line = 0 ; switch ( * p ) { case ' ' : p ++ ; if ( ( ffd = bfopen ( p , " " ) ) == NULL ) { berrno be ; ua -> error_msg ( _ ( " \n " ) , p , be . bstrerror ( ) ) ; break ; } while ( fgets ( file , sizeof ( file ) , ffd ) ) { line ++ ; if ( dir ) { if ( ! insert_dir_into_findex_list ( ua , rx , file , date ) ) { ua -> error_msg ( _ ( " \" \" \n " ) , line , p ) ; } } else { if ( ! insert_file_into_findex_list ( ua , rx , file , date ) ) { ua -> error_msg ( _ ( " \" \" \n " ) , line , p ) ; } } } fclose ( ffd ) ; break ; case ' ' : p ++ ; insert_table_into_findex_list ( ua , rx , p ) ; break ; default : if ( dir ) { insert_dir_into_findex_list ( ua , rx , ua -> cmd , date ) ; } else { insert_file_into_findex_list ( ua , rx , ua -> cmd , date ) ; } break ; } }
Insert a single file, or read a list of files from a file
Insert a single file or read a list of files from a file