mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
ANSIify function definitions.
Add some constness to avoid some warnings. Remove use register keyword. Deal with missing/unneeded extern/prototypes. Some minor type changes/casts to avoid warnings. Reviewed by: md5
This commit is contained in:
parent
d946bf7892
commit
f4ac32def2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102944
@ -60,9 +60,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
FTS *ftsp;
|
FTS *ftsp;
|
||||||
FTSENT *p;
|
FTSENT *p;
|
||||||
@ -177,7 +175,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: chflags [-R [-H | -L | -P]] flags file ...\n");
|
"usage: chflags [-R [-H | -L | -P]] flags file ...\n");
|
||||||
|
@ -56,9 +56,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char *p, *q, *suffix;
|
char *p, *q, *suffix;
|
||||||
size_t suffixlen;
|
size_t suffixlen;
|
||||||
@ -111,7 +109,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
|
@ -60,9 +60,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
FTS *ftsp;
|
FTS *ftsp;
|
||||||
FTSENT *p;
|
FTSENT *p;
|
||||||
@ -177,7 +175,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: chflags [-R [-H | -L | -P]] flags file ...\n");
|
"usage: chflags [-R [-H | -L | -P]] flags file ...\n");
|
||||||
|
@ -118,9 +118,7 @@ int pass_unknown_seqs; /* pass unknown control sequences */
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
CHAR *c;
|
CHAR *c;
|
||||||
@ -330,8 +328,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
flush_lines(nflush)
|
flush_lines(int nflush)
|
||||||
int nflush;
|
|
||||||
{
|
{
|
||||||
LINE *l;
|
LINE *l;
|
||||||
|
|
||||||
@ -357,7 +354,7 @@ flush_lines(nflush)
|
|||||||
* feeds.
|
* feeds.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
flush_blanks()
|
flush_blanks(void)
|
||||||
{
|
{
|
||||||
int half, i, nb;
|
int half, i, nb;
|
||||||
|
|
||||||
@ -386,8 +383,7 @@ flush_blanks()
|
|||||||
* and character set shifts.
|
* and character set shifts.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
flush_line(l)
|
flush_line(LINE *l)
|
||||||
LINE *l;
|
|
||||||
{
|
{
|
||||||
CHAR *c, *endc;
|
CHAR *c, *endc;
|
||||||
int nchars, last_col, this_col;
|
int nchars, last_col, this_col;
|
||||||
@ -494,7 +490,7 @@ flush_line(l)
|
|||||||
static LINE *line_freelist;
|
static LINE *line_freelist;
|
||||||
|
|
||||||
LINE *
|
LINE *
|
||||||
alloc_line()
|
alloc_line(void)
|
||||||
{
|
{
|
||||||
LINE *l;
|
LINE *l;
|
||||||
int i;
|
int i;
|
||||||
@ -515,8 +511,7 @@ alloc_line()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
free_line(l)
|
free_line(LINE *l)
|
||||||
LINE *l;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
l->l_next = line_freelist;
|
l->l_next = line_freelist;
|
||||||
@ -524,7 +519,7 @@ free_line(l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr, "usage: col [-bfhpx] [-l nline]\n");
|
(void)fprintf(stderr, "usage: col [-bfhpx] [-l nline]\n");
|
||||||
@ -532,8 +527,7 @@ usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dowarn(line)
|
dowarn(int line)
|
||||||
int line;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
warnx("warning: can't back up %s",
|
warnx("warning: can't back up %s",
|
||||||
|
@ -81,9 +81,7 @@ static int plus(char, char);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char *cp, *dp;
|
char *cp, *dp;
|
||||||
@ -191,15 +189,14 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: colcrt [-] [-2] [file ...]\n");
|
fprintf(stderr, "usage: colcrt [-] [-2] [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
plus(c, d)
|
plus(char c, char d)
|
||||||
char c, d;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((c == '|' && d == '-') || d == '_');
|
return ((c == '|' && d == '-') || d == '_');
|
||||||
@ -208,11 +205,10 @@ plus(c, d)
|
|||||||
int first;
|
int first;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pflush(ol)
|
pflush(int ol)
|
||||||
int ol;
|
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
register char *cp;
|
char *cp;
|
||||||
char lastomit;
|
char lastomit;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
@ -243,10 +239,9 @@ pflush(ol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
move(l, m)
|
move(int l, int m)
|
||||||
int l, m;
|
|
||||||
{
|
{
|
||||||
register char *cp, *dp;
|
char *cp, *dp;
|
||||||
|
|
||||||
for (cp = page[l], dp = page[m]; *cp; cp++, dp++) {
|
for (cp = page[l], dp = page[m]; *cp; cp++, dp++) {
|
||||||
switch (*cp) {
|
switch (*cp) {
|
||||||
|
@ -68,9 +68,7 @@ void needpos(size_t);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
void (*fcn)(FILE *, const char *);
|
void (*fcn)(FILE *, const char *);
|
||||||
@ -155,8 +153,7 @@ size_t autostart, autostop, maxval;
|
|||||||
char *positions;
|
char *positions;
|
||||||
|
|
||||||
void
|
void
|
||||||
get_list(list)
|
get_list(char *list)
|
||||||
char *list;
|
|
||||||
{
|
{
|
||||||
size_t setautostart, start, stop;
|
size_t setautostart, start, stop;
|
||||||
char *pos;
|
char *pos;
|
||||||
@ -237,9 +234,7 @@ needpos(size_t n)
|
|||||||
* c_cut() ought to be much faster.
|
* c_cut() ought to be much faster.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
b_n_cut(fp, fname)
|
b_n_cut(FILE *fp, const char *fname)
|
||||||
FILE *fp;
|
|
||||||
const char *fname;
|
|
||||||
{
|
{
|
||||||
size_t col, i, lbuflen;
|
size_t col, i, lbuflen;
|
||||||
char *lbuf;
|
char *lbuf;
|
||||||
@ -297,9 +292,7 @@ b_n_cut(fp, fname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
c_cut(fp, fname)
|
c_cut(FILE *fp, const char *fname __unused)
|
||||||
FILE *fp;
|
|
||||||
const char *fname __unused;
|
|
||||||
{
|
{
|
||||||
int ch, col;
|
int ch, col;
|
||||||
char *pos;
|
char *pos;
|
||||||
@ -327,9 +320,7 @@ c_cut(fp, fname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
f_cut(fp, fname)
|
f_cut(FILE *fp, const char *fname __unused)
|
||||||
FILE *fp;
|
|
||||||
const char *fname __unused;
|
|
||||||
{
|
{
|
||||||
int ch, field, isdelim;
|
int ch, field, isdelim;
|
||||||
char *pos, *p, sep;
|
char *pos, *p, sep;
|
||||||
@ -394,7 +385,7 @@ f_cut(fp, fname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
||||||
"usage: cut -b list [-n] [file ...]",
|
"usage: cut -b list [-n] [file ...]",
|
||||||
|
@ -36,8 +36,7 @@ void shuffle(char *);
|
|||||||
void setup(char *);
|
void setup(char *);
|
||||||
|
|
||||||
void
|
void
|
||||||
setup(pw)
|
setup(char *pw)
|
||||||
char *pw;
|
|
||||||
{
|
{
|
||||||
int ic, i, k, temp, pf[2], pid;
|
int ic, i, k, temp, pf[2], pid;
|
||||||
unsigned rnd;
|
unsigned rnd;
|
||||||
@ -109,11 +108,9 @@ setup(pw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register int i, n1, n2, nr1, nr2;
|
int i, n1, n2, nr1, nr2;
|
||||||
int secureflg = 0, kflag = 0;
|
int secureflg = 0, kflag = 0;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -169,8 +166,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shuffle(deckary)
|
shuffle(char deckary[])
|
||||||
char deckary[];
|
|
||||||
{
|
{
|
||||||
int i, ic, k, temp;
|
int i, ic, k, temp;
|
||||||
unsigned rnd;
|
unsigned rnd;
|
||||||
|
6
usr.bin/env/env.c
vendored
6
usr.bin/env/env.c
vendored
@ -58,9 +58,7 @@ extern char **environ;
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char **ep, *p;
|
char **ep, *p;
|
||||||
char *cleanenv[1];
|
char *cleanenv[1];
|
||||||
@ -89,7 +87,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: env [-i] [name=value ...] [utility [argument ...]]\n");
|
"usage: env [-i] [name=value ...] [utility [argument ...]]\n");
|
||||||
|
@ -62,12 +62,10 @@ static void getstops(char *);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register int c, column;
|
int c, column;
|
||||||
register int n;
|
int n;
|
||||||
int rval;
|
int rval;
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
@ -159,10 +157,9 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
getstops(cp)
|
getstops(char *cp)
|
||||||
register char *cp;
|
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
nstops = 0;
|
nstops = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -185,7 +182,7 @@ getstops(cp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf (stderr, "usage: expand [-t tablist] [file ...]\n");
|
(void)fprintf (stderr, "usage: expand [-t tablist] [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -38,15 +38,21 @@ extern char tbuf[1024]; /* Temp buffer for anybody. */
|
|||||||
extern int entries; /* Number of people. */
|
extern int entries; /* Number of people. */
|
||||||
extern DB *db; /* Database. */
|
extern DB *db; /* Database. */
|
||||||
extern int d_first;
|
extern int d_first;
|
||||||
|
extern sa_family_t family;
|
||||||
extern int gflag;
|
extern int gflag;
|
||||||
|
extern int lflag;
|
||||||
|
extern time_t now;
|
||||||
|
extern int oflag;
|
||||||
|
extern int pplan; /* don't show .plan/.project */
|
||||||
|
extern int Tflag;
|
||||||
|
|
||||||
void enter_lastlog(PERSON *);
|
void enter_lastlog(PERSON *);
|
||||||
PERSON *enter_person(struct passwd *);
|
PERSON *enter_person(struct passwd *);
|
||||||
void enter_where(struct utmp *, PERSON *);
|
void enter_where(struct utmp *, PERSON *);
|
||||||
PERSON *find_person(char *);
|
PERSON *find_person(const char *);
|
||||||
int hide(struct passwd *);
|
int hide(struct passwd *);
|
||||||
void lflag_print(void);
|
void lflag_print(void);
|
||||||
int match(struct passwd *, char *);
|
int match(struct passwd *, const char *);
|
||||||
void netfinger(char *);
|
void netfinger(char *);
|
||||||
PERSON *palloc(void);
|
PERSON *palloc(void);
|
||||||
char *prphone(char *);
|
char *prphone(char *);
|
||||||
|
@ -102,9 +102,7 @@ static void usage(void);
|
|||||||
static void userlist(int, char **);
|
static void userlist(int, char **);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
option(argc, argv)
|
option(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
@ -151,16 +149,14 @@ option(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: finger [-46lmpshoT] [login ...]\n");
|
(void)fprintf(stderr, "usage: finger [-46lmpshoT] [login ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int envargc, argcnt;
|
int envargc, argcnt;
|
||||||
char *envargv[3];
|
char *envargv[3];
|
||||||
@ -229,7 +225,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
loginlist()
|
loginlist(void)
|
||||||
{
|
{
|
||||||
PERSON *pn;
|
PERSON *pn;
|
||||||
DBT data, key;
|
DBT data, key;
|
||||||
@ -269,9 +265,7 @@ loginlist()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
userlist(argc, argv)
|
userlist(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
PERSON *pn;
|
PERSON *pn;
|
||||||
DBT data, key;
|
DBT data, key;
|
||||||
|
@ -44,6 +44,7 @@ static char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95";
|
|||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -69,9 +70,8 @@ static void lprint(PERSON *);
|
|||||||
static void vputc(unsigned char);
|
static void vputc(unsigned char);
|
||||||
|
|
||||||
void
|
void
|
||||||
lflag_print()
|
lflag_print(void)
|
||||||
{
|
{
|
||||||
extern int pplan;
|
|
||||||
PERSON *pn;
|
PERSON *pn;
|
||||||
int sflag, r;
|
int sflag, r;
|
||||||
PERSON *tmp;
|
PERSON *tmp;
|
||||||
@ -101,10 +101,8 @@ lflag_print()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lprint(pn)
|
lprint(PERSON *pn)
|
||||||
PERSON *pn;
|
|
||||||
{
|
{
|
||||||
extern time_t now;
|
|
||||||
struct tm *delta;
|
struct tm *delta;
|
||||||
WHERE *w;
|
WHERE *w;
|
||||||
int cpr, len, maxlen;
|
int cpr, len, maxlen;
|
||||||
@ -258,9 +256,7 @@ lprint(pn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
demi_print(str, oddfield)
|
demi_print(char *str, int oddfield)
|
||||||
char *str;
|
|
||||||
int oddfield;
|
|
||||||
{
|
{
|
||||||
static int lenlast;
|
static int lenlast;
|
||||||
int lenthis, maxlen;
|
int lenthis, maxlen;
|
||||||
@ -298,8 +294,7 @@ demi_print(str, oddfield)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
show_text(directory, file_name, header)
|
show_text(const char *directory, const char *file_name, const char *header)
|
||||||
const char *directory, *file_name, *header;
|
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -352,8 +347,7 @@ show_text(directory, file_name, header)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vputc(ch)
|
vputc(unsigned char ch)
|
||||||
unsigned char ch;
|
|
||||||
{
|
{
|
||||||
int meta;
|
int meta;
|
||||||
|
|
||||||
|
@ -58,17 +58,12 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include "finger.h"
|
#include "finger.h"
|
||||||
|
|
||||||
extern int lflag; /* XXX finger.h? */
|
|
||||||
extern int Tflag; /* XXX finger.h? */
|
|
||||||
extern sa_family_t family;
|
|
||||||
|
|
||||||
static void cleanup(int sig);;
|
static void cleanup(int sig);;
|
||||||
static int do_protocol(const char *name, const struct addrinfo *ai);
|
static int do_protocol(const char *name, const struct addrinfo *ai);
|
||||||
static void trying(const struct addrinfo *ai);
|
static void trying(const struct addrinfo *ai);
|
||||||
|
|
||||||
void
|
void
|
||||||
netfinger(name)
|
netfinger(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
int error, multi;
|
int error, multi;
|
||||||
char *host;
|
char *host;
|
||||||
|
@ -43,6 +43,8 @@ static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95";
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
@ -56,10 +58,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
static void stimeprint(WHERE *);
|
static void stimeprint(WHERE *);
|
||||||
|
|
||||||
void
|
void
|
||||||
sflag_print()
|
sflag_print(void)
|
||||||
{
|
{
|
||||||
extern time_t now;
|
|
||||||
extern int oflag;
|
|
||||||
PERSON *pn;
|
PERSON *pn;
|
||||||
WHERE *w;
|
WHERE *w;
|
||||||
int sflag, r, namelen;
|
int sflag, r, namelen;
|
||||||
@ -163,8 +163,7 @@ sflag_print()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stimeprint(w)
|
stimeprint(WHERE *w)
|
||||||
WHERE *w;
|
|
||||||
{
|
{
|
||||||
struct tm *delta;
|
struct tm *delta;
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
|
|||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
@ -65,9 +66,7 @@ static void userinfo(PERSON *, struct passwd *);
|
|||||||
static WHERE *walloc(PERSON *);
|
static WHERE *walloc(PERSON *);
|
||||||
|
|
||||||
int
|
int
|
||||||
match(pw, user)
|
match(struct passwd *pw, const char *user)
|
||||||
struct passwd *pw;
|
|
||||||
char *user;
|
|
||||||
{
|
{
|
||||||
char *p, *t;
|
char *p, *t;
|
||||||
char name[1024];
|
char name[1024];
|
||||||
@ -107,8 +106,7 @@ match(pw, user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
enter_lastlog(pn)
|
enter_lastlog(PERSON *pn)
|
||||||
PERSON *pn;
|
|
||||||
{
|
{
|
||||||
WHERE *w;
|
WHERE *w;
|
||||||
static int opened, fd;
|
static int opened, fd;
|
||||||
@ -157,9 +155,7 @@ enter_lastlog(pn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
enter_where(ut, pn)
|
enter_where(struct utmp *ut, PERSON *pn)
|
||||||
struct utmp *ut;
|
|
||||||
PERSON *pn;
|
|
||||||
{
|
{
|
||||||
WHERE *w;
|
WHERE *w;
|
||||||
|
|
||||||
@ -174,8 +170,7 @@ enter_where(ut, pn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PERSON *
|
PERSON *
|
||||||
enter_person(pw)
|
enter_person(struct passwd *pw)
|
||||||
struct passwd *pw;
|
|
||||||
{
|
{
|
||||||
DBT data, key;
|
DBT data, key;
|
||||||
PERSON *pn;
|
PERSON *pn;
|
||||||
@ -210,8 +205,7 @@ enter_person(pw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PERSON *
|
PERSON *
|
||||||
find_person(name)
|
find_person(const char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
@ -240,7 +234,7 @@ find_person(name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PERSON *
|
PERSON *
|
||||||
palloc()
|
palloc(void)
|
||||||
{
|
{
|
||||||
PERSON *p;
|
PERSON *p;
|
||||||
|
|
||||||
@ -250,8 +244,7 @@ palloc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static WHERE *
|
static WHERE *
|
||||||
walloc(pn)
|
walloc(PERSON *pn)
|
||||||
PERSON *pn;
|
|
||||||
{
|
{
|
||||||
WHERE *w;
|
WHERE *w;
|
||||||
|
|
||||||
@ -268,8 +261,7 @@ walloc(pn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
prphone(num)
|
prphone(char *num)
|
||||||
char *num;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int len;
|
int len;
|
||||||
@ -318,10 +310,8 @@ prphone(num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
find_idle_and_ttywrite(w)
|
find_idle_and_ttywrite(WHERE *w)
|
||||||
WHERE *w;
|
|
||||||
{
|
{
|
||||||
extern time_t now;
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
time_t touched;
|
time_t touched;
|
||||||
|
|
||||||
@ -342,9 +332,7 @@ find_idle_and_ttywrite(w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
userinfo(pn, pw)
|
userinfo(PERSON *pn, struct passwd *pw)
|
||||||
PERSON *pn;
|
|
||||||
struct passwd *pw;
|
|
||||||
{
|
{
|
||||||
char *p, *t;
|
char *p, *t;
|
||||||
char *bp, name[1024];
|
char *bp, name[1024];
|
||||||
@ -410,8 +398,7 @@ userinfo(pn, pw)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hide(pw)
|
hide(struct passwd *pw)
|
||||||
struct passwd *pw;
|
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
|
@ -68,11 +68,9 @@ int bflag; /* Count bytes, not columns */
|
|||||||
int sflag; /* Split on word boundaries */
|
int sflag; /* Split on word boundaries */
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
register int ch;
|
int ch;
|
||||||
int rval, width;
|
int rval, width;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -123,7 +121,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: fold [-bs] [-w width] [file ...]\n");
|
(void)fprintf(stderr, "usage: fold [-bs] [-w width] [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -141,8 +139,7 @@ usage()
|
|||||||
* returns embedded in the input stream.
|
* returns embedded in the input stream.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
fold(width)
|
fold(int width)
|
||||||
register int width;
|
|
||||||
{
|
{
|
||||||
static char *buf;
|
static char *buf;
|
||||||
static int buf_max;
|
static int buf_max;
|
||||||
@ -196,8 +193,7 @@ fold(width)
|
|||||||
* Update the current column position for a character.
|
* Update the current column position for a character.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
newpos(col, ch)
|
newpos(int col, int ch)
|
||||||
int col, ch;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (bflag)
|
if (bflag)
|
||||||
|
@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int match(char *, char *);
|
int match(const char *, const char *);
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -64,7 +64,8 @@ main(int argc, char **argv)
|
|||||||
FILE *mbox;
|
FILE *mbox;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
int ch, count, newline;
|
int ch, count, newline;
|
||||||
char *file, *sender, *p;
|
const char *file;
|
||||||
|
char *sender, *p;
|
||||||
#if MAXPATHLEN > BUFSIZ
|
#if MAXPATHLEN > BUFSIZ
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
#else
|
#else
|
||||||
@ -146,9 +147,10 @@ usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
match(char *line, char *sender)
|
match(const char *line, const char *sender)
|
||||||
{
|
{
|
||||||
char ch, pch, first, *p, *t;
|
char ch, pch, first;
|
||||||
|
const char *p, *t;
|
||||||
|
|
||||||
for (first = *sender++;;) {
|
for (first = *sender++;;) {
|
||||||
if (isspace(ch = *line))
|
if (isspace(ch = *line))
|
||||||
|
@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/user.h>
|
#include <sys/user.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
#include <arpa/inet.h>
|
||||||
#include <machine/elf.h>
|
#include <machine/elf.h>
|
||||||
#include <machine/vmparam.h>
|
#include <machine/vmparam.h>
|
||||||
|
|
||||||
@ -99,7 +100,8 @@ main(argc, argv)
|
|||||||
{
|
{
|
||||||
struct kinfo_proc *ki = NULL;
|
struct kinfo_proc *ki = NULL;
|
||||||
struct exec exec;
|
struct exec exec;
|
||||||
int ch, cnt, efd, fd, sflag, uid;
|
int ch, cnt, efd, fd, sflag;
|
||||||
|
uid_t uid;
|
||||||
char *binfile, *corefile;
|
char *binfile, *corefile;
|
||||||
char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN];
|
char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN];
|
||||||
int is_aout;
|
int is_aout;
|
||||||
|
@ -125,28 +125,29 @@ elf_coredump(int fd, pid_t pid)
|
|||||||
|
|
||||||
php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1;
|
php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1;
|
||||||
for (i = 0; i < seginfo.count; i++) {
|
for (i = 0; i < seginfo.count; i++) {
|
||||||
int nleft = php->p_filesz;
|
uintmax_t nleft = php->p_filesz;
|
||||||
|
|
||||||
lseek(memfd, (off_t)php->p_vaddr, SEEK_SET);
|
lseek(memfd, (off_t)php->p_vaddr, SEEK_SET);
|
||||||
while (nleft > 0) {
|
while (nleft > 0) {
|
||||||
char buf[8*1024];
|
char buf[8*1024];
|
||||||
int nwant;
|
size_t nwant;
|
||||||
int ngot;
|
ssize_t ngot;
|
||||||
|
|
||||||
nwant = nleft;
|
if (nleft > sizeof(buf))
|
||||||
if (nwant > sizeof buf)
|
|
||||||
nwant = sizeof buf;
|
nwant = sizeof buf;
|
||||||
|
else
|
||||||
|
nwant = nleft;
|
||||||
ngot = read(memfd, buf, nwant);
|
ngot = read(memfd, buf, nwant);
|
||||||
if (ngot == -1)
|
if (ngot == -1)
|
||||||
err(1, "read from %s", memname);
|
err(1, "read from %s", memname);
|
||||||
if (ngot < nwant)
|
if ((size_t)ngot < nwant)
|
||||||
errx(1, "short read from %s:"
|
errx(1, "short read from %s:"
|
||||||
" wanted %d, got %d", memname,
|
" wanted %d, got %d", memname,
|
||||||
nwant, ngot);
|
nwant, ngot);
|
||||||
ngot = write(fd, buf, nwant);
|
ngot = write(fd, buf, nwant);
|
||||||
if (ngot == -1)
|
if (ngot == -1)
|
||||||
err(1, "write of segment %d failed", i);
|
err(1, "write of segment %d failed", i);
|
||||||
if (ngot != nwant)
|
if ((size_t)ngot != nwant)
|
||||||
errx(1, "short write");
|
errx(1, "short write");
|
||||||
nleft -= nwant;
|
nleft -= nwant;
|
||||||
}
|
}
|
||||||
@ -395,7 +396,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset,
|
|||||||
err(1, "cannot open %s", name);
|
err(1, "cannot open %s", name);
|
||||||
if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1)
|
if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1)
|
||||||
err(1, "read error from %s", name);
|
err(1, "read error from %s", name);
|
||||||
if (n < sizeof status->pr_reg)
|
if ((size_t)n < sizeof(status->pr_reg))
|
||||||
errx(1, "short read from %s: wanted %u, got %d", name,
|
errx(1, "short read from %s: wanted %u, got %d", name,
|
||||||
sizeof status->pr_reg, n);
|
sizeof status->pr_reg, n);
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -406,7 +407,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset,
|
|||||||
err(1, "cannot open %s", name);
|
err(1, "cannot open %s", name);
|
||||||
if ((n = read(fd, fpregset, sizeof *fpregset)) == -1)
|
if ((n = read(fd, fpregset, sizeof *fpregset)) == -1)
|
||||||
err(1, "read error from %s", name);
|
err(1, "read error from %s", name);
|
||||||
if (n < sizeof *fpregset)
|
if ((size_t)n < sizeof(*fpregset))
|
||||||
errx(1, "short read from %s: wanted %u, got %d", name,
|
errx(1, "short read from %s: wanted %u, got %d", name,
|
||||||
sizeof *fpregset, n);
|
sizeof *fpregset, n);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/user.h>
|
#include <sys/user.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
#include <arpa/inet.h>
|
||||||
#include <machine/elf.h>
|
#include <machine/elf.h>
|
||||||
#include <machine/vmparam.h>
|
#include <machine/vmparam.h>
|
||||||
|
|
||||||
@ -99,7 +100,8 @@ main(argc, argv)
|
|||||||
{
|
{
|
||||||
struct kinfo_proc *ki = NULL;
|
struct kinfo_proc *ki = NULL;
|
||||||
struct exec exec;
|
struct exec exec;
|
||||||
int ch, cnt, efd, fd, sflag, uid;
|
int ch, cnt, efd, fd, sflag;
|
||||||
|
uid_t uid;
|
||||||
char *binfile, *corefile;
|
char *binfile, *corefile;
|
||||||
char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN];
|
char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN];
|
||||||
int is_aout;
|
int is_aout;
|
||||||
|
@ -48,9 +48,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
void
|
void
|
||||||
md_core(kd, fd, ki)
|
md_core(kd, fd, ki)
|
||||||
kvm_t *kd;
|
kvm_t *kd __unused;
|
||||||
int fd;
|
int fd __unused;
|
||||||
struct kinfo_proc *ki;
|
struct kinfo_proc *ki __unused;
|
||||||
{
|
{
|
||||||
/* Don't need to fix anything for this architecture. */
|
/* Don't need to fix anything for this architecture. */
|
||||||
return;
|
return;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
static const struct map *in_word_set(const char *str, unsigned int len);
|
static const struct map *in_word_set(const char *str, unsigned int len);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
struct map { char *name; int key; };
|
struct map { const char *name; int key; };
|
||||||
%%
|
%%
|
||||||
PATH, _CS_PATH
|
PATH, _CS_PATH
|
||||||
POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS
|
POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
static const struct map *in_word_set(const char *str, unsigned int len);
|
static const struct map *in_word_set(const char *str, unsigned int len);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
struct map { char *name; int key; };
|
struct map { const char *name; int key; };
|
||||||
%%
|
%%
|
||||||
AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX
|
AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX
|
||||||
AIO_MAX, _SC_AIO_MAX
|
AIO_MAX, _SC_AIO_MAX
|
||||||
|
@ -6,9 +6,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
@ -30,9 +30,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char **list, **p, *bindname, *name, *type;
|
char **list, **p, *bindname, *name, *type;
|
||||||
int lflag = 0, errflg = 0, bflag = 0, c;
|
int lflag = 0, errflg = 0, bflag = 0, c;
|
||||||
|
@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "hexdump.h"
|
#include "hexdump.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
conv_c(pr, p)
|
conv_c(PR *pr, u_char *p)
|
||||||
PR *pr;
|
|
||||||
u_char *p;
|
|
||||||
{
|
{
|
||||||
char buf[10];
|
char buf[10];
|
||||||
char const *str;
|
char const *str;
|
||||||
@ -92,9 +90,7 @@ strpr: *pr->cchar = 's';
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
conv_u(pr, p)
|
conv_u(PR *pr, u_char *p)
|
||||||
PR *pr;
|
|
||||||
u_char *p;
|
|
||||||
{
|
{
|
||||||
static char const * list[] = {
|
static char const * list[] = {
|
||||||
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
|
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
|
||||||
|
@ -58,14 +58,13 @@ static off_t eaddress; /* end address */
|
|||||||
static __inline void print(PR *, u_char *);
|
static __inline void print(PR *, u_char *);
|
||||||
|
|
||||||
void
|
void
|
||||||
display()
|
display(void)
|
||||||
{
|
{
|
||||||
extern FU *endfu;
|
FS *fs;
|
||||||
register FS *fs;
|
FU *fu;
|
||||||
register FU *fu;
|
PR *pr;
|
||||||
register PR *pr;
|
int cnt;
|
||||||
register int cnt;
|
u_char *bp;
|
||||||
register u_char *bp;
|
|
||||||
off_t saveaddress;
|
off_t saveaddress;
|
||||||
u_char savech, *savebp;
|
u_char savech, *savebp;
|
||||||
|
|
||||||
@ -113,9 +112,7 @@ display()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
print(pr, bp)
|
print(PR *pr, u_char *bp)
|
||||||
PR *pr;
|
|
||||||
u_char *bp;
|
|
||||||
{
|
{
|
||||||
long double ldbl;
|
long double ldbl;
|
||||||
double f8;
|
double f8;
|
||||||
@ -212,11 +209,10 @@ print(pr, bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bpad(pr)
|
bpad(PR *pr)
|
||||||
PR *pr;
|
|
||||||
{
|
{
|
||||||
static char const *spec = " -0+#";
|
static char const *spec = " -0+#";
|
||||||
register char *p1, *p2;
|
char *p1, *p2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove all conversion flags; '-' is the only one valid
|
* Remove all conversion flags; '-' is the only one valid
|
||||||
@ -233,11 +229,11 @@ bpad(pr)
|
|||||||
static char **_argv;
|
static char **_argv;
|
||||||
|
|
||||||
u_char *
|
u_char *
|
||||||
get()
|
get(void)
|
||||||
{
|
{
|
||||||
static int ateof = 1;
|
static int ateof = 1;
|
||||||
static u_char *curp, *savp;
|
static u_char *curp, *savp;
|
||||||
register int n;
|
int n;
|
||||||
int need, nread;
|
int need, nread;
|
||||||
int valid_save = 0;
|
int valid_save = 0;
|
||||||
u_char *tmpp;
|
u_char *tmpp;
|
||||||
@ -308,10 +304,8 @@ get()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
next(argv)
|
next(char **argv)
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
extern int exitval;
|
|
||||||
static int done;
|
static int done;
|
||||||
int statok;
|
int statok;
|
||||||
|
|
||||||
@ -344,11 +338,9 @@ next(argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
doskip(fname, statok)
|
doskip(const char *fname, int statok)
|
||||||
const char *fname;
|
|
||||||
int statok;
|
|
||||||
{
|
{
|
||||||
register int cnt;
|
int cnt;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (statok) {
|
if (statok) {
|
||||||
|
@ -58,11 +58,9 @@ int exitval; /* final exit value */
|
|||||||
int length = -1; /* max bytes to read */
|
int length = -1; /* max bytes to read */
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register FS *tfs;
|
FS *tfs;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
(void)setlocale(LC_ALL, "");
|
(void)setlocale(LC_ALL, "");
|
||||||
|
@ -72,7 +72,9 @@ typedef struct _fs { /* format strings */
|
|||||||
} FS;
|
} FS;
|
||||||
|
|
||||||
extern FS *fshead; /* head of format strings list */
|
extern FS *fshead; /* head of format strings list */
|
||||||
|
extern FU *endfu; /* format at end-of-data */
|
||||||
extern int blocksize; /* data block size */
|
extern int blocksize; /* data block size */
|
||||||
|
extern int exitval; /* final exit value */
|
||||||
extern int odmode; /* are we acting as od(1)? */
|
extern int odmode; /* are we acting as od(1)? */
|
||||||
extern int length; /* amount of data to read */
|
extern int length; /* amount of data to read */
|
||||||
extern off_t skip; /* amount of data to skip at start */
|
extern off_t skip; /* amount of data to skip at start */
|
||||||
|
@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
off_t skip; /* bytes to skip */
|
off_t skip; /* bytes to skip */
|
||||||
|
|
||||||
void
|
void
|
||||||
newsyntax(argc, argvp)
|
newsyntax(int argc, char ***argvp)
|
||||||
int argc;
|
|
||||||
char ***argvp;
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char *p, **argv;
|
char *p, **argv;
|
||||||
@ -135,7 +133,7 @@ newsyntax(argc, argvp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
||||||
"usage: hexdump [-bcCdovx] [-e fmt] [-f fmt_file] [-n length]",
|
"usage: hexdump [-bcCdovx] [-e fmt] [-f fmt_file] [-n length]",
|
||||||
|
@ -64,9 +64,7 @@ static void odoffset(int, char ***);
|
|||||||
static void odusage(void);
|
static void odusage(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
oldsyntax(argc, argvp)
|
oldsyntax(int argc, char ***argvp)
|
||||||
int argc;
|
|
||||||
char ***argvp;
|
|
||||||
{
|
{
|
||||||
static char empty[] = "", padding[] = PADDING;
|
static char empty[] = "", padding[] = PADDING;
|
||||||
int ch;
|
int ch;
|
||||||
@ -193,9 +191,7 @@ odusage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
odoffset(argc, argvp)
|
odoffset(int argc, char ***argvp)
|
||||||
int argc;
|
|
||||||
char ***argvp;
|
|
||||||
{
|
{
|
||||||
unsigned char *p, *num, *end;
|
unsigned char *p, *num, *end;
|
||||||
int base;
|
int base;
|
||||||
|
@ -52,10 +52,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
FU *endfu; /* format at end-of-data */
|
FU *endfu; /* format at end-of-data */
|
||||||
|
|
||||||
void
|
void
|
||||||
addfile(name)
|
addfile(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
register unsigned char *p;
|
unsigned char *p;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int ch;
|
int ch;
|
||||||
char buf[2048 + 1];
|
char buf[2048 + 1];
|
||||||
@ -78,8 +77,7 @@ addfile(name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add(fmt)
|
add(const char *fmt)
|
||||||
const char *fmt;
|
|
||||||
{
|
{
|
||||||
unsigned const char *p, *savep;
|
unsigned const char *p, *savep;
|
||||||
static FS **nextfs;
|
static FS **nextfs;
|
||||||
@ -154,12 +152,11 @@ add(fmt)
|
|||||||
static const char *spec = ".#-+ 0123456789";
|
static const char *spec = ".#-+ 0123456789";
|
||||||
|
|
||||||
int
|
int
|
||||||
size(fs)
|
size(FS *fs)
|
||||||
FS *fs;
|
|
||||||
{
|
{
|
||||||
register FU *fu;
|
FU *fu;
|
||||||
register int bcnt, cursize;
|
int bcnt, cursize;
|
||||||
register unsigned char *fmt;
|
unsigned char *fmt;
|
||||||
int prec;
|
int prec;
|
||||||
|
|
||||||
/* figure out the data block size needed for each format unit */
|
/* figure out the data block size needed for each format unit */
|
||||||
@ -208,12 +205,11 @@ size(fs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rewrite(fs)
|
rewrite(FS *fs)
|
||||||
FS *fs;
|
|
||||||
{
|
{
|
||||||
enum { NOTOKAY, USEBCNT, USEPREC } sokay;
|
enum { NOTOKAY, USEBCNT, USEPREC } sokay;
|
||||||
register PR *pr, **nextpr;
|
PR *pr, **nextpr;
|
||||||
register FU *fu;
|
FU *fu;
|
||||||
unsigned char *p1, *p2, *fmtp;
|
unsigned char *p1, *p2, *fmtp;
|
||||||
char savech, cs[3];
|
char savech, cs[3];
|
||||||
int nconv, prec;
|
int nconv, prec;
|
||||||
@ -449,10 +445,9 @@ isint2: switch(fu->bcnt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
escape(p1)
|
escape(char *p1)
|
||||||
register char *p1;
|
|
||||||
{
|
{
|
||||||
register char *p2;
|
char *p2;
|
||||||
|
|
||||||
/* alphabetic escape sequences have to be done in place */
|
/* alphabetic escape sequences have to be done in place */
|
||||||
for (p2 = p1;; ++p1, ++p2) {
|
for (p2 = p1;; ++p1, ++p2) {
|
||||||
@ -492,28 +487,25 @@ escape(p1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
badcnt(s)
|
badcnt(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
errx(1, "%s: bad byte count", s);
|
errx(1, "%s: bad byte count", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
badsfmt()
|
badsfmt(void)
|
||||||
{
|
{
|
||||||
errx(1, "%%s: requires a precision or a byte count");
|
errx(1, "%%s: requires a precision or a byte count");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
badfmt(fmt)
|
badfmt(const char *fmt)
|
||||||
const char *fmt;
|
|
||||||
{
|
{
|
||||||
errx(1, "\"%s\": bad format", fmt);
|
errx(1, "\"%s\": bad format", fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
badconv(ch)
|
badconv(char *ch)
|
||||||
char *ch;
|
|
||||||
{
|
{
|
||||||
errx(1, "%%%s: bad conversion character", ch);
|
errx(1, "%%%s: bad conversion character", ch);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,7 @@ struct passwd *
|
|||||||
int isgroups, iswhoami;
|
int isgroups, iswhoami;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct group *gr;
|
struct group *gr;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
@ -177,8 +175,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pretty(pw)
|
pretty(struct passwd *pw)
|
||||||
struct passwd *pw;
|
|
||||||
{
|
{
|
||||||
struct group *gr;
|
struct group *gr;
|
||||||
u_int eid, rid;
|
u_int eid, rid;
|
||||||
@ -218,7 +215,7 @@ pretty(pw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
current()
|
current(void)
|
||||||
{
|
{
|
||||||
struct group *gr;
|
struct group *gr;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
@ -259,8 +256,7 @@ current()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
user(pw)
|
user(struct passwd *pw)
|
||||||
struct passwd *pw;
|
|
||||||
{
|
{
|
||||||
struct group *gr;
|
struct group *gr;
|
||||||
const char *fmt;
|
const char *fmt;
|
||||||
@ -287,9 +283,7 @@ user(pw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
group(pw, nflag)
|
group(struct passwd *pw, int nflag)
|
||||||
struct passwd *pw;
|
|
||||||
int nflag;
|
|
||||||
{
|
{
|
||||||
struct group *gr;
|
struct group *gr;
|
||||||
int cnt, id, lastid, ngroups;
|
int cnt, id, lastid, ngroups;
|
||||||
@ -324,8 +318,7 @@ group(pw, nflag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct passwd *
|
struct passwd *
|
||||||
who(u)
|
who(char *u)
|
||||||
char *u;
|
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
long id;
|
long id;
|
||||||
@ -345,8 +338,7 @@ who(u)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pline(pw)
|
pline(struct passwd *pw)
|
||||||
struct passwd *pw;
|
|
||||||
{
|
{
|
||||||
u_int rid;
|
u_int rid;
|
||||||
|
|
||||||
@ -363,7 +355,7 @@ pline(pw)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isgroups)
|
if (isgroups)
|
||||||
|
@ -48,12 +48,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define IPC_TO_STRING(x) (x == 'Q' ? "message queue" : \
|
#define IPC_TO_STRING(x) (x == 'Q' ? "message queue" : \
|
||||||
(x == 'M' ? "shared memory segment" : "semaphore"))
|
(x == 'M' ? "shared memory segment" : "semaphore"))
|
||||||
|
|
||||||
void usage(void);
|
|
||||||
int msgrm(key_t, int);
|
|
||||||
int shmrm(key_t, int);
|
|
||||||
int semrm(key_t, int);
|
|
||||||
void not_configured(int);
|
|
||||||
|
|
||||||
int signaled;
|
int signaled;
|
||||||
|
|
||||||
void usage(void);
|
void usage(void);
|
||||||
@ -62,7 +56,7 @@ int shmrm(key_t, int);
|
|||||||
int semrm(key_t, int);
|
int semrm(key_t, int);
|
||||||
void not_configured(int);
|
void not_configured(int);
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n%s\n",
|
fprintf(stderr, "%s\n%s\n",
|
||||||
"usage: ipcrm [-q msqid] [-m shmid] [-s semid]",
|
"usage: ipcrm [-q msqid] [-m shmid] [-s semid]",
|
||||||
@ -70,9 +64,7 @@ void usage()
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int msgrm(key, id)
|
int msgrm(key_t key, int id)
|
||||||
key_t key;
|
|
||||||
int id;
|
|
||||||
{
|
{
|
||||||
if (key) {
|
if (key) {
|
||||||
id = msgget(key, 0);
|
id = msgget(key, 0);
|
||||||
@ -82,9 +74,7 @@ int msgrm(key, id)
|
|||||||
return msgctl(id, IPC_RMID, NULL);
|
return msgctl(id, IPC_RMID, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int shmrm(key, id)
|
int shmrm(key_t key, int id)
|
||||||
key_t key;
|
|
||||||
int id;
|
|
||||||
{
|
{
|
||||||
if (key) {
|
if (key) {
|
||||||
id = shmget(key, 0, 0);
|
id = shmget(key, 0, 0);
|
||||||
@ -94,9 +84,7 @@ int shmrm(key, id)
|
|||||||
return shmctl(id, IPC_RMID, NULL);
|
return shmctl(id, IPC_RMID, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int semrm(key, id)
|
int semrm(key_t key, int id)
|
||||||
key_t key;
|
|
||||||
int id;
|
|
||||||
{
|
{
|
||||||
union semun arg;
|
union semun arg;
|
||||||
|
|
||||||
@ -113,10 +101,7 @@ void not_configured(int signo __unused)
|
|||||||
signaled++;
|
signaled++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int c, result, errflg, target_id;
|
int c, result, errflg, target_id;
|
||||||
key_t target_key;
|
key_t target_key;
|
||||||
|
@ -77,7 +77,7 @@ typedef struct {
|
|||||||
FILE *fp; /* file descriptor */
|
FILE *fp; /* file descriptor */
|
||||||
u_long joinf; /* join field (-1, -2, -j) */
|
u_long joinf; /* join field (-1, -2, -j) */
|
||||||
int unpair; /* output unpairable lines (-a) */
|
int unpair; /* output unpairable lines (-a) */
|
||||||
int number; /* 1 for file 1, 2 for file 2 */
|
u_long number; /* 1 for file 1, 2 for file 2 */
|
||||||
|
|
||||||
LINE *set; /* set of lines with same field */
|
LINE *set; /* set of lines with same field */
|
||||||
int pushbool; /* if pushback is set */
|
int pushbool; /* if pushback is set */
|
||||||
@ -114,9 +114,7 @@ void slurp(INPUT *);
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
INPUT *F1, *F2;
|
INPUT *F1, *F2;
|
||||||
int aflag, ch, cval, vflag;
|
int aflag, ch, cval, vflag;
|
||||||
@ -270,8 +268,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
slurp(F)
|
slurp(INPUT *F)
|
||||||
INPUT *F;
|
|
||||||
{
|
{
|
||||||
LINE *lp, *lastlp, tmp;
|
LINE *lp, *lastlp, tmp;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -360,9 +357,7 @@ slurp(F)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmp(lp1, fieldno1, lp2, fieldno2)
|
cmp(LINE *lp1, u_long fieldno1, LINE *lp2, u_long fieldno2)
|
||||||
LINE *lp1, *lp2;
|
|
||||||
u_long fieldno1, fieldno2;
|
|
||||||
{
|
{
|
||||||
if (lp1->fieldcnt <= fieldno1)
|
if (lp1->fieldcnt <= fieldno1)
|
||||||
return (lp2->fieldcnt <= fieldno2 ? 0 : 1);
|
return (lp2->fieldcnt <= fieldno2 ? 0 : 1);
|
||||||
@ -372,10 +367,9 @@ cmp(lp1, fieldno1, lp2, fieldno2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
joinlines(F1, F2)
|
joinlines(INPUT *F1, INPUT *F2)
|
||||||
INPUT *F1, *F2;
|
|
||||||
{
|
{
|
||||||
unsigned int cnt1, cnt2;
|
u_long cnt1, cnt2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output the results of a join comparison. The output may be from
|
* Output the results of a join comparison. The output may be from
|
||||||
@ -393,11 +387,9 @@ joinlines(F1, F2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
outoneline(F, lp)
|
outoneline(INPUT *F, LINE *lp)
|
||||||
INPUT *F;
|
|
||||||
LINE *lp;
|
|
||||||
{
|
{
|
||||||
unsigned int cnt;
|
u_long cnt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output a single line from one of the files, according to the
|
* Output a single line from one of the files, according to the
|
||||||
@ -423,11 +415,9 @@ outoneline(F, lp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
outtwoline(F1, lp1, F2, lp2)
|
outtwoline(INPUT *F1, LINE *lp1, INPUT *F2, LINE *lp2)
|
||||||
INPUT *F1, *F2;
|
|
||||||
LINE *lp1, *lp2;
|
|
||||||
{
|
{
|
||||||
unsigned int cnt;
|
u_long cnt;
|
||||||
|
|
||||||
/* Output a pair of lines according to the join list (if any). */
|
/* Output a pair of lines according to the join list (if any). */
|
||||||
if (olist)
|
if (olist)
|
||||||
@ -461,10 +451,7 @@ outtwoline(F1, lp1, F2, lp2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
outfield(lp, fieldno, out_empty)
|
outfield(LINE *lp, u_long fieldno, int out_empty)
|
||||||
LINE *lp;
|
|
||||||
u_long fieldno;
|
|
||||||
int out_empty;
|
|
||||||
{
|
{
|
||||||
if (needsep++)
|
if (needsep++)
|
||||||
(void)printf("%c", *tabchar);
|
(void)printf("%c", *tabchar);
|
||||||
@ -487,8 +474,7 @@ outfield(lp, fieldno, out_empty)
|
|||||||
* fields.
|
* fields.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
fieldarg(option)
|
fieldarg(char *option)
|
||||||
char *option;
|
|
||||||
{
|
{
|
||||||
u_long fieldno, filenum;
|
u_long fieldno, filenum;
|
||||||
char *end, *token;
|
char *end, *token;
|
||||||
@ -522,10 +508,9 @@ fieldarg(option)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
obsolete(argv)
|
obsolete(char **argv)
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
unsigned int len;
|
size_t len;
|
||||||
char **p, *ap, *t;
|
char **p, *ap, *t;
|
||||||
|
|
||||||
while ((ap = *++argv) != NULL) {
|
while ((ap = *++argv) != NULL) {
|
||||||
@ -588,8 +573,8 @@ jbad: errx(1, "illegal option -- %s", ap);
|
|||||||
if (ap[2] != '\0')
|
if (ap[2] != '\0')
|
||||||
break;
|
break;
|
||||||
for (p = argv + 2; *p; ++p) {
|
for (p = argv + 2; *p; ++p) {
|
||||||
if (p[0][0] == '0' || (p[0][0] != '1' &&
|
if (p[0][0] == '0' || ((p[0][0] != '1' &&
|
||||||
p[0][0] != '2' || p[0][1] != '.'))
|
p[0][0] != '2') || p[0][1] != '.'))
|
||||||
break;
|
break;
|
||||||
len = strlen(*p);
|
len = strlen(*p);
|
||||||
if (len - 2 != strspn(*p + 2, "0123456789"))
|
if (len - 2 != strspn(*p + 2, "0123456789"))
|
||||||
@ -608,7 +593,7 @@ jbad: errx(1, "illegal option -- %s", ap);
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "%s %s\n%s\n",
|
(void)fprintf(stderr, "%s %s\n%s\n",
|
||||||
"usage: join [-a fileno | -v fileno ] [-e string] [-1 field]",
|
"usage: join [-a fileno | -v fileno ] [-e string] [-1 field]",
|
||||||
|
@ -119,9 +119,7 @@ usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char *p;
|
char *p;
|
||||||
@ -198,7 +196,7 @@ main(argc, argv)
|
|||||||
* read through the wtmp file
|
* read through the wtmp file
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
wtmp()
|
wtmp(void)
|
||||||
{
|
{
|
||||||
struct utmp *bp; /* current structure */
|
struct utmp *bp; /* current structure */
|
||||||
struct stat stb; /* stat of file for size */
|
struct stat stb; /* stat of file for size */
|
||||||
@ -237,8 +235,7 @@ wtmp()
|
|||||||
* process a single wtmp entry
|
* process a single wtmp entry
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
doentry(bp)
|
doentry(struct utmp *bp)
|
||||||
struct utmp *bp;
|
|
||||||
{
|
{
|
||||||
struct ttytab *tt, *ttx; /* ttylist entry */
|
struct ttytab *tt, *ttx; /* ttylist entry */
|
||||||
|
|
||||||
@ -325,9 +322,7 @@ doentry(bp)
|
|||||||
* logout type (crash/shutdown) as appropriate.
|
* logout type (crash/shutdown) as appropriate.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
printentry(bp, tt)
|
printentry(struct utmp *bp, struct ttytab *tt)
|
||||||
struct utmp *bp;
|
|
||||||
struct ttytab *tt;
|
|
||||||
{
|
{
|
||||||
char ct[80];
|
char ct[80];
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
@ -378,8 +373,7 @@ printentry(bp, tt)
|
|||||||
* see if want this entry
|
* see if want this entry
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
want(bp)
|
want(struct utmp *bp)
|
||||||
struct utmp *bp;
|
|
||||||
{
|
{
|
||||||
ARG *step;
|
ARG *step;
|
||||||
|
|
||||||
@ -412,9 +406,7 @@ want(bp)
|
|||||||
* add an entry to a linked list of arguments
|
* add an entry to a linked list of arguments
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
addarg(type, arg)
|
addarg(int type, char *arg)
|
||||||
int type;
|
|
||||||
char *arg;
|
|
||||||
{
|
{
|
||||||
ARG *cur;
|
ARG *cur;
|
||||||
|
|
||||||
@ -433,8 +425,7 @@ addarg(type, arg)
|
|||||||
* off the domain suffix since that's what login(1) does.
|
* off the domain suffix since that's what login(1) does.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
hostconv(arg)
|
hostconv(char *arg)
|
||||||
char *arg;
|
|
||||||
{
|
{
|
||||||
static int first = 1;
|
static int first = 1;
|
||||||
static char *hostdot, name[MAXHOSTNAMELEN];
|
static char *hostdot, name[MAXHOSTNAMELEN];
|
||||||
@ -457,8 +448,7 @@ hostconv(arg)
|
|||||||
* convert tty to correct name.
|
* convert tty to correct name.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
ttyconv(arg)
|
ttyconv(char *arg)
|
||||||
char *arg;
|
|
||||||
{
|
{
|
||||||
char *mval;
|
char *mval;
|
||||||
|
|
||||||
@ -490,8 +480,7 @@ ttyconv(arg)
|
|||||||
* Derived from atime_arg1() in usr.bin/touch/touch.c
|
* Derived from atime_arg1() in usr.bin/touch/touch.c
|
||||||
*/
|
*/
|
||||||
time_t
|
time_t
|
||||||
dateconv(arg)
|
dateconv(char *arg)
|
||||||
char *arg;
|
|
||||||
{
|
{
|
||||||
time_t timet;
|
time_t timet;
|
||||||
struct tm *t;
|
struct tm *t;
|
||||||
@ -562,8 +551,7 @@ terr: errx(1,
|
|||||||
* on interrupt, we inform the user how far we've gotten
|
* on interrupt, we inform the user how far we've gotten
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
onintr(signo)
|
onintr(int signo)
|
||||||
int signo;
|
|
||||||
{
|
{
|
||||||
char ct[80];
|
char ct[80];
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
|
@ -77,9 +77,7 @@ static void usage(void);
|
|||||||
#define AC_HZ ((double)AHZ)
|
#define AC_HZ ((double)AHZ)
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
struct acct ab;
|
struct acct ab;
|
||||||
@ -222,8 +220,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
time_t
|
time_t
|
||||||
expand(t)
|
expand(u_int t)
|
||||||
u_int t;
|
|
||||||
{
|
{
|
||||||
time_t nt;
|
time_t nt;
|
||||||
|
|
||||||
@ -237,8 +234,7 @@ expand(t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
flagbits(f)
|
flagbits(int f)
|
||||||
int f;
|
|
||||||
{
|
{
|
||||||
static char flags[20] = "-";
|
static char flags[20] = "-";
|
||||||
char *p;
|
char *p;
|
||||||
@ -256,9 +252,7 @@ flagbits(f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
requested(argv, acp)
|
requested(char *argv[], struct acct *acp)
|
||||||
char *argv[];
|
|
||||||
struct acct *acp;
|
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
@ -275,8 +269,7 @@ requested(argv, acp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
getdev(dev)
|
getdev(dev_t dev)
|
||||||
dev_t dev;
|
|
||||||
{
|
{
|
||||||
static dev_t lastdev = (dev_t)-1;
|
static dev_t lastdev = (dev_t)-1;
|
||||||
static const char *lastname;
|
static const char *lastname;
|
||||||
@ -291,7 +284,7 @@ getdev(dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: lastcomm [-EScesu] [ -f file ] [command ...] [user ...] [tty ...]\n");
|
"usage: lastcomm [-EScesu] [ -f file ] [command ...] [user ...] [tty ...]\n");
|
||||||
|
@ -64,13 +64,11 @@ static void usage(void);
|
|||||||
* It nags you like a mother hen.
|
* It nags you like a mother hen.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
register u_int secs;
|
u_int secs;
|
||||||
register int hours, minutes;
|
int hours, minutes;
|
||||||
register char c, *cp = NULL;
|
char c, *cp = NULL;
|
||||||
struct tm *t;
|
struct tm *t;
|
||||||
time_t now;
|
time_t now;
|
||||||
int plusnow, t_12_hour;
|
int plusnow, t_12_hour;
|
||||||
@ -139,10 +137,9 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
doalarm(secs)
|
doalarm(u_int secs)
|
||||||
u_int secs;
|
|
||||||
{
|
{
|
||||||
register int bother;
|
int bother;
|
||||||
time_t daytime;
|
time_t daytime;
|
||||||
char tb[80];
|
char tb[80];
|
||||||
int pid;
|
int pid;
|
||||||
@ -192,7 +189,7 @@ doalarm(secs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: leave [[+]hhmm]\n");
|
fprintf(stderr, "usage: leave [[+]hhmm]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -88,9 +88,7 @@ int vtyunlock; /* Unlock flag and code. */
|
|||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
struct timeval timval;
|
struct timeval timval;
|
||||||
@ -242,7 +240,7 @@ main(argc, argv)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: lock [-npv] [-t timeout]\n");
|
(void)fprintf(stderr, "usage: lock [-npv] [-t timeout]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -85,9 +85,7 @@ int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
|
|||||||
* log.
|
* log.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int ch, logflags, pri;
|
int ch, logflags, pri;
|
||||||
char *tag, *host, buf[1024];
|
char *tag, *host, buf[1024];
|
||||||
@ -142,7 +140,7 @@ main(argc, argv)
|
|||||||
|
|
||||||
/* log input line if appropriate */
|
/* log input line if appropriate */
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
register char *p, *endp;
|
char *p, *endp;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) {
|
for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) {
|
||||||
@ -240,8 +238,7 @@ logmessage(int pri, char *host, char *buf)
|
|||||||
* Decode a symbolic name to a numeric value
|
* Decode a symbolic name to a numeric value
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pencode(s)
|
pencode(char *s)
|
||||||
register char *s;
|
|
||||||
{
|
{
|
||||||
char *save;
|
char *save;
|
||||||
int fac, lev;
|
int fac, lev;
|
||||||
@ -265,11 +262,9 @@ pencode(s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
decode(name, codetab)
|
decode(char *name, CODE *codetab)
|
||||||
char *name;
|
|
||||||
CODE *codetab;
|
|
||||||
{
|
{
|
||||||
register CODE *c;
|
CODE *c;
|
||||||
|
|
||||||
if (isdigit(*name))
|
if (isdigit(*name))
|
||||||
return (atoi(name));
|
return (atoi(name));
|
||||||
@ -282,7 +277,7 @@ decode(name, codetab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: %s\n",
|
(void)fprintf(stderr, "usage: %s\n",
|
||||||
"logger [-46Ais] [-f file] [-h host] [-p pri] [-t tag] [message ...]"
|
"logger [-46Ais] [-f file] [-h host] [-p pri] [-t tag] [message ...]"
|
||||||
|
@ -53,9 +53,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[] __unused)
|
||||||
int argc;
|
|
||||||
char *argv[] __unused;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -68,7 +66,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: logname\n");
|
(void)fprintf(stderr, "usage: logname\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -101,9 +101,7 @@ void print_from(unsigned char *, unsigned char *, unsigned char *);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int ch, fd, termchar, match;
|
int ch, fd, termchar, match;
|
||||||
@ -160,11 +158,10 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
look(string, front, back)
|
look(unsigned char *string, unsigned char *front, unsigned char *back)
|
||||||
unsigned char *string, *front, *back;
|
|
||||||
{
|
{
|
||||||
register int ch;
|
int ch;
|
||||||
register unsigned char *readp, *writep;
|
unsigned char *readp, *writep;
|
||||||
|
|
||||||
/* Reformat string string to avoid doing it multiple times later. */
|
/* Reformat string string to avoid doing it multiple times later. */
|
||||||
for (readp = writep = string; (ch = *readp++);) {
|
for (readp = writep = string; (ch = *readp++);) {
|
||||||
@ -228,10 +225,9 @@ look(string, front, back)
|
|||||||
while (p < back && *p++ != '\n');
|
while (p < back && *p++ != '\n');
|
||||||
|
|
||||||
char *
|
char *
|
||||||
binary_search(string, front, back)
|
binary_search(unsigned char *string, unsigned char *front, unsigned char *back)
|
||||||
register unsigned char *string, *front, *back;
|
|
||||||
{
|
{
|
||||||
register unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
p = front + (back - front) / 2;
|
p = front + (back - front) / 2;
|
||||||
SKIP_PAST_NEWLINE(p, back);
|
SKIP_PAST_NEWLINE(p, back);
|
||||||
@ -263,8 +259,7 @@ binary_search(string, front, back)
|
|||||||
* o front is before or at the first line to be printed.
|
* o front is before or at the first line to be printed.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
linear_search(string, front, back)
|
linear_search(unsigned char *string, unsigned char *front, unsigned char *back)
|
||||||
unsigned char *string, *front, *back;
|
|
||||||
{
|
{
|
||||||
while (front < back) {
|
while (front < back) {
|
||||||
switch (compare(string, front, back)) {
|
switch (compare(string, front, back)) {
|
||||||
@ -286,8 +281,7 @@ linear_search(string, front, back)
|
|||||||
* Print as many lines as match string, starting at front.
|
* Print as many lines as match string, starting at front.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
print_from(string, front, back)
|
print_from(unsigned char *string, unsigned char *front, unsigned char *back)
|
||||||
register unsigned char *string, *front, *back;
|
|
||||||
{
|
{
|
||||||
for (; front < back && compare(string, front, back) == EQUAL; ++front) {
|
for (; front < back && compare(string, front, back) == EQUAL; ++front) {
|
||||||
for (; front < back && *front != '\n'; ++front)
|
for (; front < back && *front != '\n'; ++front)
|
||||||
@ -312,10 +306,9 @@ print_from(string, front, back)
|
|||||||
* "back" terminated).
|
* "back" terminated).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
compare(s1, s2, back)
|
compare(unsigned char *s1, unsigned char *s2, unsigned char *back)
|
||||||
register unsigned char *s1, *s2, *back;
|
|
||||||
{
|
{
|
||||||
register int ch;
|
int ch;
|
||||||
|
|
||||||
for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) {
|
for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) {
|
||||||
ch = *s2;
|
ch = *s2;
|
||||||
@ -335,7 +328,7 @@ compare(s1, s2, back)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: look [-df] [-t char] string [file ...]\n");
|
(void)fprintf(stderr, "usage: look [-df] [-t char] string [file ...]\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
|
@ -98,7 +98,7 @@ static const char *whatis_name="whatis";/* -n option: the name */
|
|||||||
static char *common_output; /* -o option: the single output file */
|
static char *common_output; /* -o option: the single output file */
|
||||||
static char *locale; /* user's locale if -L is used */
|
static char *locale; /* user's locale if -L is used */
|
||||||
static char *lang_locale; /* short form of locale */
|
static char *lang_locale; /* short form of locale */
|
||||||
static char *machine;
|
static const char *machine;
|
||||||
|
|
||||||
static int exit_code; /* exit code to use when finished */
|
static int exit_code; /* exit code to use when finished */
|
||||||
static SLIST_HEAD(, visited_dir) visited_dirs =
|
static SLIST_HEAD(, visited_dir) visited_dirs =
|
||||||
@ -358,7 +358,7 @@ open_output(char *name)
|
|||||||
static int
|
static int
|
||||||
linesort(const void *a, const void *b)
|
linesort(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return strcmp((const char *)(*(const char **)a), (const char *)(*(const char **)b));
|
return strcmp((*(const char * const *)a), (*(const char * const *)b));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -810,8 +810,8 @@ process_page(struct page_info *page, char *section_dir)
|
|||||||
static int
|
static int
|
||||||
pagesort(const void *a, const void *b)
|
pagesort(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
struct page_info *p1 = *(struct page_info **) a;
|
const struct page_info *p1 = *(struct page_info * const *) a;
|
||||||
struct page_info *p2 = *(struct page_info **) b;
|
const struct page_info *p2 = *(struct page_info * const *) b;
|
||||||
if (p1->inode == p2->inode)
|
if (p1->inode == p2->inode)
|
||||||
return strcmp(p1->name, p2->name);
|
return strcmp(p1->name, p2->name);
|
||||||
return p1->inode - p2->inode;
|
return p1->inode - p2->inode;
|
||||||
@ -964,8 +964,6 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
extern int optind;
|
|
||||||
extern char *optarg;
|
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "ai:n:o:vL")) != -1) {
|
while ((opt = getopt(argc, argv, "ai:n:o:vL")) != -1) {
|
||||||
|
@ -62,9 +62,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char *tty;
|
char *tty;
|
||||||
@ -111,7 +109,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: mesg [y | n]\n");
|
(void)fprintf(stderr, "usage: mesg [y | n]\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
|
@ -63,9 +63,7 @@ static void usage(void);
|
|||||||
static int f_mode;
|
static int f_mode;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char *modestr;
|
char *modestr;
|
||||||
void *modep;
|
void *modep;
|
||||||
@ -109,7 +107,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: mkfifo [-m mode] fifo_name ...\n");
|
(void)fprintf(stderr, "usage: mkfifo [-m mode] fifo_name ...\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -162,8 +162,7 @@ void prmesg(int);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc; char *argv[];
|
|
||||||
{
|
{
|
||||||
bool newrc, already;
|
bool newrc, already;
|
||||||
int rcfirst = 0; /* first message to print (from .rc) */
|
int rcfirst = 0; /* first message to print (from .rc) */
|
||||||
@ -287,8 +286,8 @@ int argc; char *argv[];
|
|||||||
lastmsg = 0;
|
lastmsg = 0;
|
||||||
|
|
||||||
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)){
|
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)){
|
||||||
register char *cp = dp->d_name;
|
char *cp = dp->d_name;
|
||||||
register int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (dp->d_ino == 0)
|
if (dp->d_ino == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -622,15 +621,14 @@ int argc; char *argv[];
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: msgs [fhlopq] [[-]number]\n");
|
fprintf(stderr, "usage: msgs [fhlopq] [[-]number]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prmesg(length)
|
prmesg(int length)
|
||||||
int length;
|
|
||||||
{
|
{
|
||||||
FILE *outf;
|
FILE *outf;
|
||||||
char *env_pager;
|
char *env_pager;
|
||||||
@ -677,8 +675,7 @@ int length;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
onintr(unused)
|
onintr(int unused __unused)
|
||||||
int unused __unused;
|
|
||||||
{
|
{
|
||||||
signal(SIGINT, onintr);
|
signal(SIGINT, onintr);
|
||||||
if (mailing)
|
if (mailing)
|
||||||
@ -703,8 +700,7 @@ onintr(unused)
|
|||||||
* We have just gotten a susp. Suspend and prepare to resume.
|
* We have just gotten a susp. Suspend and prepare to resume.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
onsusp(unused)
|
onsusp(int unused __unused)
|
||||||
int unused __unused;
|
|
||||||
{
|
{
|
||||||
signal(SIGTSTP, SIG_DFL);
|
signal(SIGTSTP, SIG_DFL);
|
||||||
sigsetmask(0);
|
sigsetmask(0);
|
||||||
@ -715,8 +711,7 @@ onsusp(unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
linecnt(f)
|
linecnt(FILE *f)
|
||||||
FILE *f;
|
|
||||||
{
|
{
|
||||||
off_t oldpos = ftello(f);
|
off_t oldpos = ftello(f);
|
||||||
int l = 0;
|
int l = 0;
|
||||||
@ -730,8 +725,7 @@ FILE *f;
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
next(buf)
|
next(char *buf)
|
||||||
char *buf;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
sscanf(buf, "%d", &i);
|
sscanf(buf, "%d", &i);
|
||||||
@ -740,8 +734,7 @@ char *buf;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ask(prompt)
|
ask(const char *prompt)
|
||||||
const char *prompt;
|
|
||||||
{
|
{
|
||||||
char inch;
|
char inch;
|
||||||
int n, cmsg, fd;
|
int n, cmsg, fd;
|
||||||
@ -827,8 +820,7 @@ const char *prompt;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gfrsub(infile)
|
gfrsub(FILE *infile)
|
||||||
FILE *infile;
|
|
||||||
{
|
{
|
||||||
off_t frompos;
|
off_t frompos;
|
||||||
int count;
|
int count;
|
||||||
@ -908,8 +900,7 @@ FILE *infile;
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
nxtfld(s)
|
nxtfld(unsigned char *s)
|
||||||
unsigned char *s;
|
|
||||||
{
|
{
|
||||||
if (*s) while (*s && !isspace(*s)) s++; /* skip over this field */
|
if (*s) while (*s && !isspace(*s)) s++; /* skip over this field */
|
||||||
if (*s) while (*s && isspace(*s)) s++; /* find start of next field */
|
if (*s) while (*s && isspace(*s)) s++; /* find start of next field */
|
||||||
|
@ -41,7 +41,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strings.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -64,9 +64,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
long niceness = DEFNICE;
|
long niceness = DEFNICE;
|
||||||
int ch;
|
int ch;
|
||||||
@ -108,7 +106,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr, "usage: nice [-n incr] utility [arguments]\n");
|
(void)fprintf(stderr, "usage: nice [-n incr] utility [arguments]\n");
|
||||||
|
@ -49,11 +49,11 @@ int inln(FILE *, char *, int, int *, int, int *);
|
|||||||
int inskip(FILE *, int, int);
|
int inskip(FILE *, int, int);
|
||||||
void mfail(void);
|
void mfail(void);
|
||||||
int mulfile(int, char **);
|
int mulfile(int, char **);
|
||||||
FILE *nxtfile(int, char **, char **, char *, int);
|
FILE *nxtfile(int, char **, const char **, char *, int);
|
||||||
int onecol(int, char **);
|
int onecol(int, char **);
|
||||||
int otln(char *, int, int *, int *, int);
|
int otln(char *, int, int *, int *, int);
|
||||||
void pfail(void);
|
void pfail(void);
|
||||||
int prhead(char *, char *, int);
|
int prhead(char *, const char *, int);
|
||||||
int prtail(int, int);
|
int prtail(int, int);
|
||||||
int setup(int, char **);
|
int setup(int, char **);
|
||||||
void terminate(int);
|
void terminate(int);
|
||||||
|
@ -103,7 +103,7 @@ char schar; /* text column separation character */
|
|||||||
int sflag; /* -s option for multiple columns */
|
int sflag; /* -s option for multiple columns */
|
||||||
int nohead; /* do not write head and trailer */
|
int nohead; /* do not write head and trailer */
|
||||||
int pgwd; /* page width with multiple col output */
|
int pgwd; /* page width with multiple col output */
|
||||||
char *timefrmt; /* time conversion string */
|
const char *timefrmt; /* time conversion string */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* misc globals
|
* misc globals
|
||||||
@ -187,7 +187,7 @@ onecol(int argc, char *argv[])
|
|||||||
char *hbuf;
|
char *hbuf;
|
||||||
char *ohbuf;
|
char *ohbuf;
|
||||||
FILE *inf;
|
FILE *inf;
|
||||||
char *fname;
|
const char *fname;
|
||||||
int mor;
|
int mor;
|
||||||
|
|
||||||
if (nmwd)
|
if (nmwd)
|
||||||
@ -339,7 +339,7 @@ vertcol(int argc, char *argv[])
|
|||||||
char *buf;
|
char *buf;
|
||||||
char *hbuf;
|
char *hbuf;
|
||||||
char *ohbuf;
|
char *ohbuf;
|
||||||
char *fname;
|
const char *fname;
|
||||||
FILE *inf;
|
FILE *inf;
|
||||||
int ips = 0;
|
int ips = 0;
|
||||||
int cps = 0;
|
int cps = 0;
|
||||||
@ -649,7 +649,7 @@ horzcol(int argc, char *argv[])
|
|||||||
char *buf;
|
char *buf;
|
||||||
char *hbuf;
|
char *hbuf;
|
||||||
char *ohbuf;
|
char *ohbuf;
|
||||||
char *fname;
|
const char *fname;
|
||||||
FILE *inf;
|
FILE *inf;
|
||||||
int ips = 0;
|
int ips = 0;
|
||||||
int cps = 0;
|
int cps = 0;
|
||||||
@ -795,7 +795,7 @@ mulfile(int argc, char *argv[])
|
|||||||
char *buf;
|
char *buf;
|
||||||
char *hbuf;
|
char *hbuf;
|
||||||
char *ohbuf;
|
char *ohbuf;
|
||||||
char *fname;
|
const char *fname;
|
||||||
int ips = 0;
|
int ips = 0;
|
||||||
int cps = 0;
|
int cps = 0;
|
||||||
int ops = 0;
|
int ops = 0;
|
||||||
@ -1262,7 +1262,7 @@ inskip(FILE *inf, int pgcnt, int lncnt)
|
|||||||
* dt if set skips the date processing (used with -m)
|
* dt if set skips the date processing (used with -m)
|
||||||
*/
|
*/
|
||||||
FILE *
|
FILE *
|
||||||
nxtfile(int argc, char *argv[], char **fname, char *buf, int dt)
|
nxtfile(int argc, char **argv, const char **fname, char *buf, int dt)
|
||||||
{
|
{
|
||||||
FILE *inf = NULL;
|
FILE *inf = NULL;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -1423,7 +1423,7 @@ addnum(char *buf, int wdth, int line)
|
|||||||
* pagcnt page number
|
* pagcnt page number
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
prhead(char *buf, char *fname, int pagcnt)
|
prhead(char *buf, const char *fname, int pagcnt)
|
||||||
{
|
{
|
||||||
int ips = 0;
|
int ips = 0;
|
||||||
int ops = 0;
|
int ops = 0;
|
||||||
|
@ -62,13 +62,11 @@ void usage(void);
|
|||||||
* February, 1979
|
* February, 1979
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
register char *cp, **ep;
|
char *cp, **ep;
|
||||||
register size_t len;
|
size_t len;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "")) != -1)
|
while ((ch = getopt(argc, argv, "")) != -1)
|
||||||
@ -98,7 +96,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: printenv [name]\n");
|
(void)fprintf(stderr, "usage: printenv [name]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -103,12 +103,10 @@ static char **gargv;
|
|||||||
|
|
||||||
int
|
int
|
||||||
#ifdef BUILTIN
|
#ifdef BUILTIN
|
||||||
progprintf(argc, argv)
|
progprintf(int argc, char *argv[])
|
||||||
#else
|
#else
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
static const char *skip1, *skip2;
|
static const char *skip1, *skip2;
|
||||||
int ch, chopped, end, fieldwidth, haveprec, havewidth, precision, rval;
|
int ch, chopped, end, fieldwidth, haveprec, havewidth, precision, rval;
|
||||||
@ -292,9 +290,7 @@ next: for (start = fmt;; ++fmt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
mkquad(str, ch)
|
mkquad(char *str, int ch)
|
||||||
char *str;
|
|
||||||
int ch;
|
|
||||||
{
|
{
|
||||||
static char *copy;
|
static char *copy;
|
||||||
static size_t copy_size;
|
static size_t copy_size;
|
||||||
@ -325,12 +321,10 @@ mkquad(str, ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
escape(fmt, percent)
|
escape(char *fmt, int percent)
|
||||||
register char *fmt;
|
|
||||||
int percent;
|
|
||||||
{
|
{
|
||||||
register char *store;
|
char *store;
|
||||||
register int value, c;
|
int value, c;
|
||||||
|
|
||||||
for (store = fmt; (c = *fmt); ++fmt, ++store) {
|
for (store = fmt; (c = *fmt); ++fmt, ++store) {
|
||||||
if (c != '\\') {
|
if (c != '\\') {
|
||||||
@ -395,7 +389,7 @@ escape(fmt, percent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getchr()
|
getchr(void)
|
||||||
{
|
{
|
||||||
if (!*gargv)
|
if (!*gargv)
|
||||||
return ('\0');
|
return ('\0');
|
||||||
@ -403,7 +397,7 @@ getchr()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
getstr()
|
getstr(void)
|
||||||
{
|
{
|
||||||
if (!*gargv)
|
if (!*gargv)
|
||||||
return ("");
|
return ("");
|
||||||
@ -411,8 +405,7 @@ getstr()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getint(ip)
|
getint(int *ip)
|
||||||
int *ip;
|
|
||||||
{
|
{
|
||||||
quad_t val;
|
quad_t val;
|
||||||
u_quad_t uval;
|
u_quad_t uval;
|
||||||
@ -430,10 +423,7 @@ getint(ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getquads(qp, uqp, signedconv)
|
getquads(quad_t *qp, u_quad_t *uqp, int signedconv)
|
||||||
quad_t *qp;
|
|
||||||
u_quad_t *uqp;
|
|
||||||
int signedconv;
|
|
||||||
{
|
{
|
||||||
char *ep;
|
char *ep;
|
||||||
int rval;
|
int rval;
|
||||||
@ -472,8 +462,7 @@ getquads(qp, uqp, signedconv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getdouble(dp)
|
getdouble(double *dp)
|
||||||
double *dp;
|
|
||||||
{
|
{
|
||||||
char *ep;
|
char *ep;
|
||||||
int rval;
|
int rval;
|
||||||
@ -503,9 +492,9 @@ getdouble(dp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
asciicode()
|
asciicode(void)
|
||||||
{
|
{
|
||||||
register int ch;
|
int ch;
|
||||||
|
|
||||||
ch = **gargv;
|
ch = **gargv;
|
||||||
if (ch == '\'' || ch == '"')
|
if (ch == '\'' || ch == '"')
|
||||||
@ -515,7 +504,7 @@ asciicode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: printf format [arg ...]\n");
|
(void)fprintf(stderr, "usage: printf format [arg ...]\n");
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
const char *filename, *p, *t;
|
const char *filename, *p, *t;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -108,7 +106,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: rev [file ...]\n");
|
(void)fprintf(stderr, "usage: rev [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -177,7 +177,7 @@ makemsg(const char *fname)
|
|||||||
mbuf = malloc(mbufsize);
|
mbuf = malloc(mbufsize);
|
||||||
if (mbuf == NULL)
|
if (mbuf == NULL)
|
||||||
err(1, "out of memory");
|
err(1, "out of memory");
|
||||||
if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize)
|
if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != (u_int)mbufsize)
|
||||||
err(1, "can't read temporary file");
|
err(1, "can't read temporary file");
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,7 @@ void finish(void);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int cc;
|
int cc;
|
||||||
struct termios rtt, stt;
|
struct termios rtt, stt;
|
||||||
@ -199,7 +197,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: script [-a] [-q] [-k] [-t time] [file] [command]\n");
|
"usage: script [-a] [-q] [-k] [-t time] [file] [command]\n");
|
||||||
@ -207,7 +205,7 @@ usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
finish()
|
finish(void)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int die, e, status;
|
int die, e, status;
|
||||||
@ -229,8 +227,7 @@ finish()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
doshell(av)
|
doshell(char **av)
|
||||||
char **av;
|
|
||||||
{
|
{
|
||||||
const char *shell;
|
const char *shell;
|
||||||
|
|
||||||
@ -252,15 +249,14 @@ doshell(av)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fail()
|
fail(void)
|
||||||
{
|
{
|
||||||
(void)kill(0, SIGTERM);
|
(void)kill(0, SIGTERM);
|
||||||
done(1);
|
done(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
done(eno)
|
done(int eno)
|
||||||
int eno;
|
|
||||||
{
|
{
|
||||||
time_t tvec;
|
time_t tvec;
|
||||||
|
|
||||||
|
@ -70,9 +70,7 @@ static const char rcsid[] =
|
|||||||
int process(const char *);
|
int process(const char *);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
@ -90,11 +88,10 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
process(file)
|
process(const char *file)
|
||||||
const char *file;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
char *cp;
|
||||||
register int c;
|
int c;
|
||||||
char fname[BUFSIZ];
|
char fname[BUFSIZ];
|
||||||
FILE *soee;
|
FILE *soee;
|
||||||
int isfile;
|
int isfile;
|
||||||
|
@ -66,13 +66,11 @@ void add(int, const char *);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register LIST *p;
|
LIST *p;
|
||||||
register int n, fd, rval, wval;
|
int n, fd, rval, wval;
|
||||||
register char *bp;
|
char *bp;
|
||||||
int append, ch, exitval;
|
int append, ch, exitval;
|
||||||
char *buf;
|
char *buf;
|
||||||
#define BSIZE (8 * 1024)
|
#define BSIZE (8 * 1024)
|
||||||
@ -125,16 +123,14 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: tee [-ai] [file ...]\n");
|
(void)fprintf(stderr, "usage: tee [-ai] [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add(fd, name)
|
add(int fd, const char *name)
|
||||||
int fd;
|
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
LIST *p;
|
LIST *p;
|
||||||
|
|
||||||
|
@ -68,11 +68,9 @@ static void usage(void);
|
|||||||
static char decimal_point;
|
static char decimal_point;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
register int pid;
|
int pid;
|
||||||
int aflag, ch, hflag, lflag, status, pflag;
|
int aflag, ch, hflag, lflag, status, pflag;
|
||||||
struct timeval before, after;
|
struct timeval before, after;
|
||||||
struct rusage ru;
|
struct rusage ru;
|
||||||
@ -223,7 +221,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: time [-al] [-h|-p] [-o file] utility [argument ...]\n");
|
"usage: time [-al] [-h|-p] [-o file] utility [argument ...]\n");
|
||||||
@ -234,7 +232,7 @@ usage()
|
|||||||
* Return the frequency of the kernel's statistics clock.
|
* Return the frequency of the kernel's statistics clock.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
getstathz()
|
getstathz(void)
|
||||||
{
|
{
|
||||||
struct clockinfo clockrate;
|
struct clockinfo clockrate;
|
||||||
int mib[2];
|
int mib[2];
|
||||||
@ -249,10 +247,7 @@ getstathz()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
humantime(out, sec, usec)
|
humantime(FILE *out, long sec, long usec)
|
||||||
FILE *out;
|
|
||||||
long sec;
|
|
||||||
long usec;
|
|
||||||
{
|
{
|
||||||
long days, hrs, mins;
|
long days, hrs, mins;
|
||||||
|
|
||||||
|
@ -65,9 +65,7 @@ void stime_file(char *, struct timeval *);
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
@ -197,9 +195,7 @@ main(argc, argv)
|
|||||||
#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
|
#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
|
||||||
|
|
||||||
void
|
void
|
||||||
stime_arg1(arg, tvp)
|
stime_arg1(char *arg, struct timeval *tvp)
|
||||||
char *arg;
|
|
||||||
struct timeval *tvp;
|
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *t;
|
struct tm *t;
|
||||||
@ -260,10 +256,7 @@ terr: errx(1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
stime_arg2(arg, year, tvp)
|
stime_arg2(char *arg, int year, struct timeval *tvp)
|
||||||
char *arg;
|
|
||||||
int year;
|
|
||||||
struct timeval *tvp;
|
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *t;
|
struct tm *t;
|
||||||
@ -293,9 +286,7 @@ stime_arg2(arg, year, tvp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
stime_file(fname, tvp)
|
stime_file(char *fname, struct timeval *tvp)
|
||||||
char *fname;
|
|
||||||
struct timeval *tvp;
|
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@ -306,10 +297,7 @@ stime_file(fname, tvp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rw(fname, sbp, force)
|
rw(char *fname, struct stat *sbp, int force)
|
||||||
char *fname;
|
|
||||||
struct stat *sbp;
|
|
||||||
int force;
|
|
||||||
{
|
{
|
||||||
int fd, needed_chmod, rval;
|
int fd, needed_chmod, rval;
|
||||||
u_char byte;
|
u_char byte;
|
||||||
@ -358,7 +346,7 @@ err: rval = 1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: touch [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...\n");
|
(void)fprintf(stderr, "usage: touch [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -62,9 +62,7 @@ static void usage(void);
|
|||||||
static char **process(const char *, char *, char **);
|
static char **process(const char *, char *, char **);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int ch, exitval, n;
|
int ch, exitval, n;
|
||||||
char *cptr, *term, buf[1024], tbuf[1024];
|
char *cptr, *term, buf[1024], tbuf[1024];
|
||||||
@ -120,8 +118,7 @@ errx(2, "no terminal type specified and no TERM environmental variable.");
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prlongname(buf)
|
prlongname(char *buf)
|
||||||
char *buf;
|
|
||||||
{
|
{
|
||||||
int savech;
|
int savech;
|
||||||
char *p, *savep;
|
char *p, *savep;
|
||||||
@ -134,9 +131,7 @@ prlongname(buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char **
|
static char **
|
||||||
process(cap, str, argv)
|
process(const char *cap, char *str, char **argv)
|
||||||
const char *cap;
|
|
||||||
char *str, **argv;
|
|
||||||
{
|
{
|
||||||
static const char errfew[] =
|
static const char errfew[] =
|
||||||
"not enough arguments (%d) for capability `%s'";
|
"not enough arguments (%d) for capability `%s'";
|
||||||
@ -211,7 +206,7 @@ process(cap, str, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: tput [-T term] attribute ...\n");
|
(void)fprintf(stderr, "usage: tput [-T term] attribute ...\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
|
@ -106,9 +106,7 @@ static void setup(int *, char *, STR *, int, int);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
static int collorder[NCHARS], tmpmap[NCHARS];
|
static int collorder[NCHARS], tmpmap[NCHARS];
|
||||||
int ch, cnt, lastch, *p;
|
int ch, cnt, lastch, *p;
|
||||||
@ -280,12 +278,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup(string, arg, str, cflag, Cflag)
|
setup(int *string, char *arg, STR *str, int cflag, int Cflag)
|
||||||
int *string;
|
|
||||||
char *arg;
|
|
||||||
STR *str;
|
|
||||||
int cflag;
|
|
||||||
int Cflag;
|
|
||||||
{
|
{
|
||||||
int cnt, *p;
|
int cnt, *p;
|
||||||
|
|
||||||
@ -313,7 +306,7 @@ charcoll(const void *a, const void *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
||||||
"usage: tr [-Ccsu] string1 string2",
|
"usage: tr [-Ccsu] string1 string2",
|
||||||
|
@ -72,9 +72,7 @@ int Lines, Columns; /* window size */
|
|||||||
speed_t Ospeed;
|
speed_t Ospeed;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
#ifdef TIOCGWINSZ
|
#ifdef TIOCGWINSZ
|
||||||
struct winsize win;
|
struct winsize win;
|
||||||
@ -242,10 +240,7 @@ main(argc, argv)
|
|||||||
* Tell the user if a control key has been changed from the default value.
|
* Tell the user if a control key has been changed from the default value.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
report(name, which, def)
|
report(const char *name, int which, u_int def)
|
||||||
const char *name;
|
|
||||||
int which;
|
|
||||||
u_int def;
|
|
||||||
{
|
{
|
||||||
u_int old, new;
|
u_int old, new;
|
||||||
|
|
||||||
@ -273,8 +268,7 @@ report(name, which, def)
|
|||||||
* This means that -e, -i and -k get default arguments supplied for them.
|
* This means that -e, -i and -k get default arguments supplied for them.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
obsolete(argv)
|
obsolete(char *argv[])
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
for (; *argv; ++argv) {
|
for (; *argv; ++argv) {
|
||||||
if (argv[0][0] != '-' || (argv[1] && argv[1][0] != '-') ||
|
if (argv[0][0] != '-' || (argv[1] && argv[1][0] != '-') ||
|
||||||
@ -296,7 +290,7 @@ obsolete(argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n",
|
||||||
"usage: tset [-IQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]",
|
"usage: tset [-IQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]",
|
||||||
|
@ -113,12 +113,10 @@ void tsort(void);
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register BUF *b;
|
BUF *b;
|
||||||
register int c, n;
|
int c, n;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int bsize, ch, nused;
|
int bsize, ch, nused;
|
||||||
BUF bufs[2];
|
BUF bufs[2];
|
||||||
@ -190,9 +188,7 @@ main(argc, argv)
|
|||||||
|
|
||||||
/* double the size of oldbuf and return a pointer to the new buffer. */
|
/* double the size of oldbuf and return a pointer to the new buffer. */
|
||||||
void *
|
void *
|
||||||
grow_buf(bp, size)
|
grow_buf(void *bp, size_t size)
|
||||||
void *bp;
|
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
if ((bp = realloc(bp, size)) == NULL)
|
if ((bp = realloc(bp, size)) == NULL)
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
@ -204,10 +200,9 @@ grow_buf(bp, size)
|
|||||||
* the graph, then add them.
|
* the graph, then add them.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
add_arc(s1, s2)
|
add_arc(char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
register NODE *n1;
|
NODE *n1;
|
||||||
NODE *n2;
|
NODE *n2;
|
||||||
int bsize, i;
|
int bsize, i;
|
||||||
|
|
||||||
@ -240,8 +235,7 @@ add_arc(s1, s2)
|
|||||||
|
|
||||||
/* Find a node in the graph (insert if not found) and return a pointer to it. */
|
/* Find a node in the graph (insert if not found) and return a pointer to it. */
|
||||||
NODE *
|
NODE *
|
||||||
get_node(name)
|
get_node(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
DBT data, key;
|
DBT data, key;
|
||||||
NODE *n;
|
NODE *n;
|
||||||
@ -293,7 +287,7 @@ get_node(name)
|
|||||||
* Clear the NODEST flag from all nodes.
|
* Clear the NODEST flag from all nodes.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clear_cycle()
|
clear_cycle(void)
|
||||||
{
|
{
|
||||||
NODE *n;
|
NODE *n;
|
||||||
|
|
||||||
@ -303,10 +297,10 @@ clear_cycle()
|
|||||||
|
|
||||||
/* do topological sort on graph */
|
/* do topological sort on graph */
|
||||||
void
|
void
|
||||||
tsort()
|
tsort(void)
|
||||||
{
|
{
|
||||||
register NODE *n, *next;
|
NODE *n, *next;
|
||||||
register int cnt, i;
|
int cnt, i;
|
||||||
|
|
||||||
while (graph != NULL) {
|
while (graph != NULL) {
|
||||||
/*
|
/*
|
||||||
@ -366,11 +360,10 @@ tsort()
|
|||||||
|
|
||||||
/* print node and remove from graph (does not actually free node) */
|
/* print node and remove from graph (does not actually free node) */
|
||||||
void
|
void
|
||||||
remove_node(n)
|
remove_node(NODE *n)
|
||||||
register NODE *n;
|
|
||||||
{
|
{
|
||||||
register NODE **np;
|
NODE **np;
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
(void)printf("%s\n", n->n_name);
|
(void)printf("%s\n", n->n_name);
|
||||||
for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
|
for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
|
||||||
@ -384,12 +377,10 @@ remove_node(n)
|
|||||||
|
|
||||||
/* look for the longest? cycle from node from to node to. */
|
/* look for the longest? cycle from node from to node to. */
|
||||||
int
|
int
|
||||||
find_cycle(from, to, longest_len, depth)
|
find_cycle(NODE *from, NODE *to, int longest_len, int depth)
|
||||||
NODE *from, *to;
|
|
||||||
int depth, longest_len;
|
|
||||||
{
|
{
|
||||||
register NODE **np;
|
NODE **np;
|
||||||
register int i, len;
|
int i, len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* avoid infinite loops and ignore portions of the graph known
|
* avoid infinite loops and ignore portions of the graph known
|
||||||
@ -432,7 +423,7 @@ find_cycle(from, to, longest_len, depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: tsort [-dlq] [file]\n");
|
(void)fprintf(stderr, "usage: tsort [-dlq] [file]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -101,9 +101,7 @@ void outc(int);
|
|||||||
#define PRINT(s) if (s == NULL) /* void */; else tputs(s, 1, outchar)
|
#define PRINT(s) if (s == NULL) /* void */; else tputs(s, 1, outchar)
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
const char *termtype;
|
const char *termtype;
|
||||||
@ -159,15 +157,14 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: ul [-i] [-t terminal] file...\n");
|
fprintf(stderr, "usage: ul [-i] [-t terminal] file...\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
filter(f)
|
filter(FILE *f)
|
||||||
FILE *f;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@ -277,7 +274,7 @@ filter(f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
flushln()
|
flushln(void)
|
||||||
{
|
{
|
||||||
int lastmode;
|
int lastmode;
|
||||||
int i;
|
int i;
|
||||||
@ -317,11 +314,11 @@ flushln()
|
|||||||
* We don't do anything with halfline ups and downs, or Greek.
|
* We don't do anything with halfline ups and downs, or Greek.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
overstrike()
|
overstrike(void)
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
char lbuf[256];
|
char lbuf[256];
|
||||||
register char *cp = lbuf;
|
char *cp = lbuf;
|
||||||
int hadbold=0;
|
int hadbold=0;
|
||||||
|
|
||||||
/* Set up overstrike buffer */
|
/* Set up overstrike buffer */
|
||||||
@ -355,11 +352,11 @@ overstrike()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
iattr()
|
iattr(void)
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
char lbuf[256];
|
char lbuf[256];
|
||||||
register char *cp = lbuf;
|
char *cp = lbuf;
|
||||||
|
|
||||||
for (i=0; i<maxcol; i++)
|
for (i=0; i<maxcol; i++)
|
||||||
switch (obuf[i].c_mode) {
|
switch (obuf[i].c_mode) {
|
||||||
@ -379,7 +376,7 @@ iattr()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initbuf()
|
initbuf(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
bzero((char *)obuf, sizeof (obuf)); /* depends on NORMAL == 0 */
|
bzero((char *)obuf, sizeof (obuf)); /* depends on NORMAL == 0 */
|
||||||
@ -389,7 +386,7 @@ initbuf()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fwd()
|
fwd(void)
|
||||||
{
|
{
|
||||||
int oldcol, oldmax;
|
int oldcol, oldmax;
|
||||||
|
|
||||||
@ -401,7 +398,7 @@ fwd()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
reverse()
|
reverse(void)
|
||||||
{
|
{
|
||||||
upln++;
|
upln++;
|
||||||
fwd();
|
fwd();
|
||||||
@ -411,7 +408,7 @@ reverse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initcap()
|
initcap(void)
|
||||||
{
|
{
|
||||||
static char tcapbuf[512];
|
static char tcapbuf[512];
|
||||||
char *bp = tcapbuf;
|
char *bp = tcapbuf;
|
||||||
@ -464,8 +461,7 @@ initcap()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
outchar(c)
|
outchar(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
return(putchar(c & 0177));
|
return(putchar(c & 0177));
|
||||||
}
|
}
|
||||||
@ -473,8 +469,7 @@ outchar(c)
|
|||||||
static int curmode = 0;
|
static int curmode = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
outc(c)
|
outc(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
putchar(c);
|
putchar(c);
|
||||||
if (must_use_uc && (curmode&UNDERL)) {
|
if (must_use_uc && (curmode&UNDERL)) {
|
||||||
@ -484,8 +479,7 @@ outc(c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setnewmode(newmode)
|
setnewmode(int newmode)
|
||||||
int newmode;
|
|
||||||
{
|
{
|
||||||
if (!iflag) {
|
if (!iflag) {
|
||||||
if (curmode != NORMAL && newmode != NORMAL)
|
if (curmode != NORMAL && newmode != NORMAL)
|
||||||
|
@ -56,9 +56,7 @@ static const char sccsid[] = "@(#)uname.c 8.2 (Berkeley) 5/4/95";
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
#define MFLAG 0x01
|
#define MFLAG 0x01
|
||||||
#define NFLAG 0x02
|
#define NFLAG 0x02
|
||||||
@ -174,7 +172,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: uname [-amnprsv]\n");
|
(void)fprintf(stderr, "usage: uname [-amnprsv]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -66,9 +66,7 @@ static void usage(void);
|
|||||||
static void tabify(void);
|
static void tabify(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int ch, failed;
|
int ch, failed;
|
||||||
char *filename;
|
char *filename;
|
||||||
@ -110,14 +108,14 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: unexpand [-a] [-t tablist] [file ...]\n");
|
fprintf(stderr, "usage: unexpand [-a] [-t tablist] [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tabify()
|
tabify(void)
|
||||||
{
|
{
|
||||||
int ch, dcol, doneline, limit, n, ocol;
|
int ch, dcol, doneline, limit, n, ocol;
|
||||||
|
|
||||||
@ -199,8 +197,7 @@ tabify()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
getstops(cp)
|
getstops(const char *cp)
|
||||||
const char *cp;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -71,11 +71,9 @@ static void usage(void);
|
|||||||
int stricoll(char *, char*);
|
int stricoll(char *, char*);
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register char *t1, *t2;
|
char *t1, *t2;
|
||||||
FILE *ifp, *ofp;
|
FILE *ifp, *ofp;
|
||||||
int ch;
|
int ch;
|
||||||
char *prevline, *thisline, *p;
|
char *prevline, *thisline, *p;
|
||||||
@ -199,9 +197,7 @@ getline(char *buf, size_t buflen, FILE *fp)
|
|||||||
* of the line.
|
* of the line.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
show(ofp, str)
|
show(FILE *ofp, char *str)
|
||||||
FILE *ofp;
|
|
||||||
char *str;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (cflag && *str)
|
if (cflag && *str)
|
||||||
@ -211,10 +207,9 @@ show(ofp, str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
skip(str)
|
skip(char *str)
|
||||||
register char *str;
|
|
||||||
{
|
{
|
||||||
register int nchars, nfields;
|
int nchars, nfields;
|
||||||
|
|
||||||
for (nfields = 0; *str != '\0' && nfields++ != numfields; ) {
|
for (nfields = 0; *str != '\0' && nfields++ != numfields; ) {
|
||||||
while (isblank((unsigned char)*str))
|
while (isblank((unsigned char)*str))
|
||||||
@ -227,8 +222,7 @@ skip(str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
file(name, mode)
|
file(const char *name, const char *mode)
|
||||||
const char *name, *mode;
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
@ -238,8 +232,7 @@ file(name, mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
obsolete(argv)
|
obsolete(char *argv[])
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char *ap, *p, *start;
|
char *ap, *p, *start;
|
||||||
@ -268,7 +261,7 @@ obsolete(argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
|
"usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
|
||||||
@ -276,8 +269,7 @@ usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
stricoll(s1, s2)
|
stricoll(char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
char *p, line1[MAXLINELEN], line2[MAXLINELEN];
|
char *p, line1[MAXLINELEN], line2[MAXLINELEN];
|
||||||
|
|
||||||
|
@ -55,9 +55,7 @@ void process(FILE *, const char *);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int ch;
|
int ch;
|
||||||
@ -85,18 +83,16 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: unvis [file ...]\n");
|
fprintf(stderr, "usage: unvis [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
process(fp, filename)
|
process(FILE *fp, const char *filename)
|
||||||
FILE *fp;
|
|
||||||
const char *filename;
|
|
||||||
{
|
{
|
||||||
register int offset = 0, c, ret;
|
int offset = 0, c, ret;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
char outc;
|
char outc;
|
||||||
|
|
||||||
|
@ -59,9 +59,7 @@ int scmp(const void *, const void *);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
namebuf *names = NULL;
|
namebuf *names = NULL;
|
||||||
int ncnt = 0;
|
int ncnt = 0;
|
||||||
@ -107,15 +105,14 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: users\n");
|
(void)fprintf(stderr, "usage: users\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scmp(p, q)
|
scmp(const void *p, const void *q)
|
||||||
const void *p, *q;
|
|
||||||
{
|
{
|
||||||
return(strncmp(p, q, UT_NAMESIZE));
|
return(strncmp(p, q, UT_NAMESIZE));
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,7 @@ void process(FILE *);
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int ch;
|
int ch;
|
||||||
@ -129,7 +127,7 @@ main(argc, argv)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "usage: vis [-cbflnostwd] [-F foldwidth] [file ...]\n");
|
fprintf(stderr, "usage: vis [-cbflnostwd] [-F foldwidth] [file ...]\n");
|
||||||
@ -140,13 +138,12 @@ usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
process(fp)
|
process(FILE *fp)
|
||||||
FILE *fp;
|
|
||||||
{
|
{
|
||||||
static int col = 0;
|
static int col = 0;
|
||||||
static char dummy[] = "\0";
|
static char dummy[] = "\0";
|
||||||
register char *cp = dummy+1; /* so *(cp-1) starts out != '\n' */
|
char *cp = dummy+1; /* so *(cp-1) starts out != '\n' */
|
||||||
register int c, rachar;
|
int c, rachar;
|
||||||
char buff[5];
|
char buff[5];
|
||||||
|
|
||||||
c = getc(fp);
|
c = getc(fp);
|
||||||
|
@ -60,9 +60,7 @@ static void usage(void);
|
|||||||
* what
|
* what
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@ -90,16 +88,16 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: what [-s] [file ...]\n");
|
(void)fprintf(stderr, "usage: what [-s] [file ...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
search()
|
search(void)
|
||||||
{
|
{
|
||||||
register int c;
|
int c;
|
||||||
|
|
||||||
while ((c = getchar()) != EOF) {
|
while ((c = getchar()) != EOF) {
|
||||||
loop: if (c != '@')
|
loop: if (c != '@')
|
||||||
|
@ -74,11 +74,9 @@ void search_utmp(char *, char *, char *, uid_t);
|
|||||||
int utmp_chk(char *, char *);
|
int utmp_chk(char *, char *);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
char *cp;
|
||||||
time_t atime;
|
time_t atime;
|
||||||
uid_t myuid;
|
uid_t myuid;
|
||||||
int msgsok, myttyfd;
|
int msgsok, myttyfd;
|
||||||
@ -136,7 +134,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: write user [tty]\n");
|
(void)fprintf(stderr, "usage: write user [tty]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -147,8 +145,7 @@ usage()
|
|||||||
* the given tty
|
* the given tty
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
utmp_chk(user, tty)
|
utmp_chk(char *user, char *tty)
|
||||||
char *user, *tty;
|
|
||||||
{
|
{
|
||||||
struct utmp u;
|
struct utmp u;
|
||||||
int ufd;
|
int ufd;
|
||||||
@ -179,9 +176,7 @@ utmp_chk(user, tty)
|
|||||||
* writing from, unless that's the only terminal with messages enabled.
|
* writing from, unless that's the only terminal with messages enabled.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
search_utmp(user, tty, mytty, myuid)
|
search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
|
||||||
char *user, *tty, *mytty;
|
|
||||||
uid_t myuid;
|
|
||||||
{
|
{
|
||||||
struct utmp u;
|
struct utmp u;
|
||||||
time_t bestatime, atime;
|
time_t bestatime, atime;
|
||||||
@ -233,10 +228,7 @@ search_utmp(user, tty, mytty, myuid)
|
|||||||
* and the access time
|
* and the access time
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
term_chk(tty, msgsokP, atimeP, showerror)
|
term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
|
||||||
char *tty;
|
|
||||||
int *msgsokP, showerror;
|
|
||||||
time_t *atimeP;
|
|
||||||
{
|
{
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
@ -256,9 +248,7 @@ term_chk(tty, msgsokP, atimeP, showerror)
|
|||||||
* do_write - actually make the connection
|
* do_write - actually make the connection
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
do_write(tty, mytty, myuid)
|
do_write(char *tty, char *mytty, uid_t myuid)
|
||||||
char *tty, *mytty;
|
|
||||||
uid_t myuid;
|
|
||||||
{
|
{
|
||||||
const char *login;
|
const char *login;
|
||||||
char *nows;
|
char *nows;
|
||||||
@ -298,8 +288,7 @@ do_write(tty, mytty, myuid)
|
|||||||
* done - cleanup and exit
|
* done - cleanup and exit
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
done(n)
|
done(int n __unused)
|
||||||
int n __unused;
|
|
||||||
{
|
{
|
||||||
(void)printf("EOF\r\n");
|
(void)printf("EOF\r\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -310,8 +299,7 @@ done(n)
|
|||||||
* turns \n into \r\n
|
* turns \n into \r\n
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
wr_fputs(s)
|
wr_fputs(unsigned char *s)
|
||||||
unsigned char *s;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
#define PUTC(c) if (putchar(c) == EOF) err(1, NULL);
|
#define PUTC(c) if (putchar(c) == EOF) err(1, NULL);
|
||||||
|
@ -100,9 +100,7 @@ int trymmap(int);
|
|||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct stat from_sb, to_sb;
|
struct stat from_sb, to_sb;
|
||||||
mode_t *set;
|
mode_t *set;
|
||||||
@ -238,8 +236,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
u_long
|
u_long
|
||||||
numeric_id(name, type)
|
numeric_id(const char *name, const char *type)
|
||||||
const char *name, *type;
|
|
||||||
{
|
{
|
||||||
u_long val;
|
u_long val;
|
||||||
char *ep;
|
char *ep;
|
||||||
@ -262,10 +259,7 @@ numeric_id(name, type)
|
|||||||
* build a path name and install the file
|
* build a path name and install the file
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
install(from_name, to_name, fset, flags)
|
install(const char *from_name, const char *to_name, u_long fset, u_int flags)
|
||||||
const char *from_name, *to_name;
|
|
||||||
u_long fset;
|
|
||||||
u_int flags;
|
|
||||||
{
|
{
|
||||||
struct stat from_sb, temp_sb, to_sb;
|
struct stat from_sb, temp_sb, to_sb;
|
||||||
struct utimbuf utb;
|
struct utimbuf utb;
|
||||||
@ -575,10 +569,7 @@ compare(int from_fd, const char *from_name __unused, size_t from_len,
|
|||||||
* create a temporary file based on path and open it
|
* create a temporary file based on path and open it
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
create_tempfile(path, temp, tsize)
|
create_tempfile(const char *path, char *temp, size_t tsize)
|
||||||
const char *path;
|
|
||||||
char *temp;
|
|
||||||
size_t tsize;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -598,10 +589,7 @@ create_tempfile(path, temp, tsize)
|
|||||||
* create a new file, overwriting an existing one if necessary
|
* create a new file, overwriting an existing one if necessary
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
create_newfile(path, target, sbp)
|
create_newfile(const char *path, int target, struct stat *sbp)
|
||||||
const char *path;
|
|
||||||
int target;
|
|
||||||
struct stat *sbp;
|
|
||||||
{
|
{
|
||||||
char backup[MAXPATHLEN];
|
char backup[MAXPATHLEN];
|
||||||
|
|
||||||
@ -638,12 +626,10 @@ create_newfile(path, target, sbp)
|
|||||||
* copy from one file to another
|
* copy from one file to another
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
copy(from_fd, from_name, to_fd, to_name, size)
|
copy(int from_fd, const char *from_name, int to_fd, const char *to_name,
|
||||||
register int from_fd, to_fd;
|
off_t size)
|
||||||
const char *from_name, *to_name;
|
|
||||||
off_t size;
|
|
||||||
{
|
{
|
||||||
register int nr, nw;
|
int nr, nw;
|
||||||
int serrno;
|
int serrno;
|
||||||
char *p, buf[MAXBSIZE];
|
char *p, buf[MAXBSIZE];
|
||||||
int done_copy;
|
int done_copy;
|
||||||
@ -693,8 +679,7 @@ copy(from_fd, from_name, to_fd, to_name, size)
|
|||||||
* use strip(1) to strip the target file
|
* use strip(1) to strip the target file
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
strip(to_name)
|
strip(const char *to_name)
|
||||||
const char *to_name;
|
|
||||||
{
|
{
|
||||||
const char *stripbin;
|
const char *stripbin;
|
||||||
int serrno, status;
|
int serrno, status;
|
||||||
@ -726,10 +711,9 @@ strip(to_name)
|
|||||||
* build directory heirarchy
|
* build directory heirarchy
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
install_dir(path)
|
install_dir(char *path)
|
||||||
char *path;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
char *p;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
@ -761,7 +745,7 @@ install_dir(path)
|
|||||||
* print a usage message and die
|
* print a usage message and die
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "\
|
(void)fprintf(stderr, "\
|
||||||
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n\
|
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n\
|
||||||
@ -778,8 +762,7 @@ usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n\
|
|||||||
* return true (1) if mmap should be tried, false (0) if not.
|
* return true (1) if mmap should be tried, false (0) if not.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
trymmap(fd)
|
trymmap(int fd)
|
||||||
int fd;
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The ifdef is for bootstrapping - f_fstypename doesn't exist in
|
* The ifdef is for bootstrapping - f_fstypename doesn't exist in
|
||||||
|
@ -97,9 +97,7 @@ void prstr(char *);
|
|||||||
void xsdotc(void);
|
void xsdotc(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@ -146,7 +144,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage()
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: xstr [-v] [-c] [-] [name ...]\n");
|
fprintf(stderr, "usage: xstr [-v] [-c] [-] [name ...]\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
@ -155,8 +153,7 @@ usage()
|
|||||||
char linebuf[BUFSIZ];
|
char linebuf[BUFSIZ];
|
||||||
|
|
||||||
void
|
void
|
||||||
process(name)
|
process(const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
int c;
|
int c;
|
||||||
@ -224,8 +221,7 @@ process(name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
off_t
|
off_t
|
||||||
yankstr(cpp)
|
yankstr(char **cpp)
|
||||||
char **cpp;
|
|
||||||
{
|
{
|
||||||
char *cp = *cpp;
|
char *cp = *cpp;
|
||||||
int c, ch;
|
int c, ch;
|
||||||
@ -283,14 +279,13 @@ yankstr(cpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
octdigit(c)
|
octdigit(char c)
|
||||||
char c;
|
|
||||||
{
|
{
|
||||||
return (isdigit(c) && c != '8' && c != '9');
|
return (isdigit(c) && c != '8' && c != '9');
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
inithash()
|
inithash(void)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
FILE *mesgread = fopen(strings, "r");
|
FILE *mesgread = fopen(strings, "r");
|
||||||
@ -307,10 +302,7 @@ inithash()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fgetNUL(obuf, rmdr, file)
|
fgetNUL(char *obuf, int rmdr, FILE *file)
|
||||||
char *obuf;
|
|
||||||
int rmdr;
|
|
||||||
FILE *file;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char *buf = obuf;
|
char *buf = obuf;
|
||||||
@ -322,8 +314,7 @@ fgetNUL(obuf, rmdr, file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xgetc(file)
|
xgetc(FILE *file)
|
||||||
FILE *file;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
tellpt++;
|
tellpt++;
|
||||||
@ -340,9 +331,7 @@ struct hash {
|
|||||||
} bucket[BUCKETS];
|
} bucket[BUCKETS];
|
||||||
|
|
||||||
off_t
|
off_t
|
||||||
hashit(str, new)
|
hashit(char *str, int new)
|
||||||
char *str;
|
|
||||||
int new;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct hash *hp, *hp0;
|
struct hash *hp, *hp0;
|
||||||
@ -367,7 +356,7 @@ hashit(str, new)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
flushsh()
|
flushsh(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct hash *hp;
|
struct hash *hp;
|
||||||
@ -400,10 +389,7 @@ flushsh()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
found(new, off, str)
|
found(int new, off_t off, char *str)
|
||||||
int new;
|
|
||||||
off_t off;
|
|
||||||
char *str;
|
|
||||||
{
|
{
|
||||||
if (vflg == 0)
|
if (vflg == 0)
|
||||||
return;
|
return;
|
||||||
@ -416,8 +402,7 @@ found(new, off, str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prstr(cp)
|
prstr(char *cp)
|
||||||
char *cp;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@ -433,7 +418,7 @@ prstr(cp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xsdotc()
|
xsdotc(void)
|
||||||
{
|
{
|
||||||
FILE *strf = fopen(strings, "r");
|
FILE *strf = fopen(strings, "r");
|
||||||
FILE *xdotcf;
|
FILE *xdotcf;
|
||||||
@ -468,8 +453,7 @@ xsdotc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
char
|
char
|
||||||
lastchr(cp)
|
lastchr(char *cp)
|
||||||
char *cp;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
while (cp[0] && cp[1])
|
while (cp[0] && cp[1])
|
||||||
@ -478,8 +462,7 @@ lastchr(cp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
istail(str, of)
|
istail(char *str, char *of)
|
||||||
char *str, *of;
|
|
||||||
{
|
{
|
||||||
int d = strlen(of) - strlen(str);
|
int d = strlen(of) - strlen(str);
|
||||||
|
|
||||||
@ -489,8 +472,7 @@ istail(str, of)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
onintr(dummy)
|
onintr(int dummy __unused)
|
||||||
int dummy __unused;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ignore(signal(SIGINT, SIG_IGN));
|
ignore(signal(SIGINT, SIG_IGN));
|
||||||
|
@ -48,9 +48,7 @@ static const char rcsid[] = "$FreeBSD$";
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
for(;;)
|
for(;;)
|
||||||
|
Loading…
Reference in New Issue
Block a user