X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=client-src%2Fgetfsent.c;h=6f0f2752e46e3ace5e7a8a43fe0a909d2b5d8a1b;hb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;hp=03e68d8c3e23678e27681f3a1e48540b6383ba24;hpb=d3b2175e084f88c8736ad7073eacbf4670147aec;p=debian%2Famanda diff --git a/client-src/getfsent.c b/client-src/getfsent.c index 03e68d8..6f0f275 100644 --- a/client-src/getfsent.c +++ b/client-src/getfsent.c @@ -30,6 +30,7 @@ */ #include "amanda.h" +#include "util.h" #ifdef TEST # include @@ -85,7 +86,7 @@ get_fstab_nextentry( 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); @@ -433,7 +434,7 @@ dev2rdev( 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. */ @@ -538,9 +539,8 @@ search_fstab( 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); @@ -634,7 +634,7 @@ print_entry( generic_fsent_t * fsent) { #define nchk(s) ((s)? (s) : "") - 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)); } @@ -647,8 +647,15 @@ main( 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); @@ -659,101 +666,93 @@ main( /* 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); - } - return 0; }