From 49839d5884780b05d5323732715f3f28d4b77171 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Mon, 3 Jul 2006 07:51:06 +0000 Subject: [PATCH] Fix header file includes. Move externs from source files to header files. Fix the old mingw Makefile so it builds with the new dependencies. Replace #ifdef'ed InitWinAPIWrapper with OSDependentInit macro. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3114 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/baconfig.h | 12 +++++++++++- bacula/src/bacula.h | 17 +++++++++++++++-- bacula/src/console/console.c | 7 ++----- bacula/src/dird/authenticate.c | 1 - bacula/src/dird/fd_cmds.c | 1 - bacula/src/dird/job.c | 1 - bacula/src/dird/ua_cmds.c | 1 - bacula/src/dird/ua_dotcmds.c | 2 -- bacula/src/dird/ua_output.c | 3 --- bacula/src/dird/ua_server.c | 2 -- bacula/src/dird/ua_status.c | 4 ---- bacula/src/dird/verify.c | 3 --- bacula/src/filed/filed.c | 3 --- bacula/src/filed/filed.h | 2 -- bacula/src/filed/job.c | 1 - bacula/src/filed/status.c | 7 ------- bacula/src/filed/win32/winabout.cpp | 2 ++ bacula/src/filed/win32/winbacula.h | 13 ------------- bacula/src/filed/win32/winevents.cpp | 2 ++ bacula/src/filed/win32/winmain.cpp | 11 +++-------- bacula/src/filed/win32/winservice.cpp | 4 +--- bacula/src/filed/win32/winstat.cpp | 2 ++ bacula/src/filed/win32/wintray.cpp | 9 +++------ bacula/src/findlib/Makefile.in | 2 +- bacula/src/findlib/attribs.c | 4 ---- bacula/src/findlib/bfile.h | 3 --- bacula/src/findlib/match.c | 5 +++-- bacula/src/jcr.h | 3 ++- bacula/src/lib/attr.c | 14 +++++++++----- bacula/src/lib/events.c | 2 -- bacula/src/lib/lib.h | 8 ++++---- bacula/src/lib/message.c | 4 ---- bacula/src/lib/message.h | 18 ++++++++++++------ bacula/src/lib/parse_conf.c | 2 -- bacula/src/lib/smartall.h | 8 ++++---- bacula/src/lib/var.c | 4 ++-- bacula/src/lib/watchdog.h | 4 ++++ bacula/src/stored/bcopy.c | 2 ++ bacula/src/stored/bextract.c | 8 ++------ bacula/src/stored/block.c | 1 - bacula/src/stored/bls.c | 8 ++------ bacula/src/stored/bscan.c | 8 -------- bacula/src/stored/btape.c | 2 ++ bacula/src/stored/device.c | 3 --- bacula/src/stored/label.c | 3 --- bacula/src/stored/record.c | 2 -- bacula/src/stored/status.c | 4 ---- bacula/src/stored/stored_conf.c | 3 --- bacula/src/tools/bregex.c | 2 ++ bacula/src/tools/bwild.c | 2 ++ bacula/src/tools/dbcheck.c | 2 ++ bacula/src/tools/fstype.c | 2 ++ bacula/src/tools/testls.c | 6 ------ 53 files changed, 98 insertions(+), 151 deletions(-) diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index f052b13cde..c6c6854e77 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -66,7 +66,17 @@ #define NPRT(x) (x)?(x):_("*None*") #if defined(HAVE_WIN32) +void InitWinAPIWrapper(); + +#define OSDependentInit() InitWinAPIWrapper() + #undef ENABLE_NLS +# define DLL_IMP_EXP +#else + +#define DLL_IMP_EXP + +#define OSDependentInit() #endif #ifdef ENABLE_NLS @@ -476,7 +486,7 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) /* Use our strdup with smartalloc */ -#ifndef __WXGTK__ +#ifndef HAVE_WXCONSOLE #undef strdup #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf) #endif diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h index f677f2458a..69b43828af 100644 --- a/bacula/src/bacula.h +++ b/bacula/src/bacula.h @@ -29,13 +29,12 @@ #if defined(HAVE_WIN32) #if defined(HAVE_MINGW) #include "mingwconfig.h" -#include "winhost.h" #define _STAT_H /* don't pull in MinGW stat.h */ #define _STAT_DEFINED /* don't pull in MinGW stat.h */ #else #include "winconfig.h" -#include "winhost.h" #endif +#include "winhost.h" #else #include "config.h" #include "host.h" @@ -134,11 +133,25 @@ /* Local Bacula includes. Be sure to put all the system * includes before these. */ +#if defined(HAVE_WIN32) +#include +#include "win32/compat/compat.h" +#endif + #include "version.h" #include "bc_types.h" #include "baconfig.h" #include "lib/lib.h" +#ifdef HAVE_WXCONSOLE +#undef New +#undef _ +#endif + +#if defined(HAVE_WIN32) +#include "lib/winapi.h" +#endif + #ifndef HAVE_ZLIB_H #undef HAVE_LIBZ /* no good without headers */ #endif diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index b4392f2b06..abdfc8f0f5 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -37,8 +37,6 @@ #endif #ifdef HAVE_WIN32 -#include -#include "../lib/winapi.h" #define isatty(fd) (fd==0) #endif @@ -388,10 +386,9 @@ int main(int argc, char *argv[]) signal(SIGTTIN, got_sigtin); signal(SIGTTOU, got_sigtout); trapctlc(); -#else - InitWinAPIWrapper(); #endif - + + OSDependentInit(); if (argc) { usage(); diff --git a/bacula/src/dird/authenticate.c b/bacula/src/dird/authenticate.c index 93d33ce29f..f0bcd4f026 100644 --- a/bacula/src/dird/authenticate.c +++ b/bacula/src/dird/authenticate.c @@ -29,7 +29,6 @@ #include "dird.h" extern DIRRES *director; -extern char my_name[]; /* Commands sent to Storage daemon and File daemon and received * from the User Agent */ diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 3d884f4663..4a858abdc5 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -49,7 +49,6 @@ static char OKRunBeforeNow[] = "2000 OK RunBeforeNow\n"; /* Forward referenced functions */ /* External functions */ -extern int debug_level; extern DIRRES *director; extern int FDConnectTimeout; diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 984f932041..44812a1d7b 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -36,7 +36,6 @@ extern void term_scheduler(); extern void term_ua_server(); /* Imported variables */ -extern time_t watchdog_time; jobq_t job_queue; diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 7e71408bb4..f2d2bf2f8d 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -30,7 +30,6 @@ extern int r_first; extern int r_last; extern struct s_res resources[]; -extern char my_name[]; extern jobq_t job_queue; /* job queue */ diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index 613d17c7ed..f39d3a5d06 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -32,9 +32,7 @@ extern int r_first; extern int r_last; extern struct s_res resources[]; -extern char my_name[]; extern const char *client_backups; -extern int console_msg_pending; /* Imported functions */ extern void do_messages(UAContext *ua, const char *cmd); diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index a738dfe326..f53628e974 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -33,9 +33,6 @@ extern int r_first; extern int r_last; extern RES_TABLE resources[]; extern RES **res_head; -extern int console_msg_pending; -extern FILE *con_fd; -extern brwlock_t con_lock; /* Imported functions */ diff --git a/bacula/src/dird/ua_server.c b/bacula/src/dird/ua_server.c index 7f0c6b795c..5ebaa79f75 100644 --- a/bacula/src/dird/ua_server.c +++ b/bacula/src/dird/ua_server.c @@ -28,8 +28,6 @@ extern int r_first; extern int r_last; extern struct s_res resources[]; -extern int console_msg_pending; -extern char my_name[]; /* Forward referenced functions */ diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index c69d2526ad..49ddebd316 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -25,10 +25,6 @@ #include "bacula.h" #include "dird.h" -extern char my_name[]; -extern time_t daemon_start_time; -extern int num_jobs_run; - static void list_scheduled_jobs(UAContext *ua); static void list_running_jobs(UAContext *ua); static void list_terminated_jobs(UAContext *ua); diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 3a46402ba6..84a2ba196c 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -33,9 +33,6 @@ #include "dird.h" #include "findlib/find.h" -/* Imported Global Variables */ -extern int debug_level; - /* Commands sent to File daemon */ static char verifycmd[] = "verify level=%s\n"; static char storaddr[] = "storage address=%s port=%d ssl=0\n"; diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 5145735a1c..623de061a3 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -27,9 +27,6 @@ /* Imported Functions */ extern void *handle_client_request(void *dir_sock); -/* Imported Variables */ -extern time_t watchdog_sleep_time; - /* Forward referenced functions */ void terminate_filed(int sig); static int check_resources(); diff --git a/bacula/src/filed/filed.h b/bacula/src/filed/filed.h index 2c59f340c1..c107d30ff5 100644 --- a/bacula/src/filed/filed.h +++ b/bacula/src/filed/filed.h @@ -33,6 +33,4 @@ #define uLongf uint32_t #endif -extern int win32_client; /* Are we running on Windows? */ - extern CLIENT *me; /* "Global" Client resource */ diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 5b88dd6772..9768fe2e30 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -28,7 +28,6 @@ static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER; #endif -extern char my_name[]; extern CLIENT *me; /* our client resource */ int enable_vss = 0; /* set to use vss */ diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 2c90d7a0a9..7df988108c 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -24,11 +24,6 @@ #include "bacula.h" #include "filed.h" -extern char my_name[]; -extern int num_jobs_run; -extern time_t daemon_start_time; -extern bool get_trace(void); - /* Forward referenced functions */ static void list_terminated_jobs(void sendit(const char *msg, int len, void *sarg), void *arg); static void bsock_sendit(const char *msg, int len, void *arg); @@ -403,8 +398,6 @@ static const char *level_to_str(int level) #if defined(HAVE_WIN32) -#include - int bacstat = 0; struct s_win32_arg { diff --git a/bacula/src/filed/win32/winabout.cpp b/bacula/src/filed/win32/winabout.cpp index 69ace2286a..5fbccae3a9 100755 --- a/bacula/src/filed/win32/winabout.cpp +++ b/bacula/src/filed/win32/winabout.cpp @@ -21,8 +21,10 @@ Kern E. Sibbald, 2000 */ +#include "bacula.h" #include "winbacula.h" #include "winabout.h" +#include "winres.h" bacAbout::bacAbout() { diff --git a/bacula/src/filed/win32/winbacula.h b/bacula/src/filed/win32/winbacula.h index c61d39e8d4..088205be33 100755 --- a/bacula/src/filed/win32/winbacula.h +++ b/bacula/src/filed/win32/winbacula.h @@ -29,19 +29,6 @@ // -// WinUPS header file - -#ifdef HAVE_MINGW -#include "compat.h" -#endif - -#define STRICT 1 -#include -#include -#include -#include "winres.h" - - // Application specific messages // Message used for system tray notifications diff --git a/bacula/src/filed/win32/winevents.cpp b/bacula/src/filed/win32/winevents.cpp index c41cf7cd98..50edd0a5f5 100755 --- a/bacula/src/filed/win32/winevents.cpp +++ b/bacula/src/filed/win32/winevents.cpp @@ -24,8 +24,10 @@ /* Code for the Events dialogue */ +#include "bacula.h" #include "winbacula.h" #include "winevents.h" +#include "winres.h" extern "C" void FillEventsBox(HWND hwnd, int id_list); diff --git a/bacula/src/filed/win32/winmain.cpp b/bacula/src/filed/win32/winmain.cpp index 2cda05ad2b..4a662a56e7 100755 --- a/bacula/src/filed/win32/winmain.cpp +++ b/bacula/src/filed/win32/winmain.cpp @@ -15,20 +15,15 @@ */ -#ifndef HAVE_WIN32 -#define HAVE_CYGWIN 1 -#endif - #include -#include #include + +#include "bacula.h" #include "winbacula.h" #include "wintray.h" #include "winservice.h" #include #include -#include "../../lib/winapi.h" -#include "baconfig.h" extern int BaculaMain(int argc, char *argv[]); extern void terminate_filed(int sig); @@ -40,7 +35,7 @@ extern void d_msg(const char *, int, int, const char *, ...); HINSTANCE hAppInstance; const char *szAppName = "Bacula"; DWORD mainthreadId; -bool silent = false; +bool silent = false; /* Imported variables */ extern DWORD g_servicethread; diff --git a/bacula/src/filed/win32/winservice.cpp b/bacula/src/filed/win32/winservice.cpp index a1c7ddd009..7fc85b2e7d 100755 --- a/bacula/src/filed/win32/winservice.cpp +++ b/bacula/src/filed/win32/winservice.cpp @@ -37,12 +37,10 @@ // show events, ...) -#include -#undef PASCAL +#include "bacula.h" #include "winbacula.h" #include "winservice.h" #include "wintray.h" -#include "bacula.h" void set_service_description(SC_HANDLE hSCManager, SC_HANDLE hService, LPSTR lpDesc); diff --git a/bacula/src/filed/win32/winstat.cpp b/bacula/src/filed/win32/winstat.cpp index 79da6dcc7e..45e3c41ad1 100755 --- a/bacula/src/filed/win32/winstat.cpp +++ b/bacula/src/filed/win32/winstat.cpp @@ -24,8 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "bacula.h" #include "winbacula.h" #include "winstat.h" +#include "winres.h" extern void FillStatusBox(HWND hwnd, int id_list); diff --git a/bacula/src/filed/win32/wintray.cpp b/bacula/src/filed/win32/wintray.cpp index 3a5518de10..044d34b7ce 100755 --- a/bacula/src/filed/win32/wintray.cpp +++ b/bacula/src/filed/win32/wintray.cpp @@ -34,15 +34,12 @@ // Implementation of a system tray icon & menu for Bacula +#include "bacula.h" +#include "jcr.h" #include "winbacula.h" #include "winservice.h" -#include - -// Header - +#include "winres.h" #include "wintray.h" -#include "bacula.h" -#include "jcr.h" // Constants #ifdef properties_implemented diff --git a/bacula/src/findlib/Makefile.in b/bacula/src/findlib/Makefile.in index b0fe8cbefe..a9e4a4ff76 100644 --- a/bacula/src/findlib/Makefile.in +++ b/bacula/src/findlib/Makefile.in @@ -34,7 +34,7 @@ LIBOBJS = find.o match.o find_one.o attribs.o create_file.o \ # inference rules .c.o: @echo "Compiling $<" - $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(OPENSSL_INC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< + $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< #------------------------------------------------------------------------- all: Makefile libfind.a ../lib/libbac.a @echo "==== Make of findlib is good ====" diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index fdf0c67322..6a81ac5dac 100755 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -27,10 +27,6 @@ #include "find.h" #if defined(HAVE_WIN32) - -#include "../lib/winapi.h" - - /* Forward referenced subroutines */ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd); void unix_name_to_win32(POOLMEM **win32_name, char *name); diff --git a/bacula/src/findlib/bfile.h b/bacula/src/findlib/bfile.h index 69cce6fb68..e6d4c34a06 100644 --- a/bacula/src/findlib/bfile.h +++ b/bacula/src/findlib/bfile.h @@ -66,9 +66,6 @@ typedef struct _PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT { */ #if defined(HAVE_WIN32) -#include -#include "../lib/winapi.h" - enum { BF_CLOSED, BF_READ, /* BackupRead */ diff --git a/bacula/src/findlib/match.c b/bacula/src/findlib/match.c index 4c239840a9..2e5bc26240 100644 --- a/bacula/src/findlib/match.c +++ b/bacula/src/findlib/match.c @@ -49,7 +49,6 @@ static const int fnmode = 0; #undef bmalloc #define bmalloc(x) sm_malloc(__FILE__, __LINE__, x) -extern int win32_client; int match_files(JCR *jcr, FF_PKT *ff, int callback(FF_PKT *ff_pkt, void *hpkt, bool), void *his_pkt) @@ -366,13 +365,15 @@ int file_is_excluded(FF_PKT *ff, const char *file) { const char *p; +#if defined(HAVE_WIN32) /* * ***NB*** this removes the drive from the exclude * rule. Why????? */ - if (win32_client && file[1] == ':') { + if (file[1] == ':') { file += 2; } +#endif if (file_in_excluded_list(ff->excluded_paths_list, file)) { return 1; diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index effa5580a0..f5f45ad74e 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -350,7 +350,7 @@ struct s_last_job { }; extern struct s_last_job last_job; -extern dlist *last_jobs; +extern dlist * DLL_IMP_EXP last_jobs; /* The following routines are found in lib/jcr.c */ @@ -362,6 +362,7 @@ extern JCR *get_jcr_by_partial_name(char *Job); extern JCR *get_jcr_by_full_name(char *Job); extern JCR *get_next_jcr(JCR *jcr); extern void set_jcr_job_status(JCR *jcr, int JobStatus); +extern int DLL_IMP_EXP num_jobs_run; #ifdef DEBUG extern void b_free_jcr(const char *file, int line, JCR *jcr); diff --git a/bacula/src/lib/attr.c b/bacula/src/lib/attr.c index c041f5fd56..2e30a11b62 100644 --- a/bacula/src/lib/attr.c +++ b/bacula/src/lib/attr.c @@ -23,7 +23,6 @@ #include "bacula.h" #include "jcr.h" -extern int win32_client; ATTR *new_attr() { @@ -141,9 +140,11 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr) const char *fn; int wherelen = strlen(jcr->where); pm_strcpy(attr->ofname, jcr->where); /* copy prefix */ - if (win32_client && attr->fname[1] == ':') { +#if defined(HAVE_WIN32) + if (attr->fname[1] == ':') { attr->fname[1] = '/'; /* convert : to / */ } +#endif fn = attr->fname; /* take whole name */ /* Ensure where is terminated with a slash */ if (jcr->where[wherelen-1] != '/' && fn[0] != '/') { @@ -166,9 +167,12 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr) attr->olname[0] = 0; add_link = false; } - if (win32_client && attr->lname[1] == ':') { + +#if defined(HAVE_WIN32) + if (attr->lname[1] == ':') { attr->lname[1] = '/'; /* turn : into / */ } +#endif fn = attr->lname; /* take whole name */ /* Ensure where is terminated with a slash */ if (add_link && jcr->where[wherelen-1] != '/' && fn[0] != '/') { @@ -177,10 +181,10 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr) pm_strcat(attr->olname, fn); /* copy rest of link */ } } - if (win32_client) { +#if defined(HAVE_WIN32) strip_double_slashes(attr->ofname); strip_double_slashes(attr->olname); - } +#endif } extern char *getuser(uid_t uid, char *name, int len); diff --git a/bacula/src/lib/events.c b/bacula/src/lib/events.c index 782778e12a..c89c413f02 100644 --- a/bacula/src/lib/events.c +++ b/bacula/src/lib/events.c @@ -140,8 +140,6 @@ bailout: #if defined(HAVE_WIN32) -#include - extern UPSINFO myUPS; extern int shm_OK; diff --git a/bacula/src/lib/lib.h b/bacula/src/lib/lib.h index 244bdc576f..9f86b25a83 100644 --- a/bacula/src/lib/lib.h +++ b/bacula/src/lib/lib.h @@ -31,6 +31,10 @@ #include "btime.h" #include "crypto.h" #include "mem_pool.h" +#include "rwlock.h" +#include "semlock.h" +#include "queue.h" +#include "serial.h" #include "message.h" #include "openssl.h" #include "lex.h" @@ -39,10 +43,6 @@ #include "bsock.h" #include "bshm.h" #include "workq.h" -#include "rwlock.h" -#include "semlock.h" -#include "queue.h" -#include "serial.h" #ifndef HAVE_FNMATCH #include "fnmatch.h" #endif diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 1c4b685d9a..bac2f479da 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -26,10 +26,6 @@ #include "bacula.h" #include "jcr.h" -#if !defined(HAVE_CONSOLE) && defined(HAVE_WIN32) -#include -#endif - #define FULL_LOCATION 1 /* set for file:line in Debug messages */ /* diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index e49a697418..7f73169d68 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -129,10 +129,16 @@ void d_msg(const char *file, int line, int level, const char *fmt,...); void e_msg(const char *file, int line, int type, int level, const char *fmt,...); void Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...); void Qmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...); +bool get_trace(void); -extern int debug_level; -extern int verbose; -extern char my_name[]; -extern const char *working_directory; -extern time_t daemon_start_time; -extern char catalog_db[]; + +extern int DLL_IMP_EXP debug_level; +extern int DLL_IMP_EXP verbose; +extern char DLL_IMP_EXP my_name[]; +extern const char * DLL_IMP_EXP working_directory; +extern time_t DLL_IMP_EXP daemon_start_time; +extern char catalog_db[]; + +extern int DLL_IMP_EXP console_msg_pending; +extern FILE * DLL_IMP_EXP con_fd; /* Console file descriptor */ +extern brwlock_t DLL_IMP_EXP con_lock; /* Console lock structure */ diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index f95b609485..1ad44371e6 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -50,8 +50,6 @@ #include "bacula.h" -extern int debug_level; - /* Each daemon has a slightly different set of * resources, so it will define the following * global values. diff --git a/bacula/src/lib/smartall.h b/bacula/src/lib/smartall.h index 429549b9d1..1ddd3cacff 100644 --- a/bacula/src/lib/smartall.h +++ b/bacula/src/lib/smartall.h @@ -21,10 +21,10 @@ */ -extern uint64_t sm_max_bytes; -extern uint64_t sm_bytes; -extern uint32_t sm_max_buffers; -extern uint32_t sm_buffers; +extern uint64_t DLL_IMP_EXP sm_max_bytes; +extern uint64_t DLL_IMP_EXP sm_bytes; +extern uint32_t DLL_IMP_EXP sm_max_buffers; +extern uint32_t DLL_IMP_EXP sm_buffers; #ifdef SMARTALLOC #undef SMARTALLOC diff --git a/bacula/src/lib/var.c b/bacula/src/lib/var.c index 14a59227c1..14289b19a8 100644 --- a/bacula/src/lib/var.c +++ b/bacula/src/lib/var.c @@ -37,10 +37,11 @@ */ -#ifndef HAVE_WIN32 #include "bacula.h" #if defined(HAVE_PCREPOSIX) # include +#elif defined(HAVE_WIN32) +# include "bregex.h" #else # include #endif @@ -2716,4 +2717,3 @@ const char *var_strerror(var_t *var, var_rc_t rc) } return str; } -#endif diff --git a/bacula/src/lib/watchdog.h b/bacula/src/lib/watchdog.h index c8e1cebb58..8763928e0b 100644 --- a/bacula/src/lib/watchdog.h +++ b/bacula/src/lib/watchdog.h @@ -43,3 +43,7 @@ struct s_watchdog_t { time_t next_fire; }; typedef struct s_watchdog_t watchdog_t; + +/* Exported globals */ +extern time_t DLL_IMP_EXP watchdog_time; /* this has granularity of SLEEP_TIME */ +extern time_t DLL_IMP_EXP watchdog_sleep_time; /* examine things every 60 seconds */ diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index b072bd9a93..a23cd2547a 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -138,6 +138,8 @@ int main (int argc, char *argv[]) usage(); } + OSDependentInit(); + working_directory = wd; if (configfile == NULL) { diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index 1856539ac3..71a0b2512a 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -26,12 +26,6 @@ #include "stored.h" #include "findlib/find.h" -#if defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - static void do_extract(char *fname); static bool record_cb(DCR *dcr, DEV_RECORD *rec); @@ -98,6 +92,8 @@ int main (int argc, char *argv[]) my_name_is(argc, argv, "bextract"); init_msg(NULL, NULL); /* setup message handler */ + OSDependentInit(); + ff = init_find_files(); binit(&bfd); diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 2917c0fb73..a3d354da1e 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -27,7 +27,6 @@ #include "bacula.h" #include "stored.h" -extern int debug_level; static bool terminate_writing_volume(DCR *dcr); static bool do_new_file_bookkeeping(DCR *dcr); static bool do_dvd_size_checks(DCR *dcr); diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index 40d348ccae..e12f6d47cf 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -23,12 +23,6 @@ #include "stored.h" #include "findlib/find.h" -#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - /* Dummy functions */ int generate_daemon_event(JCR *jcr, const char *event) { return 1; } @@ -102,6 +96,8 @@ int main (int argc, char *argv[]) my_name_is(argc, argv, "bls"); init_msg(NULL, NULL); /* initialize message handler */ + OSDependentInit(); + ff = init_find_files(); while ((ch = getopt(argc, argv, "b:c:d:e:i:jkLpvV:?")) != -1) { diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 6d979c96f5..397a86c437 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -51,14 +51,6 @@ static JCR *create_jcr(JOB_DBR *jr, DEV_RECORD *rec, uint32_t JobId); static int update_digest_record(B_DB *db, char *digest, DEV_RECORD *rec, int type); -/* Global variables */ -#if defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - - /* Local variables */ static DEVICE *dev = NULL; static B_DB *db; diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 0198ed0687..a69a3d2e3a 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -188,6 +188,8 @@ int main(int margc, char *margv[]) my_name_is(margc, margv, "btape"); init_msg(NULL, NULL); + OSDependentInit(); + while ((ch = getopt(margc, margv, "b:c:d:psv?")) != -1) { switch (ch) { case 'b': /* bootstrap file */ diff --git a/bacula/src/stored/device.c b/bacula/src/stored/device.c index 30f6c403f6..be6ef15fb1 100644 --- a/bacula/src/stored/device.c +++ b/bacula/src/stored/device.c @@ -48,9 +48,6 @@ /* Forward referenced functions */ -extern char my_name[]; -extern int debug_level; - /* * This is the dreaded moment. We either have an end of * medium condition or worse, and error condition. diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 43afb8933a..030a7ca2c2 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -28,9 +28,6 @@ /* Forward referenced functions */ static void create_volume_label_record(DCR *dcr, DEV_RECORD *rec); -extern char my_name[]; -extern int debug_level; - /* * Read the volume label * diff --git a/bacula/src/stored/record.c b/bacula/src/stored/record.c index 130a2884b7..8eb0509492 100644 --- a/bacula/src/stored/record.c +++ b/bacula/src/stored/record.c @@ -27,8 +27,6 @@ #include "bacula.h" #include "stored.h" -extern int debug_level; - /* * Convert a FileIndex into a printable * ASCII string. Not reentrant. diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 46a72d95d6..5edd913ac1 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -30,10 +30,6 @@ extern BSOCK *filed_chan; extern int r_first, r_last; extern struct s_res resources[]; -extern char my_name[]; -extern time_t daemon_start_time; -extern int num_jobs_run; - /* Static variables */ static char qstatus[] = ".status %127s\n"; diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index cb9766cd6f..e392d0b3d1 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -23,9 +23,6 @@ #include "bacula.h" #include "stored.h" -extern int debug_level; - - /* First and last resource ids */ int r_first = R_FIRST; int r_last = R_LAST; diff --git a/bacula/src/tools/bregex.c b/bacula/src/tools/bregex.c index 9587658f38..f21240e0e0 100644 --- a/bacula/src/tools/bregex.c +++ b/bacula/src/tools/bregex.c @@ -109,6 +109,8 @@ int main(int argc, char *const *argv) usage(); } + OSDependentInit(); + for ( ;; ) { printf("Enter regex pattern: "); if (fgets(pat, sizeof(pat)-1, stdin) == NULL) { diff --git a/bacula/src/tools/bwild.c b/bacula/src/tools/bwild.c index a7b0977046..a1f579e91e 100644 --- a/bacula/src/tools/bwild.c +++ b/bacula/src/tools/bwild.c @@ -90,6 +90,8 @@ int main(int argc, char *const *argv) usage(); } + OSDependentInit(); + for ( ;; ) { printf("Enter a wild-card: "); if (fgets(pat, sizeof(pat)-1, stdin) == NULL) { diff --git a/bacula/src/tools/dbcheck.c b/bacula/src/tools/dbcheck.c index c7eaa5a0f6..66ae3858cd 100644 --- a/bacula/src/tools/dbcheck.c +++ b/bacula/src/tools/dbcheck.c @@ -152,6 +152,8 @@ int main (int argc, char *argv[]) argc -= optind; argv += optind; + OSDependentInit(); + if (configfile) { CAT *catalog = NULL; int found = 0; diff --git a/bacula/src/tools/fstype.c b/bacula/src/tools/fstype.c index 796588d9a6..3f1430a72a 100644 --- a/bacula/src/tools/fstype.c +++ b/bacula/src/tools/fstype.c @@ -75,6 +75,8 @@ main (int argc, char *const *argv) usage(); } + OSDependentInit(); + for (i = 0; i < argc; --argc, ++argv) { if (fstype(*argv, fs, sizeof(fs))) { if (verbose) { diff --git a/bacula/src/tools/testls.c b/bacula/src/tools/testls.c index 78ff15d3ec..54d46fa0f1 100755 --- a/bacula/src/tools/testls.c +++ b/bacula/src/tools/testls.c @@ -19,12 +19,6 @@ #include "bacula.h" #include "findlib/find.h" -#if defined(HAVE_WIN32) -int win32_client = 1; -#else -int win32_client = 0; -#endif - /* Dummy functions */ int generate_daemon_event(JCR *jcr, const char *event) { return 1; } int generate_job_event(JCR *jcr, const char *event) { return 1; } -- 2.39.5