X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fbackupfile.c;h=b6a557df05dabcc1c76aa42176b2f0a14e0c5e1e;hb=2c6d91f6bcfffcaa7320af7ea4e2a9c970c0966e;hp=c20337a0a87ffd34bc018de5e8360e1e2a08c766;hpb=09e6dda2dc260b7bdacfe5cfd28c4d353155e70c;p=gnulib.git diff --git a/lib/backupfile.c b/lib/backupfile.c index c20337a0a..b6a557df0 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -1,5 +1,5 @@ /* backupfile.c -- make Emacs style backup file names - Copyright (C) 1990-1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1990-1997, 1998, 1999 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -97,18 +97,6 @@ char *malloc (); # define REAL_DIR_ENTRY(dp) 1 #endif -/* The following test is to work around the gross typo in - systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE - is defined to 0, not 1. */ -#if !EXIT_FAILURE -# undef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif - -#ifndef BACKUPFILE_EXIT_FAILURE -# define BACKUPFILE_EXIT_FAILURE EXIT_FAILURE -#endif - /* The extension added to file names to produce a simple (as opposed to numbered) backup file name. */ const char *simple_backup_suffix = "~"; @@ -224,7 +212,7 @@ version_number (const char *base, const char *backup, size_t base_length) } #endif /* HAVE_DIR */ -static const char *const backup_args[] = +static const char * const backup_args[] = { "never", "simple", "nil", "existing", "t", "numbered", 0 }; @@ -240,15 +228,11 @@ static const enum backup_type backup_types[] = enum backup_type get_version (const char *version) { - int i; - + enum backup_type type; if (version == 0 || *version == 0) - return numbered_existing; - i = argmatch (version, backup_args); - if (i < 0) - { - invalid_arg ("version control type", version, i); - exit (BACKUPFILE_EXIT_FAILURE); - } - return backup_types[i]; + type = numbered_existing; + else + XARGMATCH (&type, "version control type", version, + backup_args, backup_types, exit (2)); + return type; }