src/dird/snapshot.c
bool update_snapshot(UAContext *ua)
{
   SNAPSHOT_DBR sr;
   POOL_MEM ret;
   char ed1[130];
   bool done = false;
   int i;
   const char *kw[] = {
      NT_("Retention"),                /* 0 */
      NT_("Comment"),                  /* 1 */
      NULL };

   for (i=0; kw[i]; i++) {
      int j;
      if ((j=find_arg_with_value(ua, kw[i])) > 0) {
         /* If all from pool don't select a media record */
         if (!select_snapshot_dbr(ua, &sr)) {
            return 0;
         }
         switch (i) {
         case 0:
            update_snapretention(ua, ua->argv[j], &sr);
            break;
         case 1:
            update_snapcomment(ua, ua->argv[j], &sr);
            break;
         default:
            break;
         }
         done = true;
      }
   }

   for ( ; !done; ) {
      start_prompt(ua, _("Parameters to modify:\n"));
      add_prompt(ua, _("Snapshot Retention Period"));  /* 0 */
      add_prompt(ua, _("Snapshot Comment"));           /* 1 */
      add_prompt(ua, _("Done"));                       /* 2 */
      i = do_prompt(ua, "", _("Select parameter to modify"), NULL, 0);
      if (i == 2) {
         return 0;
      }

      if (!select_snapshot_dbr(ua, &sr)) {  /* Get Snapshot record */
         return 0;
      }
      ua->info_msg(_("Updating Snapshot \"%s\" on \"%s\"\n"), sr.Name, sr.Client);

      switch (i) {
      case 0:                         /* Snapshot retention */
         ua->info_msg(_("Current retention period is: %s\n"),
            edit_utime(sr.Retention, ed1, sizeof(ed1)));
         if (!get_cmd(ua, _("Enter Snapshot Retention period: "))) {
            return 0;
         }
         update_snapretention(ua, ua->cmd, &sr);
         break;
      case 1:
         ua->info_msg(_("Current comment is: %s\n"), NPRTB(sr.Comment));
         if (!get_cmd(ua, _("Enter Snapshot comment: "))) {
            return 0;
         }
         update_snapcomment(ua, ua->cmd, &sr);
         break;
      default:                        /* Done or error */
         ua->info_msg(_("Selection terminated.\n"));
         return 1;
      }
   }
   return 1;
}
/* This part should be in ua_update.c */
This part should be in ua_update.c
This part should be in ua_update . c
bool update_snapshot(UAContext *ua)
{
   SNAPSHOT_DBR sr;
   POOL_MEM ret;
   char ed1[130];
   bool done = false;
   int i;
   const char *kw[] = {
      NT_("Retention"),                
      NT_("Comment"),                  
      NULL };
   for (i=0; kw[i]; i++) {
      int j;
      if ((j=find_arg_with_value(ua, kw[i])) > 0) {
         if (!select_snapshot_dbr(ua, &sr)) {
            return 0;
         }
         switch (i) {
         case 0:
            update_snapretention(ua, ua->argv[j], &sr);
            break;
         case 1:
            update_snapcomment(ua, ua->argv[j], &sr);
            break;
         default:
            break;
         }
         done = true;
      }
   }
   for ( ; !done; ) {
      start_prompt(ua, _("Parameters to modify:\n"));
      add_prompt(ua, _("Snapshot Retention Period"));  
      add_prompt(ua, _("Snapshot Comment"));           
      add_prompt(ua, _("Done"));                       
      i = do_prompt(ua, "", _("Select parameter to modify"), NULL, 0);
      if (i == 2) {
         return 0;
      }
      if (!select_snapshot_dbr(ua, &sr)) {  
         return 0;
      }
      ua->info_msg(_("Updating Snapshot \"%s\" on \"%s\"\n"), sr.Name, sr.Client);
      switch (i) {
      case 0:                         
         ua->info_msg(_("Current retention period is: %s\n"),
            edit_utime(sr.Retention, ed1, sizeof(ed1)));
         if (!get_cmd(ua, _("Enter Snapshot Retention period: "))) {
            return 0;
         }
         update_snapretention(ua, ua->cmd, &sr);
         break;
      case 1:
         ua->info_msg(_("Current comment is: %s\n"), NPRTB(sr.Comment));
         if (!get_cmd(ua, _("Enter Snapshot comment: "))) {
            return 0;
         }
         update_snapcomment(ua, ua->cmd, &sr);
         break;
      default:                        
         ua->info_msg(_("Selection terminated.\n"));
         return 1;
      }
   }
   return 1;
}
bool update_snapshot ( UAContext * ua ) { SNAPSHOT_DBR sr ; POOL_MEM ret ; char ed1 [ 130 ] ; bool done = false ; int i ; const char * kw [ ] = { NT_ ( " " ) , NT_ ( " " ) , NULL } ; for ( i = 0 ; kw [ i ] ; i ++ ) { int j ; if ( ( j = find_arg_with_value ( ua , kw [ i ] ) ) > 0 ) { if ( ! select_snapshot_dbr ( ua , & sr ) ) { return 0 ; } switch ( i ) { case 0 : update_snapretention ( ua , ua -> argv [ j ] , & sr ) ; break ; case 1 : update_snapcomment ( ua , ua -> argv [ j ] , & sr ) ; break ; default : break ; } done = true ; } } for ( ; ! done ; ) { start_prompt ( ua , _ ( " \n " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; i = do_prompt ( ua , " " , _ ( " " ) , NULL , 0 ) ; if ( i == 2 ) { return 0 ; } if ( ! select_snapshot_dbr ( ua , & sr ) ) { return 0 ; } ua -> info_msg ( _ ( " \" \" \" \" \n " ) , sr . Name , sr . Client ) ; switch ( i ) { case 0 : ua -> info_msg ( _ ( " \n " ) , edit_utime ( sr . Retention , ed1 , sizeof ( ed1 ) ) ) ; if ( ! get_cmd ( ua , _ ( " " ) ) ) { return 0 ; } update_snapretention ( ua , ua -> cmd , & sr ) ; break ; case 1 : ua -> info_msg ( _ ( " \n " ) , NPRTB ( sr . Comment ) ) ; if ( ! get_cmd ( ua , _ ( " " ) ) ) { return 0 ; } update_snapcomment ( ua , ua -> cmd , & sr ) ; break ; default : ua -> info_msg ( _ ( " \n " ) ) ; return 1 ; } } return 1 ; }
This part should be in ua_update.c
This part should be in ua_update . c
/* 0 */ /* 1 */ /* If all from pool don't select a media record */ /* 0 */ /* 1 */ /* 2 */ /* Get Snapshot record */ /* Snapshot retention */ /* Done or error */