--- /dev/null
+
+ Patch to allow more natural input of time durations.
+ Permitted form is "1 day 2 hours 5 sec" with and without
+ spaces. The different duration specifications (day, hour, ...)
+ can be in any order.
+ Apply to version 1.34.6 with:
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-duration.patch
+ make
+ ...
+
+Index: src/dird/ua_cmds.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/ua_cmds.c,v
+retrieving revision 1.112
+diff -u -r1.112 ua_cmds.c
+--- src/dird/ua_cmds.c 8 Jun 2004 08:44:04 -0000 1.112
++++ src/dird/ua_cmds.c 5 Aug 2004 19:58:51 -0000
+@@ -682,7 +682,7 @@
+
+ static void update_volretention(UAContext *ua, char *val, MEDIA_DBR *mr)
+ {
+- char ed1[50];
++ char ed1[150];
+ POOLMEM *query;
+ if (!duration_to_utime(val, &mr->VolRetention)) {
+ bsendmsg(ua, _("Invalid retention period specified: %s\n"), val);
+@@ -694,7 +694,7 @@
+ if (!db_sql_query(ua->db, query, NULL, NULL)) {
+ bsendmsg(ua, "%s", db_strerror(ua->db));
+ } else {
+- bsendmsg(ua, _("New retention seconds is: %s\n"),
++ bsendmsg(ua, _("New retention period is: %s\n"),
+ edit_utime(mr->VolRetention, ed1));
+ }
+ free_pool_memory(query);
+@@ -702,7 +702,7 @@
+
+ static void update_voluseduration(UAContext *ua, char *val, MEDIA_DBR *mr)
+ {
+- char ed1[50];
++ char ed1[150];
+ POOLMEM *query;
+
+ if (!duration_to_utime(val, &mr->VolUseDuration)) {
+@@ -851,7 +851,7 @@
+ MEDIA_DBR mr;
+ POOL_DBR pr;
+ POOLMEM *query;
+- char ed1[30];
++ char ed1[130];
+ bool done = false;
+ char *kw[] = {
+ N_("VolStatus"), /* 0 */
+@@ -943,7 +943,7 @@
+ update_volstatus(ua, ua->cmd, &mr);
+ break;
+ case 1: /* Retention */
+- bsendmsg(ua, _("Current retention seconds is: %s\n"),
++ bsendmsg(ua, _("Current retention period is: %s\n"),
+ edit_utime(mr.VolRetention, ed1));
+ if (!get_cmd(ua, _("Enter Volume Retention period: "))) {
+ return 0;
+Index: src/dird/ua_select.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/ua_select.c,v
+retrieving revision 1.50
+diff -u -r1.50 ua_select.c
+--- src/dird/ua_select.c 5 Jun 2004 10:15:55 -0000 1.50
++++ src/dird/ua_select.c 5 Aug 2004 19:58:52 -0000
+@@ -38,7 +38,7 @@
+ */
+ int confirm_retention(UAContext *ua, utime_t *ret, char *msg)
+ {
+- char ed1[30];
++ char ed1[130];
+
+ for ( ;; ) {
+ bsendmsg(ua, _("The current %s retention period is: %s\n"),
+Index: src/lib/edit.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/lib/edit.c,v
+retrieving revision 1.17
+diff -u -r1.17 edit.c
+--- src/lib/edit.c 10 Jun 2004 09:45:41 -0000 1.17
++++ src/lib/edit.c 5 Aug 2004 19:58:54 -0000
+@@ -3,7 +3,7 @@
+ *
+ * Kern Sibbald, December MMII
+ *
+- * Version $Id$
++ * Version $Id$
+ */
+
+ /*
+@@ -77,7 +77,6 @@
+ }
+
+
+-
+ /*
+ * Edit an integer number with commas, the supplied buffer
+ * must be at least 27 bytes long. The incoming number
+@@ -85,7 +84,21 @@
+ */
+ char *edit_uint64_with_commas(uint64_t val, char *buf)
+ {
+- sprintf(buf, "%" llu, val);
++ /*
++ * Replacement for sprintf(buf, "%" llu, val)
++ */
++ char mbuf[50];
++ mbuf[sizeof(mbuf)-1] = 0;
++ int i = sizeof(mbuf)-2; /* edit backward */
++ if (val == 0) {
++ mbuf[i--] = '0';
++ } else {
++ while (val != 0) {
++ mbuf[i--] = "0123456789"[val%10];
++ val /= 10;
++ }
++ }
++ strcpy(buf, &mbuf[i+1]);
+ return add_commas(buf, buf);
+ }
+
+@@ -96,7 +109,21 @@
+ */
+ char *edit_uint64(uint64_t val, char *buf)
+ {
+- sprintf(buf, "%" llu, val);
++ /*
++ * Replacement for sprintf(buf, "%" llu, val)
++ */
++ char mbuf[50];
++ mbuf[sizeof(mbuf)-1] = 0;
++ int i = sizeof(mbuf)-2; /* edit backward */
++ if (val == 0) {
++ mbuf[i--] = '0';
++ } else {
++ while (val != 0) {
++ mbuf[i--] = "0123456789"[val%10];
++ val /= 10;
++ }
++ }
++ strcpy(buf, &mbuf[i+1]);
+ return buf;
+ }
+
+@@ -104,9 +131,10 @@
+ * Given a string "str", separate the integer part into
+ * str, and the modifier into mod.
+ */
+-static bool get_modifier(char *str, char *mod, int mod_len)
++static bool get_modifier(char *str, char *num, int num_len, char *mod, int mod_len)
+ {
+- int i, len;
++ int i, len, num_begin, num_end, mod_begin, mod_end;
++
+ /*
+ * Look for modifier by walking back looking for the first
+ * space or digit.
+@@ -114,36 +142,50 @@
+ strip_trailing_junk(str);
+ len = strlen(str);
+
+- /* Find beginning of the modifier */
+- for (i=len; i > 0; i--) {
+- if (!B_ISALPHA(str[i-1])) {
++ for (i=0; i<len; i++) {
++ if (!B_ISSPACE(str[i])) {
+ break;
+ }
+ }
++ num_begin = i;
+
+- /* If nothing found, error */
+- if (i == 0) {
+- Dmsg2(200, "error i=%d len=%d\n", i, len);
++ /* Walk through integer part */
++ for ( ; i<len; i++) {
++ if (!B_ISDIGIT(str[i])) {
++ break;
++ }
++ }
++ num_end = i;
++ if (num_len > (num_end - num_begin + 1)) {
++ num_len = num_end - num_begin + 1;
++ }
++ if (num_len == 0) {
+ return false;
+ }
+-
+- /* Move modifier to its location */
+- bstrncpy(mod, &str[i], mod_len);
+- Dmsg2(200, "in=%s mod=%s:\n", str, mod);
+-
+- /* Backup over any spaces in front of modifier */
+- for ( ; i > 0; i--) {
+- if (B_ISSPACE(str[i-1])) {
+- continue;
++ for ( ; i<len; i++) {
++ if (!B_ISSPACE(str[i])) {
++ break;
++ }
++ }
++ mod_begin = i;
++ for ( ; i<len; i++) {
++ if (!B_ISALPHA(str[i])) {
++ break;
+ }
+- str[i] = 0;
+- break;
+ }
+- /* The remainder (beginning) should be our number */
+- if (!is_a_number(str)) {
+- Dmsg0(200, "input not a number\n");
++ mod_end = i;
++ if (mod_len > (mod_end - mod_begin + 1)) {
++ mod_len = mod_end - mod_begin + 1;
++ }
++ Dmsg5(900, "str=%s: num_beg=%d num_end=%d mod_beg=%d mod_end=%d\n",
++ str, num_begin, num_end, mod_begin, mod_end);
++ bstrncpy(num, &str[num_begin], num_len);
++ bstrncpy(mod, &str[mod_begin], mod_len);
++ if (!is_a_number(num)) {
+ return false;
+ }
++ bstrncpy(str, &str[mod_end], len);
++
+ return true;
+ }
+
+@@ -155,8 +197,9 @@
+ int duration_to_utime(char *str, utime_t *value)
+ {
+ int i, mod_len;
+- double val;
++ double val, total = 0.0;
+ char mod_str[20];
++ char num_str[50];
+ /*
+ * The "n" = mins and months appears before minutes so that m maps
+ * to months. These "kludges" make it compatible with pre 1.31
+@@ -167,26 +210,33 @@
+ static const int32_t mult[] = {60, 1, 60*60*24*30, 60,
+ 60*60, 60*60*24, 60*60*24*7, 60*60*24*91, 60*60*24*365};
+
+- if (!get_modifier(str, mod_str, sizeof(mod_str))) {
+- return 0;
+- }
+- /* Now find the multiplier corresponding to the modifier */
+- mod_len = strlen(mod_str);
+- for (i=0; mod[i]; i++) {
+- if (strncasecmp(mod_str, mod[i], mod_len) == 0) {
+- break;
++ while (*str) {
++ if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
++ return 0;
++ }
++ /* Now find the multiplier corresponding to the modifier */
++ mod_len = strlen(mod_str);
++ if (mod_len == 0) {
++ i = 1; /* assume seconds */
++ } else {
++ for (i=0; mod[i]; i++) {
++ if (strncasecmp(mod_str, mod[i], mod_len) == 0) {
++ break;
++ }
++ }
++ if (mod[i] == NULL) {
++ i = 1; /* no modifier, assume secs */
++ }
++ }
++ Dmsg2(900, "str=%s: mult=%d\n", num_str, mult[i]);
++ errno = 0;
++ val = strtod(num_str, NULL);
++ if (errno != 0 || val < 0) {
++ return 0;
+ }
++ total += val * mult[i];
+ }
+- if (mod[i] == NULL) {
+- i = 1; /* no modifier, assume 1 */
+- }
+- Dmsg2(200, "str=%s: mult=%d\n", str, mult[i]);
+- errno = 0;
+- val = strtod(str, NULL);
+- if (errno != 0 || val < 0) {
+- return 0;
+- }
+- *value = (utime_t)(val * mult[i]);
++ *value = (utime_t)total;
+ return 1;
+ }
+
+@@ -195,32 +245,33 @@
+ */
+ char *edit_utime(utime_t val, char *buf)
+ {
+- char mybuf[30];
++ char mybuf[200];
+ static const int32_t mult[] = {60*60*24*365, 60*60*24*30, 60*60*24, 60*60, 60};
+ static const char *mod[] = {"year", "month", "day", "hour", "min"};
+ int i;
+ uint32_t times;
++ int buf_len = 50;
+
+ *buf = 0;
+ for (i=0; i<5; i++) {
+ times = (uint32_t)(val / mult[i]);
+ if (times > 0) {
+ val = val - (utime_t)times * mult[i];
+- sprintf(mybuf, "%d %s%s ", times, mod[i], times>1?"s":"");
+- strcat(buf, mybuf);
++ bsnprintf(mybuf, sizeof(mybuf), "%d %s%s ", times, mod[i], times>1?"s":"");
++ bstrncat(buf, mybuf, buf_len);
+ }
+ }
+ if (val == 0 && strlen(buf) == 0) {
+- strcat(buf, "0 secs");
++ bstrncat(buf, "0 secs", buf_len);
+ } else if (val != 0) {
+- sprintf(mybuf, "%d sec%s", (uint32_t)val, val>1?"s":"");
+- strcat(buf, mybuf);
++ bsnprintf(mybuf, sizeof(mybuf), "%d sec%s", (uint32_t)val, val>1?"s":"");
++ bstrncat(buf, mybuf, buf_len);
+ }
+ return buf;
+ }
+
+ /*
+- * Convert a size size in bytes to uint64_t
++ * Convert a size in bytes to uint64_t
+ * Returns 0: if error
+ 1: if OK, and value stored in value
+ */
+@@ -229,6 +280,7 @@
+ int i, mod_len;
+ double val;
+ char mod_str[20];
++ char num_str[50];
+ static const char *mod[] = {"*", "k", "kb", "m", "mb", "g", "gb", NULL}; /* first item * not used */
+ const int64_t mult[] = {1, /* byte */
+ 1024, /* kilobyte */
+@@ -238,7 +290,7 @@
+ 1073741824, /* gigabyte */
+ 1000000000}; /* gb gigabyte */
+
+- if (!get_modifier(str, mod_str, sizeof(mod_str))) {
++ if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
+ return 0;
+ }
+ /* Now find the multiplier corresponding to the modifier */
+@@ -251,9 +303,9 @@
+ if (mod[i] == NULL) {
+ i = 0; /* no modifier found, assume 1 */
+ }
+- Dmsg2(200, "str=%s: mult=%d\n", str, mult[i]);
++ Dmsg2(900, "str=%s: mult=%d\n", str, mult[i]);
+ errno = 0;
+- val = strtod(str, NULL);
++ val = strtod(num_str, NULL);
+ if (errno != 0 || val < 0) {
+ return 0;
+ }
+@@ -265,7 +317,7 @@
+ * Check if specified string is a number or not.
+ * Taken from SQLite, cool, thanks.
+ */
+-int is_a_number(const char *n)
++bool is_a_number(const char *n)
+ {
+ bool digit_seen = false;
+
+@@ -291,7 +343,7 @@
+ /*
+ * Check if the specified string is an integer
+ */
+-int is_an_integer(const char *n)
++bool is_an_integer(const char *n)
+ {
+ bool digit_seen = false;
+ while (B_ISDIGIT(*n)) {
+Index: src/lib/protos.h
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/lib/protos.h,v
+retrieving revision 1.77
+diff -u -r1.77 protos.h
+--- src/lib/protos.h 12 Jun 2004 07:51:26 -0000 1.77
++++ src/lib/protos.h 5 Aug 2004 19:58:54 -0000
+@@ -26,99 +26,99 @@
+ struct JCR;
+
+ /* attr.c */
+-ATTR *new_attr();
+-void free_attr(ATTR *attr);
+-int unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
+-void build_attr_output_fnames(JCR *jcr, ATTR *attr);
+-void print_ls_output(JCR *jcr, ATTR *attr);
++ATTR *new_attr();
++void free_attr(ATTR *attr);
++int unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
++void build_attr_output_fnames(JCR *jcr, ATTR *attr);
++void print_ls_output(JCR *jcr, ATTR *attr);
+
+ /* base64.c */
+-void base64_init (void);
+-int to_base64 (intmax_t value, char *where);
+-int from_base64 (intmax_t *value, char *where);
+-int bin_to_base64 (char *buf, char *bin, int len);
++void base64_init (void);
++int to_base64 (intmax_t value, char *where);
++int from_base64 (intmax_t *value, char *where);
++int bin_to_base64 (char *buf, char *bin, int len);
+
+ /* bsys.c */
+-char *bstrncpy (char *dest, const char *src, int maxlen);
+-char *bstrncat (char *dest, const char *src, int maxlen);
+-void *b_malloc (const char *file, int line, size_t size);
++char *bstrncpy (char *dest, const char *src, int maxlen);
++char *bstrncat (char *dest, const char *src, int maxlen);
++void *b_malloc (const char *file, int line, size_t size);
+ #ifndef DEBUG
+-void *bmalloc (size_t size);
++void *bmalloc (size_t size);
+ #endif
+-void *brealloc (void *buf, size_t size);
+-void *bcalloc (size_t size1, size_t size2);
+-int bsnprintf (char *str, int32_t size, const char *format, ...);
+-int bvsnprintf (char *str, int32_t size, const char *format, va_list ap);
+-int pool_sprintf (char *pool_buf, const char *fmt, ...);
+-void create_pid_file (char *dir, const char *progname, int port);
+-int delete_pid_file (char *dir, const char *progname, int port);
+-void drop (char *uid, char *gid);
+-int bmicrosleep (time_t sec, long usec);
+-char *bfgets (char *s, int size, FILE *fd);
+-void make_unique_filename (POOLMEM **name, int Id, char *what);
++void *brealloc (void *buf, size_t size);
++void *bcalloc (size_t size1, size_t size2);
++int bsnprintf (char *str, int32_t size, const char *format, ...);
++int bvsnprintf (char *str, int32_t size, const char *format, va_list ap);
++int pool_sprintf (char *pool_buf, const char *fmt, ...);
++void create_pid_file (char *dir, const char *progname, int port);
++int delete_pid_file (char *dir, const char *progname, int port);
++void drop (char *uid, char *gid);
++int bmicrosleep (time_t sec, long usec);
++char *bfgets (char *s, int size, FILE *fd);
++void make_unique_filename (POOLMEM **name, int Id, char *what);
+ #ifndef HAVE_STRTOLL
+-long long int strtoll (const char *ptr, char **endptr, int base);
++long long int strtoll (const char *ptr, char **endptr, int base);
+ #endif
+ void read_state_file(char *dir, const char *progname, int port);
+
+ /* bnet.c */
+-int32_t bnet_recv (BSOCK *bsock);
+-int bnet_send (BSOCK *bsock);
+-int bnet_fsend (BSOCK *bs, const char *fmt, ...);
+-int bnet_set_buffer_size (BSOCK *bs, uint32_t size, int rw);
+-int bnet_sig (BSOCK *bs, int sig);
+-int bnet_ssl_server (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
+-int bnet_ssl_client (BSOCK *bsock, char *password, int ssl_need);
+-BSOCK * bnet_connect (JCR *jcr, int retry_interval,
+- int max_retry_time, const char *name, char *host, char *service,
+- int port, int verbose);
+-void bnet_close (BSOCK *bsock);
+-BSOCK * init_bsock (JCR *jcr, int sockfd, const char *who, char *ip,
+- int port, struct sockaddr_in *client_addr);
+-BSOCK * dup_bsock (BSOCK *bsock);
+-void term_bsock (BSOCK *bsock);
+-char * bnet_strerror (BSOCK *bsock);
+-char * bnet_sig_to_ascii (BSOCK *bsock);
+-int bnet_wait_data (BSOCK *bsock, int sec);
+-int bnet_wait_data_intr (BSOCK *bsock, int sec);
+-int bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
+-int is_bnet_stop (BSOCK *bsock);
+-int is_bnet_error (BSOCK *bsock);
+-void bnet_suppress_error_messages(BSOCK *bsock, bool flag);
++int32_t bnet_recv (BSOCK *bsock);
++int bnet_send (BSOCK *bsock);
++int bnet_fsend (BSOCK *bs, const char *fmt, ...);
++int bnet_set_buffer_size (BSOCK *bs, uint32_t size, int rw);
++int bnet_sig (BSOCK *bs, int sig);
++int bnet_ssl_server (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
++int bnet_ssl_client (BSOCK *bsock, char *password, int ssl_need);
++BSOCK * bnet_connect (JCR *jcr, int retry_interval,
++ int max_retry_time, const char *name, char *host, char *service,
++ int port, int verbose);
++void bnet_close (BSOCK *bsock);
++BSOCK * init_bsock (JCR *jcr, int sockfd, const char *who, char *ip,
++ int port, struct sockaddr_in *client_addr);
++BSOCK * dup_bsock (BSOCK *bsock);
++void term_bsock (BSOCK *bsock);
++char * bnet_strerror (BSOCK *bsock);
++char * bnet_sig_to_ascii (BSOCK *bsock);
++int bnet_wait_data (BSOCK *bsock, int sec);
++int bnet_wait_data_intr (BSOCK *bsock, int sec);
++int bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
++int is_bnet_stop (BSOCK *bsock);
++int is_bnet_error (BSOCK *bsock);
++void bnet_suppress_error_messages(BSOCK *bsock, bool flag);
+
+ /* bget_msg.c */
+-int bget_msg(BSOCK *sock);
++int bget_msg(BSOCK *sock);
+
+ /* bpipe.c */
+-BPIPE * open_bpipe(char *prog, int wait, const char *mode);
+-int close_wpipe(BPIPE *bpipe);
+-int close_bpipe(BPIPE *bpipe);
++BPIPE * open_bpipe(char *prog, int wait, const char *mode);
++int close_wpipe(BPIPE *bpipe);
++int close_bpipe(BPIPE *bpipe);
+
+ /* cram-md5.c */
+ int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need);
+ int cram_md5_auth(BSOCK *bs, char *password, int ssl_need);
+ void hmac_md5(uint8_t* text, int text_len, uint8_t* key,
+- int key_len, uint8_t *hmac);
++ int key_len, uint8_t *hmac);
+
+ /* crc32.c */
+
+ uint32_t bcrc32(uint8_t *buf, int len);
+
+ /* daemon.c */
+-void daemon_start ();
++void daemon_start ();
+
+ /* edit.c */
+-uint64_t str_to_uint64(char *str);
+-int64_t str_to_int64(char *str);
+-char * edit_uint64_with_commas (uint64_t val, char *buf);
+-char * add_commas (char *val, char *buf);
+-char * edit_uint64 (uint64_t val, char *buf);
+-int duration_to_utime (char *str, utime_t *value);
+-int size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
+-char *edit_utime (utime_t val, char *buf);
+-int is_a_number (const char *num);
+-int is_an_integer (const char *n);
+-bool is_name_valid (char *name, POOLMEM **msg);
++uint64_t str_to_uint64(char *str);
++int64_t str_to_int64(char *str);
++char * edit_uint64_with_commas (uint64_t val, char *buf);
++char * add_commas (char *val, char *buf);
++char * edit_uint64 (uint64_t val, char *buf);
++int duration_to_utime (char *str, utime_t *value);
++int size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
++char *edit_utime (utime_t val, char *buf);
++bool is_a_number (const char *num);
++bool is_an_integer (const char *n);
++bool is_name_valid (char *name, POOLMEM **msg);
+
+ /* jcr.c (most definitions are in src/jcr.h) */
+ void init_last_jobs_list();
+@@ -132,36 +132,36 @@
+
+
+ /* lex.c */
+-LEX * lex_close_file (LEX *lf);
+-LEX * lex_open_file (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
+-int lex_get_char (LEX *lf);
+-void lex_unget_char (LEX *lf);
+-const char * lex_tok_to_str (int token);
+-int lex_get_token (LEX *lf, int expect);
++LEX * lex_close_file (LEX *lf);
++LEX * lex_open_file (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
++int lex_get_char (LEX *lf);
++void lex_unget_char (LEX *lf);
++const char * lex_tok_to_str (int token);
++int lex_get_token (LEX *lf, int expect);
+
+ /* message.c */
+-void my_name_is (int argc, char *argv[], const char *name);
+-void init_msg (JCR *jcr, MSGS *msg);
+-void term_msg (void);
+-void close_msg (JCR *jcr);
+-void add_msg_dest (MSGS *msg, int dest, int type, char *where, char *dest_code);
+-void rem_msg_dest (MSGS *msg, int dest, int type, char *where);
+-void Jmsg (JCR *jcr, int type, int level, const char *fmt, ...);
+-void dispatch_message (JCR *jcr, int type, int level, char *buf);
+-void init_console_msg (char *wd);
+-void free_msgs_res (MSGS *msgs);
+-void dequeue_messages (JCR *jcr);
+-void set_trace (int trace_flag);
+-void set_exit_on_error (int value);
++void my_name_is (int argc, char *argv[], const char *name);
++void init_msg (JCR *jcr, MSGS *msg);
++void term_msg (void);
++void close_msg (JCR *jcr);
++void add_msg_dest (MSGS *msg, int dest, int type, char *where, char *dest_code);
++void rem_msg_dest (MSGS *msg, int dest, int type, char *where);
++void Jmsg (JCR *jcr, int type, int level, const char *fmt, ...);
++void dispatch_message (JCR *jcr, int type, int level, char *buf);
++void init_console_msg (char *wd);
++void free_msgs_res (MSGS *msgs);
++void dequeue_messages (JCR *jcr);
++void set_trace (int trace_flag);
++void set_exit_on_error (int value);
+
+ /* bnet_server.c */
+-void bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq,
+- void *handle_client_request(void *bsock));
+-void bnet_stop_thread_server(pthread_t tid);
+-void bnet_server (int port, void handle_client_request(BSOCK *bsock));
+-int net_connect (int port);
+-BSOCK * bnet_bind (int port);
+-BSOCK * bnet_accept (BSOCK *bsock, char *who);
++void bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq,
++ void *handle_client_request(void *bsock));
++void bnet_stop_thread_server(pthread_t tid);
++void bnet_server (int port, void handle_client_request(BSOCK *bsock));
++int net_connect (int port);
++BSOCK * bnet_bind (int port);
++BSOCK * bnet_accept (BSOCK *bsock, char *who);
+
+ /* idcache.c */
+ char *getuser(uid_t uid);
+@@ -171,41 +171,41 @@
+
+
+ /* signal.c */
+-void init_signals (void terminate(int sig));
+-void init_stack_dump (void);
++void init_signals (void terminate(int sig));
++void init_stack_dump (void);
+
+ /* scan.c */
+-void strip_trailing_junk (char *str);
+-void strip_trailing_slashes (char *dir);
+-bool skip_spaces (char **msg);
+-bool skip_nonspaces (char **msg);
+-int fstrsch (char *a, char *b);
+-char *next_arg(char **s);
+-int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc,
+- char **argk, char **argv, int max_args);
+-void split_path_and_filename(const char *fname, POOLMEM **path,
+- int *pnl, POOLMEM **file, int *fnl);
+-int bsscanf(const char *buf, const char *fmt, ...);
++void strip_trailing_junk (char *str);
++void strip_trailing_slashes (char *dir);
++bool skip_spaces (char **msg);
++bool skip_nonspaces (char **msg);
++int fstrsch (char *a, char *b);
++char *next_arg(char **s);
++int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc,
++ char **argk, char **argv, int max_args);
++void split_path_and_filename(const char *fname, POOLMEM **path,
++ int *pnl, POOLMEM **file, int *fnl);
++int bsscanf(const char *buf, const char *fmt, ...);
+
+
+ /* util.c */
+-int is_buf_zero (char *buf, int len);
+-void lcase (char *str);
+-void bash_spaces (char *str);
+-void unbash_spaces (char *str);
+-char * encode_time (time_t time, char *buf);
+-char * encode_mode (mode_t mode, char *buf);
+-int do_shell_expansion (char *name, int name_len);
+-void jobstatus_to_ascii (int JobStatus, char *msg, int maxlen);
+-int pm_strcat (POOLMEM **pm, const char *str);
+-int pm_strcpy (POOLMEM **pm, const char *str);
+-int run_program (char *prog, int wait, POOLMEM *results);
+-char * job_type_to_str (int type);
+-char * job_status_to_str (int stat);
+-char * job_level_to_str (int level);
+-void make_session_key (char *key, char *seed, int mode);
+-POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
+-void set_working_directory(char *wd);
++int is_buf_zero (char *buf, int len);
++void lcase (char *str);
++void bash_spaces (char *str);
++void unbash_spaces (char *str);
++char * encode_time (time_t time, char *buf);
++char * encode_mode (mode_t mode, char *buf);
++int do_shell_expansion (char *name, int name_len);
++void jobstatus_to_ascii (int JobStatus, char *msg, int maxlen);
++int pm_strcat (POOLMEM **pm, const char *str);
++int pm_strcpy (POOLMEM **pm, const char *str);
++int run_program (char *prog, int wait, POOLMEM *results);
++char * job_type_to_str (int type);
++char * job_status_to_str (int stat);
++char * job_level_to_str (int level);
++void make_session_key (char *key, char *seed, int mode);
++POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
++void set_working_directory(char *wd);
+
+
+ /* watchdog.c */