projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
speed-ups and clean-ups
[unix-history]
/
usr
/
src
/
sbin
/
init
/
init.c
diff --git
a/usr/src/sbin/init/init.c
b/usr/src/sbin/init/init.c
index
31cf13d
..
89ccfff
100644
(file)
--- a/
usr/src/sbin/init/init.c
+++ b/
usr/src/sbin/init/init.c
@@
-1,4
+1,4
@@
-static char *sccsid = "@(#)init.c 4.
8
(Berkeley) %G%";
+static char *sccsid = "@(#)init.c 4.
10
(Berkeley) %G%";
#include <signal.h>
#include <sys/types.h>
#include <utmp.h>
#include <signal.h>
#include <sys/types.h>
#include <utmp.h>
@@
-51,13
+51,38
@@
int idle();
char *strcpy(), *strcat();
long lseek();
char *strcpy(), *strcat();
long lseek();
+#ifndef sun
main()
{
register int r11; /* passed thru from boot */
main()
{
register int r11; /* passed thru from boot */
+#else sun
+main(argc, argv)
+ char **argv;
+{
+#endif sun
int howto, oldhowto;
time0 = time(0);
int howto, oldhowto;
time0 = time(0);
+#ifndef sun
howto = r11;
howto = r11;
+#else sun
+ if (argc > 1 && argv[1][0] == '-') {
+ char *cp;
+
+ howto = 0;
+ cp = &argv[1][1];
+ while (*cp) switch (*cp++) {
+ case 'a':
+ howto |= RB_ASKNAME;
+ break;
+ case 's':
+ howto |= RB_SINGLE;
+ break;
+ }
+ } else {
+ howto = RB_SINGLE;
+ }
+#endif sun
setjmp(sjbuf);
signal(SIGTERM, reset);
signal(SIGTSTP, idle);
setjmp(sjbuf);
signal(SIGTERM, reset);
signal(SIGTSTP, idle);
@@
-345,6
+370,7
@@
struct tab *p;
register pid;
time_t t;
int dowait = 0;
register pid;
time_t t;
int dowait = 0;
+ extern char *sys_errlist[];
time(&t);
p->gettycnt++;
time(&t);
p->gettycnt++;
@@
-365,6
+391,8
@@
struct tab *p;
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_IGN);
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_IGN);
+ strcpy(tty, dev);
+ strncat(tty, p->line, LINSIZ);
if (dowait) {
f = open("/dev/console", 1);
write(f, "init: ", 6);
if (dowait) {
f = open("/dev/console", 1);
write(f, "init: ", 6);
@@
-377,8
+405,6
@@
struct tab *p;
close(f);
}
}
close(f);
}
}
- strcpy(tty, dev);
- strncat(tty, p->line, LINSIZ);
chown(tty, 0, 0);
chmod(tty, 0622);
if (open(tty, 2) < 0) {
chown(tty, 0, 0);
chmod(tty, 0622);
if (open(tty, 2) < 0) {
@@
-388,7
+414,11
@@
struct tab *p;
if (repcnt % 10 == 0) {
f = open("/dev/console", 1);
write(f, "init: ", 6);
if (repcnt % 10 == 0) {
f = open("/dev/console", 1);
write(f, "init: ", 6);
- errno = oerrno, perror(tty);
+ write(f, tty, strlen(tty));
+ write(f, ": ", 2);
+ write(f, sys_errlist[oerrno],
+ strlen(sys_errlist[oerrno]));
+ write(f, "\n", 1);
close(f);
if ((f = open("/dev/tty", 2)) >= 0) {
ioctl(f, TIOCNOTTY, 0);
close(f);
if ((f = open("/dev/tty", 2)) >= 0) {
ioctl(f, TIOCNOTTY, 0);