lmjm@doc.ic.ac.uk (Lee McLoughlin) (02/12/89)
Here are the patches to gnu tar 1.03 to allow it to run on minix 1.4. Although most of these patches are for minix there is also a couple of patches for a simple long vs int bug. I dont have an ethernet so haven't tested the remote tape options or server. *** Makefile --- ../gnu-tar/Makefile ************** *** 100,107 # Note that Minix "cc" produces ".s" files, not .o's, so O = s has been set. # # Pick open3 emulation or nonexistence. See open3.h, port.c. ! ##DEFS = -DV7 -DMINIX -DEMUL_OPEN3 ! ##DEFS = -DV7 -DMINIX -DNO_OPEN3 #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O #LDFLAGS = --- 100,108 ----- # Note that Minix "cc" produces ".s" files, not .o's, so O = s has been set. # # Pick open3 emulation or nonexistence. See open3.h, port.c. ! # Minix on 1.4, or better, has bzero, bcmp and execlp and ! # directory handling so add -DMINIX14. ! DEFS = -DV7 -DMINIX -DMINIX14 -DEMUL_OPEN3 -DNO_REMOTE -Dsize_t=long #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O LOCAL_SRC = ************** *** 104,114 ##DEFS = -DV7 -DMINIX -DNO_OPEN3 #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O ! #LDFLAGS = ! #LIBS = ! #DEF_AR_FILE = \"-\" ! #DEFBLOCKING = 8 /* No good reason for this, change at will */ ! #O = s # Xenix version #DEFS = -DUSG -DXENIX --- 105,117 ----- DEFS = -DV7 -DMINIX -DMINIX14 -DEMUL_OPEN3 -DNO_REMOTE -Dsize_t=long #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O ! LOCAL_SRC = ! LOCAL_OBJ = ! LDFLAGS = -i ! LIBS = ! DEF_AR_FILE = \"-\" ! DEFBLOCKING = 8 ! O = s # Xenix version #DEFS = -DUSG -DXENIX ************** *** 128,134 -DDEF_AR_FILE=$(DEF_AR_FILE) \ -DDEFBLOCKING=$(DEFBLOCKING) # next line for Debugging ! COPTS = -g # next line for Production #COPTS = -O --- 131,137 ----- -DDEF_AR_FILE=$(DEF_AR_FILE) \ -DDEFBLOCKING=$(DEFBLOCKING) # next line for Debugging ! #COPTS = -g # next line for Production COPTS = -O ************** *** 130,136 # next line for Debugging COPTS = -g # next line for Production ! #COPTS = -O # Add things here like getopt, readdir, etc that aren't in your # standard libraries. (E.g. MSDOS needs getopt, msd_dir.c, msd_dir.obj) --- 133,139 ----- # next line for Debugging #COPTS = -g # next line for Production ! COPTS = -O # Add things here like getopt, readdir, etc that aren't in your # standard libraries. (E.g. MSDOS needs getopt, msd_dir.c, msd_dir.obj) ************** *** 155,161 AUX = README COPYING Makefile tar.texinfo tar.h port.h open3.h rmt.h \ msd_dir.h msd_dir.c rtape_server.c rtape_lib.c getdate.y ! all: tar rmt tar: $(OBJS) $(CC) $(LDFLAGS) -o tar $(COPTS) $(OBJS) $(LIBS) --- 158,164 ----- AUX = README COPYING Makefile tar.texinfo tar.h port.h open3.h rmt.h \ msd_dir.h msd_dir.c rtape_server.c rtape_lib.c getdate.y ! all: tar #rmt tar: $(OBJS) $(CC) $(LDFLAGS) -o tar $(COPTS) $(OBJS) $(LIBS) *** buffer.c --- ../gnu-tar/buffer.c ************** *** 34,39 #include <signal.h> #ifndef MSDOS #include <sys/ioctl.h> #include <sys/mtio.h> #endif --- 34,40 ----- #include <signal.h> #ifndef MSDOS + #ifndef MINIX #include <sys/ioctl.h> #endif #ifndef V7 ************** *** 35,41 #ifndef MSDOS #include <sys/ioctl.h> - #include <sys/mtio.h> #endif #ifdef MSDOS --- 36,41 ----- #ifndef MSDOS #ifndef MINIX #include <sys/ioctl.h> #endif #ifndef V7 #include <sys/mtio.h> ************** *** 37,42 #include <sys/ioctl.h> #include <sys/mtio.h> #endif #ifdef MSDOS # include <fcntl.h> --- 37,46 ----- #ifndef MINIX #include <sys/ioctl.h> #endif + #ifndef V7 + #include <sys/mtio.h> + #endif + #endif #ifdef MSDOS # include <fcntl.h> ************** *** 40,46 #ifdef MSDOS # include <fcntl.h> ! #include <process.h> #else # ifdef XENIX # include <sys/inode.h> --- 44,50 ----- #ifdef MSDOS # include <fcntl.h> ! # include <process.h> #else # ifdef XENIX # include <sys/inode.h> ************** *** 45,50 # ifdef XENIX # include <sys/inode.h> # endif # include <sys/file.h> #endif --- 49,55 ----- # ifdef XENIX # include <sys/inode.h> # endif + # ifndef MINIX # include <sys/file.h> #endif #endif ************** *** 47,52 # endif # include <sys/file.h> #endif #include "tar.h" #include "port.h" --- 52,58 ----- # ifndef MINIX # include <sys/file.h> #endif + #endif #include "tar.h" #include "port.h" ************** *** 145,150 int write_archive_to_stdout; /* Used by fl_read and fl_write to store the real info about saved names */ static char real_s_name[NAMSIZ]; static long real_s_totsize; --- 151,163 ----- int write_archive_to_stdout; + #ifdef V7 + /* Avoid name clashes */ + #define real_s_name r_s_n + #define real_s_totsize r_s_t + #define real_s_sizeleft r_s_s + #endif + /* Used by fl_read and fl_write to store the real info about saved names */ static char real_s_name[NAMSIZ]; static long real_s_totsize; ************** *** 284,290 1: we're reading/writing stdin/out (to force reblocking) 2: the file is to be accessed by rmt (compress doesn't know how 3: the file is not a plain file */ ! if(!(ar_file[0]=='-' && ar_file[1]=='\0') && !_remdev(ar_file) && isfile(ar_file)) { /* We don't need a child tar. Open the archive */ if(ar_reading) { archive=open(ar_file, O_RDONLY|O_BINARY, 0666); --- 297,307 ----- 1: we're reading/writing stdin/out (to force reblocking) 2: the file is to be accessed by rmt (compress doesn't know how 3: the file is not a plain file */ ! if(!(ar_file[0]=='-' && ar_file[1]=='\0') ! #ifndef NO_REMOTE ! && !_remdev(ar_file) ! #endif ! && isfile(ar_file)) { /* We don't need a child tar. Open the archive */ if(ar_reading) { archive=open(ar_file, O_RDONLY|O_BINARY, 0666); ************** *** 1281,1287 long pos; pos = rmtlseek(archive,0L,1); ! #ifndef MSDOS /* FIXME does ftruncate really take an INT?! */ (void) ftruncate(archive,(int)pos); #else --- 1298,1304 ----- long pos; pos = rmtlseek(archive,0L,1); ! #if !defined(MSDOS) && !defined(MINIX) /* FIXME does ftruncate really take an INT?! */ (void) ftruncate(archive,(int)pos); #else ************** *** 1410,1420 break; switch(inbuf[0]) { case '?': ! fprintf(msg_file,"\ ! n [name] Give a new filename for the next (and subsequent) volume(s)\n\ ! q Abort tar\n\ ! ! Spawn a subshell\n\ ! ? Print this list\n"); break; case 'q': /* Quit */ --- 1427,1441 ----- break; switch(inbuf[0]) { case '?': ! fputs( ! " n [name] Give a new filename for the next (and subsequent) volume(s)\n", ! msg_file ); ! fputs( ! " q Abort tar\n", msg_file ); ! fputs( ! " ! Spawn a subshell\n", msg_file ); ! fputs( ! " ? Print this list\n", msg_file ); break; case 'q': /* Quit */ *** create.c --- ../gnu-tar/create.c ************** *** 48,53 #ifdef MSDOS #include <sys/dir.h> #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line --- 48,58 ----- #ifdef MSDOS #include <sys/dir.h> #else + #ifdef MINIX14 + #include <dirent.h> + #define direct dirent + #define d_namlen d_reclen + #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line ************** *** 54,59 * below to bring it in from wherever it is. */ #include "ndir.h" #endif #endif --- 59,65 ----- * below to bring it in from wherever it is. */ #include "ndir.h" + #endif #endif #endif *** diffarch.c --- ../gnu-tar/diffarch.c ************** *** 48,53 #define O_NDELAY 0 #endif extern int errno; /* From libc.a */ extern char *valloc(); /* From libc.a */ --- 48,65 ----- #define O_NDELAY 0 #endif + #ifndef S_IFLNK + #define dostat(name,pstat) stat((name),(pstat)) + #else + #define dostat(name,pstat) (f_follow_links?stat((name),(pstat)):lstat((name),(pstat))) + #endif + + #ifdef V7 + /* Avoid name clashes */ + #define compare_chunk cmp_chunk + #define compare_dir cmp_dir + #endif + extern int errno; /* From libc.a */ extern char *valloc(); /* From libc.a */ ************** *** 146,152 if (diff_name[namelen] == '/') goto really_dir; ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 158,164 ----- if (diff_name[namelen] == '/') goto really_dir; ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 207,213 break; case LF_LINK: ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 219,225 ----- break; case LF_LINK: ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 291,297 check_node: /* FIXME, deal with umask */ ! err=f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if(err<0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 303,309 ----- check_node: /* FIXME, deal with umask */ ! err=dostat(diff_name, &filestat); if(err<0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 327,333 really_dir: while (namelen && diff_name[namelen] == '/') diff_name[namelen--] = '\0'; /* Zap / */ ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 339,345 ----- really_dir: while (namelen && diff_name[namelen] == '/') diff_name[namelen--] = '\0'; /* Zap / */ ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 357,363 if (diff_name[namelen] == '/') goto really_dir; ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 369,375 ----- if (diff_name[namelen] == '/') goto really_dir; ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 424,430 int compare_chunk(bytes,buffer) ! int bytes; char *buffer; { int err; --- 436,442 ----- int compare_chunk(bytes,buffer) ! long bytes; char *buffer; { int err; ************** *** 452,458 int compare_dir(bytes,buffer) ! int bytes; char *buffer; { if(bcmp(buffer,diff_dir,bytes)) { --- 464,470 ----- int compare_dir(bytes,buffer) ! long bytes; char *buffer; { if(bcmp(buffer,diff_dir,bytes)) { ************** *** 457,463 { if(bcmp(buffer,diff_dir,bytes)) { annofile(msg_file, (char *)NULL); ! fprintf(msg_file, "%s: data differs\n",diff_name); different++; return -1; } --- 469,475 ----- { if(bcmp(buffer,diff_dir,bytes)) { annofile(msg_file, (char *)NULL); ! fprintf(msg_file, "%s: dir data differs\n",diff_name); different++; return -1; } *** list.c --- ../gnu-tar/list.c ************** *** 33,38 #include <sys/types.h> #include <sys/stat.h> #ifndef MSDOS #include <sys/file.h> #endif /* MSDOS */ --- 33,39 ----- #include <sys/types.h> #include <sys/stat.h> #ifndef MSDOS + #ifndef MINIX #include <sys/file.h> #endif #endif /* MSDOS */ ************** *** 34,39 #include <sys/stat.h> #ifndef MSDOS #include <sys/file.h> #endif /* MSDOS */ #ifdef USG --- 35,41 ----- #ifndef MSDOS #ifndef MINIX #include <sys/file.h> + #endif #endif /* MSDOS */ #ifdef USG ************** *** 242,247 * We can't use unsigned char here because of old compilers, * e.g. V7. */ sum += 0xFF & *p++; } --- 244,250 ----- * We can't use unsigned char here because of old compilers, * e.g. V7. */ + #ifdef ORIG sum += 0xFF & *p++; #else sum += 0xFF & (long)*p++; ************** *** 243,248 * e.g. V7. */ sum += 0xFF & *p++; } /* Adjust checksum to count the "chksum" field as blanks. */ --- 246,254 ----- */ #ifdef ORIG sum += 0xFF & *p++; + #else + sum += 0xFF & (long)*p++; + #endif } /* Adjust checksum to count the "chksum" field as blanks. */ *** port.c --- ../gnu-tar/port.c ************** *** 38,43 #ifdef MSDOS #include <fcntl.h> #else #include <sys/file.h> #endif --- 38,44 ----- #ifdef MSDOS #include <fcntl.h> #else + #ifndef MINIX #include <sys/file.h> #endif #endif ************** *** 40,45 #else #include <sys/file.h> #endif #include "tar.h" #include "port.h" --- 41,47 ----- #ifndef MINIX #include <sys/file.h> #endif + #endif #include "tar.h" #include "port.h" ************** *** 79,88 #define WANT_VALLOC #endif - #ifdef MINIX - #define WANT_BZERO - #endif - #ifdef MSDOS #define WANT_LSTAT #define WANT_STRING --- 81,86 ----- #define WANT_VALLOC #endif #ifdef MSDOS #define WANT_LSTAT #define WANT_STRING ************** *** 96,102 #define WANT_GETOPT #endif ! /* End of system-dependent #ifdefs */ #ifdef WANT_DUMB_GETDATE /* JF a getdate() routine takes a date/time/etc and turns it into a time_t */ --- 94,109 ----- #define WANT_GETOPT #endif ! #ifdef MINIX ! #define WANT_DUMB_GETDATE ! #define WANT_MKDIR ! #define WANT_VALLOC ! #ifdef MINIX14 ! #define WANT_BZERO ! #undef WANT_STRSTR ! #undef WANT_GETOPT ! #endif ! #endif /* End of system-dependent #ifdefs */ ************** *** 98,103 /* End of system-dependent #ifdefs */ #ifdef WANT_DUMB_GETDATE /* JF a getdate() routine takes a date/time/etc and turns it into a time_t */ /* This one is a quick hack I wrote in about five minutes to see if the N --- 105,112 ----- #endif #endif + /* End of system-dependent #ifdefs */ + #ifdef WANT_DUMB_GETDATE /* JF a getdate() routine takes a date/time/etc and turns it into a time_t */ /* This one is a quick hack I wrote in about five minutes to see if the N ************** *** 107,113 into a time_t . Its not well tested or anything. . . */ /* In general, you should use the getdate() supplied in getdate.y */ ! #define OFF_FROM GMT 18000 /* Change for your time zone! */ time_t getdate(str) --- 116,123 ----- into a time_t . Its not well tested or anything. . . */ /* In general, you should use the getdate() supplied in getdate.y */ ! /* Change for your time zone! */ ! #define OFF_FROM_GMT 0 time_t getdate(str) ************** *** 243,248 status = umask(0); /* Get current umask */ status = umask(status | (0777 & ~dmode)); /* Set for mkdir */ execl("/bin/mkdir", "mkdir", dpath, (char *)0); _exit(-1); /* Can't exec /bin/mkdir */ default: /* Parent process */ --- 253,259 ----- status = umask(0); /* Get current umask */ status = umask(status | (0777 & ~dmode)); /* Set for mkdir */ execl("/bin/mkdir", "mkdir", dpath, (char *)0); + execl("/usr/bin/mkdir", "mkdir", dpath, (char *)0); _exit(-1); /* Can't exec /bin/mkdir */ default: /* Parent process */ *** tar.c --- ../gnu-tar/tar.c ************** *** 41,46 #ifdef MSDOS #include <sys/dir.h> #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line --- 41,51 ----- #ifdef MSDOS #include <sys/dir.h> #else + #ifdef MINIX14 + #include <dirent.h> + #define direct dirent + #define d_namlen d_reclen + #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line ************** *** 49,54 #include "ndir.h" #endif #endif extern char *malloc(); extern char *getenv(); --- 54,60 ----- #include "ndir.h" #endif #endif + #endif extern char *malloc(); extern char *getenv(); ************** *** 428,433 void describe() { fprintf(stderr,"%s: choose one of the following:\n",tar); fputs("\ -A Append tar files to an archive.\n\ --- 434,478 ----- void describe() { + char **s; + static char *errs[] = { + "-A Append tar files to an archive.", + "-c Create a new archive.", + "-d Find differences between archive and file system.", + "-D Delete from the archive (NOT for use on mag tapes!)", + "-r Append files to the end of an archive.", + "-t List the contents of an archive.", + "-u Only append files that are newer than the copy in an archive.", + "-x Extract files from an archive.", + "Other options:", + "-b N blocking factor N (block size = Nx512 bytes)", + "-B reblock as we read (for reading 4.2BSD pipes)", + "-C dir change to directory DIR", + "-f F read/write archive from file or device F (or hostname:/ForD)", + "-G create/list/extract GNU-format backup", + "-h don't dump symbolic links; dump the files they point to", + "-i ignore blocks of zeros in the archive, which normally mean EOF", + "-k keep existing files, don't overwrite them from the archive", + "-K file begin at \"file\" in the archive", + "-l stay in the local file system (like dump(8)) when creating an archive", + "-m don't extract file modified time", + "-M create/list/extract multi-volume archive", + "-N date only store files newer than DATE", + "-o write an old V7 format archive, rather than ANSI [draft 6] format", + "-O extract files to standard output", + "-p do extract all protection information", + "-R dump record number within archive with each message", + "-s list of names to extract is sorted to match the archive", + "-T F get names to extract or create from file F", + "-v verbosely list what files we process", + "-V vnam create archive with volume name 'vnam'", + "-w ask for confirmation for every action", + "-W attempt to verify the archive after writing it", + "-X file eXclude files listed in \"file\"", + "-z or Z run the archive through compress(1)", + "-[0-7][lmh] specify drive and density", + 0 + }; fprintf(stderr,"%s: choose one of the following:\n",tar); for( s = errs; *s; s++ ){ fputs( *s, stderr ); ************** *** 429,476 describe() { fprintf(stderr,"%s: choose one of the following:\n",tar); ! fputs("\ ! -A Append tar files to an archive.\n\ ! -c Create a new archive.\n\ ! -d Find differences between archive and file system.\n\ ! -D Delete from the archive (NOT for use on mag tapes!)\n\ ! -r Append files to the end of an archive.\n\ ! -t List the contents of an archive.\n\ ! -u Only append files that are newer than the copy in an archive.\n\ ! -x Extract files from an archive.\n",stderr); ! ! fputs("\ ! Other options:\n\ ! -b N blocking factor N (block size = Nx512 bytes)\n\ ! -B reblock as we read (for reading 4.2BSD pipes)\n\ ! -C dir change to directory DIR\n\ ! ", stderr); /* KLUDGE */ fputs("\ ! -f F read/write archive from file or device F (or hostname:/ForD)\n\ ! -G create/list/extract GNU-format backup\n\ ! -h don't dump symbolic links; dump the files they point to\n\ ! -i ignore blocks of zeros in the archive, which normally mean EOF\n\ ! -k keep existing files, don't overwrite them from the archive\n\ ! -K file begin at \"file\" in the archive\n\ ! -l stay in the local file system (like dump(8)) when creating an archive\n\ ! ", stderr); /* KLUDGE */ fputs("\ ! -m don't extract file modified time\n\ ! -M create/list/extract multi-volume archive\n\ ! -N date only store files newer than DATE\n\ ! -o write an old V7 format archive, rather than ANSI [draft 6] format\n\ ! -O extract files to standard output\n\ ! -p do extract all protection information\n\ ! -R dump record number within archive with each message\n\ ! -s list of names to extract is sorted to match the archive\n\ ! ", stderr); /* KLUDGE */ fputs("\ ! -T F get names to extract or create from file F\n\ ! -v verbosely list what files we process\n\ ! -V vnam create archive with volume name 'vnam'\n\ ! -w ask for confirmation for every action\n\ ! -W attempt to verify the archive after writing it\n\ ! -X file eXclude files listed in \"file\"\n\ ! -z or Z run the archive through compress(1)\n\ ! -[0-7][lmh] specify drive and density\n\ ! ", stderr); } --- 474,483 ----- 0 }; fprintf(stderr,"%s: choose one of the following:\n",tar); ! for( s = errs; *s; s++ ){ ! fputs( *s, stderr ); ! fputc( '\n', stderr ); ! } } ************** *** 802,807 { ; } /* p is a directory. Add all the files in P to the namelist. If any of the files is a directory, recurse on the subdirectory. . . */ static --- 809,820 ----- { ; } + + #ifdef V7 + /* Avoid name clashes */ + #define add_dir_name a_d_n + #endif + /* p is a directory. Add all the files in P to the namelist. If any of the files is a directory, recurse on the subdirectory. . . */ static ************** *** 1213,1218 } closedir(dirp); if(rmdir(path)<0) return 1; return 0; --- 1226,1232 ----- } closedir(dirp); + #ifndef V7 if(rmdir(path)<0) #else if(unlink(path)<0) ************** *** 1214,1219 closedir(dirp); if(rmdir(path)<0) return 1; return 0; } --- 1228,1236 ----- #ifndef V7 if(rmdir(path)<0) + #else + if(unlink(path)<0) + #endif return 1; return 0; } *** update.c --- ../gnu-tar/update.c ************** *** 257,262 } #endif int number_of_blocks_read = 0; int number_of_new_records = 0; --- 257,273 ----- } #endif + #ifdef V7 + /* Avoid name clashes */ + #define number_of_blocks_read n_o_br + #define number_of_new_records n_o_nr + #define number_of_records_needed n_o_rn + #define number_of_blocks_read n_o_br + #define number_of_records_to_skip norts + #define number_of_records_to_keep nortk + #define number_of_kept_records_in_block nokrib + #endif + int number_of_blocks_read = 0; int number_of_new_records = 0; From: lmjm@doc.ic.ac.uk (Lee McLoughlin) Path: doc.ic.ac.uk!lmjm Newsgroups: comp.os.minix,gnu.util.bugs Subject: tar 1.03 patches for minix (and 16bit machines) Reply-To: lmjm@doc.ic.ac.uk (Lee McLoughlin) Distribution: world Organization: Dept. of Computing, Imperial College, London, UK. Here are the patches to gnu tar 1.03 to allow it to run on minix 1.4. Although most of these patches are for minix there is also a couple of patches for a simple long vs int bug. *** Makefile --- ../gnu-tar/Makefile ************** *** 100,107 # Note that Minix "cc" produces ".s" files, not .o's, so O = s has been set. # # Pick open3 emulation or nonexistence. See open3.h, port.c. ! ##DEFS = -DV7 -DMINIX -DEMUL_OPEN3 ! ##DEFS = -DV7 -DMINIX -DNO_OPEN3 #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O #LDFLAGS = --- 100,108 ----- # Note that Minix "cc" produces ".s" files, not .o's, so O = s has been set. # # Pick open3 emulation or nonexistence. See open3.h, port.c. ! # Minix on 1.4, or better, has bzero, bcmp and execlp and ! # directory handling so add -DMINIX14. ! DEFS = -DV7 -DMINIX -DMINIX14 -DEMUL_OPEN3 -DNO_REMOTE -Dsize_t=long #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O LOCAL_SRC = ************** *** 104,114 ##DEFS = -DV7 -DMINIX -DNO_OPEN3 #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O ! #LDFLAGS = ! #LIBS = ! #DEF_AR_FILE = \"-\" ! #DEFBLOCKING = 8 /* No good reason for this, change at will */ ! #O = s # Xenix version #DEFS = -DUSG -DXENIX --- 105,117 ----- DEFS = -DV7 -DMINIX -DMINIX14 -DEMUL_OPEN3 -DNO_REMOTE -Dsize_t=long #LOCAL_SRC = getdate.y rtape_lib.c #LOCAL_OBJ = getdate.$O rtape_lib.$O ! LOCAL_SRC = ! LOCAL_OBJ = ! LDFLAGS = -i ! LIBS = ! DEF_AR_FILE = \"-\" ! DEFBLOCKING = 8 ! O = s # Xenix version #DEFS = -DUSG -DXENIX ************** *** 128,134 -DDEF_AR_FILE=$(DEF_AR_FILE) \ -DDEFBLOCKING=$(DEFBLOCKING) # next line for Debugging ! COPTS = -g # next line for Production #COPTS = -O --- 131,137 ----- -DDEF_AR_FILE=$(DEF_AR_FILE) \ -DDEFBLOCKING=$(DEFBLOCKING) # next line for Debugging ! #COPTS = -g # next line for Production COPTS = -O ************** *** 130,136 # next line for Debugging COPTS = -g # next line for Production ! #COPTS = -O # Add things here like getopt, readdir, etc that aren't in your # standard libraries. (E.g. MSDOS needs getopt, msd_dir.c, msd_dir.obj) --- 133,139 ----- # next line for Debugging #COPTS = -g # next line for Production ! COPTS = -O # Add things here like getopt, readdir, etc that aren't in your # standard libraries. (E.g. MSDOS needs getopt, msd_dir.c, msd_dir.obj) ************** *** 155,161 AUX = README COPYING Makefile tar.texinfo tar.h port.h open3.h rmt.h \ msd_dir.h msd_dir.c rtape_server.c rtape_lib.c getdate.y ! all: tar rmt tar: $(OBJS) $(CC) $(LDFLAGS) -o tar $(COPTS) $(OBJS) $(LIBS) --- 158,164 ----- AUX = README COPYING Makefile tar.texinfo tar.h port.h open3.h rmt.h \ msd_dir.h msd_dir.c rtape_server.c rtape_lib.c getdate.y ! all: tar #rmt tar: $(OBJS) $(CC) $(LDFLAGS) -o tar $(COPTS) $(OBJS) $(LIBS) *** buffer.c --- ../gnu-tar/buffer.c ************** *** 34,39 #include <signal.h> #ifndef MSDOS #include <sys/ioctl.h> #include <sys/mtio.h> #endif --- 34,40 ----- #include <signal.h> #ifndef MSDOS + #ifndef MINIX #include <sys/ioctl.h> #endif #ifndef V7 ************** *** 35,41 #ifndef MSDOS #include <sys/ioctl.h> - #include <sys/mtio.h> #endif #ifdef MSDOS --- 36,41 ----- #ifndef MSDOS #ifndef MINIX #include <sys/ioctl.h> #endif #ifndef V7 #include <sys/mtio.h> ************** *** 37,42 #include <sys/ioctl.h> #include <sys/mtio.h> #endif #ifdef MSDOS # include <fcntl.h> --- 37,46 ----- #ifndef MINIX #include <sys/ioctl.h> #endif + #ifndef V7 + #include <sys/mtio.h> + #endif + #endif #ifdef MSDOS # include <fcntl.h> ************** *** 40,46 #ifdef MSDOS # include <fcntl.h> ! #include <process.h> #else # ifdef XENIX # include <sys/inode.h> --- 44,50 ----- #ifdef MSDOS # include <fcntl.h> ! # include <process.h> #else # ifdef XENIX # include <sys/inode.h> ************** *** 45,50 # ifdef XENIX # include <sys/inode.h> # endif # include <sys/file.h> #endif --- 49,55 ----- # ifdef XENIX # include <sys/inode.h> # endif + # ifndef MINIX # include <sys/file.h> #endif #endif ************** *** 47,52 # endif # include <sys/file.h> #endif #include "tar.h" #include "port.h" --- 52,58 ----- # ifndef MINIX # include <sys/file.h> #endif + #endif #include "tar.h" #include "port.h" ************** *** 145,150 int write_archive_to_stdout; /* Used by fl_read and fl_write to store the real info about saved names */ static char real_s_name[NAMSIZ]; static long real_s_totsize; --- 151,163 ----- int write_archive_to_stdout; + #ifdef V7 + /* Avoid name clashes */ + #define real_s_name r_s_n + #define real_s_totsize r_s_t + #define real_s_sizeleft r_s_s + #endif + /* Used by fl_read and fl_write to store the real info about saved names */ static char real_s_name[NAMSIZ]; static long real_s_totsize; ************** *** 284,290 1: we're reading/writing stdin/out (to force reblocking) 2: the file is to be accessed by rmt (compress doesn't know how 3: the file is not a plain file */ ! if(!(ar_file[0]=='-' && ar_file[1]=='\0') && !_remdev(ar_file) && isfile(ar_file)) { /* We don't need a child tar. Open the archive */ if(ar_reading) { archive=open(ar_file, O_RDONLY|O_BINARY, 0666); --- 297,307 ----- 1: we're reading/writing stdin/out (to force reblocking) 2: the file is to be accessed by rmt (compress doesn't know how 3: the file is not a plain file */ ! if(!(ar_file[0]=='-' && ar_file[1]=='\0') ! #ifndef NO_REMOTE ! && !_remdev(ar_file) ! #endif ! && isfile(ar_file)) { /* We don't need a child tar. Open the archive */ if(ar_reading) { archive=open(ar_file, O_RDONLY|O_BINARY, 0666); ************** *** 1281,1287 long pos; pos = rmtlseek(archive,0L,1); ! #ifndef MSDOS /* FIXME does ftruncate really take an INT?! */ (void) ftruncate(archive,(int)pos); #else --- 1298,1304 ----- long pos; pos = rmtlseek(archive,0L,1); ! #if !defined(MSDOS) && !defined(MINIX) /* FIXME does ftruncate really take an INT?! */ (void) ftruncate(archive,(int)pos); #else ************** *** 1410,1420 break; switch(inbuf[0]) { case '?': ! fprintf(msg_file,"\ ! n [name] Give a new filename for the next (and subsequent) volume(s)\n\ ! q Abort tar\n\ ! ! Spawn a subshell\n\ ! ? Print this list\n"); break; case 'q': /* Quit */ --- 1427,1441 ----- break; switch(inbuf[0]) { case '?': ! fputs( ! " n [name] Give a new filename for the next (and subsequent) volume(s)\n", ! msg_file ); ! fputs( ! " q Abort tar\n", msg_file ); ! fputs( ! " ! Spawn a subshell\n", msg_file ); ! fputs( ! " ? Print this list\n", msg_file ); break; case 'q': /* Quit */ *** create.c --- ../gnu-tar/create.c ************** *** 48,53 #ifdef MSDOS #include <sys/dir.h> #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line --- 48,58 ----- #ifdef MSDOS #include <sys/dir.h> #else + #ifdef MINIX14 + #include <dirent.h> + #define direct dirent + #define d_namlen d_reclen + #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line ************** *** 54,59 * below to bring it in from wherever it is. */ #include "ndir.h" #endif #endif --- 59,65 ----- * below to bring it in from wherever it is. */ #include "ndir.h" + #endif #endif #endif *** diffarch.c --- ../gnu-tar/diffarch.c ************** *** 48,53 #define O_NDELAY 0 #endif extern int errno; /* From libc.a */ extern char *valloc(); /* From libc.a */ --- 48,65 ----- #define O_NDELAY 0 #endif + #ifndef S_IFLNK + #define dostat(name,pstat) stat((name),(pstat)) + #else + #define dostat(name,pstat) (f_follow_links?stat((name),(pstat)):lstat((name),(pstat))) + #endif + + #ifdef V7 + /* Avoid name clashes */ + #define compare_chunk cmp_chunk + #define compare_dir cmp_dir + #endif + extern int errno; /* From libc.a */ extern char *valloc(); /* From libc.a */ ************** *** 146,152 if (diff_name[namelen] == '/') goto really_dir; ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 158,164 ----- if (diff_name[namelen] == '/') goto really_dir; ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 207,213 break; case LF_LINK: ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 219,225 ----- break; case LF_LINK: ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 291,297 check_node: /* FIXME, deal with umask */ ! err=f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if(err<0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 303,309 ----- check_node: /* FIXME, deal with umask */ ! err=dostat(diff_name, &filestat); if(err<0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 327,333 really_dir: while (namelen && diff_name[namelen] == '/') diff_name[namelen--] = '\0'; /* Zap / */ ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 339,345 ----- really_dir: while (namelen && diff_name[namelen] == '/') diff_name[namelen--] = '\0'; /* Zap / */ ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 357,363 if (diff_name[namelen] == '/') goto really_dir; ! err = f_follow_links ? stat(diff_name, &filestat) : lstat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { --- 369,375 ----- if (diff_name[namelen] == '/') goto really_dir; ! err = dostat(diff_name, &filestat); if (err < 0) { annofile(msg_file, (char *)NULL); if (errno==ENOENT) { ************** *** 424,430 int compare_chunk(bytes,buffer) ! int bytes; char *buffer; { int err; --- 436,442 ----- int compare_chunk(bytes,buffer) ! long bytes; char *buffer; { int err; ************** *** 452,458 int compare_dir(bytes,buffer) ! int bytes; char *buffer; { if(bcmp(buffer,diff_dir,bytes)) { --- 464,470 ----- int compare_dir(bytes,buffer) ! long bytes; char *buffer; { if(bcmp(buffer,diff_dir,bytes)) { ************** *** 457,463 { if(bcmp(buffer,diff_dir,bytes)) { annofile(msg_file, (char *)NULL); ! fprintf(msg_file, "%s: data differs\n",diff_name); different++; return -1; } --- 469,475 ----- { if(bcmp(buffer,diff_dir,bytes)) { annofile(msg_file, (char *)NULL); ! fprintf(msg_file, "%s: dir data differs\n",diff_name); different++; return -1; } *** list.c --- ../gnu-tar/list.c ************** *** 33,38 #include <sys/types.h> #include <sys/stat.h> #ifndef MSDOS #include <sys/file.h> #endif /* MSDOS */ --- 33,39 ----- #include <sys/types.h> #include <sys/stat.h> #ifndef MSDOS + #ifndef MINIX #include <sys/file.h> #endif #endif /* MSDOS */ ************** *** 34,39 #include <sys/stat.h> #ifndef MSDOS #include <sys/file.h> #endif /* MSDOS */ #ifdef USG --- 35,41 ----- #ifndef MSDOS #ifndef MINIX #include <sys/file.h> + #endif #endif /* MSDOS */ #ifdef USG ************** *** 242,247 * We can't use unsigned char here because of old compilers, * e.g. V7. */ sum += 0xFF & *p++; } --- 244,250 ----- * We can't use unsigned char here because of old compilers, * e.g. V7. */ + #ifdef ORIG sum += 0xFF & *p++; #else sum += 0xFF & (long)*p++; ************** *** 243,248 * e.g. V7. */ sum += 0xFF & *p++; } /* Adjust checksum to count the "chksum" field as blanks. */ --- 246,254 ----- */ #ifdef ORIG sum += 0xFF & *p++; + #else + sum += 0xFF & (long)*p++; + #endif } /* Adjust checksum to count the "chksum" field as blanks. */ *** port.c --- ../gnu-tar/port.c ************** *** 38,43 #ifdef MSDOS #include <fcntl.h> #else #include <sys/file.h> #endif --- 38,44 ----- #ifdef MSDOS #include <fcntl.h> #else + #ifndef MINIX #include <sys/file.h> #endif #endif ************** *** 40,45 #else #include <sys/file.h> #endif #include "tar.h" #include "port.h" --- 41,47 ----- #ifndef MINIX #include <sys/file.h> #endif + #endif #include "tar.h" #include "port.h" ************** *** 79,88 #define WANT_VALLOC #endif - #ifdef MINIX - #define WANT_BZERO - #endif - #ifdef MSDOS #define WANT_LSTAT #define WANT_STRING --- 81,86 ----- #define WANT_VALLOC #endif #ifdef MSDOS #define WANT_LSTAT #define WANT_STRING ************** *** 96,102 #define WANT_GETOPT #endif ! /* End of system-dependent #ifdefs */ #ifdef WANT_DUMB_GETDATE /* JF a getdate() routine takes a date/time/etc and turns it into a time_t */ --- 94,109 ----- #define WANT_GETOPT #endif ! #ifdef MINIX ! #define WANT_DUMB_GETDATE ! #define WANT_MKDIR ! #define WANT_VALLOC ! #ifdef MINIX14 ! #define WANT_BZERO ! #undef WANT_STRSTR ! #undef WANT_GETOPT ! #endif ! #endif /* End of system-dependent #ifdefs */ ************** *** 98,103 /* End of system-dependent #ifdefs */ #ifdef WANT_DUMB_GETDATE /* JF a getdate() routine takes a date/time/etc and turns it into a time_t */ /* This one is a quick hack I wrote in about five minutes to see if the N --- 105,112 ----- #endif #endif + /* End of system-dependent #ifdefs */ + #ifdef WANT_DUMB_GETDATE /* JF a getdate() routine takes a date/time/etc and turns it into a time_t */ /* This one is a quick hack I wrote in about five minutes to see if the N ************** *** 107,113 into a time_t . Its not well tested or anything. . . */ /* In general, you should use the getdate() supplied in getdate.y */ ! #define OFF_FROM GMT 18000 /* Change for your time zone! */ time_t getdate(str) --- 116,123 ----- into a time_t . Its not well tested or anything. . . */ /* In general, you should use the getdate() supplied in getdate.y */ ! /* Change for your time zone! */ ! #define OFF_FROM_GMT 0 time_t getdate(str) ************** *** 243,248 status = umask(0); /* Get current umask */ status = umask(status | (0777 & ~dmode)); /* Set for mkdir */ execl("/bin/mkdir", "mkdir", dpath, (char *)0); _exit(-1); /* Can't exec /bin/mkdir */ default: /* Parent process */ --- 253,259 ----- status = umask(0); /* Get current umask */ status = umask(status | (0777 & ~dmode)); /* Set for mkdir */ execl("/bin/mkdir", "mkdir", dpath, (char *)0); + execl("/usr/bin/mkdir", "mkdir", dpath, (char *)0); _exit(-1); /* Can't exec /bin/mkdir */ default: /* Parent process */ *** tar.c --- ../gnu-tar/tar.c ************** *** 41,46 #ifdef MSDOS #include <sys/dir.h> #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line --- 41,51 ----- #ifdef MSDOS #include <sys/dir.h> #else + #ifdef MINIX14 + #include <dirent.h> + #define direct dirent + #define d_namlen d_reclen + #else /* * FIXME: On other systems there is no standard place for the header file * for the portable directory access routines. Change the #include line ************** *** 49,54 #include "ndir.h" #endif #endif extern char *malloc(); extern char *getenv(); --- 54,60 ----- #include "ndir.h" #endif #endif + #endif extern char *malloc(); extern char *getenv(); ************** *** 428,433 void describe() { fprintf(stderr,"%s: choose one of the following:\n",tar); fputs("\ -A Append tar files to an archive.\n\ --- 434,478 ----- void describe() { + char **s; + static char *errs[] = { + "-A Append tar files to an archive.", + "-c Create a new archive.", + "-d Find differences between archive and file system.", + "-D Delete from the archive (NOT for use on mag tapes!)", + "-r Append files to the end of an archive.", + "-t List the contents of an archive.", + "-u Only append files that are newer than the copy in an archive.", + "-x Extract files from an archive.", + "Other options:", + "-b N blocking factor N (block size = Nx512 bytes)", + "-B reblock as we read (for reading 4.2BSD pipes)", + "-C dir change to directory DIR", + "-f F read/write archive from file or device F (or hostname:/ForD)", + "-G create/list/extract GNU-format backup", + "-h don't dump symbolic links; dump the files they point to", + "-i ignore blocks of zeros in the archive, which normally mean EOF", + "-k keep existing files, don't overwrite them from the archive", + "-K file begin at \"file\" in the archive", + "-l stay in the local file system (like dump(8)) when creating an archive", + "-m don't extract file modified time", + "-M create/list/extract multi-volume archive", + "-N date only store files newer than DATE", + "-o write an old V7 format archive, rather than ANSI [draft 6] format", + "-O extract files to standard output", + "-p do extract all protection information", + "-R dump record number within archive with each message", + "-s list of names to extract is sorted to match the archive", + "-T F get names to extract or create from file F", + "-v verbosely list what files we process", + "-V vnam create archive with volume name 'vnam'", + "-w ask for confirmation for every action", + "-W attempt to verify the archive after writing it", + "-X file eXclude files listed in \"file\"", + "-z or Z run the archive through compress(1)", + "-[0-7][lmh] specify drive and density", + 0 + }; fprintf(stderr,"%s: choose one of the following:\n",tar); for( s = errs; *s; s++ ){ fputs( *s, stderr ); ************** *** 429,476 describe() { fprintf(stderr,"%s: choose one of the following:\n",tar); ! fputs("\ ! -A Append tar files to an archive.\n\ ! -c Create a new archive.\n\ ! -d Find differences between archive and file system.\n\ ! -D Delete from the archive (NOT for use on mag tapes!)\n\ ! -r Append files to the end of an archive.\n\ ! -t List the contents of an archive.\n\ ! -u Only append files that are newer than the copy in an archive.\n\ ! -x Extract files from an archive.\n",stderr); ! ! fputs("\ ! Other options:\n\ ! -b N blocking factor N (block size = Nx512 bytes)\n\ ! -B reblock as we read (for reading 4.2BSD pipes)\n\ ! -C dir change to directory DIR\n\ ! ", stderr); /* KLUDGE */ fputs("\ ! -f F read/write archive from file or device F (or hostname:/ForD)\n\ ! -G create/list/extract GNU-format backup\n\ ! -h don't dump symbolic links; dump the files they point to\n\ ! -i ignore blocks of zeros in the archive, which normally mean EOF\n\ ! -k keep existing files, don't overwrite them from the archive\n\ ! -K file begin at \"file\" in the archive\n\ ! -l stay in the local file system (like dump(8)) when creating an archive\n\ ! ", stderr); /* KLUDGE */ fputs("\ ! -m don't extract file modified time\n\ ! -M create/list/extract multi-volume archive\n\ ! -N date only store files newer than DATE\n\ ! -o write an old V7 format archive, rather than ANSI [draft 6] format\n\ ! -O extract files to standard output\n\ ! -p do extract all protection information\n\ ! -R dump record number within archive with each message\n\ ! -s list of names to extract is sorted to match the archive\n\ ! ", stderr); /* KLUDGE */ fputs("\ ! -T F get names to extract or create from file F\n\ ! -v verbosely list what files we process\n\ ! -V vnam create archive with volume name 'vnam'\n\ ! -w ask for confirmation for every action\n\ ! -W attempt to verify the archive after writing it\n\ ! -X file eXclude files listed in \"file\"\n\ ! -z or Z run the archive through compress(1)\n\ ! -[0-7][lmh] specify drive and density\n\ ! ", stderr); } --- 474,483 ----- 0 }; fprintf(stderr,"%s: choose one of the following:\n",tar); ! for( s = errs; *s; s++ ){ ! fputs( *s, stderr ); ! fputc( '\n', stderr ); ! } } ************** *** 802,807 { ; } /* p is a directory. Add all the files in P to the namelist. If any of the files is a directory, recurse on the subdirectory. . . */ static --- 809,820 ----- { ; } + + #ifdef V7 + /* Avoid name clashes */ + #define add_dir_name a_d_n + #endif + /* p is a directory. Add all the files in P to the namelist. If any of the files is a directory, recurse on the subdirectory. . . */ static ************** *** 1213,1218 } closedir(dirp); if(rmdir(path)<0) return 1; return 0; --- 1226,1232 ----- } closedir(dirp); + #ifndef V7 if(rmdir(path)<0) #else if(unlink(path)<0) ************** *** 1214,1219 closedir(dirp); if(rmdir(path)<0) return 1; return 0; } --- 1228,1236 ----- #ifndef V7 if(rmdir(path)<0) + #else + if(unlink(path)<0) + #endif return 1; return 0; } *** update.c --- ../gnu-tar/update.c ************** *** 257,262 } #endif int number_of_blocks_read = 0; int number_of_new_records = 0; --- 257,273 ----- } #endif + #ifdef V7 + /* Avoid name clashes */ + #define number_of_blocks_read n_o_br + #define number_of_new_records n_o_nr + #define number_of_records_needed n_o_rn + #define number_of_blocks_read n_o_br + #define number_of_records_to_skip norts + #define number_of_records_to_keep nortk + #define number_of_kept_records_in_block nokrib + #endif + int number_of_blocks_read = 0; int number_of_new_records = 0;