diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-26 00:10:19 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-26 00:10:19 +0000 |
commit | 9e9afca8e1dfa8c957cf7ef77140a25e15ec2cf0 (patch) | |
tree | 64079a8f4b473ed557c9689868bbd8ab9059f443 /bin | |
parent | 6a21bbfaba9f2366ca923756df0aec2af847bd44 (diff) |
protos. this requires changing the api for the *trail() functions a bit
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pax/ar_subs.c | 10 | ||||
-rw-r--r-- | bin/pax/cpio.c | 6 | ||||
-rw-r--r-- | bin/pax/extern.h | 6 | ||||
-rw-r--r-- | bin/pax/options.c | 6 | ||||
-rw-r--r-- | bin/pax/pax.h | 148 | ||||
-rw-r--r-- | bin/pax/tar.c | 6 |
6 files changed, 93 insertions, 89 deletions
diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c index 74955f81c8b..caedfcbc948 100644 --- a/bin/pax/ar_subs.c +++ b/bin/pax/ar_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_subs.c,v 1.24 2003/06/02 23:32:08 millert Exp $ */ +/* $OpenBSD: ar_subs.c,v 1.25 2003/06/26 00:10:17 deraadt Exp $ */ /* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; #else -static const char rcsid[] = "$OpenBSD: ar_subs.c,v 1.24 2003/06/02 23:32:08 millert Exp $"; +static const char rcsid[] = "$OpenBSD: ar_subs.c,v 1.25 2003/06/26 00:10:17 deraadt Exp $"; #endif #endif /* not lint */ @@ -383,7 +383,7 @@ wr_archive(ARCHD *arcn, int is_app) int hlk; int wr_one; off_t cnt; - int (*wrf)(); + int (*wrf)(ARCHD *); int fd = -1; time_t now; @@ -1072,7 +1072,7 @@ next_head(ARCHD *arcn) /* * this format has trailers outside of valid headers */ - if ((ret = (*frmt->trail)(hdbuf,in_resync,&cnt)) == 0){ + if ((ret = (*frmt->trail)(arcn,hdbuf,in_resync,&cnt)) == 0){ /* * valid trailer found, drain input as required */ @@ -1119,7 +1119,7 @@ next_head(ARCHD *arcn) * the header. NOTE: the parameters are different than trailer routines * which encode trailers outside of the header! */ - if (frmt->inhead && ((*frmt->trail)(arcn) == 0)) { + if (frmt->inhead && ((*frmt->trail)(arcn,NULL,0,NULL) == 0)) { /* * valid trailer found, drain input as required */ diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c index f5cdf759dd2..2bfb44ee9e8 100644 --- a/bin/pax/cpio.c +++ b/bin/pax/cpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpio.c,v 1.15 2003/06/02 23:32:08 millert Exp $ */ +/* $OpenBSD: cpio.c,v 1.16 2003/06/26 00:10:17 deraadt Exp $ */ /* $NetBSD: cpio.c,v 1.5 1995/03/21 09:07:13 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93"; #else -static const char rcsid[] = "$OpenBSD: cpio.c,v 1.15 2003/06/02 23:32:08 millert Exp $"; +static const char rcsid[] = "$OpenBSD: cpio.c,v 1.16 2003/06/26 00:10:17 deraadt Exp $"; #endif #endif /* not lint */ @@ -92,7 +92,7 @@ cpio_strd(void) */ int -cpio_trail(ARCHD *arcn) +cpio_trail(ARCHD *arcn, char *notused, int notused2, int *notused3) { /* * look for trailer id in file we are about to process diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 91f9f88b6fc..f8632177e07 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.26 2003/06/13 17:51:14 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.27 2003/06/26 00:10:17 deraadt Exp $ */ /* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */ /*- @@ -113,7 +113,7 @@ int gid_name(char *, gid_t *); * cpio.c */ int cpio_strd(void); -int cpio_trail(ARCHD *); +int cpio_trail(ARCHD *, char *, int, int *); int cpio_endwr(void); int cpio_id(char *, int); int cpio_rd(ARCHD *, char *); @@ -280,7 +280,7 @@ u_int st_hash(char *, int, int); extern char *gnu_hack_string; int tar_endwr(void); off_t tar_endrd(void); -int tar_trail(char *, int, int *); +int tar_trail(ARCHD *, char *, int, int *); int tar_id(char *, int); int tar_opt(void); int tar_rd(ARCHD *, char *); diff --git a/bin/pax/options.c b/bin/pax/options.c index 2aaf3f74230..214e5ec7daf 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.58 2003/06/13 17:51:14 millert Exp $ */ +/* $OpenBSD: options.c,v 1.59 2003/06/26 00:10:17 deraadt Exp $ */ /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #else -static const char rcsid[] = "$OpenBSD: options.c,v 1.58 2003/06/13 17:51:14 millert Exp $"; +static const char rcsid[] = "$OpenBSD: options.c,v 1.59 2003/06/26 00:10:17 deraadt Exp $"; #endif #endif /* not lint */ @@ -979,6 +979,8 @@ tar_options(int argc, char **argv) } } +int mkpath(char *); + int mkpath(path) char *path; diff --git a/bin/pax/pax.h b/bin/pax/pax.h index 7b791e13e54..ff0a14f961a 100644 --- a/bin/pax/pax.h +++ b/bin/pax/pax.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pax.h,v 1.14 2003/06/02 23:32:09 millert Exp $ */ +/* $OpenBSD: pax.h,v 1.15 2003/06/26 00:10:17 deraadt Exp $ */ /* $NetBSD: pax.h,v 1.3 1995/03/21 09:07:41 cgd Exp $ */ /*- @@ -71,6 +71,63 @@ #define ISPIPE 4 /* pipe/socket */ /* + * Pattern matching structure + * + * Used to store command line patterns + */ +typedef struct pattern { + char *pstr; /* pattern to match, user supplied */ + char *pend; /* end of a prefix match */ + char *chdname; /* the dir to change to if not NULL. */ + int plen; /* length of pstr */ + int flgs; /* processing/state flags */ +#define MTCH 0x1 /* pattern has been matched */ +#define DIR_MTCH 0x2 /* pattern matched a directory */ + struct pattern *fow; /* next pattern */ +} PATTERN; + +/* + * General Archive Structure (used internal to pax) + * + * This structure is used to pass information about archive members between + * the format independent routines and the format specific routines. When + * new archive formats are added, they must accept requests and supply info + * encoded in a structure of this type. The name fields are declared statically + * here, as there is only ONE of these floating around, size is not a major + * consideration. Eventually converting the name fields to a dynamic length + * may be required if and when the supporting operating system removes all + * restrictions on the length of pathnames it will resolve. + */ +typedef struct { + int nlen; /* file name length */ + char name[PAXPATHLEN+1]; /* file name */ + int ln_nlen; /* link name length */ + char ln_name[PAXPATHLEN+1]; /* name to link to (if any) */ + char *org_name; /* orig name in file system */ + PATTERN *pat; /* ptr to pattern match (if any) */ + struct stat sb; /* stat buffer see stat(2) */ + off_t pad; /* bytes of padding after file xfer */ + off_t skip; /* bytes of real data after header */ + /* IMPORTANT. The st_size field does */ + /* not always indicate the amount of */ + /* data following the header. */ + u_long crc; /* file crc */ + int type; /* type of file node */ +#define PAX_DIR 1 /* directory */ +#define PAX_CHR 2 /* character device */ +#define PAX_BLK 3 /* block device */ +#define PAX_REG 4 /* regular file */ +#define PAX_SLK 5 /* symbolic link */ +#define PAX_SCK 6 /* socket */ +#define PAX_FIF 7 /* fifo */ +#define PAX_HLK 8 /* hard link */ +#define PAX_HRG 9 /* hard link to a regular file */ +#define PAX_CTG 10 /* high performance file */ +#define PAX_GLL 11 /* GNU long symlink */ +#define PAX_GLF 12 /* GNU long file */ +} ARCHD; + +/* * Format Specific Routine Table * * The format specific routine table allows new archive formats to be quickly @@ -106,13 +163,13 @@ typedef struct { int inhead; /* is the trailer encoded in a valid header? */ /* if not, trailers are assumed to be found */ /* in invalid headers (i.e like tar) */ - int (*id)(); /* checks if a buffer is a valid header */ - /* returns 1 if it is, o.w. returns a 0 */ - int (*st_rd)(); /* initialize routine for read. so format */ + int (*id)(char *, /* checks if a buffer is a valid header */ + int); /* returns 1 if it is, o.w. returns a 0 */ + int (*st_rd)(void); /* initialize routine for read. so format */ /* can set up tables etc before it starts */ /* reading an archive */ - int (*rd)(); /* read header routine. passed a pointer to */ - /* ARCHD. It must extract the info from the */ + int (*rd)(ARCHD *, /* read header routine. passed a pointer to */ + char *); /* ARCHD. It must extract the info from the */ /* format and store it in the ARCHD struct. */ /* This routine is expected to fill all the */ /* fields in the ARCHD (including stat buf) */ @@ -123,12 +180,12 @@ typedef struct { /* padding and the number of bytes of data */ /* which follow the header. This info is */ /* used skip to the next file header */ - off_t (*end_rd)(); /* read cleanup. Allows format to clean up */ + off_t (*end_rd)(void); /* read cleanup. Allows format to clean up */ /* and MUST RETURN THE LENGTH OF THE TRAILER */ /* RECORD (so append knows how many bytes */ /* to move back to rewrite the trailer) */ - int (*st_wr)(); /* initialize routine for write operations */ - int (*wr)(); /* write archive header. Passed an ARCHD */ + int (*st_wr)(void); /* initialize routine for write operations */ + int (*wr)(ARCHD *); /* write archive header. Passed an ARCHD */ /* filled with the specs on the next file to */ /* archived. Returns a 1 if no file data is */ /* is to be stored; 0 if file data is to be */ @@ -138,81 +195,26 @@ typedef struct { /* the proper padding can be added after */ /* file data. This routine must NEVER write */ /* a flawed archive header. */ - int (*end_wr)(); /* end write. write the trailer and do any */ + int (*end_wr)(void); /* end write. write the trailer and do any */ /* other format specific functions needed */ /* at the ecnd of a archive write */ - int (*trail)(); /* returns 0 if a valid trailer, -1 if not */ - /* For formats which encode the trailer */ - /* outside of a valid header, a return value */ + int (*trail)(ARCHD *, /* returns 0 if a valid trailer, -1 if not */ + char *, int, /* For formats which encode the trailer */ + int *); /* outside of a valid header, a return value */ /* of 1 indicates that the block passed to */ /* it can never contain a valid header (skip */ /* this block, no point in looking at it) */ /* CAUTION: parameters to this function are */ /* different for trailers inside or outside */ /* of headers. See get_head() for details */ - int (*rd_data)(); /* read/process file data from the archive */ - int (*wr_data)(); /* write/process file data to the archive */ - int (*options)(); /* process format specific options (-o) */ + int (*rd_data)(ARCHD *, /* read/process file data from the archive */ + int, off_t *); + int (*wr_data)(ARCHD *, /* write/process file data to the archive */ + int, off_t *); + int (*options)(void); /* process format specific options (-o) */ } FSUB; /* - * Pattern matching structure - * - * Used to store command line patterns - */ -typedef struct pattern { - char *pstr; /* pattern to match, user supplied */ - char *pend; /* end of a prefix match */ - char *chdname; /* the dir to change to if not NULL. */ - int plen; /* length of pstr */ - int flgs; /* processing/state flags */ -#define MTCH 0x1 /* pattern has been matched */ -#define DIR_MTCH 0x2 /* pattern matched a directory */ - struct pattern *fow; /* next pattern */ -} PATTERN; - -/* - * General Archive Structure (used internal to pax) - * - * This structure is used to pass information about archive members between - * the format independent routines and the format specific routines. When - * new archive formats are added, they must accept requests and supply info - * encoded in a structure of this type. The name fields are declared statically - * here, as there is only ONE of these floating around, size is not a major - * consideration. Eventually converting the name fields to a dynamic length - * may be required if and when the supporting operating system removes all - * restrictions on the length of pathnames it will resolve. - */ -typedef struct { - int nlen; /* file name length */ - char name[PAXPATHLEN+1]; /* file name */ - int ln_nlen; /* link name length */ - char ln_name[PAXPATHLEN+1]; /* name to link to (if any) */ - char *org_name; /* orig name in file system */ - PATTERN *pat; /* ptr to pattern match (if any) */ - struct stat sb; /* stat buffer see stat(2) */ - off_t pad; /* bytes of padding after file xfer */ - off_t skip; /* bytes of real data after header */ - /* IMPORTANT. The st_size field does */ - /* not always indicate the amount of */ - /* data following the header. */ - u_long crc; /* file crc */ - int type; /* type of file node */ -#define PAX_DIR 1 /* directory */ -#define PAX_CHR 2 /* character device */ -#define PAX_BLK 3 /* block device */ -#define PAX_REG 4 /* regular file */ -#define PAX_SLK 5 /* symbolic link */ -#define PAX_SCK 6 /* socket */ -#define PAX_FIF 7 /* fifo */ -#define PAX_HLK 8 /* hard link */ -#define PAX_HRG 9 /* hard link to a regular file */ -#define PAX_CTG 10 /* high performance file */ -#define PAX_GLL 11 /* GNU long symlink */ -#define PAX_GLF 12 /* GNU long file */ -} ARCHD; - -/* * Format Specific Options List * * Used to pass format options to the format options handler diff --git a/bin/pax/tar.c b/bin/pax/tar.c index 8acaa4c73dc..b8b4eb3662c 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tar.c,v 1.30 2003/06/02 23:32:09 millert Exp $ */ +/* $OpenBSD: tar.c,v 1.31 2003/06/26 00:10:18 deraadt Exp $ */ /* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; #else -static const char rcsid[] = "$OpenBSD: tar.c,v 1.30 2003/06/02 23:32:09 millert Exp $"; +static const char rcsid[] = "$OpenBSD: tar.c,v 1.31 2003/06/26 00:10:18 deraadt Exp $"; #endif #endif /* not lint */ @@ -110,7 +110,7 @@ tar_endrd(void) */ int -tar_trail(char *buf, int in_resync, int *cnt) +tar_trail(ARCHD *ignore, char *buf, int in_resync, int *cnt) { int i; |