char **argv;
{
int optc;
- char *datestr = NULL;
+ const char *datestr = NULL;
time_t when;
int set_date = 0;
int print_date = 0;
static void
show_date (format, when)
- char *format;
+ const char *format;
time_t when;
{
struct tm *tm;
{
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 ("\
");
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\
%%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\
#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 ();
/* 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. */
/* 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. */
};
struct speed_map
{
- char *string; /* ASCII representation. */
+ const char *string; /* ASCII representation. */
speed_t speed; /* Internal form. */
unsigned long value; /* Numeric value. */
};
/* 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;
{
*bpout++ = ch + 64;
}
*bpout = '\0';
- return buf;
+ return (const char *) buf;
}
/* Parse string S as an integer, using decimal radix by default,
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;
#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))
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);
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);
}
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)
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]);
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 ();
/* 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;
{
sprintf (idle, "%02d:%02d",
(int) (seconds_idle / (60 * 60)),
(int) ((seconds_idle % (60 * 60)) / 60));
- return idle;
+ return (const char *) idle;
}
return " old ";
}