|
|
1.1 ! root 1: #include "ar.h" ! 2: #include "config.h" ! 3: #include <stdio.h> ! 4: #include <sys/types.h> ! 5: #include <sys/stat.h> ! 6: #include <signal.h> ! 7: #include <ctype.h> ! 8: #include <errno.h> ! 9: ! 10: /* system-dependent stuff */ ! 11: #ifndef major ! 12: #include <sys/sysmacros.h> ! 13: #endif ! 14: ! 15: #ifdef FCNTL ! 16: #include <fcntl.h> ! 17: #define dup2(x,y) (close(y),fcntl(x,F_DUPFD,y)) ! 18: #endif ! 19: ! 20: /* longest archive component name we will generate */ ! 21: #define MAXCOMP 14 ! 22: ! 23: /* macro to allocate storage of a given type */ ! 24: #define new(t) ((t *) alloc (sizeof (t))) ! 25: ! 26: /* constants for tmpname function */ ! 27: #define TMPDIR "/tmp/" ! 28: #define TMPNAML (sizeof(TMPDIR) + 15) ! 29: ! 30: /* some systems define SIG_TYP, others don't, so we make our own */ ! 31: typedef int (*Sig_typ)(); ! 32: ! 33: struct replist { ! 34: char *source; ! 35: char *dest; ! 36: struct replist *link; ! 37: } *replist; ! 38: ! 39: /* structures to deal with archive headers */ ! 40: struct ar_hdr ar_hdr; ! 41: struct { ! 42: long size; ! 43: int mode; ! 44: long date; ! 45: } hdr; ! 46: ! 47: /* ! 48: * This stat buffer makes it easy to check that none of the ! 49: * input files is the same as the output. This will avoid ! 50: * filling up the entire file system by inadvertently saying ! 51: * ! 52: * mkpkg . > foo ! 53: */ ! 54: struct stat outsb; ! 55: ! 56: /* ! 57: * The following structure helps keep track of things being packaged. ! 58: * iname is the internal name of the component -- in other words, ! 59: * the archive element name. ename is the (short) pathname of the ! 60: * file. The structures are chained by the "link" field. All the ! 61: * other fields are copies of things returned by "stat" and are ! 62: * used mostly to make sure nothing changed while we were packaging. ! 63: * head and tail point to the first and last items in the chain. ! 64: * The first item is known to refer to the "Instructions" component. ! 65: */ ! 66: struct pack { ! 67: char *iname; ! 68: char *ename; ! 69: struct pack *link; ! 70: dev_t dev; ! 71: ino_t ino; ! 72: int uid, gid, mode; ! 73: time_t time; ! 74: off_t size; ! 75: }; ! 76: ! 77: struct pack *pkhead, *pktail; ! 78: ! 79: ! 80: FILE *popen(); ! 81: char *Xstr; ! 82: char *alloc(); ! 83: char *copy(); ! 84: char *fgets(); ! 85: char *fullname(); ! 86: char *getfield(); ! 87: char *getpass(); ! 88: char *getpath(); ! 89: extern char *hextab; ! 90: char *iname(); ! 91: extern char *instr; ! 92: char *keyfile; ! 93: char *mktemp(); ! 94: extern char *optarg; ! 95: char *pwd(); ! 96: char *ralloc(); ! 97: char *strcat(); ! 98: char *strchr(); ! 99: char *strcpy(); ! 100: char *strrchr(); ! 101: char *strgid(); ! 102: char *struid(); ! 103: char *tmpname(); ! 104: char *transname(); ! 105: char *xstr; ! 106: int Kflag; ! 107: int bflag; ! 108: int consider(); ! 109: int dflag; ! 110: int errno; ! 111: int kflag; ! 112: int nflag; ! 113: int install(); ! 114: int numgid(); ! 115: int numuid(); ! 116: extern int optind; ! 117: int package(); ! 118: int pkgend(); ! 119: int retcode; ! 120: int seal(); ! 121: int unseal(); ! 122: int vflag; ! 123: long cvlong(); ! 124: long read_header(); ! 125: void delete(); ! 126: void geteol(); ! 127: void next_header(); ! 128: void pkgstart(); ! 129: void pkgfile(); ! 130: void putpath();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.