From 6af9856d4afe6625ae47ad2c40321c8789949741 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 16 Mar 2012 16:03:49 +0100 Subject: [PATCH] libcompat_minix-centric cleanup remove some old minix-userland-specific stuff . /etc/ttytab as a file, and minix-compat function (fftyslot()), replaced by /etc/ttys and new libc functions . also remove minix-specific nlist(), cuserid(), fttyslot(), v8 regex functions and . and remaining minix-only utilities that use them . also unused and and redundant --- commands/Makefile | 8 +- commands/calendar/Makefile | 4 - commands/calendar/calendar.c | 236 ---- commands/leave/Makefile | 4 - commands/leave/leave.c | 210 ---- commands/modem/Makefile | 4 - commands/modem/modem.c | 253 ----- commands/rlogind/Makefile | 7 - commands/rlogind/rlogind.c | 455 -------- commands/rlogind/rlogind.h | 24 - commands/rlogind/setup.c | 92 -- etc/Makefile | 2 +- etc/rc.daemons.dist | 1 - etc/ttytab | 41 - kernel/arch/i386/arch_system.c | 1 - kernel/proto.h | 1 - kernel/system.c | 1 - kernel/system/do_sigreturn.c | 1 - kernel/system/do_sigsend.c | 1 - lib/libcompat_minix/Makefile | 13 - lib/libcompat_minix/cuserid.c | 33 - lib/libcompat_minix/fttyslot.c | 50 - lib/libcompat_minix/include/Makefile.inc | 4 +- lib/libcompat_minix/include/compat/pwd.h | 34 - lib/libcompat_minix/include/compat/regexp.h | 37 - lib/libcompat_minix/include/compat/syslog.h | 8 - lib/libcompat_minix/include/sys/sigcontext.h | 8 - lib/libcompat_minix/nlist.c | 71 -- lib/libcompat_minix/v8regerror.c | 15 - lib/libcompat_minix/v8regexp.c | 1075 ------------------ lib/libcompat_minix/v8regsub.c | 90 -- man/man1/Makefile | 7 +- man/man1/calendar.1 | 44 - man/man1/leave.1 | 26 - man/man1/modem.1 | 39 - man/man8/Makefile | 2 +- man/man8/rlogind.8 | 103 -- servers/pm/signal.c | 1 - servers/vm/signal.c | 2 +- test/test11.c | 17 +- test/test37.c | 3 - test/test47.c | 1 - 42 files changed, 15 insertions(+), 3014 deletions(-) delete mode 100644 commands/calendar/Makefile delete mode 100644 commands/calendar/calendar.c delete mode 100644 commands/leave/Makefile delete mode 100644 commands/leave/leave.c delete mode 100644 commands/modem/Makefile delete mode 100644 commands/modem/modem.c delete mode 100644 commands/rlogind/Makefile delete mode 100644 commands/rlogind/rlogind.c delete mode 100644 commands/rlogind/rlogind.h delete mode 100644 commands/rlogind/setup.c delete mode 100755 etc/ttytab delete mode 100644 lib/libcompat_minix/cuserid.c delete mode 100644 lib/libcompat_minix/fttyslot.c delete mode 100644 lib/libcompat_minix/include/compat/pwd.h delete mode 100644 lib/libcompat_minix/include/compat/regexp.h delete mode 100644 lib/libcompat_minix/include/compat/syslog.h delete mode 100644 lib/libcompat_minix/include/sys/sigcontext.h delete mode 100644 lib/libcompat_minix/nlist.c delete mode 100644 lib/libcompat_minix/v8regerror.c delete mode 100644 lib/libcompat_minix/v8regexp.c delete mode 100644 lib/libcompat_minix/v8regsub.c delete mode 100644 man/man1/calendar.1 delete mode 100644 man/man1/leave.1 delete mode 100644 man/man1/modem.1 delete mode 100644 man/man8/rlogind.8 diff --git a/commands/Makefile b/commands/Makefile index c9863c6af..15c721132 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -4,7 +4,7 @@ SUBDIR= add_route arp ash at awk \ backup badblocks banner basename \ - btrace cal calendar \ + btrace cal \ cawf cd cdprobe checkhier cpp \ chmod chown chroot ci cksum cleantmp clear cmp co \ comm compress cp crc cron crontab cut \ @@ -14,16 +14,16 @@ SUBDIR= add_route arp ash at awk \ find finger fingerd fix fold format fortune fsck.mfs \ ftp101 gcore gcov-pull getty grep head hexdump host \ hostaddr id ifconfig ifdef install \ - intr ipcrm ipcs irdpd isoread join kill last leave \ + intr ipcrm ipcs irdpd isoread join kill last \ less lex loadkeys loadramdisk logger login look lp \ lpd ls lspci mail make MAKEDEV \ mdb mesg mined mkfifo mkfs.mfs mknod \ - mkproto modem mount mt netconf newroot nice acknm nohup \ + mkproto mount mt netconf newroot nice acknm nohup \ nonamed od paste patch pax \ ping postinstall poweroff pr prep printf printroot \ profile progressbar proto pr_routes ps pwd pwdauth \ ramdisk rarpd rawspeed rcp rdate readall readclock \ - reboot remsync rev rget rlogin rlogind \ + reboot remsync rev rget rlogin \ rotate rsh rshd sed service setup shar acksize \ sleep slip sort spell split srccrc \ stty su sum svclog swifi sync synctree sysenv \ diff --git a/commands/calendar/Makefile b/commands/calendar/Makefile deleted file mode 100644 index 26275d475..000000000 --- a/commands/calendar/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= calendar -MAN= - -.include diff --git a/commands/calendar/calendar.c b/commands/calendar/calendar.c deleted file mode 100644 index ebc149d92..000000000 --- a/commands/calendar/calendar.c +++ /dev/null @@ -1,236 +0,0 @@ -/* calendar - reminder service Authors: S. & K. Hirabayashi */ - -/* Permission is hereby granted for nonprofit use. */ - -#include -#include -#include -#ifdef __NBSD_LIBC -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -/* Change these two lines for your system needs. */ -#define MAIL1 "/usr/bin/mail" -#define MAIL2 "/bin/mail" -#define PASSWD "/etc/passwd" /* system password file */ -#define MAX_EXP 4 /* see date_exp() function */ - -char *mail; /* mail command path ("/bin/mail" etc) */ -regexp *exp[MAX_EXP]; /* date expressions */ -int nexp; /* # of the date expressions */ -char calfile[PATH_MAX]; /* calendar file for the user */ - -int rflg; /* consult aged 'calendar' file and touch */ -int mflg; /* mail (multi user) service */ -char *cmd; /* the name of this command */ -char buf[BUFSIZ]; - -_PROTOTYPE(int main, (int argc, char **argv)); -_PROTOTYPE(void calendar, (void)); -_PROTOTYPE(char *getstr, (char *s, int n)); -_PROTOTYPE(int newaccess, (char *file)); -_PROTOTYPE(void grep, (char *file, char *user)); -_PROTOTYPE(int date_exp, (void)); -_PROTOTYPE(char *date_pat, (time_t t)); -/* -_PROTOTYPE(void regerror, (char *s)); -*/ -_PROTOTYPE(void error, (char *s, char *t)); - -int main(argc, argv) -int argc; -char **argv; -{ - char *s; - - cmd = *argv; - while (--argc > 0 && (*++argv)[0] == '-') { - s = argv[0] + 1; - if (*s == '\0') - mflg++; /* mail service */ - else if (strcmp(s, "r") == 0) - rflg++, mflg++; - } - - if (mflg) { /* check mailing agent */ - if (access(MAIL1, X_OK) == 0) - mail = MAIL1; - else if (access(MAIL2, X_OK) == 0) - mail = MAIL2; - else - error("cannot find %s", MAIL1); - } - nexp = date_exp(); - calendar(); - exit(0); -} - -void calendar() -{ - int i; - char *s; - FILE *fp; - - if (!mflg) { - grep("calendar", ""); - return; - } - - /* Mail sevice */ - if ((fp = fopen(PASSWD, "r")) == (FILE *) NULL) - error("cannot open %s", PASSWD); - - while (fgets(buf, BUFSIZ, fp) != (char *) NULL) { - for (i = 0, s = buf; *s && *s != '\n'; s++) - if (*s == ':') i++; - *s = '\0'; - if (i != 6) error("illegal '/etc/passwd' format: %s", buf); - - /* Calendar file = ${HOME}/calendar */ - sprintf(calfile, "%s/%s", getstr(buf, 5), "calendar"); - - if ((access(calfile, R_OK) != 0) || (rflg && !newaccess(calfile))) - continue; - - grep(calfile, getstr(buf, 0)); - } - - fclose(fp); -} - -char *getstr(s, n) -char *s; -int n; -{ -/* Returns the string value of the n-th field in the record (s) */ - int i; - char *t; - static char str[512]; - - for (i = 0; i < n && *s; s++) - if (*s == ':') i++; /* field separator */ - for (i = 0, t = str; *s && *s != ':' && i < 511; i++) *t++ = *s++; - *t = '\0'; - return str; -} - -int newaccess(file) -char *file; /* file name */ -{ -/* Check whether the file has been touched today. */ - - int r = 0; - struct tm *tm; - struct stat stbuf; - time_t clk; - char newdate[8], olddate[8]; - - time(&clk); - tm = localtime(&clk); - sprintf(newdate, "%02d%02d%02d", tm->tm_year, tm->tm_mon + 1, tm->tm_mday); - - if (stat(file, &stbuf) == -1) error("cannot stat %s", file); - tm = localtime(&stbuf.st_mtime); - sprintf(olddate, "%02d%02d%02d", tm->tm_year, tm->tm_mon + 1, tm->tm_mday); - - if (strcmp(newdate, olddate) != 0) { - utime(file, NULL); /* touch */ - r++; - } - return r; -} - -void grep(file, user) -char *file, *user; -{ /* grep 'exp[]' [| mail user] */ - int i; - char command[128]; /* mail command */ - FILE *ifp, *ofp; - - if ((ifp = fopen(file, "r")) == (FILE *) NULL) - error("cannot open %s", file); - if (*user != '\0') { - sprintf(command, "%s %s", mail, user); - ofp = (FILE *) NULL; - } else { - ofp = stdout; - } - - while (fgets(buf, BUFSIZ, ifp) != (char *) NULL) { - for (i = 0; i < nexp; i++) { - if (regexec(exp[i], buf, 1)) { - if ((ofp == (FILE *) NULL) && - (ofp = popen(command, "w")) == (FILE *) NULL) - error("cannot popen %s", mail); - fputs(buf, ofp); - break; - } - } - } - - fclose(ifp); - if (ofp == stdout) - fflush(ofp); - else if (ofp != (FILE *) NULL) - pclose(ofp); -} - -int date_exp() -{ -/* Set compiled regular expressions into the exp[] array. */ - static int n[] = {2, 2, 2, 2, 2, 4, 3}; - int i, r, wday; - time_t clk; - - time(&clk); - wday = localtime(&clk)->tm_wday; - r = n[wday]; - if (r > MAX_EXP) error("too many date expressions", ""); - for (i = 0; i < r; i++) { - exp[i] = regcomp(date_pat(clk)); - clk += 60 * 60 * 24L; /* 24 hours */ - } - return(r); -} - -char *date_pat(t) -time_t t; -{ /* returns date expression for the time (t) */ - static char *month[] = { - "[Jj]an", "[Ff]eb", "[Mm]ar", "[Aa]pr", "[Mm]ay", "[Jj]un", - "[Jj]ul", "[Aa]ug", "[Ss]ep", "[Oo]ct", "[Nn]ov", "[Dd]ec" - }; - static char str[512]; - struct tm *tm; - - tm = localtime(&t); - sprintf(str, - "(^|[ \t(,;])(((%s[^ \t]*[ \t])|0*%d/|\\*/)(0*%d|\\*))([^0123456789]|$)", - month[tm->tm_mon], tm->tm_mon + 1, tm->tm_mday); - - return str; -} - -void regerror(s) -const char *s; -{ /* regcomp() needs this */ - error("REGULAR EXPRESSION ERROR (%s)", (char *) s); -} - -void error(s, t) -char *s, *t; -{ - fprintf(stderr, "%s: ", cmd); - fprintf(stderr, s, t); - fprintf(stderr, "\n"); - exit(1); -} diff --git a/commands/leave/Makefile b/commands/leave/Makefile deleted file mode 100644 index 395f25070..000000000 --- a/commands/leave/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= leave -MAN= - -.include diff --git a/commands/leave/leave.c b/commands/leave/leave.c deleted file mode 100644 index bca1213ea..000000000 --- a/commands/leave/leave.c +++ /dev/null @@ -1,210 +0,0 @@ -/* Usage: leave [ [+] hh[:]mm ] - * - * Author: Terrence W. Holm - * - * Revision: - * Fred van Kempen, MINIX User Group Holland - * -adapted to MSS - * -adapted to new utmp database - * -adapted to POSIX (MINIX 1.5) - * Michael Temari, - * -use localtime/mktime to fix bug with DST - */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -#define Min(a,b) ((a 59) Usage(); -} - - -int Still_Logged_On(user, tty) -char *user; -char *tty; -{ - FILE *f; - struct utmp login; - - if ((f = fopen(UTMP, "r")) == NULL) - /* no login/logout records kept */ - return(1); - - while (fread(&login, sizeof(struct utmp), (size_t)1, f) == 1) { - if (!strncmp(login.ut_line, tty, (size_t)8)) - if (!strncmp(login.ut_name, user, (size_t)8)) { - fclose(f); - return(1); - } else { - fclose(f); - return(0); - } - } - fclose(f); - return(0); -} - - -int main(argc, argv) -int argc; -char *argv[]; -{ - char when[STRING]; - time_t now = time((time_t *)0); - time_t leave, delta; - struct tm *tm; - int hour, min; - int pid, i; - char *user = cuserid( (char *)NULL); - char *tty = ttyname(0) + 5; - - /* get the argument string "when" either from stdin, or argv */ - if (argc <= 1) { - printf("When do you have to leave? "); - fflush(stdout); - if (fgets(when, STRING, stdin) == NULL || when[0] == '\n') exit(0); - } else { - strcpy(when, argv[1]); - if (argc > 2) strcat(when, argv[2]); - } - - /* determine the leave time from the current time and "when" */ - tm = localtime(&now); - if (when[0] == '+') { - Get_Hour_Min(&when[1], &hour, &min); - tm->tm_hour += hour; - tm->tm_min += min; - leave = mktime(tm); - } else { - /* user entered an absolute time */ - Get_Hour_Min(&when[0], &hour, &min); - tm->tm_hour = hour; - tm->tm_min = min; - leave = mktime(tm); - if (leave < now) { - printf("That time has already passed!\n"); - exit(1); - } - } - - printf("Alarm set for %s", ctime(&leave)); - - if ((pid = fork()) == -1) { - fprintf(stderr, "leave: can not fork\n"); - exit(1); - } - if (pid != 0) exit(0); - - /* only the child continues on */ - if (user == NULL || tty == NULL) { - fprintf(stderr, "leave: Can not determine user and terminal name\n"); - exit(1); - } - signal(SIGINT, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - signal(SIGTERM, SIG_IGN); - - for (;;) { - if (!Still_Logged_On(user, tty)) exit(0); - - /* how much longer until the leave time? */ - /* XXX - use difftime all over. */ - delta = leave - time((time_t *)0); - - /* which interval are we currently in? */ - for (i = 0; i < INTERVALS; ++i) - if (delta + intervals[i] > 0) break; - - /* if we are within intervals[0] then print a warning If - * there are more intervals than messages, then use/ - * warnings[WARNINGS-1] for all subsequent messages. */ - if (i > 0) - printf("\007\r%s\r\n", - warnings[i > WARNINGS ? WARNINGS - 1 : i - 1]); - - if (i == INTERVALS) { - printf("That was the last time I'll tell you. Bye.\r\n"); - exit(0); - } - /* Sleep until the next interval. For long periods, wake up - * every hour to check if the user is still on (also required - * because 16 bit ints don't allow long waits). */ - sleep((unsigned) Min(delta + intervals[i], HOUR)); - } -} diff --git a/commands/modem/Makefile b/commands/modem/Makefile deleted file mode 100644 index b106fc1c9..000000000 --- a/commands/modem/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= modem -MAN= - -.include diff --git a/commands/modem/modem.c b/commands/modem/modem.c deleted file mode 100644 index e3e3119f5..000000000 --- a/commands/modem/modem.c +++ /dev/null @@ -1,253 +0,0 @@ -/* modem - Put modem into DIALIN or DIALOUT mode. Author: F. van Kempen */ - -/* Exit: 0 OK, suspended/restarted GETTY - * 1 UNIX error - * 2 Process busy - * Version: 1.3 12/30/89 - * - * Author: F. van Kempen, MicroWalt Corporation - * - * All fancy stuff removed, see getty.c. Kees J. Bot. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -char PATH_UTMP[] = _PATH_UTMP; /* current logins */ - -_PROTOTYPE(void usage , (void)); -_PROTOTYPE(int main , (int argc , char *argv [])); -_PROTOTYPE(void sendcodes , (char *tty, char *codes)); - - -void usage() -{ - fprintf(stderr, -"Usage: modem [-sio] [-I in-codes] [-O out-codes] line [command args ...]\n"); - exit(1); -} - - -main(argc, argv) -int argc; -char *argv[]; -{ - struct utmp entry; - char devtty[1024], *tty; - char **command; - int ex_code = 0; - int fd, i, slot, getty; - struct stat st; - enum { TOGGLE, DIALIN, DIALOUT } mode= TOGGLE; - int silent = 0; - _PROTOTYPE(void (*hsig), (int)); - _PROTOTYPE(void (*isig), (int)); - _PROTOTYPE(void (*qsig), (int)); - _PROTOTYPE(void (*tsig), (int)); - pid_t pid; - int r, status; - uid_t uid = getuid(); - gid_t gid = getgid(); - char *in_codes, *out_codes; - - i = 1; - while (i < argc && argv[i][0] == '-') { - char *opt = argv[i++] + 1; - - if (opt[0] == '-' && opt[1] == 0) break; - - while (*opt != 0) { - switch (*opt++) { - case 's': /* silent mode */ - silent = 1; - break; - case 'i': /* DIAL-IN mode: suspend GETTY */ - mode = DIALIN; - break; - case 'o': /* DIAL-OUT mode: restart GETTY */ - mode = DIALOUT; - break; - case 'I': /* code to switch modem to dial-in */ - if (*opt == 0) { - if (i == argc) usage(); - opt = argv[i++]; - } - in_codes = opt; - opt = ""; - break; - case 'O': /* code to switch modem to dial-out */ - if (*opt == 0) { - if (i == argc) usage(); - opt = argv[i++]; - } - out_codes = opt; - opt = ""; - break; - default: - usage(); - } - } - } - - if (i == argc) usage(); - tty = argv[i++]; /* Modem line */ - - if (mode != TOGGLE && i != argc) usage(); - command = argv + i; /* Command to execute (if any). */ - - if (strchr(tty, '/') == NULL) { - strcpy(devtty, "/dev/"); - strncat(devtty, tty, 1024 - 6); - tty = devtty; - } - - if (stat(tty, &st) < 0) { - fprintf(stderr, "modem: %s: %s\n", tty, strerror(errno)); - exit(1); - } - - if (!S_ISCHR(st.st_mode)) { - fprintf(stderr, "%s is not a tty\n", tty); - exit(1); - } - - /* Find the utmp slot number for the line. */ - if ((fd= open(tty, O_RDONLY)) < 0 || (slot= fttyslot(fd)) == 0) { - fprintf(stderr, "modem: %s: %s\n", tty, strerror(errno)); - exit(1); - } - close(fd); - - /* Read the UTMP file to find out the PID and STATUS of the GETTY. */ - entry.ut_type= 0; - if ((fd = open(PATH_UTMP, O_RDONLY)) < 0 - || lseek(fd, (off_t) slot * sizeof(entry), SEEK_SET) < 0 - || read(fd, &entry, sizeof(entry)) < 0 - ) { - fprintf(stderr, "modem: cannot read UTMP !\n"); - exit(1); - } - close(fd); - - hsig= signal(SIGHUP, SIG_IGN); - isig= signal(SIGINT, SIG_IGN); - qsig= signal(SIGQUIT, SIG_IGN); - tsig= signal(SIGTERM, SIG_IGN); - - /* Process the terminal entry if we got one. */ - switch (entry.ut_type) { - case LOGIN_PROCESS: /* getty waiting for a call */ - getty = 1; - break; - case USER_PROCESS: /* login or user-shell */ - if (!silent) fprintf(stderr, "modem: line is busy.\n"); - exit(2); - break; - default: - getty = 0; - } - - for (i = (mode == TOGGLE) ? 0 : 1; i < 2; i++) { - /* Now perform the desired action (DIALIN or DIALOUT). */ - switch (mode) { - case DIALOUT: - case TOGGLE: - if (getty) kill(entry.ut_pid, SIGUSR1); /* suspend getty */ - chown(tty, uid, st.st_gid); /* give line to user */ - chmod(tty, 0600); - if (out_codes != NULL) sendcodes(tty, out_codes); - if (!silent) printf("modem on %s set for dialout.\n", tty); - break; - case DIALIN: - if (in_codes != NULL) sendcodes(tty, in_codes); - chown(tty, 0, st.st_gid); /* revoke access */ - chmod(tty, 0600); - if (getty) kill(entry.ut_pid, SIGUSR2); /* restart getty */ - if (!silent) printf("modem on %s set for dialin.\n", tty); - } - if (mode == TOGGLE) { - /* Start the command to run */ - pid_t pid; - int status; - - switch ((pid = fork())) { - case -1: - fprintf(stderr, "modem: fork(): %s\n", strerror(errno)); - ex_code= 1; - break; - case 0: - setgid(gid); - setuid(uid); - (void) signal(SIGHUP, hsig); - (void) signal(SIGINT, isig); - (void) signal(SIGQUIT, qsig); - (void) signal(SIGTERM, tsig); - execvp(command[0], command); - fprintf(stderr, "modem: %s: %s\n", - command[0], strerror(errno)); - _exit(127); - default: - while ((r= wait(&status)) != pid) { - if (r == -1 && errno != EINTR) break; - } - if (r == -1 || status != 0) ex_code = 1; - } - mode = DIALIN; - } - } - exit(ex_code); -} - -void sendcodes(tty, codes) -char *tty, *codes; -{ - int fd; - int c; - char buf[1024], *bp = buf; - - if ((fd = open(tty, O_RDWR|O_NONBLOCK)) < 0) { - fprintf(stderr, "modem: can't send codes to %s: %s\n", - tty, strerror(errno)); - return; - } - while ((c = *codes++) != 0) { -fprintf(stderr, "%d\n", __LINE__); - if (c == '\\') { - if ((c = *codes++) == 0) break; - if (c == 'r') c= '\r'; - if (c == 'n') c= '\n'; - } - *bp++ = c; - if (bp == buf + sizeof(buf) || c == '\r' || c == '\n') { -fprintf(stderr, "%d\n", __LINE__); - write(fd, buf, bp - buf); -fprintf(stderr, "%d\n", __LINE__); - do {sleep(1); -fprintf(stderr, "%d\n", __LINE__); - fprintf(stderr, "%d\n", read(fd, buf, sizeof(buf))); - }while (read(fd, buf, sizeof(buf)) > 0); -fprintf(stderr, "%d\n", __LINE__); - bp = buf; - } - } - if (bp > buf) { -fprintf(stderr, "%d\n", __LINE__); - write(fd, buf, bp - buf); -fprintf(stderr, "%d\n", __LINE__); - do sleep(1); while (read(fd, buf, sizeof(buf)) > 0); -fprintf(stderr, "%d\n", __LINE__); - } - close(fd); -} diff --git a/commands/rlogind/Makefile b/commands/rlogind/Makefile deleted file mode 100644 index b52766431..000000000 --- a/commands/rlogind/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# Makefile for rlogind. - -PROG= in.rlogind -SRCS= rlogind.c setup.c -MAN= - -.include diff --git a/commands/rlogind/rlogind.c b/commands/rlogind/rlogind.c deleted file mode 100644 index f46b894a9..000000000 --- a/commands/rlogind/rlogind.c +++ /dev/null @@ -1,455 +0,0 @@ -/* -rlogind.c - -Created: by Philip Homburg -Log: Utmp improvement by Kees Bot - Split to compile easier on i86 by kjb -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define EXTERN -#include "rlogind.h" - -char pty_str[]= "/dev/ptyXX"; -char tty_str[]= "/dev/ttyXX"; -char hex_str[16]= "0123456789abcdef"; - -char PATH_UTMP[] = "/etc/utmp"; /* current logins */ -char PATH_WTMP[] = "/usr/adm/wtmp"; /* login/logout history */ - -char term[64]= "TERM="; -#define ENVSIZE (sizeof("TERM=")-1) /* skip null for concatenation. */ -int confirmed= 0; -char *env[2]; -char *args[10]; - -static void do_child(int tty_fd, char *tty_str); -static void dealloc_term(int slot, char *tty_str, int pid); -static void wtmp(char *user, char *id, char *line, int pid, int type, int slot); -static void setup_term(int fd); -static speed_t num2speed(int num); -static int do_control(char *buf, int cnt); -static void readall(char *buf, int cnt); - -int main(int argc, char *argv[]) -{ - int error; - int i, j= 0; - int tty_fd, pty_fd; - int login_pid, write_pid; - int count, bytes, tmp_count; - char *lp= 0, *cp; - struct stat struct_stat; - int slot; - - prog_name= argv[0]; - - /* Check if the remote user is allowed in. */ - authenticate(); - - write(1, "", 1); /* Send the '\0' */ - confirmed= 1; - - /* We try to convince the other side not the do ^S/^Q, the rlogin - * protocol indicates the we only send this when XOFF is turned off - * but we don't know when this happens so we tell the other side that - * it is turned off. - */ - tcp_urg(1, 1); - - write(1, "\220", 1); - - tcp_urg(1, 0); - - /* Let's look for a pty. */ - pty_fd= -1; - for (i= 'p'; i <= 'z'; i++) - { - pty_str[sizeof(pty_str)-3]= i; - pty_str[sizeof(pty_str)-2]= '0'; - error= stat(pty_str, &struct_stat); - if (error == -1) - continue; - for (j= 0; j < 16; j++) - { - pty_str[sizeof(pty_str)-2]= hex_str[j]; - pty_fd= open(pty_str, O_RDWR); - if (pty_fd != -1) - break; - } - if (pty_fd != -1) - break; - } - if (pty_fd == -1) - { - printf("%s: out of ptys\r\n", prog_name); - exit(1); - } - tty_str[sizeof(pty_str)-3]= i; - tty_str[sizeof(pty_str)-2]= hex_str[j]; - - tty_fd= open(tty_str, O_RDWR); - if (tty_fd == -1) - { - printf("%s: unable to open '%s': %s\r\n", prog_name, tty_str, - strerror(errno)); - exit(1); - } - - slot= fttyslot(tty_fd); - - login_pid= fork(); - if (login_pid == -1) - { - printf("%s: unable to fork: %s\r\n", prog_name, - strerror(errno)); - exit(1); - } - if (login_pid == 0) - { - close(pty_fd); - wtmp("", "", tty_str, login_pid, LOGIN_PROCESS, slot); - do_child(tty_fd, tty_str); - } - close(tty_fd); - - write_pid= fork(); - if (write_pid == -1) - { - printf("%s: unable to fork: %s\r\n", prog_name, - strerror(errno)); - exit(1); - } - if (write_pid == 0) - { - dup2(pty_fd, 0); - count= 0; - for (;;) - { - if (!count) - { - count= read(0, line, sizeof(line)); - if (count <= 0) - break; - lp= line; - } - bytes= write(1, lp, count); - if (bytes <= 0 || bytes > count) - break; - lp += bytes; - count -= bytes; - } - kill(getppid(), SIGKILL); - dealloc_term(slot, tty_str, login_pid); - _exit(1); - } - - dup2(pty_fd, 1); - count= 0; - for (;;) - { - if (!count) - { - count= read(0, line, sizeof(line)); - if (count <= 0) - break; - lp= line; - } - tmp_count= count; - cp= memchr(lp, 255, count); - if (cp) - { - tmp_count= cp-lp; - if (tmp_count == 0) - { - tmp_count= do_control(lp, count); - if (tmp_count) - { - lp += tmp_count; - count -= tmp_count; - continue; - } - } - } - bytes= write(1, lp, tmp_count); - if (bytes <= 0 || bytes > count) - break; - lp += bytes; - count -= bytes; - } - kill(write_pid, SIGKILL); - dealloc_term(slot, tty_str, login_pid); - return(0); -} - -static void do_child(int tty_fd, char *tty_str) -{ - int ctty_fd, tst_fd; - FILE *tty_file; - int sav_errno; - char **argp; - - /* Set up the terminal attributes. */ - setup_term(tty_fd); - - /* Let's start the new session. */ - setsid(); - ctty_fd= open(tty_str, O_RDWR); - if (ctty_fd == -1) - { - printf("%s(do_child): unable to open '%s': %s\r\n", - prog_name, tty_str, strerror(errno)); - exit(1); - } - /* Test if we really got a controlling tty. */ - tst_fd= open("/dev/tty", O_RDWR); - if (tst_fd == -1) - { - printf( - "%s(do_child): '%s' didn't result in a controlling tty (%s)\r\n", - prog_name, tty_str, strerror(errno)); - exit(1); - } - - argp= args; - *argp++= "login"; - *argp++= "-p"; - *argp++= "-h"; - *argp++= hostname; - if (authenticated) - *argp++= "-f"; - if (lusername[0] != '\0') - *argp++= lusername; - - /* We reached the point of no return. */ - close(tst_fd); - close(tty_fd); - - if (ctty_fd != 0) - { - dup2(ctty_fd, 0); - close(ctty_fd); - ctty_fd= 0; - } - dup2(ctty_fd, 1); -#if DEBUG - fprintf(stderr, "execing login\r\n"); -#endif - dup2(ctty_fd, 2); - execve("/bin/login", args, env); - if (errno == ENOENT) execve("/usr/bin/login", args, env); - sav_errno= errno; - tty_file= fdopen(2, "w"); - if (tty_file) - { - fprintf(tty_file, "%s(do_child): unable to exec login: %s\r\n", - prog_name, strerror(sav_errno)); - fflush(tty_file); - } - _exit(1); -} - -static void dealloc_term(int slot, char *tty_str, int pid) -{ - wtmp("", "", tty_str, pid, DEAD_PROCESS, slot); - - /* Finally we reset the owner and mode of the terminal. */ - chown(tty_str, 0, 0); - chmod(tty_str, 0666); -} - -static void wtmp( - char *user, /* name of user */ - char *id, /* inittab ID */ - char *line, /* TTY name */ - int pid, /* PID of process */ - int type, /* TYPE of entry */ - int slot) /* slot number in UTMP */ -{ -/* Log an event into the UTMP and WTMP files. */ - - struct utmp utmp; /* UTMP/WTMP User Accounting */ - int fd= -1; - int log = 1; /* log in wtmp */ - char *p; - - /* Strip the /dev part of the TTY name. */ - p = strrchr(line, '/'); - if (p != 0) - line= p+1; - - if (type == DEAD_PROCESS) { - /* Don't add a logout entry for just a dying login. */ - if ((fd = open(PATH_UTMP, O_RDONLY)) < 0) return; - if (lseek(fd, (off_t) slot * sizeof(utmp), SEEK_SET) != -1 - && read(fd, (void *) &utmp, sizeof(utmp)) == sizeof(utmp)) - { - if (utmp.ut_type != INIT_PROCESS - && utmp.ut_type != USER_PROCESS) - log= 0; - } - close(fd); - } - if (type == LOGIN_PROCESS) log= 0; /* and don't log this one */ - - /* Clear the utmp record. */ - memset((void *) &utmp, 0, sizeof(utmp)); - - /* Enter new values. */ - strncpy(utmp.ut_name, user, sizeof(utmp.ut_name)); - strncpy(utmp.ut_id, id, sizeof(utmp.ut_id)); - strncpy(utmp.ut_line, line, sizeof(utmp.ut_line)); - strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host)); - utmp.ut_pid = pid; - utmp.ut_type = type; - utmp.ut_time = time((time_t *)0); - - if (log) { - if ((fd = open(PATH_WTMP, O_WRONLY | O_APPEND)) < 0) return; - write(fd, (char *) &utmp, sizeof(struct utmp)); - close(fd); - } - - /* write entry to utmp */ - if ((fd = open(PATH_UTMP, O_WRONLY)) < 0) return; - if (lseek(fd, (off_t) slot * sizeof(utmp), SEEK_SET) != -1) - write(fd, (char *) &utmp, sizeof(struct utmp)); - close(fd); -} - -void fatal(int fd, char *msg, int err) -{ - int len; - char buf[80], *bp; - - bp= buf; - if (!confirmed) - *bp++= '\1'; - if (err) - len= sprintf(bp, "rlogind: %s: %s.\r\n", msg, strerror(err)); - else - len= sprintf(bp, "rlogind: %s.\r\n", msg); - write(fd, buf, bp+len-buf); - exit(1); -} - -static void setup_term(int fd) -{ - char *cp, *speed; - struct termios tt; - speed_t spd; - int num; - char *check; - - cp= strchr(term, '/'); - if (cp) - { - tcgetattr(fd, &tt); - *cp++= '\0'; - speed= cp; - cp= strchr(speed, '/'); - if (cp) - *cp++= '\0'; - num= strtol(speed, &check, 0); - spd= num2speed(num); - if (spd != B0 && check[0] == '\0') - { - cfsetospeed(&tt, spd); - cfsetispeed(&tt, spd); - } - tcsetattr(fd, TCSANOW, &tt); - } - env[0]= term; - env[1]= 0; -} - -static speed_t num2speed(int num) -{ - static struct - { - int num; - speed_t value; - } speed_table[]= - { - { 0, B0, }, { 50, B50, }, { 75, B75, }, { 110, B110, }, - { 134, B134, }, { 150, B150, }, { 200, B200, }, { 300, B300, }, - { 600, B600, }, { 1200, B1200, }, { 1800, B1800, }, - { 2400, B2400, }, { 4800, B4800, }, { 9600, B9600, }, - { 19200, B19200, }, { 38400, B38400, }, - { -1, -1 }, - }; - int i; - - for (i= 0; speed_table[i].num != -1; i++) - { - if (speed_table[i].num == num) - return (speed_table[i].value); - } - return B0; -} - -static int do_control(char *cp, int cnt) -{ - char buf[20]; - struct winsize winsize; - - if (cnt > sizeof(buf)) - cnt= sizeof(buf); - - memcpy(buf, cp, cnt); - - /* Let's fetch the first 2 bytes. */ - if (cnt < 2) - readall(buf+cnt, 2-cnt); - if ((unsigned char)buf[1] != 255) - return 0; - - /* Let's fetch the first 4 bytes. */ - if (cnt < 4) - readall(buf+cnt, 4-cnt); - if (buf[2] != 's' || buf[3] != 's') - return 0; - - /* Let's fetch a winsize structure. */ - if (cnt < 4 + sizeof(winsize)) - readall(buf+cnt, 4 + sizeof(winsize) - cnt); - - memcpy(&winsize, buf+4, sizeof(winsize)); - winsize.ws_row= ntohs(winsize.ws_row); - winsize.ws_col= ntohs(winsize.ws_col); - winsize.ws_xpixel= ntohs(winsize.ws_xpixel); - winsize.ws_ypixel= ntohs(winsize.ws_ypixel); -#if DEBUG - fprintf(stderr, "setting window size to %d, %d\r\n", winsize.ws_row, - winsize.ws_col); -#endif - ioctl(1, TIOCSWINSZ, &winsize); - return 4 + sizeof(winsize); -} - -static void readall(char *buf, int cnt) -{ - int res; - - while(cnt) - { - res= read(0, buf, cnt); - if (res <= 0) - return; - buf += cnt; - cnt -= res; - } -} diff --git a/commands/rlogind/rlogind.h b/commands/rlogind/rlogind.h deleted file mode 100644 index 8c4e2dcc2..000000000 --- a/commands/rlogind/rlogind.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -in.rld.h -*/ - -#define NMAX 30 - -#ifndef EXTERN -#define EXTERN extern -#endif - -EXTERN char *prog_name; -EXTERN char hostname[256+1]; -EXTERN char line[1024]; -EXTERN char lusername[NMAX+1], rusername[NMAX+1]; -EXTERN char term[64]; -EXTERN int authenticated; - -/* in.rld.c: */ -void fatal(int fd, char *msg, int err); - -/* setup.c: */ -void authenticate(void); -int do_rlogin(void); -void tcp_urg(int fd, int on); diff --git a/commands/rlogind/setup.c b/commands/rlogind/setup.c deleted file mode 100644 index 72a059be1..000000000 --- a/commands/rlogind/setup.c +++ /dev/null @@ -1,92 +0,0 @@ -/* -setup.c -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rlogind.h" - -static void getstr(char *buf, int cnt, char *errmsg); - -void authenticate(void) -{ - int result; - struct nwio_tcpconf tcpconf; - struct hostent *hostent; - char c; - - /* Let's lookup the hostname for the connection. */ - result= ioctl (0, NWIOGTCPCONF, &tcpconf); - if (result<0) - { - fprintf(stderr, "%s: ioctl(NWIOTCPCONF): %s\r\n", - prog_name, strerror(errno)); - exit(1); - } - hostent= gethostbyaddr((char *)&tcpconf.nwtc_remaddr, - sizeof(tcpconf.nwtc_remaddr), AF_INET); - if (hostent) - { - strncpy(hostname, hostent->h_name, sizeof(hostname)-1); - hostname[sizeof(hostname)-1]= '\0'; - } - else - { - strcpy(hostname, inet_ntoa(tcpconf.nwtc_remaddr)); - } - - authenticated = 0; - - getstr(&c, 1, "protocol violation"); - getstr(rusername, sizeof(rusername), "remuser too long"); - getstr(lusername, sizeof(lusername), "locuser too long"); - strcpy(term, "TERM="); - getstr(term+5, sizeof(term)-5, "Terminal type too long"); - -#if DEBUG - fprintf(stderr, "got lu= %s, ru= %s, te= %s\r\n", lusername, rusername, - term); -#endif - if (iruserok(tcpconf.nwtc_remaddr, 0, rusername, lusername) == 0) - authenticated = 1; -} - -static void getstr(char *buf, int cnt, char *errmsg) -{ - char c; - - errno= 0; - do - { - if (read(0, &c, 1) != 1) - fatal(1, "read failed", errno); - cnt--; - if (cnt < 0) - fatal(1, errmsg, 0); - *buf++= c; - } while(c != 0); -} - -void tcp_urg(int fd, int on) -{ - struct nwio_tcpopt tcpopt; - - tcpopt.nwto_flags= on ? (NWTO_BSD_URG | NWTO_SND_URG) : NWTO_SND_NOTURG; - if (ioctl(1, NWIOSTCPOPT, &tcpopt) == -1) - { - fprintf(stderr, "rlogind: NWIOSTCPOPT failed: %s\r\n", - strerror(errno)); - } -} diff --git a/etc/Makefile b/etc/Makefile index cf6ae56c3..906e7d526 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -3,7 +3,7 @@ USR=/usr/ USRETC=/usr/etc/ DEFAULTS=/etc/defaults FILES1=group hostname.file inet.conf motd.install mtab profile \ - protocols rc services termcap ttytab utmp rc.cd \ + protocols rc services termcap utmp rc.cd \ syslog.conf rc.daemons.dist \ rs.inet rs.single make.conf system.conf ttys resolv.conf rc.conf \ rc.subr rc.subr.minix man.conf shells boot.cfg.default diff --git a/etc/rc.daemons.dist b/etc/rc.daemons.dist index cd22f5529..ebd7db9b2 100644 --- a/etc/rc.daemons.dist +++ b/etc/rc.daemons.dist @@ -1,5 +1,4 @@ daemonize talkd daemonize tcpd shell in.rshd -daemonize tcpd login in.rlogind daemonize tcpd telnet in.telnetd daemonize tcpd ftp in.ftpd diff --git a/etc/ttytab b/etc/ttytab deleted file mode 100755 index 5419d3a4c..000000000 --- a/etc/ttytab +++ /dev/null @@ -1,41 +0,0 @@ -# ttytab - terminals -# -# Device Type Program Init -console minix getty -ttyc1 minix getty -ttyc2 minix getty -ttyc3 minix getty -tty00 unknown -tty01 unknown -ttyp0 network -ttyp1 network -ttyp2 network -ttyp3 network -ttyp4 network -ttyp5 network -ttyp6 network -ttyp7 network -ttyp8 network -ttyp9 network -ttypa network -ttypb network -ttypc network -ttypd network -ttype network -ttypf network -ttyq0 network -ttyq1 network -ttyq2 network -ttyq3 network -ttyq4 network -ttyq5 network -ttyq6 network -ttyq7 network -ttyq8 network -ttyq9 network -ttyqa network -ttyqb network -ttyqc network -ttyqd network -ttyqe network -ttyqf network diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index 455490273..d2f81d5ca 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -13,7 +13,6 @@ #include #include -#include #include #include "archconst.h" diff --git a/kernel/proto.h b/kernel/proto.h index a8288063f..d70df8174 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -8,7 +8,6 @@ #include #include -#include #include /* Struct declarations. */ diff --git a/kernel/system.c b/kernel/system.c index 0218f58cf..77b0d2e32 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include diff --git a/kernel/system/do_sigreturn.c b/kernel/system/do_sigreturn.c index 592c8e2a2..cd8b68282 100644 --- a/kernel/system/do_sigreturn.c +++ b/kernel/system/do_sigreturn.c @@ -10,7 +10,6 @@ #include "kernel/system.h" #include #include -#include #if USE_SIGRETURN diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index 3d1324344..97a36e10e 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -11,7 +11,6 @@ #include "kernel/system.h" #include #include -#include #if USE_SIGSEND diff --git a/lib/libcompat_minix/Makefile b/lib/libcompat_minix/Makefile index 05db97c6a..0009bb655 100644 --- a/lib/libcompat_minix/Makefile +++ b/lib/libcompat_minix/Makefile @@ -9,28 +9,15 @@ MACHINE_ARCH= ${ARCH} # std_err() SRCS+= stderr.c -# V8 regexp (incompatible with BSD regexp) -SRCS+= v8regerror.c v8regexp.c v8regsub.c - # Configfile Library. SRCS+= configfile.c -# ACK a.out format. -SRCS+= nlist.c - # Minix 'mtab' handling functions. # # These should be changed when we switch to # NetBSD's 'mtab' format. SRCS+= mtab.c -# fttyslot(fd), a Minix-specific extension -SRCS+= fttyslot.c - -# cuserid() -# Now considered "compat" feature in NetBSD. -SRCS+= cuserid.c - .include "include/Makefile.inc" .include diff --git a/lib/libcompat_minix/cuserid.c b/lib/libcompat_minix/cuserid.c deleted file mode 100644 index 47640e751..000000000 --- a/lib/libcompat_minix/cuserid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* cuserid(3) - * - * Author: Terrence W. Holm Sept. 1987 - */ - -#include -#include -#include -#include -#include - -#ifndef L_cuserid -#define L_cuserid 9 -#endif - -char *cuserid(user_name) -char *user_name; -{ - PRIVATE char userid[L_cuserid]; - struct passwd *pw_entry; - - if (user_name == (char *)NULL) user_name = userid; - - pw_entry = getpwuid(geteuid()); - - if (pw_entry == (struct passwd *)NULL) { - *user_name = '\0'; - return((char *)NULL); - } - strcpy(user_name, pw_entry->pw_name); - - return(user_name); -} diff --git a/lib/libcompat_minix/fttyslot.c b/lib/libcompat_minix/fttyslot.c deleted file mode 100644 index 8afb84856..000000000 --- a/lib/libcompat_minix/fttyslot.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -ttyslot.c - -Return the index in the utmp file for the current user's terminal. The -current user's terminal is the first file descriptor in the range 0..2 -for which ttyname() returns a name. The index is the line number in the -/etc/ttytab file. 0 will be returned in case of an error. - -Created: Oct 11, 1992 by Philip Homburg -*/ - -#include -#include -#include -#include - -int fttyslot(fd) -int fd; -{ - char *tname; - int lineno; - struct ttyent *ttyp; - - tname= ttyname(fd); - if (tname == NULL) return 0; - - /* Assume that tty devices are in /dev */ - if (strncmp(tname, "/dev/", 5) != 0) - return 0; /* Malformed tty name. */ - tname += 5; - - /* Scan /etc/ttytab. */ - lineno= 1; - while ((ttyp= getttyent()) != NULL) - { - if (strcmp(tname, ttyp->ty_name) == 0) - { - endttyent(); - return lineno; - } - lineno++; - } - /* No match */ - endttyent(); - return 0; -} - -/* - * $PchHeader: /mount/hd2/minix/lib/misc/RCS/ttyslot.c,v 1.3 1994/12/22 13:49:12 philip Exp $ - */ diff --git a/lib/libcompat_minix/include/Makefile.inc b/lib/libcompat_minix/include/Makefile.inc index 8cff32e84..4c79a5f99 100644 --- a/lib/libcompat_minix/include/Makefile.inc +++ b/lib/libcompat_minix/include/Makefile.inc @@ -3,8 +3,6 @@ INCSDIR= /usr/include INCS+= configfile.h -INCS+= compat/a.out.h compat/regexp.h compat/syslog.h \ - compat/pwd.h +INCS+= compat/a.out.h INCS+= net/gen/netdb.h net/gen/resolv.h net/gen/nameser.h INCS+= sys/jmp_buf.h ${MACHINE_ARCH}/compat_jmp_buf.h -INCS+= sys/sigcontext.h diff --git a/lib/libcompat_minix/include/compat/pwd.h b/lib/libcompat_minix/include/compat/pwd.h deleted file mode 100644 index a53497598..000000000 --- a/lib/libcompat_minix/include/compat/pwd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* The header defines the items in the password file. */ - -#ifndef _PWD_H -#define _PWD_H - -#ifndef _TYPES_H -#include -#endif - -struct passwd { - char *pw_name; /* login name */ - uid_t pw_uid; /* uid corresponding to the name */ - gid_t pw_gid; /* gid corresponding to the name */ - char *pw_dir; /* user's home directory */ - char *pw_shell; /* name of the user's shell */ - - /* The following members are not defined by POSIX. */ - char *pw_passwd; /* password information */ - char *pw_gecos; /* just in case you have a GE 645 around */ -}; - -/* Function Prototypes. */ -_PROTOTYPE( struct passwd *getpwnam, (const char *_name) ); -_PROTOTYPE( struct passwd *getpwuid, (uid_t _uid) ); - -#ifdef _MINIX -_PROTOTYPE( void endpwent, (void) ); -_PROTOTYPE( struct passwd *getpwent, (void) ); -_PROTOTYPE( int setpwent, (void) ); -_PROTOTYPE( void setpwfile, (const char *_file) ); -_PROTOTYPE( const char *user_from_uid, (uid_t, int) ); -#endif - -#endif /* _PWD_H */ diff --git a/lib/libcompat_minix/include/compat/regexp.h b/lib/libcompat_minix/include/compat/regexp.h deleted file mode 100644 index 06338f816..000000000 --- a/lib/libcompat_minix/include/compat/regexp.h +++ /dev/null @@ -1,37 +0,0 @@ -/* The header is used by the (V8-compatible) regexp(3) routines. */ -/* NOTE: Obsoleted by the POSIX regex(3) library. */ - -#ifndef _REGEXP_H -#define _REGEXP_H - -#include - -#define CHARBITS 0377 -#define NSUBEXP 10 -typedef struct regexp { - const char *startp[NSUBEXP]; - const char *endp[NSUBEXP]; - char regstart; /* Internal use only. */ - char reganch; /* Internal use only. */ - char *regmust; /* Internal use only. */ - int regmlen; /* Internal use only. */ - char program[1]; /* Unwarranted chumminess with compiler. */ -} regexp; - -/* Keep these functions away from the POSIX versions. */ -#define regcomp _v8_regcomp -#define regexec _v8_regexec -#define regsub _v8_regsub -#define regerror _v8_regerror - -/* Function Prototypes. */ -regexp *regcomp(const char *_exp); -int regexec(regexp *_prog, const char *_string, int _bolflag); -void regsub(regexp *_prog, char *_source, char *_dest); -void regerror(const char *_message) ; - -#endif /* _REGEXP_H */ - -/* - * $PchId: regexp.h,v 1.4 1996/04/10 21:43:17 philip Exp $ - */ diff --git a/lib/libcompat_minix/include/compat/syslog.h b/lib/libcompat_minix/include/compat/syslog.h deleted file mode 100644 index 990087a5c..000000000 --- a/lib/libcompat_minix/include/compat/syslog.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _COMPAT_SYSLOG_H -#define _COMPAT_SYSLOG_H - -#include -#define FacNames facilitynames -#define PriNames prioritynames - -#endif diff --git a/lib/libcompat_minix/include/sys/sigcontext.h b/lib/libcompat_minix/include/sys/sigcontext.h deleted file mode 100644 index c27882230..000000000 --- a/lib/libcompat_minix/include/sys/sigcontext.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef COMPAT_SYS_SIGCONTEXT_H -#define COMPAT_SYS_SIGCONTEXT_H - -/* Minix legacy compatibility header. */ -#include -#include - -#endif diff --git a/lib/libcompat_minix/nlist.c b/lib/libcompat_minix/nlist.c deleted file mode 100644 index 4901032f1..000000000 --- a/lib/libcompat_minix/nlist.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * "nlist.c", Peter Valkenburg, january 1989. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define fail(fp) (fclose(fp), -1) /* ret. exp. when nlist fails */ - -_PROTOTYPE( int nlist, (char *file, struct nlist nl[])); - -/* - * Nlist fills fields n_sclass and n_value of array nl with values found in - * non-stripped executable file. Entries that are not found have their - * n_value/n_sclass fields set to 0. Nl ends with a 0 or nul string n_name. - * The return value is -1 on failure, else the number of entries not found. - */ -int nlist(file, nl) -char *file; -struct nlist nl[]; -{ - int nents, nsrch, nfound, i; - struct nlist nlent; - FILE *fp; - struct exec hd; - - /* open executable with namelist */ - if ((fp = fopen(file, "r")) == NULL) - return -1; - - /* get header and seek to start of namelist */ - if (fread((char *) &hd, sizeof(struct exec), 1, fp) != 1 || - BADMAG(hd) || fseek(fp, A_SYMPOS(hd), SEEK_SET) != 0) - return fail(fp); - - /* determine number of entries searched for & reset fields */ - nsrch = 0; - while (nl[nsrch].n_name != NULL && *(nl[nsrch].n_name) != '\0') { - nl[nsrch].n_sclass = 0; - nl[nsrch].n_value = 0; - nl[nsrch].n_type = 0; /* for compatability */ - nsrch++; - } - - /* loop through namelist & fill in user array */ - nfound = 0; - for (nents = (hd.a_syms & 0xFFFF) / sizeof(struct nlist); - nents > 0; nents--) { - if (nsrch == nfound) - break; /* no need to look further */ - if (fread((char *) &nlent, sizeof(struct nlist), 1, fp) != 1) - return fail(fp); - for (i = 0; i < nsrch; i++) - if (nl[i].n_sclass == 0 && - strncmp(nl[i].n_name, nlent.n_name, - sizeof(nlent.n_name)) == 0) { - nl[i] = nlent; - nfound++; - break; - } - } - - (void) fclose(fp); - - return nsrch - nfound; -} diff --git a/lib/libcompat_minix/v8regerror.c b/lib/libcompat_minix/v8regerror.c deleted file mode 100644 index 6f4e11fd8..000000000 --- a/lib/libcompat_minix/v8regerror.c +++ /dev/null @@ -1,15 +0,0 @@ -/* regerror() - Default regexp error report Author: Kees J. Bot - * 12 Jun 1999 - * - * A better version of this routine should be supplied by the user in - * the program using regexps. - */ -#include -#define const /* avoid "const poisoning" */ -#include -#undef const - -void regerror(char *message) -{ - fprintf(stderr, "regexp error: %s\n", message); -} diff --git a/lib/libcompat_minix/v8regexp.c b/lib/libcompat_minix/v8regexp.c deleted file mode 100644 index 1bed2b50f..000000000 --- a/lib/libcompat_minix/v8regexp.c +++ /dev/null @@ -1,1075 +0,0 @@ -/* regcomp and regexec -- regsub and regerror are elsewhere - * - * Copyright (c) 1986 by University of Toronto. - * Written by Henry Spencer. Not derived from licensed software. - * - * Permission is granted to anyone to use this software for any - * purpose on any computer system, and to redistribute it freely, - * subject to the following restrictions: - * - * 1. The author is not responsible for the consequences of use of - * this software, no matter how awful, even if they arise - * from defects in it. - * - * 2. The origin of this software must not be misrepresented, either - * by explicit claim or by omission. - * - * 3. Altered versions must be plainly marked as such, and must not - * be misrepresented as being the original software. - * - * Beware that some of this code is subtly aware of the way operator - * precedence is structured in regular expressions. Serious changes in - * regular-expression syntax might require a total rethink. - * - * The third parameter to regexec was added by Martin C. Atkins. - * Andy Tanenbaum also made some changes. - */ - -#include -#include -#include -#define const /* avoid "const poisoning" */ -#include -#undef const - -/* The first byte of the regexp internal "program" is actually this magic - * number; the start node begins in the second byte. - */ -#define MAGIC 0234 - -/* The "internal use only" fields in regexp.h are present to pass info from - * compile to execute that permits the execute phase to run lots faster on - * simple cases. They are: - * - * regstart char that must begin a match; '\0' if none obvious - * reganch is the match anchored (at beginning-of-line only)? - * regmust string (pointer into program) that match must include, or NULL - * regmlen length of regmust string - * - * Regstart and reganch permit very fast decisions on suitable starting points - * for a match, cutting down the work a lot. Regmust permits fast rejection - * of lines that cannot possibly match. The regmust tests are costly enough - * that regcomp() supplies a regmust only if the r.e. contains something - * potentially expensive (at present, the only such thing detected is * or + - * at the start of the r.e., which can involve a lot of backup). Regmlen is - * supplied because the test in regexec() needs it and regcomp() is computing - * it anyway. - */ - -/* Structure for regexp "program". This is essentially a linear encoding - * of a nondeterministic finite-state machine (aka syntax charts or - * "railroad normal form" in parsing technology). Each node is an opcode - * plus a "next" pointer, possibly plus an operand. "Next" pointers of - * all nodes except BRANCH implement concatenation; a "next" pointer with - * a BRANCH on both ends of it is connecting two alternatives. (Here we - * have one of the subtle syntax dependencies: an individual BRANCH (as - * opposed to a collection of them) is never concatenated with anything - * because of operator precedence.) The operand of some types of node is - * a literal string; for others, it is a node leading into a sub-FSM. In - * particular, the operand of a BRANCH node is the first node of the branch. - * (NB this is *not* a tree structure: the tail of the branch connects - * to the thing following the set of BRANCHes.) The opcodes are: - */ - -/* Definition number opnd? meaning */ -#define END 0 /* no End of program. */ -#define BOL 1 /* no Match "" at beginning of line. */ -#define EOL 2 /* no Match "" at end of line. */ -#define ANY 3 /* no Match any one character. */ -#define ANYOF 4 /* str Match any character in this string. */ -#define ANYBUT 5 /* str Match any character not in this - * string. */ -#define BRANCH 6 /* node Match this alternative, or the - * next... */ -#define BACK 7 /* no Match "", "next" ptr points backward. */ -#define EXACTLY 8 /* str Match this string. */ -#define NOTHING 9 /* no Match empty string. */ -#define STAR 10 /* node Match this (simple) thing 0 or more - * times. */ -#define PLUS 11 /* node Match this (simple) thing 1 or more - * times. */ -#define OPEN 20 /* no Mark this point in input as start of - * #n. */ - /* OPEN+1 is number 1, etc. */ -#define CLOSE 30 /* no Analogous to OPEN. */ - -/* Opcode notes: - * - * BRANCH The set of branches constituting a single choice are hooked - * together with their "next" pointers, since precedence prevents - * anything being concatenated to any individual branch. The - * "next" pointer of the last BRANCH in a choice points to the - * thing following the whole choice. This is also where the - * final "next" pointer of each individual branch points; each - * branch starts with the operand node of a BRANCH node. - * - * BACK Normal "next" pointers all implicitly point forward; BACK - * exists to make loop structures possible. - * - * STAR,PLUS '?', and complex '*' and '+', are implemented as circular - * BRANCH structures using BACK. Simple cases (one character - * per match) are implemented with STAR and PLUS for speed - * and to minimize recursive plunges. - * - * OPEN,CLOSE ...are numbered at compile time. - */ - -/* A node is one char of opcode followed by two chars of "next" pointer. - * "Next" pointers are stored as two 8-bit pieces, high order first. The - * value is a positive offset from the opcode of the node containing it. - * An operand, if any, simply follows the node. (Note that much of the - * code generation knows about this implicit relationship.) - * - * Using two bytes for the "next" pointer is vast overkill for most things, - * but allows patterns to get big without disasters. - */ -#define OP(p) (*(p)) -#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) -#define OPERAND(p) ((p) + 3) - -/* Utility definitions. - */ -#ifndef CHARBITS -#define UCHARAT(p) ((int)*(unsigned char *)(p)) -#else -#define UCHARAT(p) ((int)*(p)&CHARBITS) -#endif - -#define CFAIL(m) { regerror(m); return((char *)NULL); } -#define RFAIL(m) { regerror(m); return((regexp *)NULL); } -#define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') -#define META "^$.[()|?+*\\" - -/* Flags to be passed up and down. - */ -#define HASWIDTH 01 /* Known never to match null string. */ -#define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ -#define SPSTART 04 /* Starts with * or +. */ -#define WORST 0 /* Worst case. */ - -/* Global work variables for regcomp(). - */ -static char *regparse; /* Input-scan pointer. */ -static int regnpar; /* () count. */ -static char regdummy; -static char *regcode; /* Code-emit pointer; ®dummy = don't. */ -static long regsize; /* Code size. */ - -/* Forward declarations for regcomp()'s friends. - */ -static char *reg(int paren, int *flagp); -static char *regbranch(int *flagp); -static char *regpiece(int *flagp); -static char *regatom(int *flagp); -static char *regnode(int op); -static char *regnext(char *p); -static void regc(int b); -static void reginsert(int op, char *opnd); -static void regtail(char *p, char *val); -static void regoptail(char *p, char *val); - -/* - - regcomp - compile a regular expression into internal code - * - * We can't allocate space until we know how big the compiled form will be, - * but we can't compile it (and thus know how big it is) until we've got a - * place to put the code. So we cheat: we compile it twice, once with code - * generation turned off and size counting turned on, and once "for real". - * This also means that we don't allocate space until we are sure that the - * thing really will compile successfully, and we never have to move the - * code and thus invalidate pointers into it. (Note that it has to be in - * one piece because free() must be able to free it all.) - * - * Beware that the optimization-preparation code in here knows about some - * of the structure of the compiled regexp. - */ -regexp *regcomp(exp) -char *exp; -{ - register regexp *r; - register char *scan; - register char *longest; - register int len; - int flags; - - if (exp == (char *)NULL) RFAIL("NULL argument"); - - /* First pass: determine size, legality. */ - regparse = exp; - regnpar = 1; - regsize = 0L; - regcode = ®dummy; - regc(MAGIC); - if (reg(0, &flags) == (char *)NULL) return((regexp *)NULL); - - /* Small enough for pointer-storage convention? */ - if (regsize >= 32767L) /* Probably could be 65535L. */ - RFAIL("regexp too big"); - - /* Allocate space. */ - r = (regexp *) malloc(sizeof(regexp) + (unsigned) regsize); - if (r == (regexp *)NULL) RFAIL("out of space"); - - /* Second pass: emit code. */ - regparse = exp; - regnpar = 1; - regcode = r->program; - regc(MAGIC); - if (reg(0, &flags) == (char *)NULL) return((regexp *)NULL); - - /* Dig out information for optimizations. */ - r->regstart = '\0'; /* Worst-case defaults. */ - r->reganch = 0; - r->regmust = (char *)NULL; - r->regmlen = 0; - scan = r->program + 1; /* First BRANCH. */ - if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ - scan = OPERAND(scan); - - /* Starting-point info. */ - if (OP(scan) == EXACTLY) - r->regstart = *OPERAND(scan); - else if (OP(scan) == BOL) - r->reganch++; - - /* If there's something expensive in the r.e., find the - * longest literal string that must appear and make it the - * regmust. Resolve ties in favor of later strings, since - * the regstart check works with the beginning of the r.e. - * and avoiding duplication strengthens checking. Not a - * strong reason, but sufficient in the absence of others. */ - if (flags & SPSTART) { - longest = (char *)NULL; - len = 0; - for (; scan != (char *)NULL; scan = regnext(scan)) - if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) { - longest = OPERAND(scan); - len = strlen(OPERAND(scan)); - } - r->regmust = longest; - r->regmlen = len; - } - } - return(r); -} - -/* - - reg - regular expression, i.e. main body or parenthesized thing - * - * Caller must absorb opening parenthesis. - * - * Combining parenthesis handling with the base level of regular expression - * is a trifle forced, but the need to tie the tails of the branches to what - * follows makes it hard to avoid. - */ -static char *reg(paren, flagp) -int paren; /* Parenthesized? */ -int *flagp; -{ - register char *ret; - register char *br; - register char *ender; - register int parno; - int flags; - - *flagp = HASWIDTH; /* Tentatively. */ - - /* Make an OPEN node, if parenthesized. */ - if (paren) { - if (regnpar >= NSUBEXP) CFAIL("too many ()"); - parno = regnpar; - regnpar++; - ret = regnode(OPEN + parno); - } else { - parno = 0; /* not actually used, keep compiler quiet */ - ret = (char *)NULL; - } - - /* Pick up the branches, linking them together. */ - br = regbranch(&flags); - if (br == (char *)NULL) return((char *)NULL); - if (ret != (char *)NULL) - regtail(ret, br); /* OPEN -> first. */ - else - ret = br; - if (!(flags & HASWIDTH)) *flagp &= ~HASWIDTH; - *flagp |= flags & SPSTART; - while (*regparse == '|') { - regparse++; - br = regbranch(&flags); - if (br == (char *)NULL) return((char *)NULL); - regtail(ret, br); /* BRANCH -> BRANCH. */ - if (!(flags & HASWIDTH)) *flagp &= ~HASWIDTH; - *flagp |= flags & SPSTART; - } - - /* Make a closing node, and hook it on the end. */ - ender = regnode((paren) ? CLOSE + parno : END); - regtail(ret, ender); - - /* Hook the tails of the branches to the closing node. */ - for (br = ret; br != (char *)NULL; br = regnext(br)) regoptail(br, ender); - - /* Check for proper termination. */ - if (paren && *regparse++ != ')') { - CFAIL("unmatched ()"); - } else if (!paren && *regparse != '\0') { - if (*regparse == ')') { - CFAIL("unmatched ()"); - } else - CFAIL("junk on end"); /* "Can't happen". */ - /* NOTREACHED */ - } - return(ret); -} - -/* - - regbranch - one alternative of an | operator - * - * Implements the concatenation operator. - */ -static char *regbranch(flagp) -int *flagp; -{ - register char *ret; - register char *chain; - register char *latest; - int flags; - - *flagp = WORST; /* Tentatively. */ - - ret = regnode(BRANCH); - chain = (char *)NULL; - while (*regparse != '\0' && *regparse != '|' && *regparse != ')') { - latest = regpiece(&flags); - if (latest == (char *)NULL) return((char *)NULL); - *flagp |= flags & HASWIDTH; - if (chain == (char *)NULL) /* First piece. */ - *flagp |= flags & SPSTART; - else - regtail(chain, latest); - chain = latest; - } - if (chain == (char *)NULL) /* Loop ran zero times. */ - regnode(NOTHING); - - return(ret); -} - -/* - - regpiece - something followed by possible [*+?] - * - * Note that the branching code sequences used for ? and the general cases - * of * and + are somewhat optimized: they use the same NOTHING node as - * both the endmarker for their branch list and the body of the last branch. - * It might seem that this node could be dispensed with entirely, but the - * endmarker role is not redundant. - */ -static char *regpiece(flagp) -int *flagp; -{ - register char *ret; - register char op; - register char *next; - int flags; - - ret = regatom(&flags); - if (ret == (char *)NULL) return((char *)NULL); - - op = *regparse; - if (!ISMULT(op)) { - *flagp = flags; - return(ret); - } - if (!(flags & HASWIDTH) && op != '?') CFAIL("*+ operand could be empty"); - *flagp = (op != '+') ? (WORST | SPSTART) : (WORST | HASWIDTH); - - if (op == '*' && (flags & SIMPLE)) - reginsert(STAR, ret); - else if (op == '*') { - /* Emit x* as (x&|), where & means "self". */ - reginsert(BRANCH, ret); /* Either x */ - regoptail(ret, regnode(BACK)); /* and loop */ - regoptail(ret, ret); /* back */ - regtail(ret, regnode(BRANCH)); /* or */ - regtail(ret, regnode(NOTHING)); /* null. */ - } else if (op == '+' && (flags & SIMPLE)) - reginsert(PLUS, ret); - else if (op == '+') { - /* Emit x+ as x(&|), where & means "self". */ - next = regnode(BRANCH); /* Either */ - regtail(ret, next); - regtail(regnode(BACK), ret); /* loop back */ - regtail(next, regnode(BRANCH)); /* or */ - regtail(ret, regnode(NOTHING)); /* null. */ - } else if (op == '?') { - /* Emit x? as (x|) */ - reginsert(BRANCH, ret); /* Either x */ - regtail(ret, regnode(BRANCH)); /* or */ - next = regnode(NOTHING);/* null. */ - regtail(ret, next); - regoptail(ret, next); - } - regparse++; - if (ISMULT(*regparse)) CFAIL("nested *?+"); - - return(ret); -} - -/* - - regatom - the lowest level - * - * Optimization: gobbles an entire sequence of ordinary characters so that - * it can turn them into a single node, which is smaller to store and - * faster to run. Backslashed characters are exceptions, each becoming a - * separate node; the code is simpler that way and it's not worth fixing. - */ -static char *regatom(flagp) -int *flagp; -{ - register char *ret; - int flags; - - *flagp = WORST; /* Tentatively. */ - - switch (*regparse++) { - case '^': ret = regnode(BOL); break; - case '$': ret = regnode(EOL); break; - case '.': - ret = regnode(ANY); - *flagp |= HASWIDTH | SIMPLE; - break; - case '[':{ - register int class; - register int classend; - - if (*regparse == '^') { /* Complement of range. */ - ret = regnode(ANYBUT); - regparse++; - } else - ret = regnode(ANYOF); - if (*regparse == ']' || *regparse == '-') regc(*regparse++); - while (*regparse != '\0' && *regparse != ']') { - if (*regparse == '-') { - regparse++; - if (*regparse == ']' || *regparse == '\0') - regc('-'); - else { - class = UCHARAT(regparse - 2) + 1; - classend = UCHARAT(regparse); - if (class > classend + 1) - CFAIL("invalid [] range"); - for (; class <= classend; class++) - regc(class); - regparse++; - } - } else - regc(*regparse++); - } - regc('\0'); - if (*regparse != ']') CFAIL("unmatched []"); - regparse++; - *flagp |= HASWIDTH | SIMPLE; - } - break; - case '(': - ret = reg(1, &flags); - if (ret == (char *)NULL) return((char *)NULL); - *flagp |= flags & (HASWIDTH | SPSTART); - break; - case '\0': - case '|': - case ')': - CFAIL("internal urp"); /* Supposed to be caught earlier. */ - break; - case '?': - case '+': - case '*': CFAIL("?+* follows nothing"); break; - case '\\': - if (*regparse == '\0') CFAIL("trailing \\"); - ret = regnode(EXACTLY); - regc(*regparse++); - regc('\0'); - *flagp |= HASWIDTH | SIMPLE; - break; - default:{ - register int len; - register char ender; - - regparse--; - len = strcspn(regparse, META); - if (len <= 0) CFAIL("internal disaster"); - ender = *(regparse + len); - if (len > 1 && ISMULT(ender)) - len--; /* Back off clear of ?+* operand. */ - *flagp |= HASWIDTH; - if (len == 1) *flagp |= SIMPLE; - ret = regnode(EXACTLY); - while (len > 0) { - regc(*regparse++); - len--; - } - regc('\0'); - } - break; - } - - return(ret); -} - -/* - - regnode - emit a node - */ -static char *regnode(op) -char op; -{ - register char *ret; - register char *ptr; - - ret = regcode; - if (ret == ®dummy) { - regsize += 3; - return(ret); - } - ptr = ret; - *ptr++ = op; - *ptr++ = '\0'; /* Null "next" pointer. */ - *ptr++ = '\0'; - regcode = ptr; - - return(ret); -} - -/* - - regc - emit (if appropriate) a byte of code - */ -static void regc(b) -char b; -{ - if (regcode != ®dummy) - *regcode++ = b; - else - regsize++; -} - -/* - - reginsert - insert an operator in front of already-emitted operand - * - * Means relocating the operand. - */ -static void reginsert(op, opnd) -char op; -char *opnd; -{ - register char *src; - register char *dst; - register char *place; - - if (regcode == ®dummy) { - regsize += 3; - return; - } - src = regcode; - regcode += 3; - dst = regcode; - while (src > opnd) *--dst = *--src; - - place = opnd; /* Op node, where operand used to be. */ - *place++ = op; - *place++ = '\0'; - *place++ = '\0'; -} - -/* - - regtail - set the next-pointer at the end of a node chain - */ -static void regtail(p, val) -char *p; -char *val; -{ - register char *scan; - register char *temp; - register int offset; - - if (p == ®dummy) return; - - /* Find last node. */ - scan = p; - for (;;) { - temp = (char *)regnext(scan); - if (temp == (char *)NULL) break; - scan = temp; - } - - if (OP(scan) == BACK) - offset = scan - val; - else - offset = val - scan; - *(scan + 1) = (offset >> 8) & 0377; - *(scan + 2) = offset & 0377; -} - -/* - - regoptail - regtail on operand of first argument; nop if operandless - */ -static void regoptail(p, val) -char *p; -char *val; -{ - /* "Operandless" and "op != BRANCH" are synonymous in practice. */ - if (p == (char *)NULL || p == ®dummy || OP(p) != BRANCH) return; - regtail(OPERAND(p), val); -} - -/* regexec and friends - */ - -/* Global work variables for regexec(). - */ -static char *reginput; /* String-input pointer. */ -static char *regbol; /* Beginning of input, for ^ check. */ -static char **regstartp; /* Pointer to startp array. */ -static char **regendp; /* Ditto for endp. */ - -/* Forwards. - */ -static int regtry(regexp *prog, char *string); -static int regmatch(char *prog); -static int regrepeat(char *p); - -#ifdef DEBUG -int regnarrate = 0; -void regdump(); -static char *regprop(char *op); -#endif - -/* - - regexec - match a regexp against a string - */ -int regexec(prog, string, bolflag) -register regexp *prog; -register char *string; -int bolflag; -{ - register char *s; - - /* Be paranoid... */ - if (prog == (regexp *)NULL || string == (char *)NULL) { - regerror("NULL parameter"); - return(0); - } - - /* Check validity of program. */ - if (UCHARAT(prog->program) != MAGIC) { - regerror("corrupted program"); - return(0); - } - - /* If there is a "must appear" string, look for it. */ - if (prog->regmust != (char *)NULL) { - s = string; - while ((s = strchr(s, prog->regmust[0])) != (char *)NULL) { - if (strncmp(s, prog->regmust, prog->regmlen) == 0) - break; /* Found it. */ - s++; - } - if (s == (char *)NULL) /* Not present. */ - return(0); - } - - /* Mark beginning of line for ^ . */ - if (bolflag) - regbol = string; - else - regbol = (char *)NULL; - - /* Simplest case: anchored match need be tried only once. */ - if (prog->reganch) return(regtry(prog, string)); - - /* Messy cases: unanchored match. */ - s = string; - if (prog->regstart != '\0') /* We know what char it must start with. */ - while ((s = strchr(s, prog->regstart)) != (char *)NULL) { - if (regtry(prog, s)) return(1); - s++; - } - else - /* We don't -- general case. */ - do { - if (regtry(prog, s)) return(1); - } while (*s++ != '\0'); - - /* Failure. */ - return(0); -} - -/* - - regtry - try match at specific point - */ -static int regtry(prog, string) /* 0 failure, 1 success */ -regexp *prog; -char *string; -{ - register int i; - register char **sp; - register char **ep; - - reginput = string; - regstartp = prog->startp; - regendp = prog->endp; - - sp = prog->startp; - ep = prog->endp; - for (i = NSUBEXP; i > 0; i--) { - *sp++ = (char *)NULL; - *ep++ = (char *)NULL; - } - if (regmatch(prog->program + 1)) { - prog->startp[0] = string; - prog->endp[0] = reginput; - return(1); - } else - return(0); -} - -/* - - regmatch - main matching routine - * - * Conceptually the strategy is simple: check to see whether the current - * node matches, call self recursively to see whether the rest matches, - * and then act accordingly. In practice we make some effort to avoid - * recursion, in particular by going through "ordinary" nodes (that don't - * need to know whether the rest of the match failed) by a loop instead of - * by recursion. - */ -static int regmatch(prog) /* 0 failure, 1 success */ -char *prog; -{ - register char *scan; /* Current node. */ - char *next; /* Next node. */ - - scan = prog; -#ifdef DEBUG - if (scan != (char *)NULL && regnarrate) fprintf(stderr, "%s(\n", regprop(scan)); -#endif - while (scan != (char *)NULL) { -#ifdef DEBUG - if (regnarrate) fprintf(stderr, "%s...\n", regprop(scan)); -#endif - next = regnext(scan); - - switch (OP(scan)) { - case BOL: - if (reginput != regbol) return(0); - break; - case EOL: - if (*reginput != '\0') return(0); - break; - case ANY: - if (*reginput == '\0') return(0); - reginput++; - break; - case EXACTLY:{ - register int len; - register char *opnd; - - opnd = OPERAND(scan); - /* Inline the first character, for speed. */ - if (*opnd != *reginput) return(0); - len = strlen(opnd); - if (len > 1 && strncmp(opnd, reginput, len) != 0) - return(0); - reginput += len; - } - break; - case ANYOF: - if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == (char *)NULL) - return(0); - reginput++; - break; - case ANYBUT: - if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != (char *)NULL) - return(0); - reginput++; - break; - case NOTHING: - break; - case BACK: - break; - case OPEN + 1: - case OPEN + 2: - case OPEN + 3: - case OPEN + 4: - case OPEN + 5: - case OPEN + 6: - case OPEN + 7: - case OPEN + 8: - case OPEN + 9:{ - register int no; - register char *save; - - no = OP(scan) - OPEN; - save = reginput; - - if (regmatch(next)) { - /* Don't set startp if some later - * invocation of the same parentheses - * already has. */ - if (regstartp[no] == (char *)NULL) - regstartp[no] = save; - return(1); - } else - return(0); - } - break; - case CLOSE + 1: - case CLOSE + 2: - case CLOSE + 3: - case CLOSE + 4: - case CLOSE + 5: - case CLOSE + 6: - case CLOSE + 7: - case CLOSE + 8: - case CLOSE + 9:{ - register int no; - register char *save; - - no = OP(scan) - CLOSE; - save = reginput; - - if (regmatch(next)) { - /* Don't set endp if some later - * invocation of the same parentheses - * already has. */ - if (regendp[no] == (char *)NULL) regendp[no] = save; - return(1); - } else - return(0); - } - break; - case BRANCH:{ - register char *save; - - if (OP(next) != BRANCH) /* No choice. */ - next = OPERAND(scan); /* Avoid recursion. */ - else { - do { - save = reginput; - if (regmatch(OPERAND(scan))) - return(1); - reginput = save; - scan = regnext(scan); - } while (scan != (char *)NULL && OP(scan) == BRANCH); - return(0); - /* NOTREACHED */ - } - } - break; - case STAR: - case PLUS:{ - register char nextch; - register int no; - register char *save; - register int min; - - /* Lookahead to avoid useless match attempts - * when we know what character comes next. */ - nextch = '\0'; - if (OP(next) == EXACTLY) nextch = *OPERAND(next); - min = (OP(scan) == STAR) ? 0 : 1; - save = reginput; - no = regrepeat(OPERAND(scan)); - while (no >= min) { - /* If it could work, try it. */ - if (nextch == '\0' || *reginput == nextch) - if (regmatch(next)) return(1); - /* Couldn't or didn't -- back up. */ - no--; - reginput = save + no; - } - return(0); - } - break; - case END: - return(1); /* Success! */ - break; - default: - regerror("memory corruption"); - return(0); - break; - } - - scan = next; - } - - /* We get here only if there's trouble -- normally "case END" is the - * terminating point. */ - regerror("corrupted pointers"); - return(0); -} - -/* - - regrepeat - repeatedly match something simple, report how many - */ -static int regrepeat(p) -char *p; -{ - register int count = 0; - register char *scan; - register char *opnd; - - scan = reginput; - opnd = OPERAND(p); - switch (OP(p)) { - case ANY: - count = strlen(scan); - scan += count; - break; - case EXACTLY: - while (*opnd == *scan) { - count++; - scan++; - } - break; - case ANYOF: - while (*scan != '\0' && strchr(opnd, *scan) != (char *)NULL) { - count++; - scan++; - } - break; - case ANYBUT: - while (*scan != '\0' && strchr(opnd, *scan) == (char *)NULL) { - count++; - scan++; - } - break; - default: /* Oh dear. Called inappropriately. */ - regerror("internal foulup"); - count = 0; /* Best compromise. */ - break; - } - reginput = scan; - - return(count); -} - -/* - - regnext - dig the "next" pointer out of a node - */ -static char *regnext(p) -register char *p; -{ - register int offset; - - if (p == ®dummy) return((char *)NULL); - - offset = NEXT(p); - if (offset == 0) return((char *)NULL); - - if (OP(p) == BACK) - return(p - offset); - else - return(p + offset); -} - -#ifdef DEBUG - -static char *regprop(); - -/* - - regdump - dump a regexp onto stdout in vaguely comprehensible form - */ -void regdump(r) -regexp *r; -{ - register char *s; - register char op = EXACTLY; /* Arbitrary non-END op. */ - register char *next; - - s = r->program + 1; - while (op != END) { /* While that wasn't END last time... */ - op = OP(s); - printf("%2d%s", (int) (s - r->program), regprop(s)); /* Where, what. */ - next = regnext(s); - if (next == (char *)NULL) /* Next ptr. */ - printf("(0)"); - else - printf("(%d)", (int) (s - r->program) + (int) (next - s)); - s += 3; - if (op == ANYOF || op == ANYBUT || op == EXACTLY) { - /* Literal string, where present. */ - while (*s != '\0') { - putchar(*s); - s++; - } - s++; - } - putchar('\n'); - } - - /* Header fields of interest. */ - if (r->regstart != '\0') printf("start `%c' ", r->regstart); - if (r->reganch) printf("anchored "); - if (r->regmust != (char *)NULL) printf("must have \"%s\"", r->regmust); - printf("\n"); -} - -/* - - regprop - printable representation of opcode - */ -static char *regprop(op) -char *op; -{ - register char *p; - static char buf[50]; - - (void) strcpy(buf, ":"); - - switch (OP(op)) { - case BOL: p = "BOL"; break; - case EOL: p = "EOL"; break; - case ANY: p = "ANY"; break; - case ANYOF: p = "ANYOF"; break; - case ANYBUT: p = "ANYBUT"; break; - case BRANCH: p = "BRANCH"; break; - case EXACTLY: p = "EXACTLY"; break; - case NOTHING: p = "NOTHING"; break; - case BACK: p = "BACK"; break; - case END: p = "END"; break; - case OPEN + 1: - case OPEN + 2: - case OPEN + 3: - case OPEN + 4: - case OPEN + 5: - case OPEN + 6: - case OPEN + 7: - case OPEN + 8: - case OPEN + 9: - sprintf(buf + strlen(buf), "OPEN%d", OP(op) - OPEN); - p = (char *)NULL; - break; - case CLOSE + 1: - case CLOSE + 2: - case CLOSE + 3: - case CLOSE + 4: - case CLOSE + 5: - case CLOSE + 6: - case CLOSE + 7: - case CLOSE + 8: - case CLOSE + 9: - sprintf(buf + strlen(buf), "CLOSE%d", OP(op) - CLOSE); - p = (char *)NULL; - break; - case STAR: p = "STAR"; break; - case PLUS: p = "PLUS"; break; - default: regerror("corrupted opcode"); p = (char *) NULL; break; - } - if (p != (char *)NULL) (void) strcat(buf, p); - return(buf); -} - -#endif - -/* - * $PchId: regexp.c,v 1.4 1996/02/22 09:03:07 philip Exp $ - */ diff --git a/lib/libcompat_minix/v8regsub.c b/lib/libcompat_minix/v8regsub.c deleted file mode 100644 index 36f8c03f0..000000000 --- a/lib/libcompat_minix/v8regsub.c +++ /dev/null @@ -1,90 +0,0 @@ -/* regsub - * - * Copyright (c) 1986 by University of Toronto. - * Written by Henry Spencer. Not derived from licensed software. - * - * Permission is granted to anyone to use this software for any - * purpose on any computer system, and to redistribute it freely, - * subject to the following restrictions: - * - * 1. The author is not responsible for the consequences of use of - * this software, no matter how awful, even if they arise - * from defects in it. - * - * 2. The origin of this software must not be misrepresented, either - * by explicit claim or by omission. - * - * 3. Altered versions must be plainly marked as such, and must not - * be misrepresented as being the original software. - */ - -#include -#include -#define const /* avoid "const poisoning" */ -#include -#undef const - -/* The first byte of the regexp internal "program" is actually this magic - * number; the start node begins in the second byte. - */ -#define MAGIC 0234 - -#define CHARBITS 0377 -#ifndef CHARBITS -#define UCHARAT(p) ((int)*(unsigned char *)(p)) -#else -#define UCHARAT(p) ((int)*(p)&CHARBITS) -#endif - -/* - - regsub - perform substitutions after a regexp match - */ -void regsub(prog, source, dest) -regexp *prog; -char *source; -char *dest; -{ - register char *src; - register char *dst; - register char c; - register int no; - register int len; - - if (prog == (regexp *)NULL || source == (char *)NULL || dest == (char *)NULL) { - regerror("NULL parm to regsub"); - return; - } - if (UCHARAT(prog->program) != MAGIC) { - regerror("damaged regexp fed to regsub"); - return; - } - src = source; - dst = dest; - while ((c = *src++) != '\0') { - if (c == '&') - no = 0; - else if (c == '\\' && '0' <= *src && *src <= '9') - no = *src++ - '0'; - else - no = -1; - - if (no < 0) { /* Ordinary character. */ - if (c == '\\' && (*src == '\\' || *src == '&')) c = *src++; - *dst++ = c; - } else - if (prog->startp[no] != (char *)NULL && prog->endp[no] != (char *)NULL) { - len = (int) (prog->endp[no] - prog->startp[no]); - strncpy(dst, prog->startp[no], len); - dst += len; - if (len != 0 && *(dst - 1) == '\0') { /* strncpy hit NUL. */ - regerror("damaged match string"); - return; - } - } - } - *dst++ = '\0'; -} - -/* - * $PchId: regsub.c,v 1.3 1995/11/27 20:18:16 philip Exp $ - */ diff --git a/man/man1/Makefile b/man/man1/Makefile index f9247728c..d293380fa 100644 --- a/man/man1/Makefile +++ b/man/man1/Makefile @@ -1,6 +1,5 @@ MAN= ash.1 at.1 banner.1 basename.1 \ - bsfilt.1 cal.1 \ - calendar.1 cawf.1 chgrp.1 \ + bsfilt.1 cal.1 cawf.1 chgrp.1 \ chmod.1 cksum.1 clear.1 cmp.1 comm.1 compress.1 \ cp.1 crc.1 crontab.1 ctags.1 dd.1 dev2name.1 \ df.1 dhrystone.1 dosdir.1 dosread.1 doswrite.1 \ @@ -9,10 +8,10 @@ MAN= ash.1 at.1 banner.1 basename.1 \ finger.1 flexdoc.1 fmt.1 fold.1 format.1 fortune.1 \ fsck.mfs.1 head.1 host.1 hostaddr.1 ifdef.1 \ install.1 isodir.1 isoinfo.1 isoread.1 join.1 kill.1 \ - last.1 leave.1 loadfont.1 loadkeys.1 logger.1 login.1 \ + last.1 loadfont.1 loadkeys.1 logger.1 login.1 \ look.1 lp.1 ls.1 lspci.1 mail.1 \ mesg.1 mixer.1 mkfs.1 \ - mkproto.1 modem.1 mount.1 mt.1 nice.1 nm.1 nohup.1 od.1 \ + mkproto.1 mount.1 mt.1 nice.1 nm.1 nohup.1 od.1 \ paste.1 ping.1 playwave.1 pr.1 prep.1 \ profile.1 ps.1 pwd.1 rcp.1 readall.1 recwave.1 \ ref.1 remsync.1 rget.1 rlogin.1 rsh.1 rz.1 \ diff --git a/man/man1/calendar.1 b/man/man1/calendar.1 deleted file mode 100644 index f1daf5c87..000000000 --- a/man/man1/calendar.1 +++ /dev/null @@ -1,44 +0,0 @@ -.TH CALENDAR 1 -.SH NAME -calendar \- reminder service -.SH SYNOPSIS -\fBcalendar [\fB\-\fR] [\fB\-r\fR]\fR -.br -.de FL -.TP -\\fB\\$1\\fR -\\$2 -.. -.de EX -.TP 20 -\\fB\\$1\\fR -# \\$2 -.. -.SH OPTIONS -.FL "\-" "Work for every user and send mail to him" -.FL "\-r" "Restrict multiple execution on the same day" -.SH EXAMPLES -.EX "calendar" "Check \fIcalendar\fR file in current directory" -.EX "calendar" "Normary used under the control of cron(8)" -.EX "calendar \-r" " Normary used in /etc/rc file" -.SH DESCRIPTION -.PP -Basically \fIcalendar\fR program consults the file \fIcalendar\fR in the -current directory and display lines which contain today's or tomorrow's date. -Month-day formats such -as '12/25', 'Dec. 25', 'december 25', '*/25', '12/*', '*/*' are -recognized. The asterisk -means 'all' days or 'all' months. On weekends 'tomorrow' extends through -next Monday without any consideration about holidays. -To prevent ambiguity, the formats '25 Dec.' and '25/12' are not recognized. -.PP -When an argument \fB\-\fR is present, \fIcalendar\fR works for all users -with a file \fIcalendar\fR in their login directories and sends them mail. -Normally this is done daily under the control of \fIcron\fR. -.PP -The \fB\-r\fR option does its the same job as \fB\-\fR option, but touches -the \fIcalendar\fR to prevents further access on the same day. -Normally this is done in the \fI/etc/rc\fR file on a machine which may be -booted several times in one day. -.SH "SEE ALSO" -.BR cron (8). diff --git a/man/man1/leave.1 b/man/man1/leave.1 deleted file mode 100644 index d1ec8452f..000000000 --- a/man/man1/leave.1 +++ /dev/null @@ -1,26 +0,0 @@ -.TH LEAVE 1 -.SH NAME -leave \- warn when it is time to go home -.SH SYNOPSIS -\fBleave\fR [\fR [\fB+\fR] \fIhh\fR[\fB:\fR]\fImm\fR]\fR -.br -.de FL -.TP -\\fB\\$1\\fR -\\$2 -.. -.de EX -.TP 20 -\\fB\\$1\\fR -# \\$2 -.. -.SH EXAMPLES -.EX "leave 1500" "Issue a warning at 2:55 p.m." -.EX "leave 10:00" "Issue a warning at 9:55 a.m." -.EX "leave + 30" "Issue a warning in 25 minutes" -.SH DESCRIPTION -.PP -\fILeave\fR sets an alarm clock to a specified time and issues a warning -5 minutes before, 1 minute before, and at the time to leave. -It then keeps issuing warnings every minute for 10 minutes, then quits. -If no time is provided, the program prompts for one. diff --git a/man/man1/modem.1 b/man/man1/modem.1 deleted file mode 100644 index 5593b9720..000000000 --- a/man/man1/modem.1 +++ /dev/null @@ -1,39 +0,0 @@ -.TH MODEM 1 -.SH NAME -modem \- switch the modem and getty state -.SH SYNOPSIS -\fBmodem \fR[\fB\-o\fR] [\fB\-i \fInum\fR] \fBtty\fIn\fR\fR -.br -.de FL -.TP -\\fB\\$1\\fR -\\$2 -.. -.de EX -.TP 20 -\\fB\\$1\\fR -# \\$2 -.. -.SH OPTIONS -.FL "\-o" "Turn getty off and set modem to dialout" -.FL "\-i" "Set line to dialin" -.SH EXAMPLES -.EX "modem \-o tty00" "Set tty00 to dialout" -.EX "modem \-i2 tty00" "Set tty00 to dialin (2 rings)" -.SH DESCRIPTION -.PP -The \fIgetty\fR program allows a terminal port to be used for both dialin and -dialout. -This little program switches the getty state, and also sends -some commands to the modem attached to the specified line. -If the \fB\-o\fR flag is presnt, \fImodem\fR will put the -getty process (if any) connected to the specified line into -SUSPEND state, which means that it -will not pay attention to that line until it is reset to RESTART state. -Also, \fImodem\fR will send some (Hayes) -commands to the attached modem to disable the auto-nanswer mode. -The \fB\-i\fR flag specifies the number of times the telephone has to -ring before the modem may answer the call (to give the operator a chance). -.SH "SEE ALSO" -.BR term (1), -.BR getty (8). diff --git a/man/man8/Makefile b/man/man8/Makefile index 8bacfb95b..ccc8ca6ae 100644 --- a/man/man8/Makefile +++ b/man/man8/Makefile @@ -6,7 +6,7 @@ MAN= add_route.8 backup.8 badblocks.8 boot.8 btrace.8 \ mknod.8 netconf.8 newroot.8 nonamed.8 \ ossdevlinks.8 part.8 partition.8 \ poweroff.8 printroot.8 pr_routes.8 pwdauth.8 rarpd.8 \ - rdate.8 readclock.8 reboot.8 repartition.8 rlogind.8 \ + rdate.8 readclock.8 reboot.8 repartition.8 \ rshd.8 screendump.8 serial-ip.8 service.8 \ setup.8 shutdown.8 slip.8 srccrc.8 sync.8 syslogd.8 tcpd.8 \ unix.8 update.8 usage.8 diff --git a/man/man8/rlogind.8 b/man/man8/rlogind.8 deleted file mode 100644 index 44c99194c..000000000 --- a/man/man8/rlogind.8 +++ /dev/null @@ -1,103 +0,0 @@ -.\" Copyright (c) 1983 Regents of the University of California. -.\" All rights reserved. The Berkeley software License Agreement -.\" specifies the terms and conditions for redistribution. -.\" -.\" @(#)rlogind.8c 6.3 (Berkeley) 5/24/86 -.\" -.TH RLOGIND 8 "May 24, 1986" -.UC 5 -.SH NAME -rlogind, in.rlogind \- remote login server -.SH SYNOPSIS -.B "login stream tcp nowait root /usr/sbin/in.rlogind in.rlogind" -.br -.B "tcpd login /usr/sbin/in.rlogind" -.SH DESCRIPTION -.B Rlogind -is the server for the -.BR rlogin (1) -program. The server provides a remote login facility -with authentication based on privileged port numbers from trusted hosts. -.PP -.B Rlogind -listens for service requests at the port indicated in -the ``login'' service specification; see -.BR services (5). -When a service request is received the following protocol -is initiated: -.IP 1) -The server checks the client's source port. -If the port is not in the range 0-1023, the server -aborts the connection. -.IP 2) -The server checks the client's source address -and requests the corresponding host name (see -.BR gethostbyaddr (3), -.BR hosts (5) -and -.BR named (8)). -If the hostname cannot be determined, -the dot-notation representation of the host address is used. -.PP -Once the source port and address have been checked, -.B rlogind -allocates a pseudo terminal (see -.BR tty (4)), -and manipulates file descriptors so that the slave -half of the pseudo terminal becomes the -.B stdin , -.B stdout , -and -.B stderr -for a login process. -The login process is an instance of the -.BR login (1) -program, invoked with the -.B \-r -option. The login process then proceeds with the authentication -process as described in -.BR rshd (8), -but if automatic authentication fails, it reprompts the user -to login as one finds on a standard terminal line. -.PP -The parent of the login process manipulates the master side of -the pseduo terminal, operating as an intermediary -between the login process and the client instance of the -.B rlogin -program. In normal operation, the packet protocol described -in -.BR tty (4) -is invoked to provide ^S/^Q type facilities and propagate -interrupt signals to the remote programs. The login process -propagates the client terminal's baud rate and terminal type, -as found in the environment variable, ``TERM''; see -.BR environ (7). -The screen or window size of the terminal is requested from the client, -and window size changes from the client are propagated to the pseudo terminal. -.SH "SEE ALSO" -.BR rlogin (1). -.SH DIAGNOSTICS -All diagnostic messages are returned on the connection -associated with the -.BR stderr , -after which any network connections are closed. -An error is indicated by a leading byte with a value of 1. -.PP -.B ``Try again.'' -.br -A -.B fork -by the server failed. -.PP -.B ``/bin/sh: ...'' -.br -The user's login shell could not be started. -.SH BUGS -The authentication procedure used here assumes the integrity -of each client machine and the connecting medium. This is -insecure, but is useful in an ``open'' environment. -.PP -A facility to allow all data exchanges to be encrypted should be -present. -.PP -A more extensible protocol should be used. diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 17cd8de84..1f26ebbdf 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include "mproc.h" #include "param.h" diff --git a/servers/vm/signal.c b/servers/vm/signal.c index ab4fda3ce..980ebdb72 100644 --- a/servers/vm/signal.c +++ b/servers/vm/signal.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include diff --git a/test/test11.c b/test/test11.c index 5dbcd6e44..00d07c132 100644 --- a/test/test11.c +++ b/test/test11.c @@ -132,37 +132,28 @@ void test11b() void test11c() { -/* Test getlogin() and cuserid(). This test MUST run setuid root. */ +/* Test getlogin(). This test MUST run setuid root. */ int n, etc_uid; uid_t ruid, euid; - char *lnamep, *cnamep, *p; + char *lnamep, *p; #define MAXLINELEN 200 - char array[MAXLINELEN], save[L_cuserid], save2[L_cuserid]; + char array[MAXLINELEN], save[L_cuserid]; FILE *stream; subtest = 3; errno = -2000; /* None of these calls set errno. */ - array[0] = '@'; - array[1] = '0'; save[0] = '#'; save[1] = '0'; ruid = getuid(); euid = geteuid(); lnamep = getlogin(); strcpy(save, lnamep); - cnamep = cuserid(array); - strcpy(save2, cnamep); - /* Because we are setuid root, cuser == array == 'root'; login != 'root' */ + /* Because we are setuid, login != 'root' */ if (euid != 0) e(1); if (ruid == 0) e(2); - if (strcmp(cnamep, "root") != 0) e(3); - if (strcmp(array, "root") != 0) e(4); if ( (n = strlen(save)) == 0) e(5); - if (strcmp(save, cnamep) == 0) e(6); /* they must be different */ - cnamep = cuserid(NULL); - if (strcmp(cnamep, save2) != 0) e(7); /* Check login against passwd file. First lookup login in /etc/passwd. */ if (n == 0) return; /* if login not found, don't look it up */ diff --git a/test/test37.c b/test/test37.c index 814b6d29a..def3f9c2e 100644 --- a/test/test37.c +++ b/test/test37.c @@ -2,9 +2,6 @@ #include #include -#ifdef _MINIX -#include -#endif #include #include #include diff --git a/test/test47.c b/test/test47.c index 26427ecd2..5126cd8a8 100644 --- a/test/test47.c +++ b/test/test47.c @@ -5,7 +5,6 @@ #include #include #include -#include #define MAX_ERROR 4 #include "common.c" -- 2.44.0