tar.h (169942) | tar.h (169962) |
---|---|
1/* 2 * Copyright (c) Ian F. Darwin 1986-1995. 3 * Software written by Ian F. Darwin and others; 4 * maintained 1995-present by Christos Zoulas and others. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 */ 28/* 29 * Header file for public domain tar (tape archive) program. 30 * 31 * @(#)tar.h 1.20 86/10/29 Public Domain. 32 * 33 * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu. 34 * | 1/* 2 * Copyright (c) Ian F. Darwin 1986-1995. 3 * Software written by Ian F. Darwin and others; 4 * maintained 1995-present by Christos Zoulas and others. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 */ 28/* 29 * Header file for public domain tar (tape archive) program. 30 * 31 * @(#)tar.h 1.20 86/10/29 Public Domain. 32 * 33 * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu. 34 * |
35 * $Id: tar.h,v 1.9 2006/05/03 15:19:25 christos Exp $ # checkin only | 35 * $File: tar.h,v 1.11 2007/01/16 14:56:45 ljt Exp $ # checkin only |
36 */ 37 38/* 39 * Kludge for handling systems that cannot cope with multiple 40 * external definitions of a variable. In ONE routine (tar.c), 41 * we #define TAR_EXTERN to null; here, we set it to "extern" if 42 * it is not already set. 43 */ --- 57 unchanged lines hidden (view full) --- 101 * Exit codes from the "tar" program 102 */ 103#define EX_SUCCESS 0 /* success! */ 104#define EX_ARGSBAD 1 /* invalid args */ 105#define EX_BADFILE 2 /* invalid filename */ 106#define EX_BADARCH 3 /* bad archive */ 107#define EX_SYSTEM 4 /* system gave unexpected error */ 108 | 36 */ 37 38/* 39 * Kludge for handling systems that cannot cope with multiple 40 * external definitions of a variable. In ONE routine (tar.c), 41 * we #define TAR_EXTERN to null; here, we set it to "extern" if 42 * it is not already set. 43 */ --- 57 unchanged lines hidden (view full) --- 101 * Exit codes from the "tar" program 102 */ 103#define EX_SUCCESS 0 /* success! */ 104#define EX_ARGSBAD 1 /* invalid args */ 105#define EX_BADFILE 2 /* invalid filename */ 106#define EX_BADARCH 3 /* bad archive */ 107#define EX_SYSTEM 4 /* system gave unexpected error */ 108 |
109 | |
110/* | 109/* |
111 * Global variables 112 */ 113TAR_EXTERN union record *ar_block; /* Start of block of archive */ 114TAR_EXTERN union record *ar_record; /* Current record of archive */ 115TAR_EXTERN union record *ar_last; /* Last+1 record of archive block */ 116TAR_EXTERN char ar_reading; /* 0 writing, !0 reading archive */ 117TAR_EXTERN int blocking; /* Size of each block, in records */ 118TAR_EXTERN int blocksize; /* Size of each block, in bytes */ 119TAR_EXTERN char *ar_file; /* File containing archive */ 120TAR_EXTERN char *name_file; /* File containing names to work on */ 121TAR_EXTERN char *tar; /* Name of this program */ 122 123/* 124 * Flags from the command line 125 */ 126TAR_EXTERN char f_reblock; /* -B */ 127TAR_EXTERN char f_create; /* -c */ 128TAR_EXTERN char f_debug; /* -d */ 129TAR_EXTERN char f_sayblock; /* -D */ 130TAR_EXTERN char f_follow_links; /* -h */ 131TAR_EXTERN char f_ignorez; /* -i */ 132TAR_EXTERN char f_keep; /* -k */ 133TAR_EXTERN char f_modified; /* -m */ 134TAR_EXTERN char f_oldarch; /* -o */ 135TAR_EXTERN char f_use_protection; /* -p */ 136TAR_EXTERN char f_sorted_names; /* -s */ 137TAR_EXTERN char f_list; /* -t */ 138TAR_EXTERN char f_namefile; /* -T */ 139TAR_EXTERN char f_verbose; /* -v */ 140TAR_EXTERN char f_extract; /* -x */ 141TAR_EXTERN char f_compress; /* -z */ 142 143/* 144 * We now default to Unix Standard format rather than 4.2BSD tar format. 145 * The code can actually produce all three: 146 * f_standard ANSI standard 147 * f_oldarch V7 148 * neither 4.2BSD 149 * but we don't bother, since 4.2BSD can read ANSI standard format anyway. 150 * The only advantage to the "neither" option is that we can cmp(1) our 151 * output to the output of 4.2BSD tar, for debugging. 152 */ 153#define f_standard (!f_oldarch) 154 155/* | |
156 * Structure for keeping track of filenames and lists thereof. 157 */ 158struct name { 159 struct name *next; 160 short length; 161 char found; 162 char name[NAMSIZ+1]; 163}; 164 | 110 * Structure for keeping track of filenames and lists thereof. 111 */ 112struct name { 113 struct name *next; 114 short length; 115 char found; 116 char name[NAMSIZ+1]; 117}; 118 |
165TAR_EXTERN struct name *namelist; /* Points to first name in list */ 166TAR_EXTERN struct name *namelast; /* Points to last name in list */ 167 168TAR_EXTERN int archive; /* File descriptor for archive file */ 169TAR_EXTERN int errors; /* # of files in error */ 170 | |
171/* 172 * 173 * Due to the next struct declaration, each routine that includes 174 * "tar.h" must also include <sys/types.h>. I tried to make it automatic, 175 * but System V has no defines in <sys/types.h>, so there is no way of 176 * knowing when it has been included. In addition, it cannot be included 177 * twice, but must be included exactly once. Argghh! 178 * 179 * Thanks, typedef. Thanks, USG. 180 */ 181struct link { 182 struct link *next; 183 dev_t dev; 184 ino_t ino; 185 short linkcount; 186 char name[NAMSIZ+1]; 187}; | 119/* 120 * 121 * Due to the next struct declaration, each routine that includes 122 * "tar.h" must also include <sys/types.h>. I tried to make it automatic, 123 * but System V has no defines in <sys/types.h>, so there is no way of 124 * knowing when it has been included. In addition, it cannot be included 125 * twice, but must be included exactly once. Argghh! 126 * 127 * Thanks, typedef. Thanks, USG. 128 */ 129struct link { 130 struct link *next; 131 dev_t dev; 132 ino_t ino; 133 short linkcount; 134 char name[NAMSIZ+1]; 135}; |
188 189TAR_EXTERN struct link *linklist; /* Points to first link in list */ 190 191 192/* 193 * Error recovery stuff 194 */ 195TAR_EXTERN char read_error_flag; 196 197 198#if 0 199/* 200 * Declarations of functions available to the world. 201 */ 202/*LINTLIBRARY*/ 203#define annorec(stream, msg) anno(stream, msg, 0) /* Cur rec */ 204#define annofile(stream, msg) anno(stream, msg, 1) /* Saved rec */ 205#endif | |