]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(canonicalize): Remove. All uses now merely inspect can_mode.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 3 Aug 2004 19:07:36 +0000 (19:07 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 3 Aug 2004 19:07:36 +0000 (19:07 +0000)
(no_newline, verbose): Use bool for booleans.
(can_mode): Now of type int; use -1 to denote otherwise-uninitialized.

src/readlink.c

index 7df0a2d3168fccdb6fe267e37ea9ca77f133b3ad..a99ab32c85fad90e29bd49713bc8681997d88c9d 100644 (file)
 /* Name this program was run with.  */
 char *program_name;
 
-  /* If nonzero, canonicalize file name. */
-static int canonicalize;
-  /* If nonzero, do not output the trailing newline. */
-static int no_newline;
-  /* If nonzero, report error messages. */
-static int verbose;
-  /* In canonicalize mode, use this method. */
-canonicalize_mode_t can_mode = CAN_ALL_BUT_LAST;
+/* If true, do not output the trailing newline.  */
+static bool no_newline;
+
+/* If true, report error messages.  */
+static bool verbose;
+
+/* If not -1, use this method to canonicalize.  */
+int can_mode = -1;
 
 static struct option const longopts[] =
 {
@@ -121,26 +121,23 @@ main (int argc, char *const argv[])
        case 0:
          break;
        case 'e':
-         canonicalize = 1;
          can_mode = CAN_EXISTING;
          break;
        case 'f':
-         canonicalize = 1;
          can_mode = CAN_ALL_BUT_LAST;
          break;
        case 'm':
-         canonicalize = 1;
          can_mode = CAN_MISSING;
          break;
        case 'n':
-         no_newline = 1;
+         no_newline = true;
          break;
        case 'q':
        case 's':
-         verbose = 0;
+         verbose = false;
          break;
        case 'v':
-         verbose = 1;
+         verbose = true;
          break;
        case_GETOPT_HELP_CHAR;
        case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
@@ -163,7 +160,7 @@ main (int argc, char *const argv[])
       usage (EXIT_FAILURE);
     }
 
-  value = (canonicalize
+  value = (can_mode != -1
           ? canonicalize_fname (fname)
           : xreadlink (fname, 1024));
   if (value)