diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/gzip.c | 18 | ||||
-rw-r--r-- | archival/tar.c | 167 |
2 files changed, 10 insertions, 175 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index 6fd2e3971..4b1d32ddd 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -380,7 +380,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */ # undef LZW #endif -/* $Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $ */ +/* $Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $ */ /* tailor.h -- target dependent definitions * Copyright (C) 1992-1993 Jean-loup Gailly. * This is free software; you can redistribute it and/or modify it under the @@ -391,7 +391,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */ * The target dependent functions should be defined in tailor.c. */ -/* $Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $ */ +/* $Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $ */ #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS @@ -767,7 +767,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */ #endif #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; #endif /* =========================================================================== @@ -976,7 +976,7 @@ void copy_block(buf, len, header) #include <stdio.h> #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; #endif /* =========================================================================== @@ -1592,7 +1592,7 @@ ulg deflate() */ #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; #endif #include <ctype.h> @@ -1781,7 +1781,7 @@ static int (*work) OF((int infile, int outfile)) = zip; /* function to call */ // int main (argc, argv) // int argc; // char **argv; -int gzip_main(struct FileInfo * i, int argc, char * * argv) +int gzip_main(int argc, char * * argv) { foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; if (foreground) { @@ -1925,7 +1925,7 @@ local void do_exit(int exitcode) #include <ctype.h> #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; #endif /* =========================================================================== @@ -2943,7 +2943,7 @@ local void set_file_type() */ #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; #endif #include <ctype.h> @@ -3142,7 +3142,7 @@ void display_ratio(num, den, file) */ #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 1999/10/05 16:24:56 andersen Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; #endif #include <ctype.h> diff --git a/archival/tar.c b/archival/tar.c index 03da96735..498d4a300 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -131,14 +131,10 @@ static void writeHeader(const char * fileName, static void writeTarFile(int fileCount, char ** fileTable); static void writeTarBlock(const char * buf, int len); static BOOL putOctal(char * cp, int len, long value); -extern const char * modeString(int mode); -extern const char * timeString(time_t timeVal); -extern int fullWrite(int fd, const char * buf, int len); -extern int fullRead(int fd, char * buf, int len); extern int -tar_main(struct FileInfo *unused, int argc, char ** argv) +tar_main(int argc, char ** argv) { const char * options; @@ -1258,167 +1254,6 @@ wantFileName(const char * fileName, int fileCount, char ** fileTable) -/* - * Return the standard ls-like mode string from a file mode. - * This is static and so is overwritten on each call. - */ -const char * -modeString(int mode) -{ - static char buf[12]; - - strcpy(buf, "----------"); - - /* - * Fill in the file type. - */ - if (S_ISDIR(mode)) - buf[0] = 'd'; - if (S_ISCHR(mode)) - buf[0] = 'c'; - if (S_ISBLK(mode)) - buf[0] = 'b'; - if (S_ISFIFO(mode)) - buf[0] = 'p'; -#ifdef S_ISLNK - if (S_ISLNK(mode)) - buf[0] = 'l'; -#endif -#ifdef S_ISSOCK - if (S_ISSOCK(mode)) - buf[0] = 's'; -#endif - - /* - * Now fill in the normal file permissions. - */ - if (mode & S_IRUSR) - buf[1] = 'r'; - if (mode & S_IWUSR) - buf[2] = 'w'; - if (mode & S_IXUSR) - buf[3] = 'x'; - if (mode & S_IRGRP) - buf[4] = 'r'; - if (mode & S_IWGRP) - buf[5] = 'w'; - if (mode & S_IXGRP) - buf[6] = 'x'; - if (mode & S_IROTH) - buf[7] = 'r'; - if (mode & S_IWOTH) - buf[8] = 'w'; - if (mode & S_IXOTH) - buf[9] = 'x'; - - /* - * Finally fill in magic stuff like suid and sticky text. - */ - if (mode & S_ISUID) - buf[3] = ((mode & S_IXUSR) ? 's' : 'S'); - if (mode & S_ISGID) - buf[6] = ((mode & S_IXGRP) ? 's' : 'S'); - if (mode & S_ISVTX) - buf[9] = ((mode & S_IXOTH) ? 't' : 'T'); - - return buf; -} - - -/* - * Get the time string to be used for a file. - * This is down to the minute for new files, but only the date for old files. - * The string is returned from a static buffer, and so is overwritten for - * each call. - */ -const char * -timeString(time_t timeVal) -{ - time_t now; - char * str; - static char buf[26]; - - time(&now); - - str = ctime(&timeVal); - - strcpy(buf, &str[4]); - buf[12] = '\0'; - - if ((timeVal > now) || (timeVal < now - 365*24*60*60L)) - { - strcpy(&buf[7], &str[20]); - buf[11] = '\0'; - } - - return buf; -} - - - -/* - * Write all of the supplied buffer out to a file. - * This does multiple writes as necessary. - * Returns the amount written, or -1 on an error. - */ -int -fullWrite(int fd, const char * buf, int len) -{ - int cc; - int total; - - total = 0; - - while (len > 0) - { - cc = write(fd, buf, len); - - if (cc < 0) - return -1; - - buf += cc; - total+= cc; - len -= cc; - } - - return total; -} - - -/* - * Read all of the supplied buffer from a file. - * This does multiple reads as necessary. - * Returns the amount read, or -1 on an error. - * A short read is returned on an end of file. - */ -int -fullRead(int fd, char * buf, int len) -{ - int cc; - int total; - - total = 0; - - while (len > 0) - { - cc = read(fd, buf, len); - - if (cc < 0) - return -1; - - if (cc == 0) - break; - - buf += cc; - total+= cc; - len -= cc; - } - - return total; -} - - - #endif /* END CODE */ |