summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorbasabi <none@none>2005-09-13 07:37:29 -0700
committerbasabi <none@none>2005-09-13 07:37:29 -0700
commit032624d56c174c5c55126582b32e314a6af15522 (patch)
treeac44d0f39005a6a32204d598de37b5a2e2b7704f /usr/src
parentf8047eab588b3c002f465da96280cf9f29b21d19 (diff)
downloadillumos-joyent-032624d56c174c5c55126582b32e314a6af15522.tar.gz
6271014 gcc and cmd/cron don't get along
6271953 gcc and cmd/login don't get along 6274736 gcc and ucbcmd/expr don't get along 6274737 gcc and ucbcmd/from don't get along 6274776 gcc and ucbcmd/rusage don't get along 6274779 gcc and ucbcmd/shutdown don't get along
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cron/at.c25
-rw-r--r--usr/src/cmd/cron/atq.c118
-rw-r--r--usr/src/cmd/cron/atrm.c176
-rw-r--r--usr/src/cmd/cron/cron.c12
-rw-r--r--usr/src/cmd/cron/crontab.c5
-rw-r--r--usr/src/cmd/cron/elm.c18
-rw-r--r--usr/src/cmd/cron/funcs.c19
-rw-r--r--usr/src/cmd/login/login.c15
-rw-r--r--usr/src/ucbcmd/expr/expr.y97
-rw-r--r--usr/src/ucbcmd/from/from.c18
-rw-r--r--usr/src/ucbcmd/rusage/rusage.c32
-rw-r--r--usr/src/ucbcmd/shutdown/shutdown.c74
12 files changed, 322 insertions, 287 deletions
diff --git a/usr/src/cmd/cron/at.c b/usr/src/cmd/cron/at.c
index 02e368b3db..4d6158788b 100644
--- a/usr/src/cmd/cron/at.c
+++ b/usr/src/cmd/cron/at.c
@@ -19,15 +19,15 @@
*
* CDDL HEADER END
*/
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/resource.h>
@@ -104,7 +104,7 @@ static int not_this_project(char *);
static char *mkjobname(time_t);
static time_t parse_time(char *);
static time_t gtime(struct tm *);
-void atabort(char *);
+void atabort(char *)__NORETURN;
void yyerror(void);
extern int yyparse(void);
@@ -146,9 +146,8 @@ extern char *argp;
extern int per_errno;
static projid_t project;
-main(argc, argv)
-int argc;
-char **argv;
+int
+main(int argc, char **argv)
{
FILE *inputfile;
int i, fd;
@@ -439,6 +438,7 @@ time_t t;
t += 1;
}
atabort("queue full");
+ /* NOTREACHED */
}
@@ -459,6 +459,7 @@ char *msg;
exit(1);
}
+int
yywrap(void)
{
return (1);
@@ -518,7 +519,7 @@ static time_t
gtime(tptr)
struct tm *tptr;
{
- register i;
+ int i;
long tv;
int dmsize[12] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
@@ -553,13 +554,13 @@ struct tm *tptr;
static void
copy(char *jobfile, FILE *inputfile, int when)
{
- register c;
- register FILE *pfp;
- register FILE *xfp;
+ int c;
+ FILE *pfp;
+ FILE *xfp;
char *shell;
char dirbuf[PATH_MAX + 1];
char line[LINE_MAX];
- register char **ep;
+ char **ep;
mode_t um;
char *val;
extern char **environ;
diff --git a/usr/src/cmd/cron/atq.c b/usr/src/cmd/cron/atq.c
index 1b3503683d..4cedbb518e 100644
--- a/usr/src/cmd/cron/atq.c
+++ b/usr/src/cmd/cron/atq.c
@@ -1,3 +1,8 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -8,12 +13,7 @@
* specifies the terms and conditions for redistribution.
*/
-/*
- * Copyright 1984-1988, 2002-2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
+#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
@@ -56,23 +56,29 @@ struct dirent **queue; /* the queue itself */
#define INVALIDUSER "you are not a valid user (no entry in /etc/passwd)"
#define NOTALLOWED "you are not authorized to use at. Sorry."
-
-main(argc, argv)
-int argc;
-char **argv;
+static void atabortperror(char *msg);
+static void atabort(char *msg);
+static void aterror(char *msg);
+static void atperror(char *msg);
+static void usage(void);
+static void printjobname(char *file);
+static void printdate(char *filename);
+static void printrank(int n);
+static void printqueue(uid_t *uidlist, int nuids);
+
+int
+main(int argc, char **argv)
{
- register struct passwd *pp; /* password file entry pointer */
+ struct passwd *pp; /* password file entry pointer */
struct passwd pr;
- register int i;
+ int i;
int cflag = 0; /* print in order of creation time */
int nflag = 0; /* just print the number of jobs in */
/* queue */
- int usage(); /* print usage info and exit */
extern int creation(); /* sort jobs by date of creation */
extern int execution(); /* sort jobs by date of execution */
int filewanted(); /* should file be included in queue? */
- int printqueue(); /* print the queue */
int countfiles(); /* count the number of files in queue */
/* for a given person */
uid_t *uidlist = NULL; /* array of spec. owner ID(s) requ. */
@@ -202,21 +208,20 @@ char **argv;
exit(0);
}
printqueue(uidlist, argnum);
- exit(0);
+ return (0);
}
/*
* Count the number of jobs in the spooling area owned by a certain person(s).
*/
-countfiles(uidlist, nuids)
-uid_t *uidlist;
-int nuids;
+int
+countfiles(uid_t *uidlist, int nuids)
{
- register int i, j; /* for loop indices */
+ int i, j; /* for loop indices */
int entryfound; /* found file owned by users */
int numfiles = 0; /* number of files owned by a */
/* certain person(s) */
- register uid_t *ptr; /* scratch pointer */
+ uid_t *ptr; /* scratch pointer */
struct stat stbuf; /* buffer for file stats */
@@ -248,16 +253,14 @@ int nuids;
* Print the queue. If only jobs belonging to a certain person(s) are requested,
* only print jobs that belong to that person(s).
*/
-printqueue(uidlist, nuids)
-uid_t *uidlist;
-int nuids;
+static void
+printqueue(uid_t *uidlist, int nuids)
{
- register int i, j; /* for loop indices */
+ int i, j; /* for loop indices */
int rank; /* rank of a job */
int entryfound; /* found file owned by users */
- int printrank(); /* print the rank of a job */
char *getname();
- register uid_t *ptr; /* scratch pointer */
+ uid_t *ptr; /* scratch pointer */
struct stat stbuf; /* buffer for file stats */
char curqueue; /* queue of current job */
char lastqueue; /* queue of previous job */
@@ -317,8 +320,7 @@ int nuids;
* such account name exists.
*/
uid_t
-getid(name)
-char *name;
+getid(char *name)
{
struct passwd *pwdinfo; /* password info structure */
@@ -334,10 +336,9 @@ char *name;
* Get the full login name of a person using his/her user id.
*/
char *
-getname(uid)
-uid_t uid;
+getname(uid_t uid)
{
- register struct passwd *pwdinfo; /* password info structure */
+ struct passwd *pwdinfo; /* password info structure */
if ((pwdinfo = getpwuid(uid)) == 0)
@@ -348,8 +349,8 @@ uid_t uid;
/*
* Print the rank of a job. (I've got to admit it, I stole it from "lpq")
*/
-static
-printrank(n)
+static void
+printrank(int n)
{
static char *r[] = {
"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"
@@ -365,12 +366,12 @@ printrank(n)
* Print the date that a job is to be executed. This takes some manipulation
* of the file name.
*/
-printdate(filename)
-char *filename;
+static void
+printdate(char *filename)
{
time_t jobdate;
extern time_t num();
- register struct tm *unpackeddate;
+ struct tm *unpackeddate;
char date[18]; /* reformatted execution date */
/*
@@ -399,8 +400,8 @@ char *filename;
* the three line header that the new version of "at" puts in the spoolfile.
* Thus, we just print "???".
*/
-printjobname(file)
-char *file;
+static void
+printjobname(char *file)
{
char *ptr; /* scratch pointer */
char jobname[28]; /* the job name */
@@ -453,13 +454,13 @@ char *file;
/*
* Sort files by queue, time of creation, and sequence. (used by "ascandir")
*/
-creation(d1, d2)
-struct dirent **d1, **d2;
+int
+creation(struct dirent **d1, struct dirent **d2)
{
- register char *p1, *p2;
- register int i;
+ char *p1, *p2;
+ int i;
struct stat stbuf1, stbuf2;
- register int seq1, seq2;
+ int seq1, seq2;
if ((p1 = strchr((*d1)->d_name, '.')) == NULL)
return (0);
@@ -490,14 +491,14 @@ struct dirent **d1, **d2;
/*
* Sort files by queue, time of execution, and sequence. (used by "ascandir")
*/
-execution(d1, d2)
-struct dirent **d1, **d2;
+int
+execution(struct dirent **d1, struct dirent **d2)
{
- register char *p1, *p2;
- register int i;
+ char *p1, *p2;
+ int i;
char *name1, *name2;
- register time_t time1, time2;
- register int seq1, seq2;
+ time_t time1, time2;
+ int seq1, seq2;
extern time_t num();
name1 = (*d1)->d_name;
@@ -529,33 +530,34 @@ struct dirent **d1, **d2;
/*
* Print usage info and exit.
*/
-usage()
+static void
+usage(void)
{
fprintf(stderr, "usage: atq [-c] [-n] [name ...]\n");
exit(1);
}
-aterror(msg)
- char *msg;
+static void
+aterror(char *msg)
{
fprintf(stderr, "atq: %s\n", msg);
}
-atperror(msg)
- char *msg;
+static void
+atperror(char *msg)
{
fprintf(stderr, "atq: %s: %s\n", msg, errmsg(errno));
}
-atabort(msg)
- char *msg;
+static void
+atabort(char *msg)
{
aterror(msg);
exit(1);
}
-atabortperror(msg)
- char *msg;
+static void
+atabortperror(char *msg)
{
atperror(msg);
exit(1);
diff --git a/usr/src/cmd/cron/atrm.c b/usr/src/cmd/cron/atrm.c
index 161b56ece4..54e2ffc124 100644
--- a/usr/src/cmd/cron/atrm.c
+++ b/usr/src/cmd/cron/atrm.c
@@ -1,3 +1,8 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -6,12 +11,9 @@
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
-
- * Copyright 1984-2002 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
+#pragma ident "%Z%%M% %I% %E% SMI"
/*
* synopsis: atrm [-f] [-i] [-a] [[job #] [user] ...]
@@ -30,17 +32,17 @@
#include <errno.h>
#include <unistd.h>
#include <locale.h>
+#include <strings.h>
#include "cron.h"
extern time_t num();
extern char *errmsg();
-extern int errno;
extern void audit_at_delete(char *, char *, int);
-#define SUPERUSER 0 /* is user super-user? */
-#define CANTCD "can't change directory to the at directory"
-#define NOREADDIR "can't read the at directory"
+#define SUPERUSER 0 /* is user super-user? */
+#define CANTCD "can't change directory to the at directory"
+#define NOREADDIR "can't read the at directory"
uid_t user; /* person requesting removal */
int fflag = 0; /* suppress announcements? */
@@ -49,21 +51,25 @@ int iflag = 0; /* run interactively? */
char login[UNAMESIZE];
char login_authchk[UNAMESIZE]; /* used for authorization checks */
-#define INVALIDUSER "you are not a valid user (no entry in /etc/passwd)"
-#define NOTALLOWED "you are not authorized to use at. Sorry."
+#define INVALIDUSER "you are not a valid user (no entry in /etc/passwd)"
+#define NOTALLOWED "you are not authorized to use at. Sorry."
#define NAMETOOLONG "login name too long"
-main(argc,argv)
-int argc;
-char **argv;
+static void usage(void);
+static void atabortperror(char *msg);
+static void atabort(char *msg);
+static void atperror(char *msg);
+static void atperror2(char *msg, char *name);
+static void aterror(char *msg);
+static void powner(char *file);
+int
+main(int argc, char **argv)
{
int i; /* for loop index */
int numjobs; /* # of jobs in spooling area */
- int usage(); /* print usage info and exit */
int allflag = 0; /* remove all jobs belonging to user? */
int jobexists; /* does a requested job exist? */
- extern int strcmp(); /* sort jobs by date of execution */
char *pp;
char *getuser();
struct dirent **namelist; /* names of jobs in spooling area */
@@ -74,13 +80,13 @@ char **argv;
* If job number, user name, or "-" is not specified, just print
* usage info and exit.
*/
- (void)setlocale(LC_ALL, "");
+ (void) setlocale(LC_ALL, "");
if (argc < 2)
usage();
--argc; ++argv;
- pp = getuser((user=getuid()));
+ pp = getuser((user = getuid()));
if (pp == NULL)
atabort(INVALIDUSER);
if (strlcpy(login, pp, sizeof (login)) >= sizeof (login))
@@ -97,7 +103,8 @@ char **argv;
*/
while (argc > 0 && **argv == '-') {
*(*argv)++;
- while (**argv) switch (*(*argv)++) {
+ while (**argv) {
+ switch (*(*argv)++) {
case 'a': ++allflag;
break;
@@ -109,22 +116,23 @@ char **argv;
break;
default: usage();
+ }
}
++argv; --argc;
}
/*
- * If all jobs are to be removed and extra command line arguments
+ * If all jobs are to be removed and extra command line arguments
* are given, print usage info and exit.
*/
- if (allflag && argc)
+ if (allflag && argc)
usage();
/*
* If only certain jobs are to be removed and no job #'s or user
* names are specified, print usage info and exit.
*/
- if (!allflag && !argc)
+ if (!allflag && !argc)
usage();
/*
@@ -139,7 +147,7 @@ char **argv;
* Move to spooling directory and get a list of the files in the
* spooling area.
*/
- numjobs = getjoblist(&namelist,&statlist,strcmp);
+ numjobs = getjoblist(&namelist, &statlist, strcmp);
/*
* If all jobs belonging to the user are to be removed, compare
* the user's id to the owner of the file. If they match, remove
@@ -147,7 +155,7 @@ char **argv;
* the id's. After all files are removed, exit (status 0).
*/
if (allflag) {
- for (i = 0; i < numjobs; ++i) {
+ for (i = 0; i < numjobs; ++i) {
if (chkauthattr(CRONADMIN_AUTH, login_authchk) ||
user == statlist[i]->st_uid)
(void) removentry(namelist[i]->d_name,
@@ -161,7 +169,7 @@ char **argv;
* line argument. A check is done to see if it is a user's name or
* a job number (inode #). If it's a user's name, compare the argument
* to the files owner. If it's a job number, compare the argument to
- * the file name. In either case, if a match occurs, try to
+ * the file name. In either case, if a match occurs, try to
* remove the file.
*/
@@ -173,7 +181,7 @@ char **argv;
if (statlist[i]->st_ino == 0)
continue;
- /*
+ /*
* if argv is a username, compare his/her uid to
* the uid of the owner of the file......
*/
@@ -185,7 +193,7 @@ char **argv;
* thus compare argv to the file name.
*/
} else {
- if (strcmp(namelist[i]->d_name,*argv))
+ if (strcmp(namelist[i]->d_name, *argv))
continue;
}
++jobexists;
@@ -193,7 +201,8 @@ char **argv;
* if the entry is ultimately removed, don't
* try to remove it again later.
*/
- if (removentry(namelist[i]->d_name, statlist[i], user)) {
+ if (removentry(namelist[i]->d_name, statlist[i],
+ user)) {
statlist[i]->st_ino = 0;
}
}
@@ -202,19 +211,21 @@ char **argv;
* If a requested argument doesn't exist, print a message.
*/
if (!jobexists && !fflag) {
- fprintf(stderr, "atrm: %s: no such job number\n", *argv);
+ fprintf(stderr, "atrm: %s: no such job number\n",
+ *argv);
}
++argv;
}
- exit(0);
+ return (0);
}
/*
* Print usage info and exit.
*/
-usage()
+static void
+usage(void)
{
- fprintf(stderr,"usage: atrm [-f] [-i] [-a] [[job #] [user] ...]\n");
+ fprintf(stderr, "usage: atrm [-f] [-i] [-a] [[job #] [user] ...]\n");
exit(1);
}
@@ -224,16 +235,13 @@ usage()
* write permission (since all jobs are mode 644). If access is granted,
* unlink the file. If the fflag (suppress announcements) is not set,
* print the job number that we are removing and the result of the access
- * check (either "permission denied" or "removed"). If we are running
- * interactively (iflag), prompt the user before we unlink the file. If
- * the super-user is removing jobs, inform him/her who owns each file before
+ * check (either "permission denied" or "removed"). If we are running
+ * interactively (iflag), prompt the user before we unlink the file. If
+ * the super-user is removing jobs, inform him/her who owns each file before
* it is removed. Return TRUE if file removed, else FALSE.
*/
int
-removentry(filename,statptr,user)
-char *filename;
-register struct stat *statptr;
-uid_t user;
+removentry(char *filename, struct stat *statptr, uid_t user)
{
struct passwd *pwd;
char *pp;
@@ -241,7 +249,7 @@ uid_t user;
int r;
if (!fflag)
- printf("%s: ",filename);
+ printf("%s: ", filename);
if (user != statptr->st_uid &&
!chkauthattr(CRONADMIN_AUTH, login_authchk)) {
@@ -264,14 +272,14 @@ uid_t user;
}
if (chkauthattr(CRONADMIN_AUTH, login_authchk)) {
- pp = getuser((uid_t) statptr->st_uid);
+ pp = getuser((uid_t)statptr->st_uid);
if (pp == NULL)
atabort(INVALIDUSER);
if (strlcpy(login, pp, sizeof (login)) >=
sizeof (login))
atabort(NAMETOOLONG);
}
- cron_sendmsg(DELETE,login,filename,AT);
+ cron_sendmsg(DELETE, login, filename, AT);
if ((r = unlink(filename)) < 0) {
if (!fflag) {
fputs("could not remove\n", stdout);
@@ -292,34 +300,32 @@ uid_t user;
* Print the owner of the job. This is the owner of the spoolfile.
* If we run into trouble getting the name, we'll just print "???".
*/
-powner(file)
-char *file;
+static void
+powner(char *file)
{
struct stat statb;
char *getname();
- if (stat(file,&statb) < 0) {
- printf("%s","???");
- (void) fprintf(stderr,"atrm: Couldn't stat spoolfile %s: %s\n",
+ if (stat(file, &statb) < 0) {
+ printf("%s", "???");
+ (void) fprintf(stderr, "atrm: Couldn't stat spoolfile %s: %s\n",
file, errmsg(errno));
- return(0);
+ return;
}
- printf("%s",getname(statb.st_uid));
+ printf("%s", getname(statb.st_uid));
}
int
-getjoblist(namelistp, statlistp,sortfunc)
- struct dirent ***namelistp;
- struct stat ***statlistp;
- int (*sortfunc)();
+getjoblist(struct dirent ***namelistp, struct stat ***statlistp,
+ int (*sortfunc)())
{
- register int numjobs;
- register struct dirent **namelist;
- register int i;
- register struct stat *statptr; /* pointer to file stat structure */
- register struct stat **statlist;
+ int numjobs;
+ struct dirent **namelist;
+ int i;
+ struct stat *statptr; /* pointer to file stat structure */
+ struct stat **statlist;
extern int alphasort(); /* sort jobs by date of execution */
extern int filewanted(); /* should a file be listed in queue? */
@@ -329,10 +335,12 @@ getjoblist(namelistp, statlistp,sortfunc)
/*
* Get a list of the files in the spooling area.
*/
- if ((numjobs = ascandir(".",namelistp,filewanted,sortfunc)) < 0)
+ if ((numjobs = ascandir(".", namelistp, filewanted, sortfunc)) < 0)
atabortperror(NOREADDIR);
- if ((statlist = (struct stat **) malloc(numjobs * sizeof (struct stat ***))) == NULL)
+ if ((statlist =
+ (struct stat **)malloc(numjobs * sizeof (struct stat ***)))
+ == NULL)
atabort("Out of memory");
namelist = *namelistp;
@@ -341,12 +349,12 @@ getjoblist(namelistp, statlistp,sortfunc)
* Build an array of pointers to the file stats for all jobs in
* the spooling area.
*/
- for (i = 0; i < numjobs; ++i) {
- statptr = (struct stat *) malloc(sizeof(struct stat));
+ for (i = 0; i < numjobs; ++i) {
+ statptr = (struct stat *)malloc(sizeof (struct stat));
if (statptr == NULL)
atabort("Out of memory");
if (stat(namelist[i]->d_name, statptr) < 0) {
- atperror("Can't stat", namelist[i]->d_name);
+ atperror2("Can't stat", namelist[i]->d_name);
continue;
}
statlist[i] = statptr;
@@ -361,17 +369,18 @@ getjoblist(namelistp, statlistp,sortfunc)
* Get answer to interactive prompts, eating all characters beyond the first
* one. If a 'y' is typed, return 1.
*/
-yes()
+int
+yes(void)
{
- register int ch; /* dummy variable */
- register int ch1; /* dummy variable */
+ int ch; /* dummy variable */
+ int ch1; /* dummy variable */
ch = ch1 = getchar();
while (ch1 != '\n' && ch1 != EOF)
ch1 = getchar();
if (isupper(ch))
ch = tolower(ch);
- return(ch == 'y');
+ return (ch == 'y');
}
@@ -379,38 +388,43 @@ yes()
* Get the full login name of a person using his/her user id.
*/
char *
-getname(uid)
-uid_t uid;
+getname(uid_t uid)
{
- register struct passwd *pwdinfo; /* password info structure */
+ struct passwd *pwdinfo; /* password info structure */
if ((pwdinfo = getpwuid(uid)) == 0)
- return("???");
- return(pwdinfo->pw_name);
+ return ("???");
+ return (pwdinfo->pw_name);
+}
+
+static void
+aterror(char *msg)
+{
+ fprintf(stderr, "atrm: %s\n", msg);
}
-aterror(msg)
- char *msg;
+static void
+atperror(char *msg)
{
- fprintf(stderr,"atrm: %s\n",msg);
+ fprintf(stderr, "atrm: %s: %s\n", msg, errmsg(errno));
}
-atperror(msg)
- char *msg;
+static void
+atperror2(char *msg, char *name)
{
- fprintf(stderr,"atrm: %s: %s\n", msg, errmsg(errno));
+ fprintf(stderr, "atrm: %s %s: %s\n", msg, name, errmsg(errno));
}
-atabort(msg)
- char *msg;
+static void
+atabort(char *msg)
{
aterror(msg);
exit(1);
}
-atabortperror(msg)
- char *msg;
+static void
+atabortperror(char *msg)
{
atperror(msg);
exit(1);
diff --git a/usr/src/cmd/cron/cron.c b/usr/src/cmd/cron/cron.c
index f29c1917ef..cac3ff108c 100644
--- a/usr/src/cmd/cron/cron.c
+++ b/usr/src/cmd/cron/cron.c
@@ -316,8 +316,8 @@ static void process_msg(struct message *, time_t);
static void reap_child(void);
static void miscpid_insert(pid_t);
static int miscpid_delete(pid_t);
-static int contract_set_template(void);
-static int contract_clear_template(void);
+static void contract_set_template(void);
+static void contract_clear_template(void);
static void contract_abandon_latest(pid_t);
static void cte_init(void);
@@ -3236,8 +3236,8 @@ miscpid_delete(pid_t pid)
* Establish contract terms such that all children are in abandoned
* process contracts.
*/
-static int
-contract_set_template()
+static void
+contract_set_template(void)
{
int fd;
@@ -3261,8 +3261,8 @@ contract_set_template()
/*
* Clear active process contract template.
*/
-static int
-contract_clear_template()
+static void
+contract_clear_template(void)
{
int fd;
diff --git a/usr/src/cmd/cron/crontab.c b/usr/src/cmd/cron/crontab.c
index 2ed88c4c6d..9638fab398 100644
--- a/usr/src/cmd/cron/crontab.c
+++ b/usr/src/cmd/cron/crontab.c
@@ -101,9 +101,8 @@ static void crabort(char *);
static void cerror(char *);
static void copycron(FILE *);
-main(argc, argv)
-int argc;
-char **argv;
+int
+main(int argc, char **argv)
{
int c, r;
int rflag = 0;
diff --git a/usr/src/cmd/cron/elm.c b/usr/src/cmd/cron/elm.c
index c8b03ea7c9..157b0e00f8 100644
--- a/usr/src/cmd/cron/elm.c
+++ b/usr/src/cmd/cron/elm.c
@@ -20,16 +20,17 @@
* CDDL HEADER END
*/
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
+#pragma ident "%Z%%M% %I% %E% SMI"
/**************************************************************************
*** General-Purpose Event List Manager ***
**************************************************************************
@@ -352,7 +353,8 @@ int id,flag;
/*************************/
-el_empty()
+int
+el_empty(void)
/*************************/
{
if (current == NULL) return(1);
@@ -362,7 +364,7 @@ el_empty()
/*************************/
void *
-el_first()
+el_first(void)
/*************************/
{
struct notice *n,*fn;
@@ -455,7 +457,7 @@ el_first()
/******************/
void
-el_delete()
+el_delete(void)
/******************/
{
/* el_delete frees up all the space associated with the event list */
diff --git a/usr/src/cmd/cron/funcs.c b/usr/src/cmd/cron/funcs.c
index 32dc93733b..95641aaaf1 100644
--- a/usr/src/cmd/cron/funcs.c
+++ b/usr/src/cmd/cron/funcs.c
@@ -19,16 +19,16 @@
*
* CDDL HEADER END
*/
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
/*
- * Copyright 1988-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/stat.h>
@@ -63,6 +63,7 @@ num(char **ptr)
static int dom[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+int
days_btwn(int m1, int d1, int y1, int m2, int d2, int y2)
{
/*
@@ -177,7 +178,7 @@ int
filewanted(struct dirent *direntry)
{
char *p;
- register char c;
+ char c;
p = direntry->d_name;
(void) num(&p);
@@ -215,9 +216,9 @@ ascandir(dirname, namelist, select, dcomp)
int (*select)();
int (*dcomp)();
{
- register struct dirent *d, *p, **names;
- register int nitems;
- register char *cp1, *cp2;
+ struct dirent *d, *p, **names;
+ int nitems;
+ char *cp1, *cp2;
struct stat stb;
long arraysz;
DIR *dirp;
diff --git a/usr/src/cmd/login/login.c b/usr/src/cmd/login/login.c
index ea62bf37c6..35d559c4bd 100644
--- a/usr/src/cmd/login/login.c
+++ b/usr/src/cmd/login/login.c
@@ -384,7 +384,7 @@ static void check_for_console(void);
static void check_for_dueling_unix(char *);
static void get_user_name(void);
static uint_t get_audit_id(void);
-static void login_exit(int);
+static void login_exit(int)__NORETURN;
static int logins_disabled(char *);
static void log_bad_attempts(void);
static int is_number(char *);
@@ -401,7 +401,7 @@ static int is_number(char *);
*
*/
-void
+int
main(int argc, char *argv[], char **renvp)
{
/* ONC_PLUS EXTRACT END */
@@ -661,7 +661,7 @@ main(int argc, char *argv[], char **renvp)
* All done
*/
login_exit(1);
- /* NOTREACHED */
+ return (0);
}
@@ -940,7 +940,7 @@ login_conv(int num_msg, struct pam_message **msg,
*/
static int
-verify_passwd()
+verify_passwd(void)
{
int error;
char *user;
@@ -1102,7 +1102,7 @@ getargs(char *input_line)
*/
static void
-get_user_name()
+get_user_name(void)
{
FILE *fp;
@@ -1762,7 +1762,7 @@ chdir_to_dir_user(void)
*/
static void
-login_authenticate()
+login_authenticate(void)
{
char *user;
int err;
@@ -1939,7 +1939,8 @@ setup_credentials(void)
/* ONC_PLUS EXTRACT END */
static uint_t
-get_audit_id() {
+get_audit_id(void)
+{
if (rflag)
return (ADT_rlogin);
else if (hflag)
diff --git a/usr/src/ucbcmd/expr/expr.y b/usr/src/ucbcmd/expr/expr.y
index c18a01ea2e..3a4259c802 100644
--- a/usr/src/ucbcmd/expr/expr.y
+++ b/usr/src/ucbcmd/expr/expr.y
@@ -21,6 +21,11 @@
* CDDL HEADER END
*/
%}
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -85,22 +90,22 @@ expr: '(' expr ')' = { $$ = $2; }
#define ESIZE 256
#define EQL(x,y) !strcmp(x,y)
-#define INIT register char *sp = instring;
+#define INIT char *sp = instring;
#define GETC() (*sp++)
#define PEEKC() (*sp)
#define UNGETC(c) (--sp)
-#define RETURN(c) return
+#define RETURN(c) return(c)
#define ERROR(c) errxx(c)
#include <regexp.h>
#include <malloc.h>
+#include <stdlib.h>
-long atol();
-char *ltoa(), *strcpy(), *strncpy();
-void exit();
char **Av;
int Ac;
int Argi;
+char *ltoa(long l);
+
char Mstring[1][128];
@@ -112,9 +117,11 @@ int op[] = {
OR, AND, ADD, SUBT, MULT, DIV, REM, MCH,
EQ, EQ, LT, LEQ, GT, GEQ, NEQ,
MATCH, SUBSTR, LENGTH, INDEX };
-yylex() {
- register char *p;
- register i;
+int
+yylex(void)
+{
+ char *p;
+ int i;
if(Argi >= Ac) return NOARG;
@@ -130,9 +137,10 @@ yylex() {
return A_STRING;
}
-char *rel(oper, r1, r2) register char *r1, *r2;
+char *
+rel(int oper, char *r1, char *r2)
{
- register long i;
+ long i;
if(ematch(r1, "-\\{0,1\\}[0-9]*$") && ematch(r2, "-\\{0,1\\}[0-9]*$"))
i = atol(r1) - atol(r2);
@@ -164,7 +172,7 @@ char *rel(oper, r1, r2) register char *r1, *r2;
char *arith(oper, r1, r2) char *r1, *r2;
{
long i1, i2;
- register char *rv;
+ char *rv;
if(!(ematch(r1, "-\\{0,1\\}[0-9]*$") && ematch(r2, "-\\{0,1\\}[0-9]*$")))
yyerror("non-numeric argument");
@@ -198,7 +206,7 @@ char *arith(oper, r1, r2) char *r1, *r2;
}
char *conj(oper, r1, r2) char *r1, *r2;
{
- register char *rv;
+ char *rv;
switch(oper) {
@@ -227,9 +235,11 @@ char *conj(oper, r1, r2) char *r1, *r2;
return rv;
}
-char *substr(v, s, w) char *v, *s, *w; {
-register si, wi;
-register char *res;
+char *
+substr(char *v, char *s, char *w)
+{
+ int si, wi;
+ char *res;
si = atol(s);
wi = atol(w);
@@ -243,9 +253,11 @@ register char *res;
return res;
}
-char *index(s, t) char *s, *t; {
- register long i, j;
- register char *rv;
+char *
+index(char *s, char *t)
+{
+ long i, j;
+ char *rv;
for(i = 0; s[i] ; ++i)
for(j = 0; t[j] ; ++j)
@@ -256,9 +268,11 @@ char *index(s, t) char *s, *t; {
return "0";
}
-char *length(s) register char *s; {
- register long i = 0;
- register char *rv;
+char *
+length(char *s)
+{
+ long i = 0;
+ char *rv;
while(*s++) ++i;
@@ -267,10 +281,10 @@ char *length(s) register char *s; {
return rv;
}
-char *match(s, p)
-char *s, *p;
+char *
+match(char *s, char *p)
{
- register char *rv;
+ char *rv;
(void) strcpy(rv=malloc(8), ltoa((long)ematch(s, p)));
if(nbra) {
@@ -280,13 +294,12 @@ char *s, *p;
return rv;
}
-ematch(s, p)
-char *s;
-register char *p;
+int
+ematch(char *s, char *p)
{
static char expbuf[ESIZE];
char *compile();
- register num;
+ int num;
extern char *braslist[], *braelist[], *loc2;
compile(p, expbuf, &expbuf[ESIZE], 0);
@@ -305,10 +318,10 @@ register char *p;
return(0);
}
-errxx(err)
-register err;
+int
+errxx(int err)
{
- register char *message;
+ char *message;
switch(err) {
case 11:
@@ -352,24 +365,28 @@ register err;
break;
}
yyerror(message);
+ /* NOTREACHED */
+ return (0);
}
-yyerror(s)
-char *s;
+int
+yyerror(char *s)
{
(void) write(2, "expr: ", 6);
(void) write(2, s, (unsigned) strlen(s));
(void) write(2, "\n", 1);
exit(2);
+ /* NOTREACHED */
+ return (0);
}
-char *ltoa(l)
-long l;
+char *
+ltoa(long l)
{
static char str[20];
- register char *sp;
- register i;
- register neg;
+ char *sp;
+ int i;
+ int neg;
if(l == 0x80000000L)
return "-2147483648";
@@ -389,10 +406,12 @@ long l;
return sp;
}
-main(argc, argv) char **argv;
+int
+main(int argc, char **argv)
{
Ac = argc;
Argi = 1;
Av = argv;
yyparse();
+ return (0);
}
diff --git a/usr/src/ucbcmd/from/from.c b/usr/src/ucbcmd/from/from.c
index 7929d036ad..be14b33de1 100644
--- a/usr/src/ucbcmd/from/from.c
+++ b/usr/src/ucbcmd/from/from.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1994 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -22,15 +22,14 @@
static int match(char *, char *);
-main(argc, argv)
- int argc;
- register char **argv;
+int
+main(int argc, char **argv)
{
char lbuf[BUFSIZ];
char lbuf2[BUFSIZ];
- register struct passwd *pp;
+ struct passwd *pp;
int stashed = 0;
- register char *name;
+ char *name;
char *sender = NULL;
char mailbox[MAXPATHLEN];
char *tmp_mailbox;
@@ -93,14 +92,13 @@ main(argc, argv)
}
if (stashed)
(void) printf("%s", lbuf2);
- return(0);
+ return (0);
}
static int
-match(line, str)
- register char *line, *str;
+match(char *line, char *str)
{
- register char ch;
+ char ch;
while (*line == ' ' || *line == '\t')
++line;
diff --git a/usr/src/ucbcmd/rusage/rusage.c b/usr/src/ucbcmd/rusage/rusage.c
index 51b89a84d7..e1bfe73aac 100644
--- a/usr/src/ucbcmd/rusage/rusage.c
+++ b/usr/src/ucbcmd/rusage/rusage.c
@@ -19,12 +19,14 @@
*
* CDDL HEADER END
*/
-#ident "%Z%%M% %I% %E% SMI"
/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
+#pragma ident "%Z%%M% %I% %E% SMI"
+
/*
* rusage
*/
@@ -43,17 +45,16 @@ fprintt(s, tv)
struct timeval *tv;
{
- (void) fprintf(stderr, gettext("%d.%02d %s "),
+ (void) fprintf(stderr, gettext("%d.%02d %s "),
tv->tv_sec, tv->tv_usec/10000, s);
}
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
union wait status;
- int options=0;
- register int p;
+ int options = 0;
+ int p;
struct timeval before, after;
struct rusage ru;
struct timezone tz;
@@ -61,11 +62,11 @@ main(argc, argv)
(void) setlocale(LC_ALL, "");
#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
+#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
- if (argc<=1)
+ if (argc <= 1)
exit(0);
(void) gettimeofday(&before, &tz);
@@ -88,8 +89,8 @@ main(argc, argv)
/* parent code - wait for command to complete */
- (void)signal(SIGINT, SIG_IGN);
- (void)signal(SIGQUIT, SIG_IGN);
+ (void) signal(SIGINT, SIG_IGN);
+ (void) signal(SIGQUIT, SIG_IGN);
while (wait3(&status.w_status, options, &ru) != p)
;
@@ -99,7 +100,8 @@ main(argc, argv)
/* check for exit status of command */
if ((status.w_termsig) != 0)
- (void) fprintf(stderr, gettext("Command terminated abnormally.\n"));
+ (void) fprintf(stderr,
+ gettext("Command terminated abnormally.\n"));
/* print an accounting summary line */
@@ -128,7 +130,5 @@ main(argc, argv)
ru.ru_isrss);
(void) fprintf(stderr, "\n");
- exit((int)status.w_retcode);
- /*NOTREACHED*/
+ return ((int)status.w_retcode);
}
-
diff --git a/usr/src/ucbcmd/shutdown/shutdown.c b/usr/src/ucbcmd/shutdown/shutdown.c
index b1e19f9acc..4c7a0a5844 100644
--- a/usr/src/ucbcmd/shutdown/shutdown.c
+++ b/usr/src/ucbcmd/shutdown/shutdown.c
@@ -90,9 +90,6 @@ struct hostlist {
char hostname[MAXHOSTNAMELEN];
char mbuf[BUFSIZ];
-void timeout();
-time_t getsdt();
-
extern char *malloc();
extern char *ctime();
@@ -166,9 +163,18 @@ char *msg20 = "Can't get PID for init\n";
char *shutter, *getlogin();
+static void timeout(void);
+static void gethostlist(void);
+static void finish(char *, char *, int);
+static void nolog(time_t);
+static void rprintf(char *, char *);
+static void rwarn(char *, time_t, time_t, char *, int);
+static void doitfast(void);
+static void warn(FILE *, time_t, time_t, char *, int);
+static time_t getsdt(char *);
pid_t
-get_initpid()
+get_initpid(void)
{
pid_t init_pid;
@@ -293,7 +299,7 @@ main(int argc, char **argv)
#endif
(void) signal(SIGTTOU, SIG_IGN);
(void) signal(SIGINT, finish_sig);
- (void) signal(SIGALRM, timeout);
+ (void) signal(SIGALRM, (void(*)())timeout);
(void) setpriority(PRIO_PROCESS, 0, PRIO_MIN);
(void) fflush(stdout);
#ifndef DEBUG
@@ -460,9 +466,8 @@ main(int argc, char **argv)
/* NOTREACHED */
}
-time_t
-getsdt(s)
- char *s;
+static time_t
+getsdt(char *s)
{
time_t t, t1, tim;
char c;
@@ -518,14 +523,12 @@ getsdt(s)
badform:
(void) printf(gettext("Bad time format\n"));
finish(gettext("Bad time format"), "", 0);
- /*NOTREACHED*/
+ return (0);
+ /* NOTREACHED */
}
-warn(termf, sdt, now, type, first)
- FILE *termf;
- time_t sdt, now;
- char *type;
- int first;
+static void
+warn(FILE *termf, time_t sdt, time_t now, char *type, int first)
{
char *ts;
time_t delay = sdt - now;
@@ -554,7 +557,8 @@ warn(termf, sdt, now, type, first)
}
}
-doitfast()
+static void
+doitfast(void)
{
FILE *fastd;
@@ -564,11 +568,8 @@ doitfast()
}
}
-rwarn(host, sdt, now, type, first)
- char *host;
- time_t sdt, now;
- char *type;
- int first;
+static void
+rwarn(char *host, time_t sdt, time_t now, char *type, int first)
{
char *ts;
time_t delay = sdt - now;
@@ -604,8 +605,8 @@ rwarn(host, sdt, now, type, first)
rprintf(host, mbuf);
}
-rprintf(host, bufp)
- char *host, *bufp;
+static void
+rprintf(char *host, char *bufp)
{
int err;
@@ -623,8 +624,8 @@ rprintf(host, bufp)
}
}
-nolog(sdt)
- time_t sdt;
+static void
+nolog(time_t sdt)
{
FILE *nologf;
@@ -638,27 +639,27 @@ nolog(sdt)
}
void
-finish_sig()
+finish_sig(void)
{
finish("SIGINT", "", 1);
}
-finish(s1, s2, exitcode)
- char *s1;
- char *s2;
+static void
+finish(char *s1, char *s2, int exitcode)
{
(void) signal(SIGINT, SIG_IGN);
exit(exitcode);
}
-void
-timeout()
+static void
+timeout(void)
{
(void) signal(SIGALRM, (void(*)())timeout);
longjmp(alarmbuf, 1);
}
-gethostlist()
+static void
+gethostlist(void)
{
int s;
struct mountbody *ml;
@@ -720,13 +721,10 @@ gethostlist()
* callrpc or clnt_call, so use rmtcall instead. Use timeout
* of 8 secs, based on the per try timeout of 3 secs for rmtcall
*/
-callrpcfast(host, prognum, versnum, procnum, inproc, in, outproc, out)
- char *host;
- rpcprog_t prognum;
- rpcvers_t versnum;
- rpcproc_t procnum;
- xdrproc_t inproc, outproc;
- char *in, *out;
+int
+callrpcfast(char *host, rpcprog_t prognum, rpcprog_t versnum,
+ rpcprog_t procnum, xdrproc_t inproc, xdrproc_t outproc,
+ char *in, char *out)
{
struct sockaddr_in server_addr;
struct hostent *hp;