70 lines
1.5 KiB
Plaintext
70 lines
1.5 KiB
Plaintext
$NetBSD: patch-aw,v 1.4 2015/11/07 21:47:07 dholland Exp $
|
|
|
|
- Use standard headers.
|
|
- Throw out a raft of legacy sgtty/termio logic.
|
|
- Don't fail if NAME_MAX is missing.
|
|
|
|
--- src/unix.c.orig 2000-03-15 22:13:29.000000000 +0000
|
|
+++ src/unix.c
|
|
@@ -6,11 +6,14 @@
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/param.h>
|
|
+#include <sys/ioctl.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <pwd.h>
|
|
-#include <sys/dir.h>
|
|
+#include <dirent.h>
|
|
+#include <limits.h>
|
|
+#include <termios.h>
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
#include "icb.h"
|
|
@@ -32,32 +35,10 @@ void noecho (void);
|
|
#undef stty
|
|
#undef gtty
|
|
|
|
-#if defined(__linux__)
|
|
-#include <termios.h>
|
|
-#include <sys/ioctl.h>
|
|
#define TTYSTRUCT termios
|
|
#define stty(fd,buf) tcgetattr((fd), (buf))
|
|
#define gtty(fd,buf) tcsetattr((fd), TCSANOW, (buf))
|
|
#define SYSV
|
|
-#else
|
|
-#ifndef SYSV
|
|
-
|
|
-#ifdef linux
|
|
-#include <bsd/sgtty.h>
|
|
-#else
|
|
-#include <sgtty.h>
|
|
-#endif
|
|
-
|
|
-#define TTYSTRUCT sgttyb
|
|
-#define stty(fd,buf) ioctl((fd),TIOCSETN,(buf))
|
|
-#define gtty(fd,buf) ioctl((fd),TIOCGETP,(buf))
|
|
-#else /* SYSV */
|
|
-#include <termio.h>
|
|
-#define TTYSTRUCT termio
|
|
-#define stty(fd,buf) ioctl((fd),TCSETA,(buf))
|
|
-#define gtty(fd,buf) ioctl((fd),TCGETA,(buf))
|
|
-#endif /* SYSV */
|
|
-#endif /* __linux__ */
|
|
|
|
char *getlogin();
|
|
|
|
@@ -235,7 +216,11 @@ tildexpand (char *s)
|
|
struct passwd *pw;
|
|
char login[17];
|
|
char *p = login;
|
|
+#ifdef NAME_MAX
|
|
+ static char path[NAME_MAX + 1];
|
|
+#else
|
|
static char path[MAXNAMLEN+1];
|
|
+#endif
|
|
|
|
/* has to start with a tilde */
|
|
if (*s++ != '~')
|