summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Makefile.in47
-rw-r--r--lib/backupfile.c20
-rw-r--r--lib/mkdir.c81
-rw-r--r--lib/savedir.c20
-rw-r--r--src/chgrp.c12
-rw-r--r--src/chmod.c10
-rw-r--r--src/chown.c10
-rw-r--r--src/cp-hash.c10
-rw-r--r--src/cp.c10
-rw-r--r--src/dd.c10
-rw-r--r--src/df.c10
-rw-r--r--src/du.c10
-rw-r--r--src/install.c10
-rw-r--r--src/ln.c10
-rw-r--r--src/ls.c20
-rw-r--r--src/mkdir.c10
-rw-r--r--src/mkfifo.c10
-rw-r--r--src/mknod.c10
-rw-r--r--src/mv.c10
-rw-r--r--src/rm.c17
-rw-r--r--src/rmdir.c10
-rw-r--r--src/sync.c10
-rw-r--r--src/system.h51
-rw-r--r--src/touch.c10
24 files changed, 107 insertions, 321 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 5737aa4ef..b84df8b5f 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -23,14 +23,12 @@ VPATH = @srcdir@
CC = @CC@
AR = ar
RANLIB = @RANLIB@
-DEFS = -DCONFIG_BROKETS -Dlint @DEFS@
+DEFS = -Dlint @DEFS@
CFLAGS = @CFLAGS@
YACC = @YACC@
-prefix = @prefix@
-exec_prefix = $(prefix)
+exec_prefix = @exec_prefix@
libdir = $(exec_prefix)/lib
-
SOURCES = getdate.y posixtm.y \
argmatch.c backupfile.c basename.c dirname.c eaccess.c \
error.c filemode.c fsusage.c full-write.c getopt.c getopt1.c \
@@ -49,19 +47,21 @@ stripslash.o xgetcwd.o xmalloc.o xstrdup.o userspec.o yesno.o \
@LIBOBJS@ @ALLOCA@
DISTFILES = Makefile.in backupfile.h getopt.h modechange.h \
-fnmatch.h fsusage.h mountlist.h pathmax.h safe-xstat.c.in safe-xstat.h.in \
+fnmatch.h fsusage.h mountlist.h pathmax.h safe-xstat.cin safe-xstat.hin \
getdate.c posixtm.c $(SOURCES)
all: libfu.a
-.SUFFIXES =
-.SUFFIXES = .c .o
+.SUFFIXES:
+.SUFFIXES: .c .o
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) -I. -I.. -I$(srcdir) $(CFLAGS) $<
Makefile: ../config.status Makefile.in
- CONFIG_FILES=$@ CONFIG_HEADERS= ../config.status
+ cd ..; CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
+
+installdirs:
install: all
@@ -78,12 +78,13 @@ clean:
mostlyclean: clean
distclean: clean
- rm -f Makefile *.tab.c getdate.c *posixtm.c
+ rm -f Makefile *.tab.c getdate.c *posixtm.c \
+ safe-stat.c safe-stat.h safe-lstat.c safe-lstat.h
realclean: distclean
- rm -f TAGS safe-stat.c safe-stat.h safe-lstat.c safe-lstat.h
+ rm -f TAGS
-distdir = ../`cat ../.fname`/lib
+distdir = ../`cat ../distname`/$(subdir)
dist: $(DISTFILES)
for file in $(DISTFILES); do \
ln $$file $(distdir) \
@@ -98,21 +99,21 @@ libfu.a: $(OBJECTS)
extract_stat = sed -e 's/@l@//g' -e 's/@L@//g'
extract_lstat = sed -e 's/@l@/l/g' -e 's/@L@/L/g'
-safe-lstat.c: safe-xstat.c.in
- $(extract_lstat) $(srcdir)/safe-xstat.c.in > $@-tmp
- mv $@-tmp $@
+safe-lstat.c: safe-xstat.cin
+ $(extract_lstat) $(srcdir)/safe-xstat.cin > $@-t
+ mv $@-t $@
-safe-lstat.h: safe-xstat.h.in
- $(extract_lstat) $(srcdir)/safe-xstat.h.in > $@-tmp
- mv $@-tmp $@
+safe-lstat.h: safe-xstat.hin
+ $(extract_lstat) $(srcdir)/safe-xstat.hin > $@-t
+ mv $@-t $@
-safe-stat.c: safe-xstat.c.in
- $(extract_stat) $(srcdir)/safe-xstat.c.in > $@-tmp
- mv $@-tmp $@
+safe-stat.c: safe-xstat.cin
+ $(extract_stat) $(srcdir)/safe-xstat.cin > $@-t
+ mv $@-t $@
-safe-stat.h: safe-xstat.h.in
- $(extract_stat) $(srcdir)/safe-xstat.h.in > $@-tmp
- mv $@-tmp $@
+safe-stat.h: safe-xstat.hin
+ $(extract_stat) $(srcdir)/safe-xstat.hin > $@-t
+ mv $@-t $@
safe-stat.o: safe-stat.h
safe-lstat.o: safe-lstat.h
diff --git a/lib/backupfile.c b/lib/backupfile.c
index 2ef0f0b48..36094af5e 100644
--- a/lib/backupfile.c
+++ b/lib/backupfile.c
@@ -45,24 +45,24 @@
#include <strings.h>
#endif
-#ifdef DIRENT
+#ifdef HAVE_DIRENT_H
#include <dirent.h>
#define NLENGTH(direct) (strlen((direct)->d_name))
-#else /* not DIRENT */
+#else /* not HAVE_DIRENT_H */
#define dirent direct
#define NLENGTH(direct) ((direct)->d_namlen)
-#ifdef SYSNDIR
+#ifdef HAVE_SYS_NDIR_H
#include <sys/ndir.h>
-#endif /* SYSNDIR */
-#ifdef SYSDIR
+#endif /* HAVE_SYS_NDIR_H */
+#ifdef HAVE_SYS_DIR_H
#include <sys/dir.h>
-#endif /* SYSDIR */
-#ifdef NDIR
+#endif /* HAVE_SYS_DIR_H */
+#ifdef HAVE_NDIR_H
#include <ndir.h>
-#endif /* NDIR */
-#endif /* DIRENT */
+#endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
-#ifdef VOID_CLOSEDIR
+#ifdef CLOSEDIR_VOID
/* Fake a return value. */
#define CLOSEDIR(d) (closedir (d), 0)
#else
diff --git a/lib/mkdir.c b/lib/mkdir.c
index b1eb47333..3726cbbcc 100644
--- a/lib/mkdir.c
+++ b/lib/mkdir.c
@@ -1,4 +1,4 @@
-/* mkdir.c -- BSD compatible directory functions for System V
+/* mkdir.c -- BSD compatible make directory function for System V
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -28,14 +28,15 @@
#include <sys/types.h>
#include <sys/stat.h>
+
#include <errno.h>
-#ifndef STDC_HEADERS
+#ifndef errno
extern int errno;
#endif
#ifdef STAT_MACROS_BROKEN
#undef S_ISDIR
-#endif /* STAT_MACROS_BROKEN. */
+#endif
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
@@ -43,7 +44,7 @@ extern int errno;
#include "safe-stat.h"
-/* mkdir and rmdir adapted from GNU tar. */
+/* mkdir adapted from GNU tar. */
/* Make directory DPATH, with permission mode DMODE.
@@ -66,7 +67,7 @@ mkdir (dpath, dmode)
if (SAFE_STAT (dpath, &statbuf) == 0)
{
- errno = EEXIST; /* stat worked, so it already exists. */
+ errno = EEXIST; /* stat worked, it already exists */
return -1;
}
@@ -77,70 +78,36 @@ mkdir (dpath, dmode)
cpid = fork ();
switch (cpid)
{
- case -1: /* Cannot fork. */
- return -1; /* errno is set already. */
+ case -1: /* cannot fork */
+ return -1; /* errno already set */
+
+ case 0: /* child process */
- case 0: /* Child process. */
/* Cheap hack to set mode of new directory. Since this child
- process is going away anyway, we zap its umask.
- This won't suffice to set SUID, SGID, etc. on this
- directory, so the parent process calls chmod afterward. */
- status = umask (0); /* Get current umask. */
- umask (status | (0777 & ~dmode)); /* Set for mkdir. */
+ process is going away anyway, we zap its umask. This won't
+ suffice to set SUID, SGID, etc. on this directory, so the parent
+ process calls chmod afterward. */
+
+ status = umask (0);
+ umask (status | (0777 & ~dmode));
execl ("/bin/mkdir", "mkdir", dpath, (char *) 0);
_exit (1);
- default: /* Parent process. */
- while (wait (&status) != cpid) /* Wait for kid to finish. */
- /* Do nothing. */ ;
+ default: /* parent process */
- if (status & 0xFFFF)
- {
- errno = EIO; /* /bin/mkdir failed. */
- return -1;
- }
- return chmod (dpath, dmode);
- }
-}
-
-/* Remove directory DPATH.
- Return 0 if successful, -1 if not. */
+ /* Wait for kid to finish. */
-int
-rmdir (dpath)
- char *dpath;
-{
- int cpid, status;
- struct stat statbuf;
-
- if (SAFE_STAT (dpath, &statbuf) != 0)
- return -1; /* stat set errno. */
-
- if (!S_ISDIR (statbuf.st_mode))
- {
- errno = ENOTDIR;
- return -1;
- }
-
- cpid = fork ();
- switch (cpid)
- {
- case -1: /* Cannot fork. */
- return -1; /* errno is set already. */
-
- case 0: /* Child process. */
- execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
- _exit (1);
-
- default: /* Parent process. */
- while (wait (&status) != cpid) /* Wait for kid to finish. */
+ while (wait (&status) != cpid)
/* Do nothing. */ ;
if (status & 0xFFFF)
{
- errno = EIO; /* /bin/rmdir failed. */
+
+ /* /bin/mkdir failed. */
+
+ errno = EIO;
return -1;
}
- return 0;
+ return chmod (dpath, dmode);
}
}
diff --git a/lib/savedir.c b/lib/savedir.c
index b831c1fe9..cdf1288a3 100644
--- a/lib/savedir.c
+++ b/lib/savedir.c
@@ -34,24 +34,24 @@
#include <unistd.h>
#endif
-#ifdef DIRENT
+#ifdef HAVE_DIRENT_H
#include <dirent.h>
#define NLENGTH(direct) (strlen((direct)->d_name))
-#else /* not DIRENT */
+#else /* not HAVE_DIRENT_H */
#define dirent direct
#define NLENGTH(direct) ((direct)->d_namlen)
-#ifdef SYSNDIR
+#ifdef HAVE_SYS_NDIR_H
#include <sys/ndir.h>
-#endif /* SYSNDIR */
-#ifdef SYSDIR
+#endif /* HAVE_SYS_NDIR_H */
+#ifdef HAVE_SYS_DIR_H
#include <sys/dir.h>
-#endif /* SYSDIR */
-#ifdef NDIR
+#endif /* HAVE_SYS_DIR_H */
+#ifdef HAVE_NDIR_H
#include <ndir.h>
-#endif /* NDIR */
-#endif /* DIRENT */
+#endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
-#ifdef VOID_CLOSEDIR
+#ifdef CLOSEDIR_VOID
/* Fake a return value. */
#define CLOSEDIR(d) (closedir (d), 0)
#else
diff --git a/src/chgrp.c b/src/chgrp.c
index a7d952be6..84e6b4fc8 100644
--- a/src/chgrp.c
+++ b/src/chgrp.c
@@ -17,17 +17,7 @@
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
@@ -48,7 +38,7 @@
struct group *getgrnam ();
#endif
-#ifdef _POSIX_SOURCE
+#ifdef _POSIX_VERSION
#define endgrent()
#endif
diff --git a/src/chmod.c b/src/chmod.c
index c2d1c879a..6a0ebb74c 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -23,17 +23,7 @@
David MacKenzie <djm@gnu.ai.mit.edu> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
diff --git a/src/chown.c b/src/chown.c
index 9d5a424e3..b6e203177 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -28,17 +28,7 @@
Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
diff --git a/src/cp-hash.c b/src/cp-hash.c
index 5204d1368..92c55a130 100644
--- a/src/cp-hash.c
+++ b/src/cp-hash.c
@@ -17,17 +17,7 @@
Written by Torbjorn Granlund, Sweden (tege@sics.se). */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include "cp.h"
#include "safe-stat.h"
diff --git a/src/cp.c b/src/cp.c
index fbbc4fd8c..3ba38f5aa 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -21,17 +21,7 @@
#pragma alloca
#endif
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include "cp.h"
diff --git a/src/dd.c b/src/dd.c
index 881af94e4..5d8aa6e6e 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -53,17 +53,7 @@
sync Pad every input block to size of ibs with
trailing NULs. */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <ctype.h>
diff --git a/src/df.c b/src/df.c
index c1457bc35..23be53140 100644
--- a/src/df.c
+++ b/src/df.c
@@ -33,17 +33,7 @@
Written by David MacKenzie <djm@gnu.ai.mit.edu> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <sys/types.h>
#include <getopt.h>
diff --git a/src/du.c b/src/du.c
index 0a2a16515..ad22be0ea 100644
--- a/src/du.c
+++ b/src/du.c
@@ -40,17 +40,7 @@
#pragma alloca
#endif
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
diff --git a/src/install.c b/src/install.c
index ad5aef395..fc880e03e 100644
--- a/src/install.c
+++ b/src/install.c
@@ -52,17 +52,7 @@
David MacKenzie <djm@gnu.ai.mit.edu> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <ctype.h>
diff --git a/src/ln.c b/src/ln.c
index 4a9c362ce..41227980a 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -21,17 +21,7 @@
#pragma alloca
#endif
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <sys/types.h>
#include <getopt.h>
diff --git a/src/ls.c b/src/ls.c
index da0c1d66e..551871c78 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -36,17 +36,7 @@
#pragma alloca
#endif
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <sys/types.h>
#if !defined(_POSIX_SOURCE) || defined(_AIX)
#include <sys/ioctl.h>
@@ -58,17 +48,25 @@
#include "system.h"
#include <fnmatch.h>
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
#include "ls.h"
#include "version.h"
#include "safe-stat.h"
#include "safe-lstat.h"
+#ifndef INT_MAX
+#define INT_MAX (((unsigned int) ~(unsigned int) 0) >> 1)
+#endif
+
#ifndef S_IEXEC
#define S_IEXEC S_IXUSR
#endif
/* Return an int indicating the result of comparing two longs. */
-#if SIZEOF_INT == 2
+#if (INT_MAX <= 65535)
#define longdiff(a, b) ((a) < (b) ? -1 : (a) > (b) ? 1 : 0)
#else
#define longdiff(a, b) ((a) - (b))
diff --git a/src/mkdir.c b/src/mkdir.c
index 234d34f55..5a6030490 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -27,17 +27,7 @@
David MacKenzie <djm@ai.mit.edu> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
diff --git a/src/mkfifo.c b/src/mkfifo.c
index 4977d58ac..0c9972334 100644
--- a/src/mkfifo.c
+++ b/src/mkfifo.c
@@ -22,17 +22,7 @@
David MacKenzie <djm@ai.mit.edu> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
diff --git a/src/mknod.c b/src/mknod.c
index d92754c55..957e11a74 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -27,17 +27,7 @@
David MacKenzie <djm@ai.mit.edu> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
diff --git a/src/mv.c b/src/mv.c
index 1b6664557..0c2ddde10 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -41,17 +41,7 @@
#pragma alloca
#endif
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
diff --git a/src/rm.c b/src/rm.c
index 438e8fa42..5ff703cba 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -17,17 +17,7 @@
/* Written by Paul Rubin, David MacKenzie, and Richard Stallman. */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
@@ -35,12 +25,11 @@
#include "version.h"
#include "safe-lstat.h"
-#ifdef _POSIX_SOURCE
+#ifdef D_INO_IN_DIRENT
+#define D_INO(dp) ((dp)->d_ino)
+#else
/* POSIX.1 doesn't have inodes, so fake them to avoid lots of ifdefs. */
-#define ino_t unsigned long
#define D_INO(dp) 1
-#else
-#define D_INO(dp) ((dp)->d_ino)
#endif
char *basename ();
diff --git a/src/rmdir.c b/src/rmdir.c
index c863973f7..ba8c15d3b 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -22,17 +22,7 @@
David MacKenzie <djm@ai.mit.edu> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
diff --git a/src/sync.c b/src/sync.c
index 1d44443ee..04daa3c13 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -17,17 +17,7 @@
/* Jim Meyering <meyering@comco.com> */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include "system.h"
diff --git a/src/system.h b/src/system.h
index 7c49788d1..95bf9945c 100644
--- a/src/system.h
+++ b/src/system.h
@@ -1,5 +1,5 @@
/* system-dependent definitions for fileutils programs.
- Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
+ Copyright (C) 89, 91, 92, 93, 1994 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,8 +32,8 @@
#undef S_ISSOCK
#endif /* STAT_MACROS_BROKEN. */
-#ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */
-#define mode_t unsigned short
+#ifndef S_IFMT
+#define S_IFMT 0170000
#endif
#if !defined(S_ISBLK) && defined(S_IFBLK)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
@@ -67,7 +67,7 @@
#define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
#endif
-#ifndef _POSIX_SOURCE
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -91,6 +91,7 @@
#include "pathmax.h"
+/* FIXME: Don't use _POSIX_VERSION. */
#ifndef _POSIX_VERSION
off_t lseek ();
#endif
@@ -121,15 +122,15 @@ off_t lseek ();
#endif
#undef HAVE_MAJOR
-#ifdef _POSIX_VERSION
+#ifdef HAVE_UTIME_H
#include <utime.h>
-#else /* not _POSIX_VERSION */
+#else
struct utimbuf
{
long actime;
long modtime;
};
-#endif /* _POSIX_VERSION */
+#endif
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
#include <string.h>
@@ -159,7 +160,7 @@ char *getenv ();
extern int errno;
#endif /* STDC_HEADERS */
-#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#else
#include <sys/file.h>
@@ -177,24 +178,24 @@ extern int errno;
#define R_OK 4
#endif
-#if defined(DIRENT) || defined(_POSIX_VERSION)
-#include <dirent.h>
-#define NLENGTH(direct) (strlen((direct)->d_name))
-#else /* not (DIRENT or _POSIX_VERSION) */
-#define dirent direct
-#define NLENGTH(direct) ((direct)->d_namlen)
-#ifdef SYSNDIR
-#include <sys/ndir.h>
-#endif /* SYSNDIR */
-#ifdef SYSDIR
-#include <sys/dir.h>
-#endif /* SYSDIR */
-#ifdef NDIR
-#include <ndir.h>
-#endif /* NDIR */
-#endif /* DIRENT or _POSIX_VERSION */
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+# define NLENGTH(direct) (strlen((direct)->d_name))
+#else /* not HAVE_DIRENT_H */
+# define dirent direct
+# define NLENGTH(direct) ((direct)->d_namlen)
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* HAVE_SYS_NDIR_H */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* HAVE_SYS_DIR_H */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
-#ifdef VOID_CLOSEDIR
+#ifdef CLOSEDIR_VOID
/* Fake a return value. */
#define CLOSEDIR(d) (closedir (d), 0)
#else
diff --git a/src/touch.c b/src/touch.c
index feadcc713..94bc914b4 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -32,17 +32,7 @@
Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,
and Randy Smith. */
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
#include <stdio.h>
#include <ctype.h>
#include <getopt.h>