ANSIfy and remove register.

Resulting binary verified with strip(1)+md5(1).
This commit is contained in:
Xin LI 2008-01-16 19:27:43 +00:00
parent f831d6e073
commit 93b9f50404
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175387
18 changed files with 99 additions and 169 deletions

View File

@ -49,8 +49,7 @@ static const char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95";
#include "extern.h"
void
command(cmd)
const char *cmd;
command(const char *cmd)
{
struct cmdtab *p;
char *cp, *tmpstr, *tmpstr1;
@ -150,8 +149,7 @@ command(cmd)
}
struct cmdtab *
lookup(name)
const char *name;
lookup(const char *name)
{
const char *p, *q;
struct cmdtab *ct, *found;
@ -179,7 +177,7 @@ lookup(name)
}
void
status()
status(void)
{
error("Showing %s, refresh every %d seconds.",
@ -187,8 +185,7 @@ status()
}
int
prefix(s1, s2)
const char *s1, *s2;
prefix(const char *s1, const char *s2)
{
while (*s1 == *s2) {

View File

@ -126,7 +126,7 @@ get_scale(const char *name)
}
const char *
get_helplist()
get_helplist(void)
{
int i;
size_t len;

View File

@ -173,7 +173,7 @@ dscmd(const char *cmd, const char *args, int maxshowdevs, struct statinfo *s1)
return(2);
}
if (prefix(cmd, "drives")) {
register int i;
int i;
move(CMDLINE, 0);
clrtoeol();
for (i = 0; i < num_devices; i++) {

View File

@ -51,9 +51,7 @@ static const char sccsid[] = "@(#)fetch.c 8.1 (Berkeley) 6/6/93";
#include "extern.h"
int
kvm_ckread(a, b, l)
void *a, *b;
int l;
kvm_ckread(void *a, void *b, int l)
{
if (kvm_read(kd, (u_long)a, b, l) != l) {
if (verbose)
@ -64,10 +62,7 @@ kvm_ckread(a, b, l)
return (1);
}
void getsysctl(name, ptr, len)
const char *name;
void *ptr;
size_t len;
void getsysctl(const char *name, void *ptr, size_t len)
{
size_t nlen = len;
if (sysctlbyname(name, ptr, &nlen, NULL, 0) != 0) {
@ -103,9 +98,7 @@ void getsysctl(name, ptr, len)
#define SD_MAXMIB 16
char *
sysctl_dynread(n, szp)
const char *n;
size_t *szp;
sysctl_dynread(const char *n, size_t *szp)
{
char *rv = NULL;
int mib[SD_MAXMIB];

View File

@ -96,8 +96,7 @@ openicmp(void)
}
void
closeicmp(w)
WINDOW *w;
closeicmp(WINDOW *w)
{
if (w == NULL)
return;

View File

@ -94,8 +94,7 @@ openicmp6(void)
}
void
closeicmp6(w)
WINDOW *w;
closeicmp6(WINDOW *w)
{
if (w == NULL)
return;

View File

@ -95,14 +95,13 @@ static int devstats(int, int, int);
static void stat1(int, int);
WINDOW *
openiostat()
openiostat(void)
{
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
closeiostat(w)
WINDOW *w;
closeiostat(WINDOW *w)
{
if (w == NULL)
return;
@ -112,7 +111,7 @@ closeiostat(w)
}
int
initiostat()
initiostat(void)
{
if ((num_devices = devstat_getnumdevs(NULL)) < 0)
return(0);
@ -133,7 +132,7 @@ initiostat()
}
void
fetchiostat()
fetchiostat(void)
{
struct devinfo *tmp_dinfo;
size_t len;
@ -175,7 +174,7 @@ fetchiostat()
#define INSET 10
void
labeliostat()
labeliostat(void)
{
int row;
@ -195,8 +194,7 @@ labeliostat()
}
static int
numlabels(row)
int row;
numlabels(int row)
{
int i, _col, regions, ndrives;
char tmpstr[10];
@ -237,8 +235,7 @@ numlabels(row)
}
static int
barlabels(row)
int row;
barlabels(int row)
{
int i;
char tmpstr[10];
@ -263,7 +260,7 @@ barlabels(row)
void
showiostat()
showiostat(void)
{
long t;
int i, row, _col;
@ -312,8 +309,7 @@ showiostat()
}
static int
devstats(row, _col, dn)
int row, _col, dn;
devstats(int row, int _col, int dn)
{
long double transfers_per_second;
long double kb_per_transfer, mb_per_second;
@ -351,8 +347,7 @@ devstats(row, _col, dn)
}
static void
stat1(row, o)
int row, o;
stat1(int row, int o)
{
int i;
double dtime;
@ -368,10 +363,7 @@ stat1(row, o)
}
static void
histogram(val, colwidth, scale)
long double val;
int colwidth;
double scale;
histogram(long double val, int colwidth, double scale)
{
char buf[10];
int k;
@ -392,8 +384,7 @@ histogram(val, colwidth, scale)
}
int
cmdiostat(cmd, args)
const char *cmd, *args;
cmdiostat(const char *cmd, const char *args)
{
if (prefix(cmd, "kbpt"))

View File

@ -103,8 +103,7 @@ openip(void)
}
void
closeip(w)
WINDOW *w;
closeip(WINDOW *w)
{
if (w == NULL)
return;

View File

@ -98,8 +98,7 @@ openip6(void)
}
void
closeip6(w)
WINDOW *w;
closeip6(WINDOW *w)
{
if (w == NULL)
return;

View File

@ -47,7 +47,7 @@ static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
#include "extern.h"
int
keyboard()
keyboard(void)
{
char ch, line[80];
int oldmask;

View File

@ -180,7 +180,7 @@ main(int argc, char **argv)
}
void
labels()
labels(void)
{
if (curcmd->c_flags & CF_LOADAV) {
mvaddstr(0, 20,
@ -195,8 +195,7 @@ labels()
}
void
display(signo)
int signo __unused;
display(int signo __unused)
{
int i, j;
@ -231,7 +230,7 @@ display(signo)
}
void
load()
load(void)
{
(void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0]));
@ -241,8 +240,7 @@ load()
}
void
die(signo)
int signo __unused;
die(int signo __unused)
{
move(CMDLINE, 0);
clrtoeol();
@ -278,8 +276,7 @@ error(const char *fmt, ...)
}
void
nlisterr(n_list)
struct nlist n_list[];
nlisterr(struct nlist n_list[])
{
int i, n;

View File

@ -69,14 +69,13 @@ static struct mtnames {
#define NNAMES (sizeof (mtnames) / sizeof (mtnames[0]))
WINDOW *
openmbufs()
openmbufs(void)
{
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
closembufs(w)
WINDOW *w;
closembufs(WINDOW *w)
{
if (w == NULL)
return;
@ -86,7 +85,7 @@ closembufs(w)
}
void
labelmbufs()
labelmbufs(void)
{
wmove(wnd, 0, 0); wclrtoeol(wnd);
mvwaddstr(wnd, 0, 10,
@ -94,7 +93,7 @@ labelmbufs()
}
void
showmbufs()
showmbufs(void)
{
int i, j, max, idx;
u_long totmbufs;
@ -165,7 +164,7 @@ showmbufs()
}
int
initmbufs()
initmbufs(void)
{
size_t len;
@ -188,7 +187,7 @@ initmbufs()
}
void
fetchmbufs()
fetchmbufs(void)
{
size_t len;

View File

@ -81,8 +81,7 @@ static int selecthost(struct in_addr *, int);
static void showhosts(void);
int
netcmd(cmd, args)
const char *cmd, *args;
netcmd(const char *cmd, const char *args)
{
if (prefix(cmd, "proto")) {
@ -128,9 +127,7 @@ netcmd(cmd, args)
static void
changeitems(args, onoff)
const char *args;
int onoff;
changeitems(const char *args, int onoff)
{
char *cp, *tmpstr, *tmpstr1;
struct servent *sp;
@ -172,8 +169,7 @@ changeitems(args, onoff)
}
static int
selectproto(proto)
const char *proto;
selectproto(const char *proto)
{
if (proto == 0 || streq(proto, "all"))
@ -189,7 +185,7 @@ selectproto(proto)
}
static void
showprotos()
showprotos(void)
{
if ((protos&TCP) == 0)
@ -206,11 +202,9 @@ static struct pitem {
} *ports;
static int
selectport(port, onoff)
long port;
int onoff;
selectport(long port, int onoff)
{
register struct pitem *p;
struct pitem *p;
if (port == -1) {
if (ports == 0)
@ -235,10 +229,9 @@ selectport(port, onoff)
}
int
checkport(inp)
register struct inpcb *inp;
checkport(struct inpcb *inp)
{
register struct pitem *p;
struct pitem *p;
if (ports)
for (p = ports; p < ports+nports; p++)
@ -248,9 +241,9 @@ checkport(inp)
}
static void
showports()
showports(void)
{
register struct pitem *p;
struct pitem *p;
struct servent *sp;
for (p = ports; p < ports+nports; p++) {
@ -266,11 +259,9 @@ showports()
}
static int
selecthost(in, onoff)
struct in_addr *in;
int onoff;
selecthost(struct in_addr *in, int onoff)
{
register struct hitem *p;
struct hitem *p;
if (in == 0) {
if (hosts == 0)
@ -295,10 +286,9 @@ selecthost(in, onoff)
}
int
checkhost(inp)
register struct inpcb *inp;
checkhost(struct inpcb *inp)
{
register struct hitem *p;
struct hitem *p;
if (hosts)
for (p = hosts; p < hosts+nhosts; p++)
@ -309,9 +299,9 @@ checkhost(inp)
}
static void
showhosts()
showhosts(void)
{
register struct hitem *p;
struct hitem *p;
struct hostent *hp;
for (p = hosts; p < hosts+nhosts; p++) {

View File

@ -93,7 +93,7 @@ static void inetprint(struct sockaddr *, const char *);
#define YMAX(w) ((w)->_maxy-1)
WINDOW *
opennetstat()
opennetstat(void)
{
sethostent(1);
setnetent(1);
@ -122,8 +122,7 @@ static int nflag = 0;
static int lastrow = 1;
void
closenetstat(w)
WINDOW *w;
closenetstat(WINDOW *w)
{
struct netinfo *p;
@ -157,14 +156,14 @@ struct nlist namelist[] = {
};
int
initnetstat()
initnetstat(void)
{
protos = TCP|UDP;
return(1);
}
void
fetchnetstat()
fetchnetstat(void)
{
if (use_kvm)
fetchnetstat_kvm();
@ -173,7 +172,7 @@ fetchnetstat()
}
static void
fetchnetstat_kvm()
fetchnetstat_kvm(void)
{
struct inpcb *next;
struct netinfo *p;
@ -245,7 +244,7 @@ fetchnetstat_kvm()
}
static void
fetchnetstat_sysctl()
fetchnetstat_sysctl(void)
{
struct netinfo *p;
int idx;
@ -334,11 +333,7 @@ fetchnetstat_sysctl()
}
static void
enter_kvm(inp, so, state, proto)
struct inpcb *inp;
struct socket *so;
int state;
const char *proto;
enter_kvm(struct inpcb *inp, struct socket *so, int state, const char *proto)
{
struct netinfo *p;
@ -349,11 +344,7 @@ enter_kvm(inp, so, state, proto)
}
static void
enter_sysctl(inp, so, state, proto)
struct inpcb *inp;
struct xsocket *so;
int state;
const char *proto;
enter_sysctl(struct inpcb *inp, struct xsocket *so, int state, const char *proto)
{
struct netinfo *p;
@ -365,10 +356,7 @@ enter_sysctl(inp, so, state, proto)
static struct netinfo *
enter(inp, state, proto)
struct inpcb *inp;
int state;
const char *proto;
enter(struct inpcb *inp, int state, const char *proto)
{
struct netinfo *p;
struct sockaddr_storage lsa, fsa;
@ -456,7 +444,7 @@ enter(inp, state, proto)
void
labelnetstat()
labelnetstat(void)
{
if (use_kvm && namelist[X_TCB].n_type == 0)
return;
@ -470,7 +458,7 @@ labelnetstat()
}
void
shownetstat()
shownetstat(void)
{
struct netinfo *p, *q;
char proto[6];
@ -551,9 +539,7 @@ shownetstat()
* If the nflag was specified, use numbers instead of names.
*/
static void
inetprint(sa, proto)
struct sockaddr *sa;
const char *proto;
inetprint(struct sockaddr *sa, const char *proto)
{
struct servent *sp = 0;
char line[80], *cp;
@ -596,8 +582,7 @@ inetprint(sa, proto)
* numeric value, otherwise try for symbolic name.
*/
static char *
inetname(sa)
struct sockaddr *sa;
inetname(struct sockaddr *sa)
{
char *cp = 0;
static char line[NI_MAXHOST];
@ -647,8 +632,7 @@ inetname(sa)
}
int
cmdnetstat(cmd, args)
const char *cmd, *args;
cmdnetstat(const char *cmd, const char *args)
{
if (prefix(cmd, "all")) {
aflag = !aflag;

View File

@ -70,14 +70,13 @@ static int fscale;
static double lccpu;
WINDOW *
openpigs()
openpigs(void)
{
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
closepigs(w)
WINDOW *w;
closepigs(WINDOW *w)
{
if (w == NULL)
return;
@ -88,9 +87,9 @@ closepigs(w)
void
showpigs()
showpigs(void)
{
register int i, j, y, k;
int i, j, y, k;
const char *uname, *pname;
char pidname[30];
@ -118,7 +117,7 @@ showpigs()
}
int
initpigs()
initpigs(void)
{
fixpt_t ccpu;
size_t len;
@ -144,7 +143,7 @@ initpigs()
}
void
fetchpigs()
fetchpigs(void)
{
int i;
float ftime;
@ -183,7 +182,7 @@ fetchpigs()
}
void
labelpigs()
labelpigs(void)
{
wmove(wnd, 0, 0);
wclrtoeol(wnd);
@ -192,8 +191,7 @@ labelpigs()
}
int
compar(a, b)
const void *a, *b;
compar(const void *a, const void *b)
{
return (((const struct p_times *) a)->pt_pctcpu >
((const struct p_times *) b)->pt_pctcpu)? -1: 1;

View File

@ -68,14 +68,13 @@ static int ulen, oulen;
static int pagesize;
WINDOW *
openswap()
openswap(void)
{
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
closeswap(w)
WINDOW *w;
closeswap(WINDOW *w)
{
if (w == NULL)
return;
@ -100,7 +99,7 @@ static void calclens(void);
#define CONVERT(v) ((int)((int64_t)(v) * pagesize / blocksize))
static void
calclens()
calclens(void)
{
int i, n;
int len;
@ -119,7 +118,7 @@ calclens()
}
int
initswap()
initswap(void)
{
static int once = 0;
@ -144,7 +143,7 @@ initswap()
}
void
fetchswap()
fetchswap(void)
{
okvnsw = kvnsw;
@ -159,7 +158,7 @@ fetchswap()
}
void
labelswap()
labelswap(void)
{
const char *name;
int i;
@ -184,7 +183,7 @@ labelswap()
}
void
showswap()
showswap(void)
{
int count;
int i;

View File

@ -102,8 +102,7 @@ opentcp(void)
}
void
closetcp(w)
WINDOW *w;
closetcp(WINDOW *w)
{
if (w == NULL)
return;

View File

@ -154,7 +154,7 @@ struct utmp utmp;
WINDOW *
openkre()
openkre(void)
{
ut = open(_PATH_UTMP, O_RDONLY);
@ -164,8 +164,7 @@ openkre()
}
void
closekre(w)
WINDOW *w;
closekre(WINDOW *w)
{
(void) close(ut);
@ -206,7 +205,7 @@ closekre(w)
#define MAXDRIVES DRIVESPACE /* max # to display */
int
initkre()
initkre(void)
{
char *cp, *cp1, *cp2, *intrnamebuf, *nextcp;
int i;
@ -296,7 +295,7 @@ initkre()
}
void
fetchkre()
fetchkre(void)
{
time_t now;
struct tm *tp;
@ -313,7 +312,7 @@ fetchkre()
}
void
labelkre()
labelkre(void)
{
int i, j;
@ -416,7 +415,7 @@ static char cpuorder[CPUSTATES] = { CP_SYS, CP_INTR, CP_USER, CP_NICE,
CP_IDLE };
void
showkre()
showkre(void)
{
float f1, f2;
int psiz, inttotal;
@ -568,8 +567,7 @@ showkre()
}
int
cmdkre(cmd, args)
const char *cmd, *args;
cmdkre(const char *cmd, const char *args)
{
int retval;
@ -633,7 +631,7 @@ cmdkre(cmd, args)
/* calculate number of users on the system */
static int
ucount()
ucount(void)
{
int nusers = 0;
@ -648,8 +646,7 @@ ucount()
}
static float
cputime(indx)
int indx;
cputime(int indx)
{
double lt;
int i;
@ -663,8 +660,7 @@ cputime(indx)
}
static void
putint(n, l, lc, w)
int n, l, lc, w;
putint(int n, int l, int lc, int w)
{
int snr;
char b[128];
@ -694,9 +690,7 @@ putint(n, l, lc, w)
}
static void
putfloat(f, l, lc, w, d, nz)
double f;
int l, lc, w, d, nz;
putfloat(double f, int l, int lc, int w, int d, int nz)
{
int snr;
char b[128];
@ -724,9 +718,7 @@ putfloat(f, l, lc, w, d, nz)
}
static void
putlongdouble(f, l, lc, w, d, nz)
long double f;
int l, lc, w, d, nz;
putlongdouble(long double f, int l, int lc, int w, int d, int nz)
{
int snr;
char b[128];
@ -754,8 +746,7 @@ putlongdouble(f, l, lc, w, d, nz)
}
static void
getinfo(ls)
struct Info *ls;
getinfo(struct Info *ls)
{
struct devinfo *tmp_dinfo;
size_t size;
@ -833,8 +824,7 @@ getinfo(ls)
}
static void
allocinfo(ls)
struct Info *ls;
allocinfo(struct Info *ls)
{
ls->intrcnt = (long *) calloc(nintr, sizeof(long));
@ -843,8 +833,7 @@ allocinfo(ls)
}
static void
copyinfo(from, to)
struct Info *from, *to;
copyinfo(struct Info *from, struct Info *to)
{
long *intrcnt;
@ -860,9 +849,7 @@ copyinfo(from, to)
}
static void
dinfo(dn, lc, now, then)
int dn, lc;
struct statinfo *now, *then;
dinfo(int dn, int lc, struct statinfo *now, struct statinfo *then)
{
long double transfers_per_second;
long double kb_per_transfer, mb_per_second;