*/
#include "amanda.h"
+#include "util.h"
#ifdef TEST
# include <stdio.h>
fsent->mntopts = xmntopts = newstralloc(xmntopts, sys_fsent->fs_opts);
#else
#if defined(_AIX)
- fsent->fstype = xfstype = newstralloc(xfstype, "unknown");
+ fsent->fstype = xfstype = newstralloc(xfstype, _("unknown"));
fsent->mntopts = xmntopts = newstralloc(xmntopts, sys_fsent->fs_type);
#else
fsent->fstype = xfstype = newstralloc(xfstype, sys_fsent->fs_vfstype);
}
fsent->fstype = lfsnam;
-#define sc "hs"
- if (strncmp(fsent->fstype, sc, SIZEOF(sc)-1) == 0)
+ if (strncmp_const(fsent->fstype, "hs") == 0)
fsent->fstype = "iso9660";
-#undef sc
fsent->freq = 0;
fsent->passno = 0;
char *s;
int ch;
- if(stat(name, &st) == 0 && S_ISCHR(st.st_mode)) {
+ if(stat(name, &st) == 0 && !S_ISBLK(st.st_mode)) {
/*
* If the input is already a character device, just return it.
*/
amfree(rdev);
- if(fsent->mntdir != NULL &&
- (smnt = stat(fsent->mntdir, &mntstat)) == -1)
- continue;
+ if(fsent->mntdir != NULL)
+ smnt = stat(fsent->mntdir, &mntstat);
if(fsent->fsname != NULL) {
sfs = stat(fsent->fsname, &fsstat);
generic_fsent_t * fsent)
{
#define nchk(s) ((s)? (s) : "<NULL>")
- printf("%-20.20s %-14.14s %-7.7s %4d %5d %s\n",
+ g_printf("%-20.20s %-14.14s %-7.7s %4d %5d %s\n",
nchk(fsent->fsname), nchk(fsent->mntdir), nchk(fsent->fstype),
fsent->freq, fsent->passno, nchk(fsent->mntopts));
}
generic_fsent_t fsent;
char *s;
char *name = NULL;
- unsigned long malloc_hist_1, malloc_size_1;
- unsigned long malloc_hist_2, malloc_size_2;
+
+ /*
+ * Configure program for internationalization:
+ * 1) Only set the message locale for now.
+ * 2) Set textdomain for all amanda related programs to "amanda"
+ * We don't want to be forced to support dozens of message catalogs.
+ */
+ setlocale(LC_MESSAGES, "C");
+ textdomain("amanda");
safe_fd(-1, 0);
/* Don't die when child closes pipe */
signal(SIGPIPE, SIG_IGN);
- malloc_size_1 = malloc_inuse(&malloc_hist_1);
-
if(!open_fstab()) {
- fprintf(stderr, "getfsent_test: could not open fstab\n");
+ g_fprintf(stderr, _("getfsent_test: could not open fstab\n"));
return 1;
}
- printf("getfsent (%s)\n",GETFSENT_TYPE);
- printf("l/r fsname mntdir fstype freq pass# mntopts\n");
+ g_printf("getfsent (%s)\n",GETFSENT_TYPE);
+ g_printf("l/r fsname mntdir fstype freq pass# mntopts\n");
while(get_fstab_nextentry(&fsent)) {
- printf("%c ",is_local_fstype(&fsent)? 'l' : 'r');
+ g_printf("%c ",is_local_fstype(&fsent)? 'l' : 'r');
print_entry(&fsent);
}
- printf("--------\n");
+ g_printf("--------\n");
close_fstab();
name = newstralloc(name, "/usr");
if(search_fstab(name, &fsent, 1) || search_fstab(name, &fsent, 0)) {
- printf("Found %s mount for %s:\n",
- is_local_fstype(&fsent)? "local" : "remote", name);
+ g_printf(_("Found %s mount for %s:\n"),
+ is_local_fstype(&fsent)? _("local") : _("remote"), name);
print_entry(&fsent);
}
else
- printf("Mount for %s not found\n", name);
+ g_printf(_("Mount for %s not found\n"), name);
name = newstralloc(name, "/");
if(search_fstab(name, &fsent, 1) || search_fstab(name, &fsent, 0)) {
- printf("Found %s mount for %s:\n",
- is_local_fstype(&fsent)? "local" : "remote", name);
+ g_printf(_("Found %s mount for %s:\n"),
+ is_local_fstype(&fsent)? _("local") : _("remote"), name);
print_entry(&fsent);
}
else
- printf("Mount for %s not found\n", name);
+ g_printf(_("Mount for %s not found\n"), name);
name = newstralloc(name, "/");
s = amname_to_fstype(name);
- printf("fstype of `%s': %s\n", name, s);
+ g_printf(_("fstype of `%s': %s\n"), name, s);
amfree(s);
name = newstralloc(name, "/dev/root");
s = amname_to_fstype(name);
- printf("fstype of `%s': %s\n", name, s);
+ g_printf(_("fstype of `%s': %s\n"), name, s);
amfree(s);
name = newstralloc(name, "/usr");
s = amname_to_fstype(name);
- printf("fstype of `%s': %s\n", name, s);
+ g_printf(_("fstype of `%s': %s\n"), name, s);
amfree(s);
name = newstralloc(name, "c0t3d0s0");
s = amname_to_fstype(name);
- printf("fstype of `%s': %s\n", name, s);
+ g_printf(_("fstype of `%s': %s\n"), name, s);
amfree(s);
name = newstralloc(name, "/tmp/foo");
s = amname_to_devname(name);
- printf("device of `%s': %s\n", name, s);
+ g_printf(_("device of `%s': %s\n"), name, s);
amfree(s);
s = amname_to_dirname(name);
- printf("dirname of `%s': %s\n", name, s);
+ g_printf(_("dirname of `%s': %s\n"), name, s);
amfree(s);
s = amname_to_fstype(name);
- printf("fstype of `%s': %s\n", name, s);
+ g_printf(_("fstype of `%s': %s\n"), name, s);
amfree(s);
name = newstralloc(name, "./foo");
s = amname_to_devname(name);
- printf("device of `%s': %s\n", name, s);
+ g_printf(_("device of `%s': %s\n"), name, s);
amfree(s);
s = amname_to_dirname(name);
- printf("dirname of `%s': %s\n", name, s);
+ g_printf(_("dirname of `%s': %s\n"), name, s);
amfree(s);
s = amname_to_fstype(name);
- printf("fstype of `%s': %s\n", name, s);
+ g_printf(_("fstype of `%s': %s\n"), name, s);
amfree(s);
while (--argc > 0) {
name = newstralloc(name, *++argv);
s = amname_to_devname(name);
- printf("device of `%s': %s\n", name, s);
+ g_printf(_("device of `%s': %s\n"), name, s);
amfree(s);
s = amname_to_dirname(name);
- printf("dirname of `%s': %s\n", name, s);
+ g_printf(_("dirname of `%s': %s\n"), name, s);
amfree(s);
s = amname_to_fstype(name);
- printf("fstype of `%s': %s\n", name, s);
+ g_printf(_("fstype of `%s': %s\n"), name, s);
amfree(s);
}
amfree(name);
- malloc_size_2 = malloc_inuse(&malloc_hist_2);
-
- if(malloc_size_1 != malloc_size_2) {
- malloc_list(fileno(stderr), malloc_hist_1, malloc_hist_2);
- }
-
+ dbclose();
return 0;
}