2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1999 University of Maryland at College Park
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of U.M. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. U.M. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Authors: the Amanda Development Team. Its members are listed in a
24 * file named AUTHORS, in the root directory of this distribution.
27 * $Id: genversion.c 1168 2008-07-03 14:15:21Z djmitche $
29 * dump the current Amanda version info
34 /* distribution-time information */
37 /* build-time information */
38 #include "genversion.h"
43 static size_t linelen;
45 #define startline(title) g_printf(" \"%-*s", LMARGIN, title); linelen = 0
46 #define endline() g_printf("\\n\",\n")
48 static void prstr(const char *);
49 static void prvar(const char *, const char *);
50 static void prundefvar(const char *var);
51 static void prnum(const char *var, long val);
53 int main(int, char **);
60 size_t len = strlen(string) + 1;
63 * If this string overflows this line, and there's other stuff
64 * on the line, create a new one.
66 if (linelen > 0 && linelen + len >= RMARGIN - LMARGIN) {
70 g_printf(" %s", string);
74 static char *buf = NULL;
75 static size_t buf_len = 0;
77 /* Print a text variable */
90 if(new_len > buf_len) {
93 buf = malloc(new_len);
95 g_fprintf(stderr, _("genversion: Not enough memory"));
100 g_snprintf(buf, buf_len, "%s=\\\"%s\\\"", var, val); /* safe */
104 /* Print a undef variable */
111 new_len = strlen(var)
114 if(new_len > buf_len) {
117 buf = malloc(new_len); /* let it die if malloc() fails */
119 g_fprintf(stderr, _("genversion: Not enough memory"));
124 g_snprintf(buf, buf_len, "%s=UNDEF", var); /* safe */
128 /* Print a numeric variable */
134 static char number[NUM_STR_SIZE];
137 g_snprintf(number, SIZEOF(number), "%ld", val);
138 new_len = strlen(var)
142 if(new_len > buf_len) {
145 buf = malloc(new_len); /* let it die if malloc() fails */
147 g_fprintf(stderr, _("genversion: Not enough memory"));
152 g_snprintf(buf, buf_len, "%s=%s", var, number); /* safe */
165 (void)argc; /* Quiet unused parameter warning */
166 (void)argv; /* Quiet unused parameter warning */
169 * Configure program for internationalization:
170 * 1) Only set the message locale for now.
171 * 2) Set textdomain for all amanda related programs to "amanda"
172 * We don't want to be forced to support dozens of message catalogs.
174 setlocale(LC_MESSAGES, "C");
175 textdomain("amanda");
177 g_printf(_("/* version.c - generated by genversion.c - DO NOT EDIT! */\n"));
178 g_printf("const char * const version_info[] = {\n");
182 v_len = SIZEOF("Amanda-") + strlen(v) + 1;
183 verstr = malloc(v_len);
185 g_fprintf(stderr, _("genversion: Not enough memory"));
189 g_snprintf(verstr, v_len, "Amanda-%s", v); /* safe */
190 prvar("VERSION", verstr);
194 prvar("BUILT_DATE", BUILT_DATE);
196 prundefvar("BUILT_DATE");
200 prvar("BUILT_MACH", BUILT_MACH);
202 prundefvar("BUILT_MACH");
206 prvar("BUILT_REV", BUILT_REV);
208 prundefvar("BUILT_REV");
212 prvar("BUILT_BRANCH", BUILT_BRANCH);
214 prundefvar("BUILT_BRANCH");
227 prvar("bindir", bindir);
228 prvar("sbindir", sbindir);
229 prvar("libexecdir", libexecdir);
230 prvar("amlibexecdir", amlibexecdir);
231 prvar("mandir", mandir);
232 prvar("AMANDA_TMPDIR", AMANDA_TMPDIR);
234 prvar("AMANDA_DBGDIR", AMANDA_DBGDIR);
236 prundefvar("AMANDA_DBGDIR");
238 prvar("CONFIG_DIR", CONFIG_DIR);
241 prvar("DEV_PREFIX", DEV_PREFIX);
243 prundefvar("DEV_PREFIX");
247 prvar("RDEV_PREFIX", RDEV_PREFIX);
249 prundefvar("RDEV_PREFIX");
254 prvar("RESTORE", RESTORE);
257 prundefvar("RESTORE");
261 prvar("VDUMP", VDUMP);
262 prvar("VRESTORE", VRESTORE);
265 prundefvar("VRESTORE");
269 prvar("XFSDUMP", XFSDUMP);
270 prvar("XFSRESTORE", XFSRESTORE);
272 prundefvar("XFSDUMP");
273 prundefvar("XFSRESTORE");
277 prvar("VXDUMP", VXDUMP);
278 prvar("VXRESTORE", VXRESTORE);
280 prundefvar("VXDUMP");
281 prundefvar("VXRESTORE");
285 prvar("SAMBA_CLIENT", SAMBA_CLIENT);
287 prundefvar("SAMBA_CLIENT");
291 prvar("GNUTAR", GNUTAR);
293 prundefvar("GNUTAR");
297 prvar("COMPRESS_PATH", COMPRESS_PATH);
299 prundefvar("COMPRESS_PATH");
302 #ifdef UNCOMPRESS_PATH
303 prvar("UNCOMPRESS_PATH", UNCOMPRESS_PATH);
305 prundefvar("UNCOMPRESS_PATH");
309 prvar("LPRCMD", LPRCMD);
311 prundefvar(" LPRCMD");
315 prvar("MAILER", MAILER);
317 prundefvar(" MAILER");
320 #ifdef GNUTAR_LISTED_INCREMENTAL_DIR
321 prvar("listed_incr_dir", GNUTAR_LISTED_INCREMENTAL_DIR);
323 prundefvar("GNUTAR_LISTED_INCREMENTAL_DIR");
329 prvar("DEFAULT_SERVER", DEFAULT_SERVER);
330 prvar("DEFAULT_CONFIG", DEFAULT_CONFIG);
331 prvar("DEFAULT_TAPE_SERVER", DEFAULT_TAPE_SERVER);
333 #ifdef DEFAULT_TAPE_DEVICE
334 prvar("DEFAULT_TAPE_DEVICE", DEFAULT_TAPE_DEVICE);
342 prstr("BROKEN_VOID");
345 #ifdef DUMP_RETURNS_1
346 prstr("DUMP_RETURNS_1");
353 #ifndef HAVE_STRERROR
354 prstr("NEED_STRERROR");
358 prstr("NEED_STRSTR");
362 prstr("HAVE_SYSVSHM");
365 #ifdef WANT_AMFLOCK_POSIX
366 prstr("AMFLOCK_POSIX");
368 #ifdef WANT_AMFLOCK_FLOCK
369 prstr("AMFLOCK_FLOCK");
371 #ifdef WANT_AMFLOCK_LOCKF
372 prstr("AMFLOCK_LOCKF");
374 #ifdef WANT_AMFLOCK_LNLOCK
375 prstr("AMFLOCK_LNLOCK");
383 prstr("STATFS_OSF1");
387 prstr("STATFS_ULTRIX");
391 prstr("SETPGRP_VOID");
398 #ifdef AMANDA_DEBUG_DAYS
399 prnum("AMANDA_DEBUG_DAYS", AMANDA_DEBUG_DAYS);
403 prstr("BSD_SECURITY");
407 prstr("KRB4_SECURITY");
411 prstr("KRB5_SECURITY");
415 prstr("RSH_SECURITY");
418 #ifdef USE_AMANDAHOSTS
419 prstr("USE_AMANDAHOSTS");
423 prstr("USE_RUNDUMP");
426 prvar("CLIENT_LOGIN", CLIENT_LOGIN);
429 prstr("CHECK_USERID");
432 #ifdef USE_VERSION_SUFFIXES
433 prstr("USE_VERSION_SUFFIXES");
440 #ifdef COMPRESS_SUFFIX
441 prvar("COMPRESS_SUFFIX", COMPRESS_SUFFIX);
444 #ifdef COMPRESS_FAST_OPT
445 prvar("COMPRESS_FAST_OPT", COMPRESS_FAST_OPT);
448 #ifdef COMPRESS_BEST_OPT
449 prvar("COMPRESS_BEST_OPT", COMPRESS_BEST_OPT);
452 #ifdef UNCOMPRESS_OPT
453 prvar("UNCOMPRESS_OPT", UNCOMPRESS_OPT);
458 g_printf(" 0\n};\n");
460 return (0); /* exit */