SCCS-vsn: bin/ps/ps.c 5.17
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)ps.c 5.16 (Berkeley) %G%";
+static char sccsid[] = "@(#)ps.c 5.17 (Berkeley) %G%";
-#include <stdio.h>
-#include <ctype.h>
-#include <a.out.h>
-#include <pwd.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <sys/proc.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <sys/proc.h>
-#include <machine/pte.h>
#include <sys/vm.h>
#include <sys/text.h>
#include <sys/stat.h>
#include <sys/mbuf.h>
#include <sys/vm.h>
#include <sys/text.h>
#include <sys/stat.h>
#include <sys/mbuf.h>
+#include <machine/pte.h>
+#include <a.out.h>
+#include <pwd.h>
#include <math.h>
#include <errno.h>
#include <math.h>
#include <errno.h>
+#include <stdio.h>
+#include <ctype.h>
+#include "pathnames.h"
char *nl_names[] = {
"_proc",
char *nl_names[] = {
"_proc",
#define u user.user
#ifndef PSFILE
#define u user.user
#ifndef PSFILE
-char *psdb = "/etc/psdatabase";
+char *psdb = _PATH_PSDATABASE;
#else
char *psdb = PSFILE;
#endif
#else
char *psdb = PSFILE;
#endif
tptr = ap;
else if ((tptr = ttyname(0)) != 0) {
tptr = strcpy(mytty, tptr);
tptr = ap;
else if ((tptr = ttyname(0)) != 0) {
tptr = strcpy(mytty, tptr);
- if (strncmp(tptr, "/dev/", 5) == 0)
+ if (strncmp(tptr, _PATH_DEV,
+ sizeof(_PATH_DEV) - 1) == 0)
tptr += 5;
}
if (strncmp(tptr, "tty", 3) == 0)
tptr += 5;
}
if (strncmp(tptr, "tty", 3) == 0)
- kmemf = argc > 2 ? argv[2] : "/vmcore";
+ kmemf = argc > 2 ? argv[2] : _PATH_VMCORE;
kmem = open(kmemf, 0);
if (kmem < 0) {
perror(kmemf);
kmem = open(kmemf, 0);
if (kmem < 0) {
perror(kmemf);
mem = kmem;
memf = kmemf;
} else {
mem = kmem;
memf = kmemf;
} else {
mem = open(memf, 0);
if (mem < 0) {
perror(memf);
mem = open(memf, 0);
if (mem < 0) {
perror(memf);
}
}
if (kflg == 0 || argc > 3) {
}
}
if (kflg == 0 || argc > 3) {
- swapf = argc>3 ? argv[3]: "/dev/drum";
+ swapf = argc>3 ? argv[3]: _PATH_DRUM;
swap = open(swapf, 0);
if (swap < 0) {
perror(swapf);
swap = open(swapf, 0);
if (swap < 0) {
perror(swapf);
int faildb = 0; /* true if psdatabase init failed */
int i;
int faildb = 0; /* true if psdatabase init failed */
int i;
- nlistf = argc > 1 ? argv[1] : "/vmunix";
+ nlistf = argc > 1 ? argv[1] : _PATH_UNIX;
if (Uflg) {
init_nlist();
nlist(nlistf, nl);
if (Uflg) {
init_nlist();
nlist(nlistf, nl);
struct ttys *t;
struct lttys *lt;
struct ttys *t;
struct lttys *lt;
- if (chdir("/dev") < 0) {
- perror("/dev");
+ if (chdir(_PATH_DEV) < 0) {
+ perror(_PATH_DEV);
exit(1);
}
dialbase = -1;
if ((df = opendir(".")) == NULL) {
exit(1);
}
dialbase = -1;
if ((df = opendir(".")) == NULL) {
- fprintf(stderr, "Can't open . in /dev\n");
+ fprintf(stderr, "ps: can't open . in %s\n", _PATH_DEV);
exit(1);
}
while ((dbuf = readdir(df)) != NULL)
exit(1);
}
while ((dbuf = readdir(df)) != NULL)
closedir(df);
allttys = (struct ttys *)malloc(sizeof(struct ttys)*nttys);
if (allttys == NULL) {
closedir(df);
allttys = (struct ttys *)malloc(sizeof(struct ttys)*nttys);
if (allttys == NULL) {
- fprintf(stderr, "ps: Can't malloc space for tty table\n");
+ fprintf(stderr, "ps: can't malloc space for tty table\n");
exit(1);
}
for (lt = lallttys, t = allttys; lt ; lt = lt->next, t++)
exit(1);
}
for (lt = lallttys, t = allttys; lt ; lt = lt->next, t++)
register struct passwd *pw;
struct passwd *getpwent();
register int cp;
register struct passwd *pw;
struct passwd *getpwent();
register int cp;
extern int _pw_stayopen;
_pw_stayopen = 1;
extern int _pw_stayopen;
_pw_stayopen = 1;
#if (((NUID) & ((NUID) - 1)) != 0)
cp = uid % (NUID);
#if (((NUID) & ((NUID) - 1)) != 0)
cp = uid % (NUID);