Browse Source

*** empty log message ***

François Pinard 30 years ago
parent
commit
3bf00060f3
3 changed files with 20 additions and 41 deletions
  1. 2 1
      scripts/level-1
  2. 7 29
      src/gnu.c
  3. 11 11
      src/port.h

+ 2 - 1
scripts/level-1

@@ -65,9 +65,10 @@ startdate="`date`"
 here="`pwd`"
 
 # Logfile name should be in the form  ``log-1993-03-18-level-1''
+# They go in the subdirectory `log' of the current directory. 
 # i.e. year-month-date.  This format is useful for sorting by name, since
 # logfiles are intentionally kept online for future reference.
-LOGFILE="log-`date | sed -ne '
+LOGFILE="log/log-`date | sed -ne '
    s/[^ ]*  *\([^ ]*\)  *\([^ ]*\).* \([^ ]*\)$/\3-\1-\2/
    /-[0-9]$/s/\([0-9]\)$/0\1/
    /Jan/{s/Jan/01/p;q;}

+ 7 - 29
src/gnu.c

@@ -30,28 +30,6 @@ time_t time ();
 #include "tar.h"
 #include "port.h"
 
-#if defined(_POSIX_VERSION) || defined(DIRENT)
-#include <dirent.h>
-#ifdef direct
-#undef direct
-#endif /* direct */
-#define direct dirent
-#define DP_NAMELEN(x) strlen((x)->d_name)
-#endif /* _POSIX_VERSION or DIRENT */
-#if !defined(_POSIX_VERSION) && !defined(DIRENT) && defined(BSD42)
-#include <sys/dir.h>
-#define DP_NAMELEN(x)	(x)->d_namlen
-#endif /* not _POSIX_VERSION and BSD42 */
-#ifdef __MSDOS__
-#include "msd_dir.h"
-#define DP_NAMELEN(x)	(x)->d_namlen
-#define direct dirent
-#endif
-#if defined(USG) && !defined(_POSIX_VERSION) && !defined(DIRENT)
-#include <ndir.h>
-#define DP_NAMELEN(x) strlen((x)->d_name)
-#endif /* USG and not _POSIX_VERSION and not DIRENT */
-
 #ifndef S_ISLNK
 #define lstat stat
 #endif
@@ -127,7 +105,7 @@ read_dir_file ()
   time (&this_time);
   if (gnu_dumpfile[0] != '/')
     {
-#if defined(__MSDOS__) || defined(USG) || defined(_POSIX_VERSION)
+#if defined(__MSDOS__) || defined(HAVE_GETCWD) || defined(_POSIX_VERSION)
       if (!getcwd (path, PATH_MAX))
 	{
 	  msg ("Couldn't get current directory.");
@@ -323,7 +301,7 @@ get_dir_contents (p, device)
      int device;
 {
   DIR *dirp;
-  register struct direct *d;
+  register struct dirent *d;
   char *new_buf;
   char *namebuf;
   int bufsiz;
@@ -369,7 +347,7 @@ get_dir_contents (p, device)
 	  /* Skip . and .. */
 	  if (is_dot_or_dotdot (d->d_name))
 	    continue;
-	  if (DP_NAMELEN (d) + len >= bufsiz)
+	  if (NLENGTH (d) + len >= bufsiz)
 	    {
 	      bufsiz += NAMSIZ;
 	      namebuf = ck_realloc (namebuf, bufsiz + 2);
@@ -433,7 +411,7 @@ get_dir_contents (p, device)
 	    add_buffer (the_buffer, "N", 1);
 	  else
 	    add_buffer (the_buffer, "Y", 1);
-	  add_buffer (the_buffer, d->d_name, (int) (DP_NAMELEN (d) + 1));
+	  add_buffer (the_buffer, d->d_name, (int) (NLENGTH (d) + 1));
 	}
       add_buffer (the_buffer, "\000\000", 2);
       closedir (dirp);
@@ -570,7 +548,7 @@ gnu_restore (skipcrud)
   PTR the_buffer;
   char *p;
   DIR *dirp;
-  struct direct *d;
+  struct dirent *d;
   char *cur, *arc;
   extern struct stat hstat;	/* Stat struct corresponding */
   long size, copied;
@@ -594,7 +572,7 @@ gnu_restore (skipcrud)
       if (is_dot_or_dotdot (d->d_name))
 	continue;
 
-      add_buffer (the_buffer, d->d_name, (int) (DP_NAMELEN (d) + 1));
+      add_buffer (the_buffer, d->d_name, (int) (NLENGTH (d) + 1));
     }
   closedir (dirp);
   add_buffer (the_buffer, "", 1);
@@ -660,7 +638,7 @@ recursively_delete (path)
 {
   struct stat sbuf;
   DIR *dirp;
-  struct direct *dp;
+  struct dirent *dp;
   char *path_buf;
   /* int path_len; */
 

+ 11 - 11
src/port.h

@@ -25,7 +25,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <alloca.h>
 #else /* not HAVE_ALLOCA_H */
 #ifdef _AIX
- #pragma alloca
+#pragma alloca
 #else /* not _AIX */
 char *alloca ();
 #endif /* not _AIX */
@@ -62,7 +62,7 @@ char *alloca ();
 #define	major(dev)		(dev)
 #define	minor(dev)		(dev)
 typedef long off_t;
-#endif	/* __MSDOS__ */
+#endif /* __MSDOS__ */
 
 #if defined(__STDC__) || defined(__TURBOC__)
 #define PTR void *
@@ -116,17 +116,17 @@ typedef long off_t;
 #if defined(STDC_HEADERS)
 #include <stdlib.h>
 #else
-char *malloc(), *realloc();
-char *getenv();
+char *malloc (), *realloc ();
+char *getenv ();
 #endif
 
 #ifndef _POSIX_VERSION
 #ifdef __MSDOS__
 #include <io.h>
-#else				/* !__MSDOS__ */
-off_t lseek();
-#endif				/* !__MSDOS__ */
-char *getcwd();
+#else /* !__MSDOS__ */
+off_t lseek ();
+#endif /* !__MSDOS__ */
+char *getcwd ();
 #endif /* !_POSIX_VERSION */
 
 #ifndef NULL
@@ -175,14 +175,14 @@ char *getcwd();
 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
 #define	S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
 #endif
-#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
+#if !defined(S_ISMPB) && defined(S_IFMPB)	/* V7 */
 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
 #endif
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
+#if !defined(S_ISNWK) && defined(S_IFNWK)	/* HP/UX */
 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
 #endif
-#if !defined(S_ISCTG) && defined(S_IFCTG) /* contiguous file */
+#if !defined(S_ISCTG) && defined(S_IFCTG)	/* contiguous file */
 #define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
 #endif
 #if !defined(S_ISVTX)