src/dird/snapshot.c
int select_snapshot_dbr(UAContext *ua, SNAPSHOT_DBR *sr)
{
   int   ret = 0;
   char *p;
   POOLMEM *err = get_pool_memory(PM_FNAME);
   *err=0;

   sr->reset();
   snapshot_scan_cmdline(ua, 0, sr);

   if (sr->SnapshotId == 0 && (sr->Name[0] == 0 || sr->Client[0] == 0)) {
      CLIENT_DBR cr;
      memset(&cr, 0, sizeof(cr));
      /* Get the pool from client=<client-name> */
      if (!get_client_dbr(ua, &cr, JT_BACKUP_RESTORE)) {
         goto bail_out;
      }
      sr->ClientId = cr.ClientId;
      db_list_snapshot_records(ua->jcr, ua->db, sr, prtit, ua, HORZ_LIST);
      if (!get_cmd(ua, _("Enter a SnapshotId: "))) {
         goto bail_out;
      }
      p = ua->cmd;
      if (*p == '*') {
         p++;
      }
      if (is_a_number(p)) {
         sr->SnapshotId = str_to_int64(p);
      } else {
         goto bail_out;
      }
   }

   if (!get_snapshot_record(ua, sr)) {
      ua->error_msg(_("Unable to get Snapshot record.\n"));
      goto bail_out;
   }

   ret = 1;

bail_out:
   if (!ret && *err) {
      ua->error_msg("%s", err);
   }
   free_pool_memory(err);
   return ret;
}
/* Select a Snapshot record from the database, might be in ua_select.c */
Select a Snapshot record from the database, might be in ua_select.c
Select a Snapshot record from the database might be in ua_select . c
int select_snapshot_dbr(UAContext *ua, SNAPSHOT_DBR *sr)
{
   int   ret = 0;
   char *p;
   POOLMEM *err = get_pool_memory(PM_FNAME);
   *err=0;
   sr->reset();
   snapshot_scan_cmdline(ua, 0, sr);
   if (sr->SnapshotId == 0 && (sr->Name[0] == 0 || sr->Client[0] == 0)) {
      CLIENT_DBR cr;
      memset(&cr, 0, sizeof(cr));
      if (!get_client_dbr(ua, &cr, JT_BACKUP_RESTORE)) {
         goto bail_out;
      }
      sr->ClientId = cr.ClientId;
      db_list_snapshot_records(ua->jcr, ua->db, sr, prtit, ua, HORZ_LIST);
      if (!get_cmd(ua, _("Enter a SnapshotId: "))) {
         goto bail_out;
      }
      p = ua->cmd;
      if (*p == '*') {
         p++;
      }
      if (is_a_number(p)) {
         sr->SnapshotId = str_to_int64(p);
      } else {
         goto bail_out;
      }
   }
   if (!get_snapshot_record(ua, sr)) {
      ua->error_msg(_("Unable to get Snapshot record.\n"));
      goto bail_out;
   }
   ret = 1;
bail_out:
   if (!ret && *err) {
      ua->error_msg("%s", err);
   }
   free_pool_memory(err);
   return ret;
}
int select_snapshot_dbr ( UAContext * ua , SNAPSHOT_DBR * sr ) { int ret = 0 ; char * p ; POOLMEM * err = get_pool_memory ( PM_FNAME ) ; * err = 0 ; sr -> reset ( ) ; snapshot_scan_cmdline ( ua , 0 , sr ) ; if ( sr -> SnapshotId == 0 && ( sr -> Name [ 0 ] == 0 || sr -> Client [ 0 ] == 0 ) ) { CLIENT_DBR cr ; memset ( & cr , 0 , sizeof ( cr ) ) ; if ( ! get_client_dbr ( ua , & cr , JT_BACKUP_RESTORE ) ) { goto bail_out ; } sr -> ClientId = cr . ClientId ; db_list_snapshot_records ( ua -> jcr , ua -> db , sr , prtit , ua , HORZ_LIST ) ; if ( ! get_cmd ( ua , _ ( " " ) ) ) { goto bail_out ; } p = ua -> cmd ; if ( * p == ' ' ) { p ++ ; } if ( is_a_number ( p ) ) { sr -> SnapshotId = str_to_int64 ( p ) ; } else { goto bail_out ; } } if ( ! get_snapshot_record ( ua , sr ) ) { ua -> error_msg ( _ ( " \n " ) ) ; goto bail_out ; } ret = 1 ; bail_out : if ( ! ret && * err ) { ua -> error_msg ( " " , err ) ; } free_pool_memory ( err ) ; return ret ; }
Select a Snapshot record from the database, might be in ua_select.c
Select a Snapshot record from the database might be in ua_select . c
/* Get the pool from client=<client-name> */