]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/util.c
Tweak version date
[bacula/bacula] / bacula / src / lib / util.c
index 5d3bffa30afa8ee894efd1cbf7e0ee21ba7caeb8..0f9b9857af8f1e53c59196b2247036af911fa0c0 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -188,6 +188,9 @@ void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen)
    case JS_Terminated:
       jobstat = _("OK");
       break;
+   case JS_Incomplete:
+      jobstat = _("Error: incomplete job");
+      break;
    case JS_FatalError:
    case JS_ErrorTerminated:
       jobstat = _("Error");
@@ -349,46 +352,65 @@ const char *job_status_to_str(int stat)
  */
 const char *job_type_to_str(int type)
 {
-   const char *str;
+   const char *str = NULL;
 
    switch (type) {
    case JT_BACKUP:
       str = _("Backup");
       break;
+   case JT_MIGRATED_JOB:
+      str = _("Migrated Job");
+      break;
    case JT_VERIFY:
       str = _("Verify");
       break;
    case JT_RESTORE:
       str = _("Restore");
       break;
+   case JT_CONSOLE:
+      str = _("Console");
+      break;
+   case JT_SYSTEM:
+      str = _("System or Console");
+      break;
    case JT_ADMIN:
       str = _("Admin");
       break;
-   case JT_MIGRATE:
-      str = _("Migrate");
-      break;
-   case JT_COPY:
-      str = _("Copy");
+   case JT_ARCHIVE:
+      str = _("Archive");
       break;
    case JT_JOB_COPY:
       str = _("Job Copy");
       break;
-   case JT_CONSOLE:
-      str = _("Console");
+   case JT_COPY:
+      str = _("Copy");
       break;
-   case JT_SYSTEM:
-      str = _("System or Console");
+   case JT_MIGRATE:
+      str = _("Migrate");
       break;
    case JT_SCAN:
       str = _("Scan");
       break;
-   default:
-      str = _("Unknown Type");
-      break;
    }
+   if (!str) {
+      str = _("Unknown Type");
+   }   
    return str;
 }
 
+/* Convert ActionOnPurge to string (Truncate, Erase, Destroy)
+ */
+char *action_on_purge_to_string(int aop, POOL_MEM &ret)
+{
+   if (aop & ON_PURGE_TRUNCATE) {
+      pm_strcpy(ret, _("Truncate"));
+   }
+   if (!aop) {
+      pm_strcpy(ret, _("None"));
+   }
+   return ret.c_str();
+}
+
 /*
  * Convert Job Level into a string
  */
@@ -399,6 +421,7 @@ const char *job_level_to_str(int level)
    switch (level) {
    case L_BASE:
       str = _("Base");
+      break;
    case L_FULL:
       str = _("Full");
       break;
@@ -699,6 +722,8 @@ void decode_session_key(char *decode, char *session, char *key, int maxlen)
  *  %t = Job type (Backup, ...)
  *  %r = Recipients
  *  %v = Volume name
+ *  %b = Job Bytes
+ *  %F = Job Files
  *
  *  omsg = edited output message
  *  imsg = input string containing edit codes (%x)
@@ -709,7 +734,7 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co
 {
    char *p, *q;
    const char *str;
-   char add[20];
+   char add[50];
    char name[MAX_NAME_LENGTH];
    int i;
 
@@ -755,7 +780,7 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co
             break;
          case 'l':
             if (jcr) {
-               str = job_level_to_str(jcr->get_JobLevel());
+               str = job_level_to_str(jcr->getJobLevel());
             } else {
                str = _("*none*");
             }
@@ -784,9 +809,15 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co
                str = _("*none*");
             }
             break;
+         case 'F':                    /* Job Files */
+            str = edit_uint64(jcr->JobFiles, add);
+            break;
+         case 'b':                    /* Job Bytes */
+            str = edit_uint64(jcr->JobBytes, add);
+            break;
          case 't':
             if (jcr) {
-               str = job_type_to_str(jcr->get_JobType());
+               str = job_type_to_str(jcr->getJobType());
             } else {
                str = _("*none*");
             }