src/filed/fd_snapshot.c
int snapshot_list_catalog(JCR *jcr,
                          const char *query,
                          alist *lst)
{
   int ret = 0, i;
   arg_parser cmd;
   POOL_MEM q, tmp;
   if (cmd.parse_cmd(query) != bRC_OK) {
      Dmsg1(DT_SNAPSHOT, "Unable to decode query %s\n", query);
      return 0;
   }
   Mmsg(q, "CatReq Job=%s list_snapshot name=", jcr->Job);
   if ((i = cmd.find_arg_with_value("name")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   pm_strcat(q, " volume=");
   if ((i = cmd.find_arg_with_value("volume")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   pm_strcat(q, " device=");
   if ((i = cmd.find_arg_with_value("device")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   pm_strcat(q, " tdate=");
   if ((i = cmd.find_arg_with_value("tdate")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   pm_strcat(q, " type=");
   if ((i = cmd.find_arg_with_value("type")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   pm_strcat(q, " before=");
   if ((i = cmd.find_arg_with_value("before")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   pm_strcat(q, " after=");
   if ((i = cmd.find_arg_with_value("after")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   pm_strcat(q, " expired=");
   if ((i = cmd.find_arg_with_value("expired")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }

   jcr->dir_bsock->fsend("%s\n", q.c_str());

   while (jcr->dir_bsock->recv() > 0) {
      if (cmd.parse_cmd(jcr->dir_bsock->msg) != bRC_OK) {
         Dmsg1(DT_SNAPSHOT, "Unable to decode director output %s\n", jcr->dir_bsock->msg);

      } else {
         ret = 1;               /* OK */
         snapshot *s = New(snapshot(jcr));
         s->scan_arg(&cmd);
         lst->append(s);
      }
   }
   return ret;
}
/* List Catalog entry of the current client */
List Catalog entry of the current client
List Catalog entry of the current client
int snapshot_list_catalog(JCR *jcr,
                          const char *query,
                          alist *lst)
{
   int ret = 0, i;
   arg_parser cmd;
   POOL_MEM q, tmp;
   if (cmd.parse_cmd(query) != bRC_OK) {
      Dmsg1(DT_SNAPSHOT, "Unable to decode query %s\n", query);
      return 0;
   }
   Mmsg(q, "CatReq Job=%s list_snapshot name=", jcr->Job);
   if ((i = cmd.find_arg_with_value("name")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   pm_strcat(q, " volume=");
   if ((i = cmd.find_arg_with_value("volume")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   pm_strcat(q, " device=");
   if ((i = cmd.find_arg_with_value("device")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   pm_strcat(q, " tdate=");
   if ((i = cmd.find_arg_with_value("tdate")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   pm_strcat(q, " type=");
   if ((i = cmd.find_arg_with_value("type")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   pm_strcat(q, " before=");
   if ((i = cmd.find_arg_with_value("before")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   pm_strcat(q, " after=");
   if ((i = cmd.find_arg_with_value("after")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   pm_strcat(q, " expired=");
   if ((i = cmd.find_arg_with_value("expired")) >= 0) {
      bash_spaces(cmd.argv[i]);
      pm_strcat(q, cmd.argv[i]);
   }
   jcr->dir_bsock->fsend("%s\n", q.c_str());
   while (jcr->dir_bsock->recv() > 0) {
      if (cmd.parse_cmd(jcr->dir_bsock->msg) != bRC_OK) {
         Dmsg1(DT_SNAPSHOT, "Unable to decode director output %s\n", jcr->dir_bsock->msg);
      } else {
         ret = 1;               
         snapshot *s = New(snapshot(jcr));
         s->scan_arg(&cmd);
         lst->append(s);
      }
   }
   return ret;
}
int snapshot_list_catalog ( JCR * jcr , const char * query , alist * lst ) { int ret = 0 , i ; arg_parser cmd ; POOL_MEM q , tmp ; if ( cmd . parse_cmd ( query ) != bRC_OK ) { Dmsg1 ( DT_SNAPSHOT , " \n " , query ) ; return 0 ; } Mmsg ( q , " " , jcr -> Job ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } pm_strcat ( q , " " ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } pm_strcat ( q , " " ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } pm_strcat ( q , " " ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } pm_strcat ( q , " " ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } pm_strcat ( q , " " ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } pm_strcat ( q , " " ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } pm_strcat ( q , " " ) ; if ( ( i = cmd . find_arg_with_value ( " " ) ) >= 0 ) { bash_spaces ( cmd . argv [ i ] ) ; pm_strcat ( q , cmd . argv [ i ] ) ; } jcr -> dir_bsock -> fsend ( " \n " , q . c_str ( ) ) ; while ( jcr -> dir_bsock -> recv ( ) > 0 ) { if ( cmd . parse_cmd ( jcr -> dir_bsock -> msg ) != bRC_OK ) { Dmsg1 ( DT_SNAPSHOT , " \n " , jcr -> dir_bsock -> msg ) ; } else { ret = 1 ; snapshot * s = New ( snapshot ( jcr ) ) ; s -> scan_arg ( & cmd ) ; lst -> append ( s ) ; } } return ret ; }
List Catalog entry of the current client
List Catalog entry of the current client
/* OK */