]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
.
authorJim Meyering <jim@meyering.net>
Sun, 25 Sep 1994 02:25:20 +0000 (02:25 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 25 Sep 1994 02:25:20 +0000 (02:25 +0000)
src/date.c
src/stty.c
src/su.c
src/tee.c
src/who.c

index 9c9cf42ffed74fb6a38dc34a7245ffe2ce8e47ce..36a77fee435a68bb3e187d49a8ff57a2bf7fd61a 100644 (file)
@@ -107,7 +107,7 @@ main (argc, argv)
      char **argv;
 {
   int optc;
-  char *datestr = NULL;
+  const char *datestr = NULL;
   time_t when;
   int set_date = 0;
   int print_date = 0;
@@ -218,7 +218,7 @@ non-option argument must be a format string beginning with `+'");
 
 static void
 show_date (format, when)
-     char *format;
+     const char *format;
      time_t when;
 {
   struct tm *tm;
@@ -264,7 +264,7 @@ usage (status)
     {
       printf ("\
 Usage: %s [OPTION]... [+FORMAT]\n\
-  or:  %s [-u] [--utc] [--universal] [MMDDhhmm[[CC]YY][.ss]]\n\
+  or:  %s [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n\
 ",
              program_name, program_name);
       printf ("\
@@ -277,7 +277,8 @@ Usage: %s [OPTION]... [+FORMAT]\n\
 ");
       printf ("\
 \n\
-FORMAT controls the output.  Interpreted sequences are:\n\
+FORMAT controls the output.  The only valid option for the second form\n\
+specifies Coordinated Universal Time.  Interpreted sequences are:\n\
 \n\
   %%%%   a literal %%\n\
   %%a   locale's abbreviated weekday name (Sun..Sat)\n\
@@ -312,7 +313,7 @@ FORMAT controls the output.  Interpreted sequences are:\n\
   %%Z   time zone (e.g., EDT), or nothing if no time zone is determinable\n\
 \n\
 By default, `date' pads numeric fields with zeroes.  GNU `date'\n\
-recognizes the following nonstandard modifiers between `%' and a\n\
+recognizes the following nonstandard modifiers between `%%' and a\n\
 numeric directive.\n\
 \n\
   `-' (hyphen) do not pad the field\n\
index c6c9be70060121d558a5c453bbf61aa6a9553b3b..c1dc3e40840155ca29e7a414a3c971cfa8cb169d 100644 (file)
 #define CSTATUS Control ('t')
 #endif
 
-static char *visible ();
+static const char *visible ();
 static unsigned long baud_to_value ();
 static int recover_mode ();
 static int screen_columns ();
@@ -191,7 +191,7 @@ enum mode_type
 /* Each mode.  */
 struct mode_info
   {
-    char *name;                        /* Name given on command line.  */
+    const char *name;          /* Name given on command line.  */
     enum mode_type type;       /* Which structure element to change. */
     char flags;                        /* Setting and display options.  */
     unsigned long bits;                /* Bits to set for this mode.  */
@@ -352,7 +352,7 @@ static struct mode_info mode_info[] =
 /* Control character settings.  */
 struct control_info
   {
-    char *name;                        /* Name given on command line.  */
+    const char *name;          /* Name given on command line.  */
     unsigned char saneval;     /* Value to set for `stty sane'.  */
     int offset;                        /* Offset in c_cc.  */
   };
@@ -1528,7 +1528,7 @@ recover_mode (arg, mode)
 
 struct speed_map
 {
-  char *string;                        /* ASCII representation. */
+  const char *string;          /* ASCII representation. */
   speed_t speed;               /* Internal form. */
   unsigned long value;         /* Numeric value. */
 };
@@ -1621,7 +1621,7 @@ sane_mode (mode)
 /* Return a string that is the printable representation of character CH.  */
 /* Adapted from `cat' by Torbjorn Granlund.  */
 
-static char *
+static const char *
 visible (ch)
      unsigned char ch;
 {
@@ -1667,7 +1667,7 @@ visible (ch)
       *bpout++ = ch + 64;
     }
   *bpout = '\0';
-  return buf;
+  return (const char *) buf;
 }
 
 /* Parse string S as an integer, using decimal radix by default,
index 303a3c67d25712cbe9fccce01e61c21d75209a18..97392f15b8235f81a6c7e1c42ba89c176e70c698 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -204,7 +204,7 @@ main (argc, argv)
      char **argv;
 {
   int optc;
-  char *new_user = DEFAULT_USER;
+  const char *new_user = DEFAULT_USER;
   char *command = 0;
   char **additional_args = 0;
   char *shell = 0;
@@ -298,7 +298,7 @@ main (argc, argv)
 #endif
 
   if (pw->pw_shell == 0 || pw->pw_shell[0] == 0)
-    pw->pw_shell = DEFAULT_SHELL;
+    pw->pw_shell = (char *) DEFAULT_SHELL;
   if (shell == 0 && change_environment == 0)
     shell = getenv ("SHELL");
   if (shell != 0 && getuid () && restricted_shell (pw->pw_shell))
@@ -430,19 +430,24 @@ run_shell (shell, command, additional_args)
      char *command;
      char **additional_args;
 {
-  char **args;
+  const char **args;
   int argno = 1;
 
   if (additional_args)
-    args = (char **) xmalloc (sizeof (char *)
-                             * (10 + elements (additional_args)));
+    args = (const char **) xmalloc (sizeof (char *)
+                                   * (10 + elements (additional_args)));
   else
-    args = (char **) xmalloc (sizeof (char *) * 10);
+    args = (const char **) xmalloc (sizeof (char *) * 10);
   if (simulate_login)
     {
-      args[0] = xmalloc (strlen (shell) + 2);
-      args[0][0] = '-';
-      strcpy (args[0] + 1, basename (shell));
+      char *arg0;
+      char *shell_basename;
+
+      shell_basename = basename (shell);
+      arg0 = xmalloc (strlen (shell_basename) + 2);
+      arg0[0] = '-';
+      strcpy (arg0 + 1, shell_basename);
+      args[0] = arg0;
     }
   else
     args[0] = basename (shell);
@@ -457,7 +462,7 @@ run_shell (shell, command, additional_args)
     for (; *additional_args; ++additional_args)
       args[argno++] = *additional_args;
   args[argno] = NULL;
-  execv (shell, args);
+  execv (shell, (char **) args);
   error (1, errno, "cannot run %s", shell);
 }
 
@@ -470,7 +475,7 @@ log_su (pw, successful)
      struct passwd *pw;
      int successful;
 {
-  char *new_user, *old_user, *tty;
+  const char *new_user, *old_user, *tty;
 
 #ifndef SYSLOG_NON_ROOT
   if (pw->pw_uid)
index b453c2bf285747eeeabed09d6c0cf65218d577ff..3e322a4dbe31c81316fc02b4ffc7c6c9615d24b8 100644 (file)
--- a/src/tee.c
+++ b/src/tee.c
@@ -131,16 +131,16 @@ main (argc, argv)
 
   if (ignore_interrupts)
     {
-#ifdef _POSIX_VERSION
+#ifdef _POSIX_SOURCE
       struct sigaction sigact;
 
       sigact.sa_handler = SIG_IGN;
       sigemptyset (&sigact.sa_mask);
       sigact.sa_flags = 0;
       sigaction (SIGINT, &sigact, NULL);
-#else                          /* !_POSIX_VERSION */
+#else                          /* !_POSIX_SOURCE */
       signal (SIGINT, SIG_IGN);
-#endif                         /* _POSIX_VERSION */
+#endif                         /* _POSIX_SOURCE */
     }
 
   errs = tee (argc - optind, (const char **) &argv[optind]);
index 50eaa378c4f1cd7a14d22193dc1b81f75cb5df98..69216698c0448474c6741626cb9685a27e90393b 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -102,7 +102,7 @@ int gethostname ();
 
 static int read_utmp ();
 #ifdef WHO
-static char *idle_string ();
+static const char *idle_string ();
 static STRUCT_UTMP *search_entries ();
 static void print_entry ();
 static void print_heading ();
@@ -525,7 +525,7 @@ who_am_i (filename)
 /* Return a string representing the time between WHEN and the time
    that this function is first run. */
 
-static char *
+static const char *
 idle_string (when)
      time_t when;
 {
@@ -544,7 +544,7 @@ idle_string (when)
       sprintf (idle, "%02d:%02d",
               (int) (seconds_idle / (60 * 60)),
               (int) ((seconds_idle % (60 * 60)) / 60));
-      return idle;
+      return (const char *) idle;
     }
   return " old ";
 }