commit c856afe173818bceaeaf4b23321794c10a9b5fda
parent c914c9abfc734660c9b8be497462197cfea646ce
Author: ukai <ukai>
Date: Fri, 16 Nov 2001 22:02:00 +0000
follow autoconf conventions, #include cleanups
Diffstat:
24 files changed, 175 insertions(+), 174 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,45 @@
2001-11-17 Fumitoshi UKAI <ukai@debian.or.jp>
+ * configure: follow autoconf conventions
+ STRCASECMP -> HAVE_STRCASECMP
+ STRCHR -> HAVE_STRCHR
+ STRERROR -> HAVE_STRERROR
+ SYS_ERRLIST -> HAVE_SYS_ERRLIST
+ NOBCOPY -> HAVE_BCOPY
+ GETCWD -> HAVE_GETCWD
+ GETWD -> HAVE_GETWD
+ READLINK -> HAVE_READLINK (HAVE_LSTAT?)
+ TERMIO -> HAVE_TERMIO_H
+ TERMIOS -> HAVE_TERMIOS_H
+ SGTTY -> HAVE_SGTTY_H
+ DIRENT -> HAVE_DIRENT_H
+ NO_FLOAT_H -> HAVE_FLOAT_H
+ * etc.c fm.h config.h: HAVE_STRCASECMP
+ * etc.c config.h file.c: HAVE_STRCHR
+ strchr() moved from file.c to etc.c
+ * etc.c config.h: HAVE_STRERROR
+ * etc.c config.h main.c (MAIN): HAVE_SYS_ERRLIST
+ * etc.c fm.h: HAVE_BCOPY
+ * etc.c indep.c (currentdir) config.h: HAVE_GETCWD
+ * indep.c (currentdir) config.h: HAVE_GETWD
+ * form.c (form_write_from_file) local.c (dirBuffer)
+ config.h: HAVE_READLINK
+ * config.h terms.c: HAVE_TERMIO_H, HAVE_TERMIOS_H, HAVE_SGTTY_H
+ * config.h local.h: HAVE_DIRENT_H
+ * config.h matric.c: HAVE_FLOAT_H
+
+ * anchor.c cookie.c file.c parsetagx.c regex.c table.c url.c:
+ remove include <strings.h> ifdef __EMX__
+ it will be included in fm.h
+ * frame.c: remove include <strings.h> for bzero() and bcopy()
+ these are declared in fm.h
+ * indep.c: remove include <strings.h> for bcopy()
+ this is declared in fm.h
+ * istream.c mailcap.c: remove include <strings.h> for bzero()
+ this is declared in fm.h
+ * parsetag.c: remove include <strings.h> for bzero()
+ no bzero() used in this file
+
* terms.c (set_tty): "rxvt" is xterm
(getTCstr): tgetstr("Km", &pt) is not xterm, removed
(mouse_init): check Gpm_Open() == -2 to detect xterm when USE_GPM
diff --git a/Str.c b/Str.c
@@ -17,7 +17,7 @@
#include <gc.h>
#include <stdarg.h>
#include <string.h>
-#ifdef __EMX__
+#ifdef __EMX__ /* or include "fm.h" for HAVE_BCOPY? */
#include <strings.h>
#endif
#include "Str.h"
diff --git a/anchor.c b/anchor.c
@@ -1,8 +1,4 @@
/* $Id$ */
-#ifdef __EMX__
-#include <strings.h>
-#endif
-
#include "fm.h"
#include "myctype.h"
#include "regex.h"
diff --git a/config.h b/config.h
@@ -168,26 +168,24 @@ MODEL=Linux.i686-monster-ja
#define DEF_SAVE_FILE "index.html"
#undef USE_BINMODE_STREAM
-#define TERMIOS
-#define DIRENT
-#define STRCASECMP
-#define STRCHR
-#define STRERROR
-#define SYS_ERRLIST
-#undef NOBCOPY
+#define HAVE_TERMIOS_H
+#define HAVE_DIRENT_H
+#define HAVE_STRCASECMP
+#define HAVE_STRCHR
+#define HAVE_STRERROR
+#define HAVE_SYS_ERRLIST
+#define HAVE_BCOPY
#define HAVE_WAITPID
#define HAVE_WAIT3
#define HAVE_STRFTIME
-#define GETCWD
-#define GETWD
-#define READLINK
+#define HAVE_GETCWD
+#define HAVE_GETWD
+#define HAVE_READLINK
#define HAVE_SETENV
#define HAVE_PUTENV
#define HAVE_SRAND48
#define HAVE_SRANDOM
-#define READLINK
-
#define SETJMP(env) sigsetjmp(env,1)
#define LONGJMP(env,val) siglongjmp(env,val)
@@ -209,7 +207,7 @@ typedef void MySignalHandler;
#undef TABLE_NO_COMPACT
#define NOWRAP 1
#define MATRIX 1
-#undef NO_FLOAT_H
+#define HAVE_FLOAT_H
#ifndef HAVE_SRAND48
#ifdef HAVE_SRANDOM
diff --git a/configure b/configure
@@ -1015,10 +1015,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have strcasecmp()."
- strcasecmp_flg="#define STRCASECMP"
+ strcasecmp_flg="#define HAVE_STRCASECMP"
else
echo "You don't have strcasecmp()."
- strcasecmp_flg="#undef STRCASECMP"
+ strcasecmp_flg="#undef HAVE_STRCASECMP"
fi
####### strchr
@@ -1033,10 +1033,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have strchr()."
- strchr_flg="#define STRCHR"
+ strchr_flg="#define HAVE_STRCHR"
else
echo "You don't have strchr()."
- strchr_flg="#undef STRCHR"
+ strchr_flg="#undef HAVE_STRCHR"
fi
####### strerror
@@ -1050,10 +1050,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have strerror()."
- strerror_flg="#define STRERROR"
+ strerror_flg="#define HAVE_STRERROR"
else
echo "You don't have strerror()."
- strerror_flg="#undef STRERROR"
+ strerror_flg="#undef HAVE_STRERROR"
fi
@@ -1067,10 +1067,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have sys_errlist[]."
- syserrlist_flg="#define SYS_ERRLIST"
+ syserrlist_flg="#define HAVE_SYS_ERRLIST"
else
echo "You don't have sys_errlist[]."
- syserrlist_flg="#undef SYS_ERRLIST"
+ syserrlist_flg="#undef HAVE_SYS_ERRLIST"
fi
####### bcopy
@@ -1085,10 +1085,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have bcopy()."
- bcopy_flg="#undef NOBCOPY"
+ bcopy_flg="#define HAVE_BCOPY"
else
echo "You don't have bcopy()."
- bcopy_flg="#define NOBCOPY"
+ bcopy_flg="#undef HAVE_BCOPY"
fi
####### waitpid
@@ -1183,10 +1183,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have getcwd()."
- getcwd_flg="#define GETCWD"
+ getcwd_flg="#define HAVE_GETCWD"
else
echo "You don't have getcwd()."
- getcwd_flg="#undef GETCWD"
+ getcwd_flg="#undef HAVE_GETCWD"
fi
####### getwd
@@ -1200,10 +1200,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have getwd()."
- getwd_flg="#define GETWD"
+ getwd_flg="#define HAVE_GETWD"
else
echo "You don't have getwd()."
- getwd_flg="#undef GETWD"
+ getwd_flg="#undef HAVE_GETWD"
fi
####### readlink
@@ -1217,10 +1217,10 @@ EOF
if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
then
echo "You have readlink()."
- readlink_flg="#define READLINK"
+ readlink_flg="#define HAVE_READLINK"
else
echo "You don't have readlink()."
- readlink_flg="#undef READLINK"
+ readlink_flg="#undef HAVE_READLINK"
fi
####### setenv
@@ -1373,22 +1373,22 @@ fi
term_if='#define SGTTY'
if [ $sysname = "HP-UX" ]; then
echo "Your OS is HP-UX; using termio"
- term_if="#define TERMIO"
+ term_if="#define HAVE_TERMIO_H"
elif [ $sysname = "CYGWIN" ]; then
echo "Your OS is CYGWIN; using termios"
- term_if="#define TERMIOS"
+ term_if="#define HAVE_TERMIOS_H"
elif [ $sysname = "OS/2" ]; then
echo "Your OS is OS/2; using termios"
- term_if='#define TERMIOS'
+ term_if='#define HAVE_TERMIOS_H'
elif [ -r /usr/include/termios.h ]; then
echo "You have termios."
- term_if='#define TERMIOS'
+ term_if='#define HAVE_TERMIOS_H'
elif [ -r /usr/include/termio.h ]; then
echo "You have termio."
- term_if='#define TERMIO'
+ term_if='#define HAVE_TERMIO_H'
elif [ -r /usr/include/sgtty.h ]; then
echo "You have sgtty."
- term_if='#define SGTTY'
+ term_if='#define HAVE_SGTTY_H'
else
echo "Do you have tty interface? I can't find one but I hope sgtty works..."
fi
@@ -1397,13 +1397,13 @@ fi
dir_if=''
if [ $sysname = "CYGWIN" ]; then
echo "Your OS is CYGWIN; using dirent.h"
- dir_if='#define DIRENT'
+ dir_if='#define HAVE_DIRENT_H'
elif [ $sysname = "OS/2" ]; then
echo "Your OS is OS/2; using dirent.h"
- dir_if='#define DIRENT'
+ dir_if='#define HAVE_DIRENT_H'
elif [ -r /usr/include/dirent.h ]; then
echo "You have dirent.h."
- dir_if='#define DIRENT'
+ dir_if='#define HAVE_DIRENT_H'
elif [ -r /usr/include/sys/dir.h ]; then
echo "You have sys/dir.h."
dir_if=''
@@ -1466,9 +1466,9 @@ EOF
if $cc $cflags -c _zmachdep.c > /dev/null 2>&1
then
echo "You have float.h."
- no_float_h='#undef NO_FLOAT_H'
+ no_float_h='#define HAVE_FLOAT_H'
else
- no_float_h='#define NO_FLOAT_H 1'
+ no_float_h='#undef HAVE_FLOAT_H'
fi
####### setpgrp(pid, pgrp) or setpgrp() ?
diff --git a/cookie.c b/cookie.c
@@ -12,10 +12,6 @@
#include "fm.h"
#include "html.h"
-#ifdef __EMX__
-#include <strings.h>
-#endif
-
#ifdef USE_COOKIE
#include <time.h>
#include "local.h"
diff --git a/etc.c b/etc.c
@@ -7,10 +7,10 @@
#include "hash.h"
#include "terms.h"
-#ifdef GETCWD
+#ifdef HAVE_GETCWD /* ??? ukai */
#include <unistd.h>
#include <sys/param.h>
-#endif /* GETCWD */
+#endif /* HAVE_GETCWD */
#include <sys/types.h>
#include <time.h>
@@ -22,7 +22,21 @@
#define close(x) close_s(x)
#endif /* __WATT32__ */
-#ifndef STRCASECMP
+
+#ifndef HAVE_STRCHR
+char *
+strchr(char *s, char c)
+{
+ while (*s) {
+ if (*s == c)
+ return s;
+ s++;
+ }
+ return NULL;
+}
+#endif /* not HAVE_STRCHR */
+
+#ifndef HAVE_STRCASECMP
int
strcasecmp(char *s1, char *s2)
{
@@ -55,7 +69,7 @@ strncasecmp(char *s1, char *s2, int n)
return x;
return 0;
}
-#endif /* not STRCASECMP */
+#endif /* not HAVE_STRCASECMP */
int
arg_is(char *str, char *tag)
@@ -640,7 +654,7 @@ lastFileName(char *path)
return allocStr(q, 0);
}
-#ifdef NOBCOPY
+#ifndef HAVE_BCOPY
void
bcopy(void *src, void *dest, int len)
{
@@ -664,7 +678,7 @@ bzero(void *ptr, int len)
for (i = 0; i < len; i++)
*(ptr++) = 0;
}
-#endif /* NOBCOPY */
+#endif /* not HAVE_BCOPY */
#ifdef USE_INCLUDED_SRAND48
static unsigned long R1 = 0x1234abcd;
@@ -723,16 +737,16 @@ mydirname(char *s)
return allocStr(s, strlen(s) - strlen(p) + 1);
}
-#ifndef STRERROR
+#ifndef HAVE_STRERROR
char *
strerror(int errno)
{
extern char *sys_errlist[];
return sys_errlist[errno];
}
-#endif /* not STRERROR */
+#endif /* not HAVE_STRERROR */
-#ifndef SYS_ERRLIST
+#ifndef HAVE_SYS_ERRLIST
char **sys_errlist;
prepare_sys_errlist()
@@ -748,7 +762,7 @@ prepare_sys_errlist()
for (i = 1; i < n; i++)
sys_errlist[i] = strerror(i);
}
-#endif /* not SYS_ERRLIST */
+#endif /* not HAVE_SYS_ERRLIST */
int
next_status(char c, int *status)
diff --git a/file.c b/file.c
@@ -7,9 +7,6 @@
#include <sys/wait.h>
#include <stdio.h>
#include <time.h>
-#ifdef __EMX__
-#include <strings.h>
-#endif /* __EMX__ */
#include <sys/stat.h>
#include <fcntl.h>
/* foo */
@@ -150,19 +147,6 @@ char *violations[COO_EMAX] = {
#define SAVE_BUF_SIZE 1536
-#ifndef STRCHR
-char *
-strchr(char *s, char c)
-{
- while (*s) {
- if (*s == c)
- return s;
- s++;
- }
- return NULL;
-}
-#endif /* not STRCHR */
-
static MySignalHandler
KeyAbort(SIGNAL_ARG)
{
diff --git a/fm.h b/fm.h
@@ -41,12 +41,13 @@
#include "funcname1.h"
#include "terms.h"
-#ifdef NOBCOPY
+#ifndef HAVE_BCOPY
void bcopy(void *, void *, int);
void bzero(void *, int);
-#else /* not NOBCOPY */
-#include <string.h>
-#endif /* not NOBCOPY */
+#endif /* HAVE_BCOPY */
+#ifdef __EMX__
+#include <strings.h> /* for bzero() and bcopy() */
+#endif
#ifdef MAINPROGRAM
#define global
@@ -229,7 +230,7 @@ extern int REV_LB[];
#define free(x) GC_free(x) /* let GC do it. */
#ifdef __EMX__
-#define STRCASECMP
+#define HAVE_STRCASECMP
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif /* __EMX__ */
diff --git a/form.c b/form.c
@@ -648,10 +648,10 @@ form_write_from_file(FILE * f, char *boundary, char *name, char *filename, char
fprintf(f, "Content-Type: %s\r\n\r\n",
type ? type : "application/octet-stream");
-#ifdef READLINK
+#ifdef HAVE_READLINK /* readline == lstat ? (ukai) */
if (lstat(file, &st) < 0)
goto write_end;
-#endif /* READLINK */
+#endif /* HAVE_READLINK */
if (S_ISDIR(st.st_mode))
goto write_end;
fd = fopen(file, "r");
diff --git a/frame.c b/frame.c
@@ -4,9 +4,6 @@
#include "myctype.h"
#include <signal.h>
#include <setjmp.h>
-#ifdef __EMX__
-#include <strings.h> /* for bzero() and bcopy() */
-#endif /* __EMX__ */
#ifdef KANJI_SYMBOLS
#define RULE_WIDTH 2
diff --git a/indep.c b/indep.c
@@ -5,9 +5,6 @@
#include <sys/param.h>
#include <sys/types.h>
#include <stdlib.h>
-#ifdef __EMX__
-#include <strings.h> /* for bcopy() */
-#endif /* __EMX__ */
#include "indep.h"
#include "Str.h"
#include "gc.h"
@@ -50,14 +47,14 @@ char *
currentdir()
{
char *path;
-#ifdef GETCWD
+#ifdef HAVE_GETCWD
path = NewAtom_N(char, MAXPATHLEN);
getcwd(path, MAXPATHLEN);
-#else /* not GETCWD */
-#ifdef GETWD
+#else /* not HAVE_GETCWD */
+#ifdef HAVE_GETWD
path = NewAtom_N(char, 1024);
getwd(path);
-#else /* not GETWD */
+#else /* not HAVE_GETWD */
FILE *f;
char *p;
path = NewAtom_N(char, 1024);
@@ -69,8 +66,8 @@ currentdir()
*p = '\0';
break;
}
-#endif /* not GETWD */
-#endif /* not GETCWD */
+#endif /* not HAVE_GETWD */
+#endif /* not HAVE_GETCWD */
return path;
}
diff --git a/istream.c b/istream.c
@@ -2,9 +2,6 @@
#include "fm.h"
#include "istream.h"
#include <signal.h>
-#ifdef __EMX__
-#include <strings.h> /* for bzero() */
-#endif /* __EMX__ */
#define uchar unsigned char
diff --git a/local.c b/local.c
@@ -5,9 +5,9 @@
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
-#ifdef READLINK
+#ifdef HAVE_READLINK
#include <unistd.h>
-#endif /* READLINK */
+#endif /* HAVE_READLINK */
#ifdef __EMX__
#include <limits.h>
#endif /* __EMX__ */
@@ -42,10 +42,10 @@ dirBuffer(char *dname)
char **flist;
char *p, *qdir;
Str fbuf = Strnew();
-#ifdef READLINK
+#ifdef HAVE_READLINK
struct stat lst;
char lbuf[1024];
-#endif /* READLINK */
+#endif /* HAVE_READLINK */
int i, l, nrow, n = 0, maxlen = 0;
int nfile, nfile_max = 100;
Str dirname;
@@ -90,7 +90,7 @@ dirBuffer(char *dname)
if (Strlastchar(fbuf) != '/')
Strcat_char(fbuf, '/');
Strcat_charp(fbuf, p);
-#ifdef READLINK
+#ifdef HAVE_READLINK /* readlink == lstat() ? (ukai) */
if (lstat(fbuf->ptr, &lst) < 0)
continue;
#endif /* READLINK */
@@ -103,10 +103,10 @@ dirBuffer(char *dname)
else {
if (S_ISDIR(st.st_mode))
Strcat_charp(tmp, "[DIR] ");
-#ifdef READLINK
+#ifdef HAVE_READLINK
else if (S_ISLNK(lst.st_mode))
Strcat_charp(tmp, "[LINK] ");
-#endif /* READLINE */
+#endif /* HAVE_READLINE */
else
Strcat_charp(tmp, "[FILE] ");
}
@@ -127,7 +127,7 @@ dirBuffer(char *dname)
}
}
else {
-#ifdef READLINK
+#ifdef HAVE_READLINK
if (S_ISLNK(lst.st_mode)) {
if ((l = readlink(fbuf->ptr, lbuf, sizeof(lbuf))) > 0) {
lbuf[l] = '\0';
@@ -136,7 +136,7 @@ dirBuffer(char *dname)
Strcat_char(tmp, '/');
}
}
-#endif /* READLINK */
+#endif /* HAVE_READLINK */
Strcat_charp(tmp, "<br>\n");
}
}
diff --git a/local.h b/local.h
@@ -6,13 +6,13 @@
#define LOCAL_H
#include <sys/types.h>
-#ifdef DIRENT
+#ifdef HAVE_DIRENT_H
#include <dirent.h>
typedef struct dirent Directory;
-#else /* not DIRENT */
+#else /* not HAVE_DIRENT_H */
#include <sys/dir.h>
typedef struct direct Directory;
-#endif /* not DIRENT */
+#endif /* not HAVE_DIRENT_H */
#include <sys/stat.h>
#ifndef S_IFMT
@@ -32,13 +32,13 @@ typedef struct direct Directory;
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif /* not S_ISDIR */
-#ifdef READLINK
+#ifdef HAVE_READLINK
#ifndef S_IFLNK
#define S_IFLNK 0120000
#endif /* not S_IFLNK */
#ifndef S_ISLNK
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif /* not S_ISLNK */
-#endif /* not READLINK */
+#endif /* not HAVE_READLINK */
#endif /* not LOCAL_H */
diff --git a/mailcap.c b/mailcap.c
@@ -5,9 +5,6 @@
#include <errno.h>
#include "parsetag.h"
#include "local.h"
-#ifdef __EMX__
-#include <strings.h> /* for bzero() */
-#endif /* __EMX__ */
static struct mailcap DefaultMailcap[] =
{
diff --git a/main.c b/main.c
@@ -13,7 +13,7 @@
#ifdef USE_GPM
#include <gpm.h>
#endif /* USE_GPM */
-#ifdef __EMX__
+#ifdef __EMX__ /* HAVE_TIME_H? */
#include <time.h> /* for time() */
#endif /* __EMX__ */
#if defined(USE_GPM) || defined(USE_SYSMOUSE)
@@ -263,9 +263,9 @@ MAIN(int argc, char **argv, char **envp)
char *post_file = NULL;
Str err_msg;
-#ifndef SYS_ERRLIST
+#ifndef HAVE_SYS_ERRLIST
prepare_sys_errlist();
-#endif /* not SYS_ERRLIST */
+#endif /* not HAVE_SYS_ERRLIST */
srand48(time(0));
diff --git a/matrix.c b/matrix.c
@@ -50,9 +50,9 @@
#define SWAPD(a,b) { double tmp = a; a = b; b = tmp; }
#define SWAPI(a,b) { int tmp = a; a = b; b = tmp; }
-#ifndef NO_FLOAT_H
+#ifdef HAVE_FLOAT_H
#include <float.h>
-#endif /* not NO_FLOAT_H */
+#endif /* not HAVE_FLOAT_H */
#if defined(DBL_MAX)
static double Tiny = 10.0 / DBL_MAX;
#elif defined(FLT_MAX)
diff --git a/parsetag.c b/parsetag.c
@@ -1,6 +1,3 @@
-#ifdef __EMX__
-#include <strings.h> /* for bzero() */
-#endif /* __EMX__ */
#include "myctype.h"
#include "indep.h"
#include "Str.h"
diff --git a/parsetagx.c b/parsetagx.c
@@ -1,6 +1,3 @@
-#ifdef __EMX__
-#include <strings.h> /* for bzero() */
-#endif /* __EMX__ */
#include "fm.h"
#include "myctype.h"
#include "indep.h"
diff --git a/regex.c b/regex.c
@@ -10,9 +10,6 @@
#endif /* REGEX_DEBUG */
#include <ctype.h>
#include <gc.h>
-#ifdef __EMX__
-#include <strings.h>
-#endif
#include "fm.h"
#include "regex.h"
diff --git a/table.c b/table.c
@@ -6,10 +6,6 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
-#ifdef __EMX__
-#include <strings.h>
-#endif /* __EMX__ */
-
#include "fm.h"
#include "html.h"
#include "parsetagx.h"
diff --git a/terms.c b/terms.c
@@ -61,7 +61,7 @@ void flush_tty();
#define SIGIOT SIGABRT
#endif /* not SIGIOT */
-#ifdef TERMIO
+#ifdef HAVE_TERMIO_H
#include <sys/ioctl.h>
#include <termio.h>
typedef struct termio TerminalMode;
@@ -69,9 +69,9 @@ typedef struct termio TerminalMode;
#define TerminalGet(fd,x) ioctl(fd,TCGETA,x)
#define MODEFLAG(d) ((d).c_lflag)
#define IMODEFLAG(d) ((d).c_iflag)
-#endif /* TERMIO */
+#endif /* HAVE_TERMIO_H */
-#ifdef TERMIOS
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
#include <unistd.h>
typedef struct termios TerminalMode;
@@ -79,16 +79,16 @@ typedef struct termios TerminalMode;
#define TerminalGet(fd,x) tcgetattr(fd,x)
#define MODEFLAG(d) ((d).c_lflag)
#define IMODEFLAG(d) ((d).c_iflag)
-#endif /* TERMIOS */
+#endif /* HAVE_TERMIOS_H */
-#ifdef SGTTY
+#ifdef HAVE_SGTTY_H
#include <sys/ioctl.h>
#include <sgtty.h>
typedef struct sgttyb TerminalMode;
#define TerminalSet(fd,x) ioctl(fd,TIOCSETP,x)
#define TerminalGet(fd,x) ioctl(fd,TIOCGETP,x)
#define MODEFLAG(d) ((d).sg_flags)
-#endif /* SGTTY */
+#endif /* HAVE_SGTTY_H */
#define MAX_LINE 200
#define MAX_COLUMN 400
@@ -259,9 +259,9 @@ ttymode_set(int mode, int imode)
TerminalGet(tty, &ioval);
MODEFLAG(ioval) |= mode;
-#ifndef SGTTY
+#ifndef HAVE_SGTTY_H
IMODEFLAG(ioval) |= imode;
-#endif /* not SGTTY */
+#endif /* not HAVE_SGTTY_H */
while (TerminalSet(tty, &ioval) == -1) {
if (errno == EINTR || errno == EAGAIN) continue;
@@ -277,9 +277,9 @@ ttymode_reset(int mode, int imode)
TerminalGet(tty, &ioval);
MODEFLAG(ioval) &= ~mode;
-#ifndef SGTTY
+#ifndef HAVE_SGTTY_H
IMODEFLAG(ioval) &= ~imode;
-#endif /* not SGTTY */
+#endif /* not HAVE_SGTTY_H */
while (TerminalSet(tty, &ioval) == -1) {
if (errno == EINTR || errno == EAGAIN) continue;
@@ -288,7 +288,7 @@ ttymode_reset(int mode, int imode)
}
}
-#ifndef SGTTY
+#ifndef HAVE_SGTTY_H
void
set_cc(int spec, int val)
{
@@ -302,7 +302,7 @@ set_cc(int spec, int val)
reset_exit(SIGNAL_ARGLIST);
}
}
-#endif /* not SGTTY */
+#endif /* not HAVE_SGTTY_H */
void
close_tty(void)
@@ -500,7 +500,7 @@ setlinescols(void)
}
#endif
}
-#elif defined(TERMIOS) && defined(TIOCGWINSZ)
+#elif defined(HAVE_TERMIOS_H) && defined(TIOCGWINSZ)
struct winsize wins;
i = ioctl(tty, TIOCGWINSZ, &wins);
@@ -508,9 +508,7 @@ setlinescols(void)
LINES = wins.ws_row;
COLS = wins.ws_col;
}
-#endif /* defined(TERMIOS) && defined(TIOCGWINSZ)
- *
- */
+#endif /* defined(HAVE-TERMIOS_H) && defined(TIOCGWINSZ) */
if (LINES <= 0 &&
(p = getenv("LINES")) != NULL &&
(i = atoi(p)) >= 0)
@@ -1462,38 +1460,38 @@ addnstr_sup(char *s, int n)
void
crmode(void)
-#ifndef SGTTY
+#ifndef HAVE_SGTTY_H
{
ttymode_reset(ICANON, IXON);
ttymode_set(ISIG, 0);
-#ifdef TERMIOS
+#ifdef HAVE_TERMIOS_H
set_cc(VMIN, 1);
-#else /* not TERMIOS */
+#else /* not HAVE_TERMIOS_H */
set_cc(VEOF, 1);
-#endif /* not TERMIOS */
+#endif /* not HAVE_TERMIOS_H */
}
-#else /* SGTTY */
+#else /* HAVE_SGTTY_H */
{
ttymode_set(CBREAK, 0);
}
-#endif /* SGTTY */
+#endif /* HAVE_SGTTY_H */
void
nocrmode(void)
-#ifndef SGTTY
+#ifndef HAVE_SGTTY_H
{
ttymode_set(ICANON, 0);
-#ifdef TERMIOS
+#ifdef HAVE_TERMIOS_H
set_cc(VMIN, 4);
-#else /* not TERMIOS */
+#else /* not HAVE_TERMIOS_H */
set_cc(VEOF, 4);
-#endif /* not TERMIOS */
+#endif /* not HAVE_TERMIOS_H */
}
-#else /* SGTTY */
+#else /* HAVE_SGTTY_H */
{
ttymode_reset(CBREAK, 0);
}
-#endif /* SGTTY */
+#endif /* HAVE_SGTTY_H */
void
term_echo(void)
@@ -1509,7 +1507,7 @@ term_noecho(void)
void
term_raw(void)
-#ifndef SGTTY
+#ifndef HAVE_SGTTY_H
#ifdef IEXTEN
#define TTY_MODE ISIG|ICANON|ECHO|IEXTEN
#else /* not IEXTEN */
@@ -1517,21 +1515,21 @@ term_raw(void)
#endif /* not IEXTEN */
{
ttymode_reset(TTY_MODE, IXON | IXOFF);
-#ifdef TERMIOS
+#ifdef HAVE_TERMIOS_H
set_cc(VMIN, 1);
-#else /* not TERMIOS */
+#else /* not HAVE_TERMIOS_H */
set_cc(VEOF, 1);
-#endif /* not TERMIOS */
+#endif /* not HAVE_TERMIOS_H */
}
-#else /* SGTTY */
+#else /* HAVE_SGTTY_H */
{
ttymode_set(RAW, 0);
}
-#endif /* SGTTY */
+#endif /* HAVE_SGTTY_H */
void
term_cooked(void)
-#ifndef SGTTY
+#ifndef HAVE_SGTTY_H
{
#ifdef __EMX__
/* On XFree86/OS2, some scrambled characters
@@ -1541,17 +1539,17 @@ term_cooked(void)
#else
ttymode_set(TTY_MODE, 0);
#endif
-#ifdef TERMIOS
+#ifdef HAVE_TERMIOS_H
set_cc(VMIN, 4);
-#else /* not TERMIOS */
+#else /* not HAVE_TERMIOS_H */
set_cc(VEOF, 4);
-#endif /* not TERMIOS */
+#endif /* not HAVE_TERMIOS_H */
}
-#else /* SGTTY */
+#else /* HAVE_SGTTY_H */
{
ttymode_reset(RAW, 0);
}
-#endif /* SGTTY */
+#endif /* HAVE_SGTTY_H */
void
term_cbreak(void)
diff --git a/url.c b/url.c
@@ -11,8 +11,7 @@
#include <sys/stat.h>
#ifdef __EMX__
-#include <io.h>
-#include <strings.h>
+#include <io.h> /* ?? */
#endif /* __EMX__ */
#include "html.h"