* file named AUTHORS, in the root directory of this distribution.
*/
/*
- * $Id: amanda.h,v 1.131.2.5 2006/12/12 14:56:38 martinea Exp $
+ * $Id: amanda.h,v 1.131 2006/07/25 18:27:56 martinea Exp $
*
* the central header file included by all amanda sources
*/
#define AMANDA_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+/* use a relative path here to avoid conflicting with Perl's config.h. */
+#include "../config/config.h"
#endif
+#include <glib.h>
+#include <glib/gprintf.h>
+
+#include "amflock.h"
+
/*
* Force large file source even if configure guesses wrong.
*/
# include <sys/types.h>
#endif
+/* gnulib creates this header locally if the system doesn't provide it */
+#include <stdint.h>
+
/*
* I would prefer that each Amanda module include only those system headers
* that are locally needed, but on most Unixes the system header files are not
* Also, some systems put key files in different places, so by including
* everything here the rest of the system is isolated from such things.
*/
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
/* from the autoconf documentation */
#ifdef HAVE_DIRENT_H
# endif
#endif
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# include <locale.h>
+# define plural(String1, String2, Count) \
+ (((Count) == 1) ? (String1) : (String2))
+#else
+# define plural(String1, String2, Count) \
+ (((Count) == 1) ? (String1) : (String2))
+# define setlocale(Which, Locale)
+# define textdomain(Domain)
+# define bindtextdomain(Package, Directory)
+# define gettext(String) String
+# define dgettext(Domain, String) String
+# define dcgettext(Domain, String, Catagory) String
+# define ngettext(String1, String2, Count) \
+ plural((String1), (String2), (Count))
+# define dngettext(Domain, String1, String2, Count) \
+ plural((String1), (String2), (Count))
+# define dcngettext(Domain, String1, String2, Count, Catagory) \
+ plural((String1), (String2), (Count))
+#endif
+#define T_(String) String
+#ifndef SWIG /* TODO: make this go away */
+#define _(String) dgettext("amanda", (String))
+#endif
+
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
# include <unistd.h>
#endif
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
#include <ctype.h>
#include <errno.h>
-#include <netinet/in.h>
#include <pwd.h>
#include <signal.h>
#include <setjmp.h>
#include <sys/resource.h>
#include <sys/socket.h>
-#if !defined(CONFIGURE_TEST)
-# include "amanda-int.h"
-#endif
-
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
-/*
- * The dbmalloc package comes from:
- *
- * http://www.clark.net/pub/dickey/dbmalloc/dbmalloc.tar.gz
- *
- * or
- *
- * ftp://gatekeeper.dec.com/pub/usenet/comp.sources.misc/volume32/dbmalloc/
- *
- * The following functions are sprinkled through the code, but are
- * disabled unless USE_DBMALLOC is defined:
- *
- * malloc_enter(char *) -- stack trace for malloc reports
- * malloc_leave(char *) -- stack trace for malloc reports
- * malloc_mark(void *) -- mark an area as never to be free-d
- * malloc_chain_check(void) -- check the malloc area now
- * malloc_dump(int fd) -- report the malloc contents to a file descriptor
- * malloc_list(int fd, ulong a, ulong b) -- report memory activated since
- * history stamp a that is still active as of stamp b (leak check)
- * malloc_inuse(ulong *h) -- create history stamp h and return the amount
- * of memory currently in use.
- */
+#ifdef WORKING_IPV6
+#define INET6
+#endif
-#ifdef USE_DBMALLOC
-#include "dbmalloc.h"
-#else
-#define malloc_enter(func) ((void)0)
-#define malloc_leave(func) ((void)0)
-#define malloc_mark(ptr) ((void)0)
-#define malloc_chain_check() ((void)0)
-#define malloc_dump(fd) ((void)0)
-#define malloc_list(a,b,c) ((void)0)
-#define malloc_inuse(hist) (*(hist) = 0, 0)
-#define dbmalloc_caller_loc(x,y) (x)
+#ifndef INET_ADDRSTRLEN
+#define INET_ADDRSTRLEN 16
#endif
#if !defined(HAVE_SIGACTION) && defined(HAVE_SIGVEC)
#define stringize(x) #x
#define stringconcat(x, y) x ## y
-/*
- * So that we can use GNUC attributes (such as to get -Wall warnings
- * for printf-like functions). Only do this in gcc 2.7 or later ...
- * it may work on earlier stuff, but why chance it.
- */
-#if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(S_SPLINT_S) || defined(LINT) || defined(__lint)
-#undef __attribute__
-#define __attribute__(__x)
-#endif
-
-/*
- * assertions, but call error() instead of abort
- */
-#ifndef ASSERTIONS
-
-#define assert(exp) ((void)0)
-
-#else /* ASSERTIONS */
-
-#define assert(exp) do { \
- if (!(exp)) { \
- onerror(abort); \
- error("assert: %s false, file %s, line %d", \
- stringize(exp), __FILE__, __LINE__); \
- /*NOTREACHED*/ \
- } \
-} while (0)
-
-#endif /* ASSERTIONS */
-
-/*
- * print debug output, else compile to nothing.
- */
-
-#ifdef DEBUG_CODE /* { */
-# define dbopen(a) debug_open(a)
-# define dbreopen(a,b) debug_reopen(a,b)
-# define dbrename(a,b) debug_rename(a,b)
-# define dbclose() debug_close()
-# define dbprintf(p) (debug_printf p)
-# define dbfd() debug_fd()
-# define dbfp() debug_fp()
-# define dbfn() debug_fn()
-
-extern void debug_open(char *subdir);
-extern void debug_reopen(char *file, char *notation);
-extern void debug_rename(char *config, char *subdir);
-extern void debug_close(void);
-extern void debug_printf(const char *format, ...)
- __attribute__ ((format (printf, 1, 2)));
-extern int debug_fd(void);
-extern FILE * debug_fp(void);
-extern char * debug_fn(void);
-extern void set_debug_prefix_pid(pid_t);
-extern char *debug_prefix(char *);
-extern char *debug_prefix_time(char *);
-#else /* }{ */
-# define dbopen(a)
-# define dbreopen(a,b)
-# define dbrename(a,b)
-# define dbclose()
-# define dbprintf(p)
-# define dbfd() (-1)
-# define dbfp() NULL
-# define dbfn() NULL
-# define set_debug_prefix_pid(x)
-# define debug_prefix(x) get_pname()
-# define debug_prefix_time(x) get_pname()
-#endif /* } */
-
/* amanda #days calculation, with roundoff */
#define SECS_PER_DAY (24*60*60)
#define DISK_BLOCK_KB 32
#define DISK_BLOCK_BYTES (DISK_BLOCK_KB * 1024)
-/* Maximum size of a tape block */
-/* MAX_TAPE_BLOCK_KB is defined in config.h */
-/* by configure --with-maxtapeblocksize */
-#define MAX_TAPE_BLOCK_BYTES (MAX_TAPE_BLOCK_KB*1024)
-
/* Maximum length of tape label, plus one for null-terminator. */
#define MAX_TAPE_LABEL_LEN (10240)
#define MAX_TAPE_LABEL_BUF (MAX_TAPE_LABEL_LEN+1)
#define MAX_TAPE_LABEL_FMT "%10240s"
-/* Define miscellaneous amanda functions. */
-#define ERR_INTERACTIVE 1
-#define ERR_SYSLOG 2
-#define ERR_AMANDALOG 4
-
-extern void set_logerror(void (*f)(char *));
-extern void set_pname(char *pname);
-extern char *get_pname(void);
-extern int erroutput_type;
-extern void error(const char *format, ...)
- __attribute__ ((format (printf, 1, 2), noreturn));
-extern void errordump(const char *format, ...)
- __attribute__ ((format (printf, 1, 2), noreturn));
-extern int onerror(void (*errf)(void));
-
-extern void *debug_alloc (const char *c, int l, size_t size);
-extern void *debug_newalloc (const char *c, int l, void *old, size_t size);
-extern char *debug_stralloc (const char *c, int l, const char *str);
-extern char *debug_newstralloc(const char *c, int l, char *oldstr,
- const char *newstr);
-extern const char *debug_caller_loc (const char *file, int line);
-extern int debug_alloc_push (char *file, int line);
-extern void debug_alloc_pop (void);
+/* Unfortunately, the system-level sockaddr_storage definition can lead to
+ * C aliasing errors (where the optimizer doesn't notice that two operations
+ * affect the same datum). We define our own similar type as a union.
+ */
+typedef union sockaddr_union {
+ struct sockaddr sa;
+ struct sockaddr_in sin;
+#ifdef WORKING_IPV6
+ struct sockaddr_in6 sin6;
+#endif
+#ifdef HAVE_SOCKADDR_STORAGE
+ struct sockaddr_storage ss; /* not used; just here to make the union full-size */
+#endif
+} sockaddr_union;
+
+#include "debug.h"
+#include "file.h"
+
+void *debug_alloc(const char *file, int line, size_t size);
+void *debug_newalloc(const char *file, int line, void *old, size_t size);
+char *debug_stralloc(const char *file, int line, const char *str);
+char *debug_newstralloc(const char *file, int line,
+ char *oldstr, const char *newstr);
+char *debug_vstralloc(const char *file, int line, const char *str, ...);
+char *debug_newvstralloc(const char *file, int line,
+ char *oldstr, const char *str, ...);
+char *debug_vstrallocf(const char *file, int line, const char *fmt,
+ ...) G_GNUC_PRINTF(3, 4);
+char *debug_newvstrallocf(const char *file, int line, char *oldstr,
+ const char *fmt, ...) G_GNUC_PRINTF(4, 5);
+
+/* Usage: vstrextend(foo, "bar, "baz", NULL). Extends the existing
+ * string, or allocates a brand new one. */
+char *debug_vstrextend(const char *file, int line, char **oldstr, ...);
#define alloc(s) debug_alloc(__FILE__, __LINE__, (s))
#define newalloc(p,s) debug_newalloc(__FILE__, __LINE__, (p), (s))
#define stralloc(s) debug_stralloc(__FILE__, __LINE__, (s))
#define newstralloc(p,s) debug_newstralloc(__FILE__, __LINE__, (p), (s))
+#define vstralloc(...) debug_vstralloc(__FILE__,__LINE__,__VA_ARGS__)
+#define newvstralloc(...) debug_newvstralloc(__FILE__,__LINE__,__VA_ARGS__)
+#define vstrallocf(...) debug_vstrallocf(__FILE__,__LINE__,__VA_ARGS__)
+#define newvstrallocf(...) debug_newvstrallocf(__FILE__,__LINE__,__VA_ARGS__)
+#define vstrextend(...) debug_vstrextend(__FILE__,__LINE__,__VA_ARGS__)
-/*
- * Voodoo time. We want to be able to mark these calls with the source
- * line, but CPP does not handle variable argument lists so we cannot
- * do what we did above (e.g. for alloc()).
- *
- * What we do is call a function to save the file and line number
- * and have it return "false". That triggers the "?" operator to
- * the right side of the ":" which is a call to the debug version of
- * vstralloc/newvstralloc but without parameters. The compiler gets
- * those from the next input tokens:
- *
- * xx = vstralloc(a,b,NULL);
- *
- * becomes:
- *
- * xx = debug_alloc_push(__FILE__,__LINE__)?0:debug_vstralloc(a,b,NULL);
- *
- * This works as long as vstralloc/newvstralloc are not part of anything
- * very complicated. Assignment is fine, as is an argument to another
- * function (but you should not do that because it creates a memory leak).
- * This will not work in arithmetic or comparison, but it is unlikely
- * they are used like that.
- *
- * xx = vstralloc(a,b,NULL); OK
- * return vstralloc(j,k,NULL); OK
- * sub(a, vstralloc(g,h,NULL), z); OK, but a leak
- * if(vstralloc(s,t,NULL) == NULL) { ... NO, but unneeded
- * xx = vstralloc(x,y,NULL) + 13; NO, but why do it?
- */
-
-#define vstralloc debug_alloc_push(__FILE__,__LINE__)?0:debug_vstralloc
-#define newvstralloc debug_alloc_push(__FILE__,__LINE__)?0:debug_newvstralloc
+#define stralloc2(s1,s2) vstralloc((s1),(s2),NULL)
+#define newstralloc2(p,s1,s2) newvstralloc((p),(s1),(s2),NULL)
-extern char *debug_vstralloc(const char *str, ...);
-extern char *debug_newvstralloc(char *oldstr, const char *newstr, ...);
+#define vstrallocf(...) debug_vstrallocf(__FILE__,__LINE__,__VA_ARGS__)
-#define stralloc2(s1,s2) vstralloc((s1),(s2),NULL)
-#define newstralloc2(p,s1,s2) newvstralloc((p),(s1),(s2),NULL)
-
-/* Usage: vstrextend(foo, "bar, "baz", NULL). Extends the existing
- * string, or allocates a brand new one. */
-extern char *vstrextend(char **oldstr, ...);
-
-extern /*@only@*/ /*@null@*/ char *debug_agets(const char *c, int l, FILE *file);
-extern /*@only@*/ /*@null@*/ char *debug_areads(const char *c, int l, int fd);
+/*@only@*/ /*@null@*/ char *debug_agets(const char *file, int line, FILE *f);
+/*@only@*/ /*@null@*/ char *debug_areads(const char *file, int line, int fd);
#define agets(f) debug_agets(__FILE__,__LINE__,(f))
#define areads(f) debug_areads(__FILE__,__LINE__,(f))
(b), \
(f))
-extern void amtable_free(void **table, size_t *current);
+extern void amtable_free(void **, size_t *);
-extern uid_t client_uid;
-extern gid_t client_gid;
-
-void safe_fd(int fd_start, int fd_count);
-void safe_cd(void);
-void save_core(void);
char ** safe_env(void);
char * validate_regexp(const char *regex);
char * validate_glob(const char *glob);
char * clean_regex(const char *regex);
int match(const char *regex, const char *str);
+int match_no_newline(const char *regex, const char *str);
int match_glob(const char *glob, const char *str);
char * glob_to_regex(const char *glob);
int match_tar(const char *glob, const char *str);
int match_datestamp(const char *dateexp, const char *datestamp);
int match_level(const char *levelexp, const char *level);
time_t unctime(char *timestr);
-ssize_t areads_dataready(int fd);
-void areads_relbuf(int fd);
/*
* amfree(ptr) -- if allocated, release space and set ptr to NULL.
(s1) = t_t_t; \
} while(0)
-/*
- * "Safe" close macros. Close the object then set it to a value that
- * will cause an error if referenced.
- *
- * aclose(fd) -- close a file descriptor and set it to -1.
- * afclose(f) -- close a stdio file and set it to NULL.
- * apclose(p) -- close a stdio pipe file and set it to NULL.
- *
- * Note: be careful not to do the following:
- *
- * for(fd = low; fd < high; fd++) {
- * aclose(fd);
- * }
- *
- * Since aclose() sets the argument to -1, this will loop forever.
- * Just copy fd to a temp variable and use that with aclose().
- *
- * Aclose() interacts with areads() to inform it to release any buffer
- * it has outstanding on the file descriptor.
- */
-
-#define aclose(fd) do { \
- if((fd) >= 0) { \
- close(fd); \
- areads_relbuf(fd); \
- } \
- (fd) = -1; \
- (void)(fd); /* Fix value never used warning at end of routines */ \
-} while(0)
-
-#define afclose(f) do { \
- if((f) != NULL) { \
- fclose(f); \
- (f) = NULL; \
- (void)(f); /* Fix value never used warning at end of routines */ \
- } \
-} while(0)
-
-#define apclose(p) do { \
- if((p) != NULL) { \
- pclose(p); \
- (p) = NULL; \
- (void)(p); /* Fix value never used warning at end of routines */ \
- } \
-} while(0)
-
/*
* Return the number of elements in an array.
*/
* -- skip an integer field
* skip_line (ptr, var)
* -- skip just past the next newline
+ * strncmp_const (str, const_str)
+ * -- compare str to const_str, a string constant
+ * strncmp_const_skip (str, const_var, ptr, var)
+ * -- like strncmp_const, but skip the string if a match is
+ * found; this macro only tests for equality, discarding
+ * ordering information.
*
* where:
*
#define NUM_STR_SIZE 128 /* a generic number buffer size */
#define skip_whitespace(ptr,c) do { \
- while((c) != '\n' && isspace(c)) (c) = *(ptr)++; \
+ while((c) != '\n' && g_ascii_isspace((int)c)) (c) = *(ptr)++; \
} while(0)
#define skip_non_whitespace(ptr,c) do { \
- while((c) != '\0' && !isspace(c)) (c) = *(ptr)++; \
+ while((c) != '\0' && !g_ascii_isspace((int)c)) (c) = *(ptr)++; \
} while(0)
#define skip_non_whitespace_cs(ptr,c) do { \
- while((c) != '\0' && (c) != '#' && !isspace(c)) (c) = *(ptr)++; \
+ while((c) != '\0' && (c) != '#' && !g_ascii_isspace((int)c)) (c) = *(ptr)++;\
} while(0)
#define skip_non_integer(ptr,c) do { \
#define skip_quoted_string(ptr, c) do { \
int iq = 0; \
- while (((c) != '\0') && !((iq == 0) && isspace(c))) { \
+ while (((c) != '\0') && !((iq == 0) && g_ascii_isspace((int)c))) { \
if ((c) == '"') { \
iq = !iq; \
- } else if (((c) == '\\') && (*(ptr) == '"')) { \
- (ptr)++; \
+ } else if ((c) == '\\') { \
+ if (*ptr) /* not last character */ \
+ (ptr)++; \
} \
(c) = *(ptr)++; \
} \
#define copy_string(ptr,c,f,l,fp) do { \
(fp) = (f); \
- while((c) != '\0' && !isspace(c)) { \
+ while((c) != '\0' && !g_ascii_isspace((int)c)) { \
if((fp) >= (f) + (l) - 1) { \
*(fp) = '\0'; \
(fp) = NULL; \
#define copy_string_cs(ptr,c,f,l,fp) do { \
(fp) = (f); \
- while((c) != '\0' && (c) != '#' && !isspace(c)) { \
+ while((c) != '\0' && (c) != '#' && !g_ascii_isspace((int)c)) { \
if((fp) >= (f) + (l) - 1) { \
*(fp) = '\0'; \
(fp) = NULL; \
&& ((s)[1] == '\0' \
|| ((s)[1] == '.' && (s)[2] == '\0')))
-/* from amflock.c */
-extern int amflock(int fd, char *resource);
-extern int amroflock(int fd, char *resource);
-extern int amfunlock(int fd, char *resource);
+#define strncmp_const(str, cnst) \
+ strncmp((str), (cnst), sizeof((cnst))-1)
-/* from file.c */
-extern int mkpdir(char *file, mode_t mode, uid_t uid, gid_t gid);
-extern int rmpdir(char *file, char *topdir);
-extern char *sanitise_filename(char *inp);
-extern char *old_sanitise_filename(char *inp);
+/* (have to roll this up in an expression, so it can be used in if()) */
+#define strncmp_const_skip(str, cnst, ptr, var) \
+ ((strncmp((str), (cnst), sizeof((cnst))-1) == 0)? \
+ ((ptr)+=sizeof((cnst))-1, (var)=(ptr)[-1], 0) \
+ :1)
/* from old bsd-security.c */
extern int debug;
-extern int check_security(struct sockaddr_in *, char *, unsigned long, char **);
+extern int check_security(sockaddr_union *, char *, unsigned long, char **);
/*
* Handle functions which are not always declared on all systems. This
/* AIX #defines accept, and provides a prototype for the alternate name */
#if !defined(HAVE_ACCEPT_DECL) && !defined(accept)
-extern int accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+extern int accept(int s, struct sockaddr *addr, socklen_t_equiv *addrlen);
#endif
#ifndef HAVE_ATOF_DECL
#endif
#ifndef HAVE_BIND_DECL
-extern int bind(int s, const struct sockaddr *name, socklen_t namelen);
+extern int bind(int s, const struct sockaddr *name, socklen_t_equiv namelen);
#endif
#ifndef HAVE_BZERO
#endif
#ifndef HAVE_CONNECT_DECL
-extern int connect(int s, struct sockaddr *name, socklen_t namelen);
-#endif
-
-#if !defined(TEXTDB) && !defined(HAVE_DBM_OPEN_DECL)
-#undef DBM_INSERT
-#define DBM_INSERT 0
-
-#undef DBM_REPLACE
-#define DBM_REPLACE 1
-
- typedef struct {
- int dummy[10];
- } DBM;
-
-#ifndef HAVE_STRUCT_DATUM
- typedef struct {
- char *dptr;
- int dsize;
- } datum;
-#endif
-
- extern DBM *dbm_open(char *file, int flags, int mode);
- extern void dbm_close(DBM *db);
- extern datum dbm_fetch(DBM *db, datum key);
- extern datum dbm_firstkey(DBM *db);
- extern datum dbm_nextkey(DBM *db);
- extern int dbm_delete(DBM *db, datum key);
- extern int dbm_store(DBM *db, datum key, datum content, int flg);
+extern int connect(int s, struct sockaddr *name, socklen_t_equiv namelen);
#endif
#ifndef HAVE_FCLOSE_DECL
/* AIX #defines getpeername, and provides a prototype for the alternate name */
#if !defined(HAVE_GETPEERNAME_DECL) && !defined(getpeername)
-extern int getpeername(int s, struct sockaddr *name, socklen_t *namelen);
+extern int getpeername(int s, struct sockaddr *name, socklen_t_equiv *namelen);
#endif
/* AIX #defines getsockname, and provides a prototype for the alternate name */
#if !defined(HAVE_GETSOCKNAME_DECL) && !defined(getsockname)
-extern int getsockname(int s, struct sockaddr *name, socklen_t *namelen);
+extern int getsockname(int s, struct sockaddr *name, socklen_t_equiv *namelen);
#endif
#ifndef HAVE_GETSOCKOPT_DECL
extern int getsockopt(int s, int level, int optname, char *optval,
- socklen_t *optlen);
-#endif
-
-#ifndef HAVE_GETTIMEOFDAY_DECL
-# ifdef HAVE_TWO_ARG_GETTIMEOFDAY
-extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
-# else
-extern int gettimeofday(struct timeval *tp);
-# endif
+ socklen_t_equiv *optlen);
#endif
#ifndef HAVE_INITGROUPS
/* AIX #defines recvfrom, and provides a prototype for the alternate name */
#if !defined(HAVE_RECVFROM_DECL) && !defined(recvfrom)
extern int recvfrom(int s, char *buf, int len, int flags,
- struct sockaddr *from, socklen_t *fromlen);
+ struct sockaddr *from, socklen_t_equiv *fromlen);
#endif
#ifndef HAVE_REMOVE_DECL
#ifndef HAVE_SNPRINTF_DECL
#include "arglist.h"
int snprintf(char *buf, size_t len, const char *format,...)
- __attribute__((format(printf,3,4)));
+ G_GNUC_PRINTF(3,4);
#endif
#ifndef HAVE_VSNPRINTF_DECL
#include "arglist.h"
#ifndef HAVE_SYSLOG_DECL
extern void syslog(int priority, const char *logstring, ...)
- __attribute__ ((format (printf, 2, 3)));
+ G_GNUC_PRINTF(2,3);
#endif
#ifndef HAVE_SYSTEM_DECL
extern int vprintf(const char *format, va_list ap);
#endif
+/* gnulib-only includes (hence "" instead of <>) */
+#include "getaddrinfo.h"
+#include "inet_ntop.h"
+#include "safe-read.h"
+#include "full-read.h"
+#include "full-write.h"
+
#if !defined(S_ISCHR) && defined(_S_IFCHR) && defined(_S_IFMT)
#define S_ISCHR(mode) (((mode) & _S_IFMT) == _S_IFCHR)
#endif
#endif
#if SIZEOF_SIZE_T == SIZEOF_INT
-# define SIZE_T_FMT "%u"
-# define SIZE_T_FMT_TYPE unsigned
# define SIZE_T_ATOI (size_t)atoi
# ifndef SIZE_MAX
-# define SIZE_MAX UINT_MAX
+# define SIZE_MAX G_MAXUINT
# endif
#else
-# define SIZE_T_FMT "%lu"
-# define SIZE_T_FMT_TYPE unsigned long
# define SIZE_T_ATOI (size_t)atol
# ifndef SIZE_MAX
# define SIZE_MAX ULONG_MAX
#endif
#if SIZEOF_SSIZE_T == SIZEOF_INT
-# define SSIZE_T_FMT "%d"
-# define SSIZE_T_FMT_TYPE int
# define SSIZE_T_ATOI (ssize_t)atoi
# ifndef SSIZE_MAX
# define SSIZE_MAX INT_MAX
# define SSIZE_MIN INT_MIN
# endif
#else
-# define SSIZE_T_FMT "%ld"
-# define SSIZE_T_FMT_TYPE long
# define SSIZE_T_ATOI (ssize_t)atol
# ifndef SSIZE_MAX
# define SSIZE_MAX LONG_MAX
#endif
#if SIZEOF_TIME_T == SIZEOF_INT
-# define TIME_T_FMT "%u"
-# define TIME_T_FMT_TYPE unsigned
# define TIME_T_ATOI (time_t)atoi
# ifndef TIME_MAX
-# define TIME_MAX UINT_MAX
+# define TIME_MAX G_MAXUINT
# endif
#else
-# define TIME_T_FMT "%lu"
-# define TIME_T_FMT_TYPE unsigned long
# define TIME_T_ATOI (time_t)atol
# ifndef TIME_MAX
# define TIME_MAX ULONG_MAX
#endif
#if SIZEOF_OFF_T > SIZEOF_LONG
-# define OFF_T_FMT LL_FMT
-# define OFF_T_RFMT LL_RFMT
-# define OFF_T_FMT_TYPE long long
# ifdef HAVE_ATOLL
-# define OFF_T_ATOI (off_t)atoll
+# define OFF_T_ATOI (off_t)atoll
# else
-# define OFF_T_ATOI (off_t)atol
+# define OFF_T_ATOI (off_t)atol
# endif
# ifdef HAVE_STRTOLL
-# define OFF_T_STRTOL (off_t)strtoll
+# define OFF_T_STRTOL (off_t)strtoll
# else
-# define OFF_T_STRTOL (off_t)strtol
+# define OFF_T_STRTOL (off_t)strtol
# endif
#else
# if SIZEOF_OFF_T == SIZEOF_LONG
-# define OFF_T_FMT "%ld"
-# define OFF_T_RFMT "ld"
-# define OFF_T_FMT_TYPE long
# define OFF_T_ATOI (off_t)atol
# define OFF_T_STRTOL (off_t)strtol
# else
-# define OFF_T_FMT "%d"
-# define OFF_T_RFMT "d"
-# define OFF_T_FMT_TYPE int
# define OFF_T_ATOI (off_t)atoi
# define OFF_T_STRTOL (off_t)strtol
# endif
#endif
-#if SIZEOF_OFF_T == 8
-# ifdef OFF_MAX
-# define AM64_MAX (off_t)(OFF_MAX)
-# else
-# define AM64_MAX (off_t)(9223372036854775807LL)
-# endif
-# ifdef OFF_MIN
-# define AM64_MIN (off_t)(OFF_MIN)
-# else
-# define AM64_MIN (off_t)(-9223372036854775807LL -1LL)
-# endif
-# define AM64_FMT OFF_T_FMT
-#else
-#if SIZEOF_LONG == 8
-# ifdef LONG_MAX
-# define AM64_MAX (off_t)(LONG_MAX)
-# else
-# define AM64_MAX (off_t)9223372036854775807L
-# endif
-# ifdef LONG_MIN
-# define AM64_MIN (off_t)(LONG_MIN)
-# else
-# define AM64_MIN (off_t)(-9223372036854775807L -1L)
-# endif
-# define AM64_FMT "%ld"
-#else
-#if SIZEOF_LONG_LONG == 8
-# ifdef LONG_LONG_MAX
-# define AM64_MAX (off_t)(LONG_LONG_MAX)
-# else
-# define AM64_MAX (off_t)9223372036854775807LL
-# endif
-# ifdef LONG_LONG_MIN
-# define AM64_MIN (off_t)(LONG_LONG_MIN)
-# else
-# define AM64_MIN (off_t)(-9223372036854775807LL -1LL)
-# endif
-# define AM64_FMT LL_FMT
-#else
-#if SIZEOF_INTMAX_T == 8
-# ifdef INTMAX_MAX
-# define AM64_MAX (off_t)(INTMAX_MAX)
-# else
-# define AM64_MAX (off_t)9223372036854775807LL
-# endif
-# ifdef INTMAX_MIN
-# define AM64_MIN (off_t)(INTMAX_MIN)
-# else
-# define AM64_MIN (off_t)(-9223372036854775807LL -1LL)
-# endif
-# define AM64_FMT LL_FMT
-#else /* no 64 bits type found, use long. */
-# ifdef LONG_MAX
-# define AM64_MAX (off_t)(LONG_MAX)
-# else
-# define AM64_MAX (off_t)2147483647
-# endif
-# ifdef LONG_MIN
-# define AM64_MIN (off_t)(LONG_MIN)
-# else
-# define AM64_MIN (off_t)(-2147483647 -1)
-# endif
-# define AM64_FMT "%ld"
-#endif
-#endif
-#endif
-#endif
-#ifdef HAVE_LIBREADLINE
-# ifdef HAVE_READLINE_READLINE_H
-# include <readline/readline.h>
-# ifdef HAVE_READLINE_HISTORY_H
-# include <readline/history.h>
-# endif
-# else
-# ifdef HAVE_READLINE_H
-# include <readline.h>
-# ifdef HAVE_HISTORY_H
-# include <history.h>
-# endif
-# else
-# undef HAVE_LIBREADLINE
-# endif
-# endif
-#else
+#define BIND_CYCLE_RETRIES 120 /* Total of 30 minutes */
-char * readline(const char *prompt);
-void add_history(const char *line);
+#define MAX_DUMPERS 63
+#ifndef NI_MAXHOST
+#define NI_MAXHOST 1025
#endif
-#define BIND_CYCLE_RETRIES 120 /* Total of 30 minutes */
-
-#define DBG_SUBDIR_SERVER "server"
-#define DBG_SUBDIR_CLIENT "client"
-#define DBG_SUBDIR_AMANDAD "amandad"
+typedef enum {
+ KENCRYPT_NONE, /* krb5 encryption not enabled */
+ KENCRYPT_WILL_DO, /* krb5 encryption will be enabled once amanda
+ protocol stream is closed */
+ KENCRYPT_YES /* krb5 encryption enabled on all stream */
+} kencrypt_type;
#endif /* !AMANDA_H */