mirror of
https://github.com/aaronsgiles/uuUndo.git
synced 2024-11-22 01:32:02 +00:00
1 line
17 KiB
C
1 line
17 KiB
C
|
/*
* uundo.c: extract a multi-part uuencoded archive Version 1.3a
* written by Aaron Giles 03/08/92
*
* usage:
* uundo [-hLloqv] file1 [file2 [...]]
* uundo [-hLloqv] < file
*
* options:
* -h header: write the article header of the earliest part to target.hdr
* -L lower all: convert all characters in all filenames to lower case
* -l lower: convert only all-upper-case filenames to lower case
* -o overwrite: automatically overwrite existing files without permission
* -q query: allow overwriting of existing files, but ask permission first
* -v verbose: display part numbers and status info
*
* special features:
* - does not require all parts to be in order*
* - attempts to identify missing parts*
* - works on uuencoded files included in shar archives
* - can accept either single or multiple files on the command line
* - can accept stream input from stdin
* (* requires part numbering informating in the subject line of each part)
*
* bugs/requests/modifications to:
* a-giles@uchicago.edu -or-
* gile@midway.uchicago.edu -or-
* giles@hep.uchicago.edu
*
* philosophy:
* I will try my best to keep up with any bug reports (first priority) or
* new feature requests. Note that my primary goal is robustness, so that
* requests which would overly complicate things or result in "flaky" code
* will very likely not be put in.
*
* copyright control:
* This program is public domain, though copyrighted (c) 1992 by its
* author, Aaron Giles. If you wish to distribute modified copies of
* this program, please contact the author first.
*
* standard disclaimer:
* Use this program at your own risk. The author takes no responsibility
* for any loss of data or damage that results from using this program.
*
* known problems/limitations:
* - cannot handle multiple target files in the same input file (sorry!)
* - can't yet accept input piped from rn or trn
*
* to be added in future versions:
* - support for saving header information
* - support for piping, allowing use with rn/trn
*
* version history:
* 1.0 (2/11/92) - initial release
* 1.1 (2/13/92) - added stdin support for preliminary use with rn
* no longer so restrictive on the first line of each part
* added verbose option
* added a warning to overwrite existing files
* added an option to turn off this warning
* now attempts to make file writeable before overwriting
* fixed problem with "BEGIN..." lines fooling the decoder
* 1.2 (2/21/92) - added force lowercase options
* changed procedure dealing with conflicting filenames
* added query option
* now uses process ID in temporary names to avoid conflicts
* output directory can be set via UUNDO environment variable
* 1.21 (2/28/92) - fixed bug that would alter directory attributes if none
* of the input files were found
* 1.3 (3/08/92) - added support for maximum filename length
* - refined handling of jumbled and unlabelled parts
* - fixed the aforementioned bug -- again
* - added option to write header of earliest part to a file
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
/*
* Platform-specific definitions
*/
#define PATHSEP '/' /* path separator character */
#define MAXNAMELEN 32 /* maximum length of a given filename */
#define TEMPNAME "/usr/tmp/uu" /* prefix for temporary files */
/*
* Arbitrary global definitions
*/
#define MAXLEN 256 /* maximum length of strings/pathnames */
#define MAXPARTS 256 /* maximum number of parts in file */
#define BUFSIZE 32768 /* size of temporary buffer */
/*
* Header storage structure
*/
typedef struct he
|