]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/1.34.6/1.34.6-duration.patch
Cleanup patches a bit
[bacula/bacula] / bacula / patches / 1.34.6 / 1.34.6-duration.patch
1  
2  Patch to allow more natural input of time durations.
3  Permitted form is "1 day 2 hours 5 sec" with and without
4  spaces. The different duration specifications (day, hour, ...) 
5  can be in any order.
6  Apply to version 1.34.6 with:
7
8  cd <bacula-source>
9  patch -p0 <1.34.6-duration.patch
10  make
11  ...
12
13 Index: src/dird/ua_cmds.c
14 ===================================================================
15 RCS file: /cvsroot/bacula/bacula/src/dird/ua_cmds.c,v
16 retrieving revision 1.112
17 diff -u -r1.112 ua_cmds.c
18 --- src/dird/ua_cmds.c  8 Jun 2004 08:44:04 -0000       1.112
19 +++ src/dird/ua_cmds.c  5 Aug 2004 19:58:51 -0000
20 @@ -682,7 +682,7 @@
21  
22  static void update_volretention(UAContext *ua, char *val, MEDIA_DBR *mr)
23  {
24 -   char ed1[50];
25 +   char ed1[150];
26     POOLMEM *query;
27     if (!duration_to_utime(val, &mr->VolRetention)) {
28        bsendmsg(ua, _("Invalid retention period specified: %s\n"), val);
29 @@ -694,7 +694,7 @@
30     if (!db_sql_query(ua->db, query, NULL, NULL)) {  
31        bsendmsg(ua, "%s", db_strerror(ua->db));
32     } else {
33 -      bsendmsg(ua, _("New retention seconds is: %s\n"),
34 +      bsendmsg(ua, _("New retention period is: %s\n"),
35          edit_utime(mr->VolRetention, ed1));
36     }
37     free_pool_memory(query);
38 @@ -702,7 +702,7 @@
39  
40  static void update_voluseduration(UAContext *ua, char *val, MEDIA_DBR *mr)
41  {
42 -   char ed1[50];
43 +   char ed1[150];
44     POOLMEM *query;
45  
46     if (!duration_to_utime(val, &mr->VolUseDuration)) {
47 @@ -851,7 +851,7 @@
48     MEDIA_DBR mr;
49     POOL_DBR pr;
50     POOLMEM *query;
51 -   char ed1[30];
52 +   char ed1[130];
53     bool done = false;
54     char *kw[] = {
55        N_("VolStatus"),                /* 0 */
56 @@ -943,7 +943,7 @@
57          update_volstatus(ua, ua->cmd, &mr);
58          break;
59        case 1:                        /* Retention */
60 -         bsendmsg(ua, _("Current retention seconds is: %s\n"),
61 +         bsendmsg(ua, _("Current retention period is: %s\n"),
62             edit_utime(mr.VolRetention, ed1));
63           if (!get_cmd(ua, _("Enter Volume Retention period: "))) {
64             return 0;
65 Index: src/dird/ua_select.c
66 ===================================================================
67 RCS file: /cvsroot/bacula/bacula/src/dird/ua_select.c,v
68 retrieving revision 1.50
69 diff -u -r1.50 ua_select.c
70 --- src/dird/ua_select.c        5 Jun 2004 10:15:55 -0000       1.50
71 +++ src/dird/ua_select.c        5 Aug 2004 19:58:52 -0000
72 @@ -38,7 +38,7 @@
73   */
74  int confirm_retention(UAContext *ua, utime_t *ret, char *msg)
75  {
76 -   char ed1[30];
77 +   char ed1[130];
78  
79     for ( ;; ) {
80         bsendmsg(ua, _("The current %s retention period is: %s\n"), 
81 Index: src/lib/edit.c
82 ===================================================================
83 RCS file: /cvsroot/bacula/bacula/src/lib/edit.c,v
84 retrieving revision 1.17
85 diff -u -r1.17 edit.c
86 --- src/lib/edit.c      10 Jun 2004 09:45:41 -0000      1.17
87 +++ src/lib/edit.c      5 Aug 2004 19:58:54 -0000
88 @@ -3,7 +3,7 @@
89   * 
90   *    Kern Sibbald, December MMII
91   *
92 - *   Version $Id$
93 + *   Version $Id$
94   */
95  
96  /*
97 @@ -77,7 +77,6 @@
98  }
99  
100  
101 -
102  /*
103   * Edit an integer number with commas, the supplied buffer
104   * must be at least 27 bytes long.  The incoming number
105 @@ -85,7 +84,21 @@
106   */
107  char *edit_uint64_with_commas(uint64_t val, char *buf)
108  {
109 -   sprintf(buf, "%" llu, val);
110 +   /*  
111 +    * Replacement for sprintf(buf, "%" llu, val)
112 +    */
113 +   char mbuf[50];
114 +   mbuf[sizeof(mbuf)-1] = 0;
115 +   int i = sizeof(mbuf)-2;                /* edit backward */
116 +   if (val == 0) {
117 +      mbuf[i--] = '0';
118 +   } else {
119 +      while (val != 0) {
120 +         mbuf[i--] = "0123456789"[val%10];
121 +        val /= 10;
122 +      }
123 +   }
124 +   strcpy(buf, &mbuf[i+1]);
125     return add_commas(buf, buf);
126  }
127  
128 @@ -96,7 +109,21 @@
129   */
130  char *edit_uint64(uint64_t val, char *buf)
131  {
132 -   sprintf(buf, "%" llu, val);
133 +   /*  
134 +    * Replacement for sprintf(buf, "%" llu, val)
135 +    */
136 +   char mbuf[50];
137 +   mbuf[sizeof(mbuf)-1] = 0;
138 +   int i = sizeof(mbuf)-2;                /* edit backward */
139 +   if (val == 0) {
140 +      mbuf[i--] = '0';
141 +   } else {
142 +      while (val != 0) {
143 +         mbuf[i--] = "0123456789"[val%10];
144 +        val /= 10;
145 +      }
146 +   }
147 +   strcpy(buf, &mbuf[i+1]);
148     return buf;
149  }
150  
151 @@ -104,9 +131,10 @@
152   * Given a string "str", separate the integer part into
153   *   str, and the modifier into mod.
154   */
155 -static bool get_modifier(char *str, char *mod, int mod_len)
156 +static bool get_modifier(char *str, char *num, int num_len, char *mod, int mod_len)
157  {
158 -   int i, len;
159 +   int i, len, num_begin, num_end, mod_begin, mod_end;
160 +        
161     /*
162      * Look for modifier by walking back looking for the first
163      *  space or digit.
164 @@ -114,36 +142,50 @@
165     strip_trailing_junk(str);
166     len = strlen(str);
167  
168 -   /* Find beginning of the modifier */
169 -   for (i=len; i > 0; i--) {
170 -      if (!B_ISALPHA(str[i-1])) {
171 +   for (i=0; i<len; i++) {
172 +      if (!B_ISSPACE(str[i])) {
173          break;
174        }
175     }
176 +   num_begin = i;
177  
178 -   /* If nothing found, error */
179 -   if (i == 0) {
180 -      Dmsg2(200, "error i=%d len=%d\n", i, len);
181 +   /* Walk through integer part */
182 +   for ( ; i<len; i++) {
183 +      if (!B_ISDIGIT(str[i])) {
184 +        break;
185 +      }
186 +   }
187 +   num_end = i;
188 +   if (num_len > (num_end - num_begin + 1)) {
189 +      num_len = num_end - num_begin + 1;
190 +   }
191 +   if (num_len == 0) {
192        return false;
193     }
194 -
195 -   /* Move modifier to its location */
196 -   bstrncpy(mod, &str[i], mod_len);
197 -   Dmsg2(200, "in=%s  mod=%s:\n", str, mod);
198 -
199 -   /* Backup over any spaces in front of modifier */
200 -   for ( ; i > 0; i--) {
201 -      if (B_ISSPACE(str[i-1])) {
202 -        continue;
203 +   for ( ; i<len; i++) {
204 +      if (!B_ISSPACE(str[i])) {
205 +        break;
206 +      }
207 +   }
208 +   mod_begin = i;
209 +   for ( ; i<len; i++) {
210 +      if (!B_ISALPHA(str[i])) {
211 +        break;
212        }
213 -      str[i] = 0;
214 -      break;
215     }
216 -   /* The remainder (beginning) should be our number */
217 -   if (!is_a_number(str)) {
218 -      Dmsg0(200, "input not a number\n");
219 +   mod_end = i;
220 +   if (mod_len > (mod_end - mod_begin + 1)) {
221 +      mod_len = mod_end - mod_begin + 1;
222 +   }
223 +   Dmsg5(900, "str=%s: num_beg=%d num_end=%d mod_beg=%d mod_end=%d\n",
224 +      str, num_begin, num_end, mod_begin, mod_end);
225 +   bstrncpy(num, &str[num_begin], num_len);
226 +   bstrncpy(mod, &str[mod_begin], mod_len);
227 +   if (!is_a_number(num)) {
228        return false;
229     }
230 +   bstrncpy(str, &str[mod_end], len);
231 +
232     return true;
233  }
234  
235 @@ -155,8 +197,9 @@
236  int duration_to_utime(char *str, utime_t *value)
237  {
238     int i, mod_len;
239 -   double val;
240 +   double val, total = 0.0;
241     char mod_str[20];
242 +   char num_str[50];
243     /*
244      * The "n" = mins and months appears before minutes so that m maps
245      *   to months. These "kludges" make it compatible with pre 1.31 
246 @@ -167,26 +210,33 @@
247     static const int32_t mult[] = {60,  1, 60*60*24*30, 60, 
248                   60*60, 60*60*24, 60*60*24*7, 60*60*24*91, 60*60*24*365};
249  
250 -   if (!get_modifier(str, mod_str, sizeof(mod_str))) {
251 -      return 0;
252 -   }
253 -   /* Now find the multiplier corresponding to the modifier */
254 -   mod_len = strlen(mod_str);
255 -   for (i=0; mod[i]; i++) {
256 -      if (strncasecmp(mod_str, mod[i], mod_len) == 0) {
257 -        break;
258 +   while (*str) {
259 +      if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
260 +        return 0;
261 +      }
262 +      /* Now find the multiplier corresponding to the modifier */
263 +      mod_len = strlen(mod_str);
264 +      if (mod_len == 0) {
265 +        i = 1;                          /* assume seconds */
266 +      } else {
267 +        for (i=0; mod[i]; i++) {
268 +           if (strncasecmp(mod_str, mod[i], mod_len) == 0) {
269 +              break;
270 +           }
271 +        }
272 +        if (mod[i] == NULL) {
273 +           i = 1;                       /* no modifier, assume secs */
274 +        }
275 +      }
276 +      Dmsg2(900, "str=%s: mult=%d\n", num_str, mult[i]);
277 +      errno = 0;
278 +      val = strtod(num_str, NULL);
279 +      if (errno != 0 || val < 0) {
280 +        return 0;
281        }
282 +      total += val * mult[i];
283     }
284 -   if (mod[i] == NULL) {
285 -      i = 1;                         /* no modifier, assume 1 */
286 -   }
287 -   Dmsg2(200, "str=%s: mult=%d\n", str, mult[i]);
288 -   errno = 0;
289 -   val = strtod(str, NULL);
290 -   if (errno != 0 || val < 0) {
291 -      return 0;
292 -   }
293 -  *value = (utime_t)(val * mult[i]);
294 +   *value = (utime_t)total;
295     return 1;
296  }
297  
298 @@ -195,32 +245,33 @@
299   */
300  char *edit_utime(utime_t val, char *buf)
301  {
302 -   char mybuf[30];
303 +   char mybuf[200];
304     static const int32_t mult[] = {60*60*24*365, 60*60*24*30, 60*60*24, 60*60, 60};
305     static const char *mod[]  = {"year",  "month",  "day", "hour", "min"};
306     int i;
307     uint32_t times;
308 +   int buf_len = 50;
309  
310     *buf = 0;
311     for (i=0; i<5; i++) {
312        times = (uint32_t)(val / mult[i]);
313        if (times > 0) {
314          val = val - (utime_t)times * mult[i];
315 -         sprintf(mybuf, "%d %s%s ", times, mod[i], times>1?"s":"");
316 -        strcat(buf, mybuf);
317 +         bsnprintf(mybuf, sizeof(mybuf), "%d %s%s ", times, mod[i], times>1?"s":"");
318 +        bstrncat(buf, mybuf, buf_len);
319        }
320     }
321     if (val == 0 && strlen(buf) == 0) {    
322 -      strcat(buf, "0 secs");
323 +      bstrncat(buf, "0 secs", buf_len);
324     } else if (val != 0) {
325 -      sprintf(mybuf, "%d sec%s", (uint32_t)val, val>1?"s":"");
326 -      strcat(buf, mybuf);
327 +      bsnprintf(mybuf, sizeof(mybuf), "%d sec%s", (uint32_t)val, val>1?"s":"");
328 +      bstrncat(buf, mybuf, buf_len);
329     }
330     return buf;
331  }
332  
333  /*
334 - * Convert a size size in bytes to uint64_t
335 + * Convert a size in bytes to uint64_t
336   * Returns 0: if error
337            1: if OK, and value stored in value
338   */
339 @@ -229,6 +280,7 @@
340     int i, mod_len;
341     double val;
342     char mod_str[20];
343 +   char num_str[50];
344     static const char *mod[]  = {"*", "k", "kb", "m", "mb",  "g", "gb",  NULL}; /* first item * not used */
345     const int64_t mult[] = {1,            /* byte */
346                            1024,          /* kilobyte */
347 @@ -238,7 +290,7 @@
348                            1073741824,    /* gigabyte */
349                            1000000000};   /* gb gigabyte */
350  
351 -   if (!get_modifier(str, mod_str, sizeof(mod_str))) {
352 +   if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
353        return 0;
354     }
355     /* Now find the multiplier corresponding to the modifier */
356 @@ -251,9 +303,9 @@
357     if (mod[i] == NULL) {
358        i = 0;                         /* no modifier found, assume 1 */
359     }
360 -   Dmsg2(200, "str=%s: mult=%d\n", str, mult[i]);
361 +   Dmsg2(900, "str=%s: mult=%d\n", str, mult[i]);
362     errno = 0;
363 -   val = strtod(str, NULL);
364 +   val = strtod(num_str, NULL);
365     if (errno != 0 || val < 0) {
366        return 0;
367     }
368 @@ -265,7 +317,7 @@
369   * Check if specified string is a number or not.
370   *  Taken from SQLite, cool, thanks.
371   */
372 -int is_a_number(const char *n)
373 +bool is_a_number(const char *n)
374  {
375     bool digit_seen = false;
376  
377 @@ -291,7 +343,7 @@
378  /*
379   * Check if the specified string is an integer  
380   */
381 -int is_an_integer(const char *n)
382 +bool is_an_integer(const char *n)
383  {
384     bool digit_seen = false;
385     while (B_ISDIGIT(*n)) {
386 Index: src/lib/protos.h
387 ===================================================================
388 RCS file: /cvsroot/bacula/bacula/src/lib/protos.h,v
389 retrieving revision 1.77
390 diff -u -r1.77 protos.h
391 --- src/lib/protos.h    12 Jun 2004 07:51:26 -0000      1.77
392 +++ src/lib/protos.h    5 Aug 2004 19:58:54 -0000
393 @@ -26,99 +26,99 @@
394  struct JCR;
395  
396  /* attr.c */
397 -ATTR     *new_attr();
398 -void      free_attr(ATTR *attr);
399 -int       unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
400 -void      build_attr_output_fnames(JCR *jcr, ATTR *attr);
401 -void      print_ls_output(JCR *jcr, ATTR *attr);
402 +ATTR    *new_attr();
403 +void     free_attr(ATTR *attr);
404 +int      unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
405 +void     build_attr_output_fnames(JCR *jcr, ATTR *attr);
406 +void     print_ls_output(JCR *jcr, ATTR *attr);
407  
408  /* base64.c */
409 -void      base64_init            (void);
410 -int       to_base64              (intmax_t value, char *where);
411 -int       from_base64            (intmax_t *value, char *where);
412 -int       bin_to_base64          (char *buf, char *bin, int len);
413 +void     base64_init            (void);
414 +int      to_base64              (intmax_t value, char *where);
415 +int      from_base64            (intmax_t *value, char *where);
416 +int      bin_to_base64          (char *buf, char *bin, int len);
417  
418  /* bsys.c */
419 -char     *bstrncpy               (char *dest, const char *src, int maxlen);
420 -char     *bstrncat               (char *dest, const char *src, int maxlen);
421 -void     *b_malloc               (const char *file, int line, size_t size);
422 +char    *bstrncpy               (char *dest, const char *src, int maxlen);
423 +char    *bstrncat               (char *dest, const char *src, int maxlen);
424 +void    *b_malloc               (const char *file, int line, size_t size);
425  #ifndef DEBUG
426 -void     *bmalloc                (size_t size);
427 +void    *bmalloc                (size_t size);
428  #endif
429 -void     *brealloc               (void *buf, size_t size);
430 -void     *bcalloc                (size_t size1, size_t size2);
431 -int       bsnprintf              (char *str, int32_t size, const char *format, ...);
432 -int       bvsnprintf             (char *str, int32_t size, const char *format, va_list ap);
433 -int       pool_sprintf           (char *pool_buf, const char *fmt, ...);
434 -void      create_pid_file        (char *dir, const char *progname, int port);
435 -int       delete_pid_file        (char *dir, const char *progname, int port);
436 -void      drop                   (char *uid, char *gid);
437 -int       bmicrosleep            (time_t sec, long usec);
438 -char     *bfgets                 (char *s, int size, FILE *fd);
439 -void      make_unique_filename   (POOLMEM **name, int Id, char *what);
440 +void    *brealloc               (void *buf, size_t size);
441 +void    *bcalloc                (size_t size1, size_t size2);
442 +int      bsnprintf              (char *str, int32_t size, const char *format, ...);
443 +int      bvsnprintf             (char *str, int32_t size, const char *format, va_list ap);
444 +int      pool_sprintf           (char *pool_buf, const char *fmt, ...);
445 +void     create_pid_file        (char *dir, const char *progname, int port);
446 +int      delete_pid_file        (char *dir, const char *progname, int port);
447 +void     drop                   (char *uid, char *gid);
448 +int      bmicrosleep            (time_t sec, long usec);
449 +char    *bfgets                 (char *s, int size, FILE *fd);
450 +void     make_unique_filename   (POOLMEM **name, int Id, char *what);
451  #ifndef HAVE_STRTOLL
452 -long long int strtoll            (const char *ptr, char **endptr, int base);
453 +long long int strtoll           (const char *ptr, char **endptr, int base);
454  #endif
455  void read_state_file(char *dir, const char *progname, int port);
456  
457  /* bnet.c */
458 -int32_t    bnet_recv             (BSOCK *bsock);
459 -int        bnet_send             (BSOCK *bsock);
460 -int        bnet_fsend            (BSOCK *bs, const char *fmt, ...);
461 -int        bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
462 -int        bnet_sig              (BSOCK *bs, int sig);
463 -int        bnet_ssl_server       (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
464 -int        bnet_ssl_client       (BSOCK *bsock, char *password, int ssl_need);
465 -BSOCK *    bnet_connect            (JCR *jcr, int retry_interval,
466 -               int max_retry_time, const char *name, char *host, char *service, 
467 -               int port, int verbose);
468 -void       bnet_close            (BSOCK *bsock);
469 -BSOCK *    init_bsock            (JCR *jcr, int sockfd, const char *who, char *ip, 
470 -                                  int port, struct sockaddr_in *client_addr);
471 -BSOCK *    dup_bsock             (BSOCK *bsock);
472 -void       term_bsock            (BSOCK *bsock);
473 -char *     bnet_strerror         (BSOCK *bsock);
474 -char *     bnet_sig_to_ascii     (BSOCK *bsock);
475 -int        bnet_wait_data        (BSOCK *bsock, int sec);
476 -int        bnet_wait_data_intr   (BSOCK *bsock, int sec);
477 -int        bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
478 -int        is_bnet_stop          (BSOCK *bsock);
479 -int        is_bnet_error         (BSOCK *bsock);
480 -void       bnet_suppress_error_messages(BSOCK *bsock, bool flag);
481 +int32_t    bnet_recv            (BSOCK *bsock);
482 +int       bnet_send             (BSOCK *bsock);
483 +int       bnet_fsend            (BSOCK *bs, const char *fmt, ...);
484 +int       bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
485 +int       bnet_sig              (BSOCK *bs, int sig);
486 +int       bnet_ssl_server       (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
487 +int       bnet_ssl_client       (BSOCK *bsock, char *password, int ssl_need);
488 +BSOCK *    bnet_connect           (JCR *jcr, int retry_interval,
489 +              int max_retry_time, const char *name, char *host, char *service, 
490 +              int port, int verbose);
491 +void      bnet_close            (BSOCK *bsock);
492 +BSOCK *    init_bsock           (JCR *jcr, int sockfd, const char *who, char *ip, 
493 +                                 int port, struct sockaddr_in *client_addr);
494 +BSOCK *    dup_bsock            (BSOCK *bsock);
495 +void      term_bsock            (BSOCK *bsock);
496 +char *    bnet_strerror         (BSOCK *bsock);
497 +char *    bnet_sig_to_ascii     (BSOCK *bsock);
498 +int       bnet_wait_data        (BSOCK *bsock, int sec);
499 +int       bnet_wait_data_intr   (BSOCK *bsock, int sec);
500 +int       bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
501 +int       is_bnet_stop          (BSOCK *bsock);
502 +int       is_bnet_error         (BSOCK *bsock);
503 +void      bnet_suppress_error_messages(BSOCK *bsock, bool flag);
504  
505  /* bget_msg.c */
506 -int      bget_msg(BSOCK *sock);
507 +int     bget_msg(BSOCK *sock);
508  
509  /* bpipe.c */
510 -BPIPE *          open_bpipe(char *prog, int wait, const char *mode);
511 -int              close_wpipe(BPIPE *bpipe);
512 -int              close_bpipe(BPIPE *bpipe);
513 +BPIPE *         open_bpipe(char *prog, int wait, const char *mode);
514 +int             close_wpipe(BPIPE *bpipe);
515 +int             close_bpipe(BPIPE *bpipe);
516  
517  /* cram-md5.c */
518  int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need);
519  int cram_md5_auth(BSOCK *bs, char *password, int ssl_need);
520  void hmac_md5(uint8_t* text, int text_len, uint8_t*  key,
521 -              int key_len, uint8_t *hmac);
522 +             int key_len, uint8_t *hmac);
523  
524  /* crc32.c */
525  
526  uint32_t bcrc32(uint8_t *buf, int len);
527  
528  /* daemon.c */
529 -void     daemon_start            ();
530 +void    daemon_start            ();
531  
532  /* edit.c */
533 -uint64_t         str_to_uint64(char *str);
534 -int64_t          str_to_int64(char *str);
535 -char *           edit_uint64_with_commas   (uint64_t val, char *buf);
536 -char *           add_commas              (char *val, char *buf);
537 -char *           edit_uint64             (uint64_t val, char *buf);
538 -int              duration_to_utime       (char *str, utime_t *value);
539 -int              size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
540 -char             *edit_utime             (utime_t val, char *buf);
541 -int              is_a_number             (const char *num);
542 -int              is_an_integer           (const char *n);
543 -bool             is_name_valid           (char *name, POOLMEM **msg);
544 +uint64_t        str_to_uint64(char *str);
545 +int64_t         str_to_int64(char *str);
546 +char *          edit_uint64_with_commas   (uint64_t val, char *buf);
547 +char *          add_commas              (char *val, char *buf);
548 +char *          edit_uint64             (uint64_t val, char *buf);
549 +int             duration_to_utime       (char *str, utime_t *value);
550 +int             size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
551 +char            *edit_utime             (utime_t val, char *buf);
552 +bool            is_a_number             (const char *num);
553 +bool            is_an_integer           (const char *n);
554 +bool            is_name_valid           (char *name, POOLMEM **msg);
555  
556  /* jcr.c (most definitions are in src/jcr.h) */
557  void init_last_jobs_list();
558 @@ -132,36 +132,36 @@
559  
560  
561  /* lex.c */
562 -LEX *     lex_close_file         (LEX *lf);
563 -LEX *     lex_open_file          (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
564 -int       lex_get_char           (LEX *lf);
565 -void      lex_unget_char         (LEX *lf);
566 -const char *  lex_tok_to_str     (int token);
567 -int       lex_get_token          (LEX *lf, int expect);
568 +LEX *    lex_close_file         (LEX *lf);
569 +LEX *    lex_open_file          (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
570 +int      lex_get_char           (LEX *lf);
571 +void     lex_unget_char         (LEX *lf);
572 +const char *  lex_tok_to_str    (int token);
573 +int      lex_get_token          (LEX *lf, int expect);
574  
575  /* message.c */
576 -void       my_name_is            (int argc, char *argv[], const char *name);
577 -void       init_msg              (JCR *jcr, MSGS *msg);
578 -void       term_msg              (void);
579 -void       close_msg             (JCR *jcr);
580 -void       add_msg_dest          (MSGS *msg, int dest, int type, char *where, char *dest_code);
581 -void       rem_msg_dest          (MSGS *msg, int dest, int type, char *where);
582 -void       Jmsg                  (JCR *jcr, int type, int level, const char *fmt, ...);
583 -void       dispatch_message      (JCR *jcr, int type, int level, char *buf);
584 -void       init_console_msg      (char *wd);
585 -void       free_msgs_res         (MSGS *msgs);
586 -void       dequeue_messages      (JCR *jcr);
587 -void       set_trace             (int trace_flag);
588 -void       set_exit_on_error     (int value);
589 +void      my_name_is            (int argc, char *argv[], const char *name);
590 +void      init_msg              (JCR *jcr, MSGS *msg);
591 +void      term_msg              (void);
592 +void      close_msg             (JCR *jcr);
593 +void      add_msg_dest          (MSGS *msg, int dest, int type, char *where, char *dest_code);
594 +void      rem_msg_dest          (MSGS *msg, int dest, int type, char *where);
595 +void      Jmsg                  (JCR *jcr, int type, int level, const char *fmt, ...);
596 +void      dispatch_message      (JCR *jcr, int type, int level, char *buf);
597 +void      init_console_msg      (char *wd);
598 +void      free_msgs_res         (MSGS *msgs);
599 +void      dequeue_messages      (JCR *jcr);
600 +void      set_trace             (int trace_flag);
601 +void      set_exit_on_error     (int value);
602  
603  /* bnet_server.c */
604 -void       bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq, 
605 -                   void *handle_client_request(void *bsock));
606 -void       bnet_stop_thread_server(pthread_t tid);
607 -void             bnet_server             (int port, void handle_client_request(BSOCK *bsock));
608 -int              net_connect             (int port);
609 -BSOCK *          bnet_bind               (int port);
610 -BSOCK *          bnet_accept             (BSOCK *bsock, char *who);
611 +void      bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq, 
612 +                  void *handle_client_request(void *bsock));
613 +void      bnet_stop_thread_server(pthread_t tid);
614 +void            bnet_server             (int port, void handle_client_request(BSOCK *bsock));
615 +int             net_connect             (int port);
616 +BSOCK *         bnet_bind               (int port);
617 +BSOCK *         bnet_accept             (BSOCK *bsock, char *who);
618  
619  /* idcache.c */
620  char *getuser(uid_t uid);
621 @@ -171,41 +171,41 @@
622  
623  
624  /* signal.c */
625 -void             init_signals             (void terminate(int sig));
626 -void             init_stack_dump          (void);
627 +void            init_signals             (void terminate(int sig));
628 +void            init_stack_dump          (void);
629  
630  /* scan.c */
631 -void             strip_trailing_junk     (char *str);
632 -void             strip_trailing_slashes  (char *dir);
633 -bool             skip_spaces             (char **msg);
634 -bool             skip_nonspaces          (char **msg);
635 -int              fstrsch                 (char *a, char *b);
636 -char            *next_arg(char **s);
637 -int              parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, 
638 -                        char **argk, char **argv, int max_args);
639 -void            split_path_and_filename(const char *fname, POOLMEM **path, 
640 -                        int *pnl, POOLMEM **file, int *fnl);
641 -int             bsscanf(const char *buf, const char *fmt, ...);
642 +void            strip_trailing_junk     (char *str);
643 +void            strip_trailing_slashes  (char *dir);
644 +bool            skip_spaces             (char **msg);
645 +bool            skip_nonspaces          (char **msg);
646 +int             fstrsch                 (char *a, char *b);
647 +char           *next_arg(char **s);
648 +int             parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, 
649 +                       char **argk, char **argv, int max_args);
650 +void           split_path_and_filename(const char *fname, POOLMEM **path, 
651 +                       int *pnl, POOLMEM **file, int *fnl);
652 +int            bsscanf(const char *buf, const char *fmt, ...);
653  
654  
655  /* util.c */
656 -int              is_buf_zero             (char *buf, int len);
657 -void             lcase                   (char *str);
658 -void             bash_spaces             (char *str);
659 -void             unbash_spaces           (char *str);
660 -char *           encode_time             (time_t time, char *buf);
661 -char *           encode_mode             (mode_t mode, char *buf);
662 -int              do_shell_expansion      (char *name, int name_len);
663 -void             jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
664 -int              pm_strcat               (POOLMEM **pm, const char *str);
665 -int              pm_strcpy               (POOLMEM **pm, const char *str);
666 -int              run_program             (char *prog, int wait, POOLMEM *results);
667 -char *           job_type_to_str         (int type);
668 -char *           job_status_to_str       (int stat);
669 -char *           job_level_to_str        (int level);
670 -void             make_session_key        (char *key, char *seed, int mode);
671 -POOLMEM         *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
672 -void             set_working_directory(char *wd);
673 +int             is_buf_zero             (char *buf, int len);
674 +void            lcase                   (char *str);
675 +void            bash_spaces             (char *str);
676 +void            unbash_spaces           (char *str);
677 +char *          encode_time             (time_t time, char *buf);
678 +char *          encode_mode             (mode_t mode, char *buf);
679 +int             do_shell_expansion      (char *name, int name_len);
680 +void            jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
681 +int             pm_strcat               (POOLMEM **pm, const char *str);
682 +int             pm_strcpy               (POOLMEM **pm, const char *str);
683 +int             run_program             (char *prog, int wait, POOLMEM *results);
684 +char *          job_type_to_str         (int type);
685 +char *          job_status_to_str       (int stat);
686 +char *          job_level_to_str        (int level);
687 +void            make_session_key        (char *key, char *seed, int mode);
688 +POOLMEM        *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
689 +void            set_working_directory(char *wd);
690  
691  
692  /* watchdog.c */