SCCS-vsn: usr.bin/write/write.c 4.14
-static char *sccsid = "@(#)write.c 4.13 %G%";
+static char *sccsid = "@(#)write.c 4.14 %G%";
#endif
/*
* write to another user
#endif
/*
* write to another user
#include <signal.h>
#include <utmp.h>
#include <sys/time.h>
#include <signal.h>
#include <utmp.h>
#include <sys/time.h>
#define NMAX sizeof(ubuf.ut_name)
#define LMAX sizeof(ubuf.ut_line)
#define NMAX sizeof(ubuf.ut_name)
#define LMAX sizeof(ubuf.ut_line)
him = argv[1];
if (argc > 2)
histtya = argv[2];
him = argv[1];
if (argc > 2)
histtya = argv[2];
- if ((uf = fopen("/etc/utmp", "r")) == NULL) {
- perror("write: Can't open /etc/utmp");
+ if ((uf = fopen(_PATH_UTMP, "r")) == NULL) {
+ fprintf(stderr, "write: can't read %s\n", _PATH_UTMP);
if (histtya == 0)
exit(10);
goto cont;
if (histtya == 0)
exit(10);
goto cont;
}
mytty = rindex(mytty, '/') + 1;
if (histtya) {
}
mytty = rindex(mytty, '/') + 1;
if (histtya) {
- strcpy(histty, "/dev/");
+ strcpy(histty, _PATH_DEV);
strcat(histty, histtya);
}
while (fread((char *)&ubuf, sizeof(ubuf), 1, uf) == 1) {
strcat(histty, histtya);
}
while (fread((char *)&ubuf, sizeof(ubuf), 1, uf) == 1) {
continue;
logcnt++;
if (histty[0]==0 || nomesg && histtya == 0) {
continue;
logcnt++;
if (histty[0]==0 || nomesg && histtya == 0) {
- strcpy(ttybuf, "/dev/");
+ strcpy(ttybuf, _PATH_DEV);
strcat(ttybuf, ubuf.ut_line);
if (histty[0]==0)
strcpy(histty, ttybuf);
strcat(ttybuf, ubuf.ut_line);
if (histty[0]==0)
strcpy(histty, ttybuf);
setgid(getgid()); /* Give up effective group privs */
sigs((int (*)())0);
execl(getenv("SHELL") ?
setgid(getgid()); /* Give up effective group privs */
sigs((int (*)())0);
execl(getenv("SHELL") ?
- getenv("SHELL") : "/bin/sh", "sh", "-c", bp+1, 0);
+ getenv("SHELL") : _PATH_BSHELL, "sh", "-c", bp+1, 0);
exit(0);
}
while (wait((int *)NULL) != i)
exit(0);
}
while (wait((int *)NULL) != i)