diff options
author | Jim Meyering <jim@meyering.net> | 1994-09-25 02:25:20 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-09-25 02:25:20 +0000 |
commit | 4bac19f0bff5d16d226b4e6b7fd6b17a3f036d6e (patch) | |
tree | 70a9bc31304563e5a9eb209951e0dd632b6257ff | |
parent | c09c5906165965293606321728370a6c3c8f6aac (diff) | |
download | coreutils-4bac19f0bff5d16d226b4e6b7fd6b17a3f036d6e.tar.xz |
.
-rw-r--r-- | src/date.c | 11 | ||||
-rw-r--r-- | src/stty.c | 12 | ||||
-rw-r--r-- | src/su.c | 27 | ||||
-rw-r--r-- | src/tee.c | 6 | ||||
-rw-r--r-- | src/who.c | 6 |
5 files changed, 34 insertions, 28 deletions
diff --git a/src/date.c b/src/date.c index 9c9cf42ff..36a77fee4 100644 --- a/src/date.c +++ b/src/date.c @@ -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\ diff --git a/src/stty.c b/src/stty.c index c6c9be700..c1dc3e408 100644 --- a/src/stty.c +++ b/src/stty.c @@ -143,7 +143,7 @@ #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, @@ -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) @@ -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]); @@ -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 "; } |