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