+#include "ifuncs.h"
+
+extern int verbose;
+extern int dry_run;
+extern int am_daemon;
+extern int am_server;
+extern int am_sender;
+extern int am_generator;
+extern int local_server;
+extern int quiet;
+extern int module_id;
+extern int msg_fd_out;
+extern int allow_8bit_chars;
+extern int protocol_version;
+extern int preserve_times;
+extern int uid_ndx;
+extern int gid_ndx;
+extern int stdout_format_has_i;
+extern int stdout_format_has_o_or_i;
+extern int logfile_format_has_i;
+extern int logfile_format_has_o_or_i;
+extern mode_t orig_umask;
+extern char *auth_user;
+extern char *stdout_format;
+extern char *logfile_format;
+extern char *logfile_name;
+#ifdef ICONV_CONST
+extern iconv_t ic_chck;
+#endif
+#ifdef ICONV_OPTION
+extern iconv_t ic_send, ic_recv;
+#endif
+extern char curr_dir[];
+extern char *module_dir;
+extern unsigned int module_dirlen;
+
+static int log_initialised;
+static int logfile_was_closed;
+static FILE *logfile_fp;
+struct stats stats;
+
+int log_got_error = 0;
+
+struct {
+ int code;
+ char const *name;
+} const rerr_names[] = {
+ { RERR_SYNTAX , "syntax or usage error" },
+ { RERR_PROTOCOL , "protocol incompatibility" },
+ { RERR_FILESELECT , "errors selecting input/output files, dirs" },
+ { RERR_UNSUPPORTED, "requested action not supported" },
+ { RERR_STARTCLIENT, "error starting client-server protocol" },
+ { RERR_SOCKETIO , "error in socket IO" },
+ { RERR_FILEIO , "error in file IO" },
+ { RERR_STREAMIO , "error in rsync protocol data stream" },
+ { RERR_MESSAGEIO , "errors with program diagnostics" },
+ { RERR_IPC , "error in IPC code" },
+ { RERR_CRASHED , "sibling process crashed" },
+ { RERR_TERMINATED , "sibling process terminated abnormally" },
+ { RERR_SIGNAL1 , "received SIGUSR1" },
+ { RERR_SIGNAL , "received SIGINT, SIGTERM, or SIGHUP" },
+ { RERR_WAITCHILD , "waitpid() failed" },
+ { RERR_MALLOC , "error allocating core memory buffers" },
+ { RERR_PARTIAL , "some files could not be transferred" },
+ { RERR_VANISHED , "some files vanished before they could be transferred" },
+ { RERR_TIMEOUT , "timeout in data send/receive" },
+ { RERR_CMD_FAILED , "remote shell failed" },
+ { RERR_CMD_KILLED , "remote shell killed" },
+ { RERR_CMD_RUN , "remote command could not be run" },
+ { RERR_CMD_NOTFOUND,"remote command not found" },
+ { RERR_DEL_LIMIT , "the --max-delete limit stopped deletions" },
+ { 0, NULL }
+};