| 1 |
/** $MirOS: src/bin/pax/pax.c,v 1.5 2006/07/16 18:00:33 tg Exp $ */ |
/** $MirOS: src/bin/pax/pax.c,v 1.7 2007/02/17 04:52:41 tg Exp $ */ |
| 2 |
/* $OpenBSD: pax.c,v 1.28 2005/08/04 10:02:44 mpf Exp $ */ |
/* $OpenBSD: pax.c,v 1.28 2005/08/04 10:02:44 mpf Exp $ */ |
| 3 |
/* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */ |
/* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */ |
| 4 |
|
|
| 35 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
| 36 |
*/ |
*/ |
| 37 |
|
|
|
#ifndef lint |
|
|
static const char copyright[] = |
|
|
"@(#) Copyright (c) 1992, 1993\n\ |
|
|
The Regents of the University of California. All rights reserved.\n"; |
|
|
#endif /* not lint */ |
|
|
|
|
| 38 |
#include <sys/param.h> |
#include <sys/param.h> |
| 39 |
#include <sys/stat.h> |
#include <sys/stat.h> |
| 40 |
#include <sys/time.h> |
#include <sys/time.h> |
| 51 |
#include "pax.h" |
#include "pax.h" |
| 52 |
#include "extern.h" |
#include "extern.h" |
| 53 |
|
|
| 54 |
|
__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ |
| 55 |
|
The Regents of the University of California. All rights reserved.\n"); |
| 56 |
__SCCSID("@(#)pax.c 8.2 (Berkeley) 4/18/94"); |
__SCCSID("@(#)pax.c 8.2 (Berkeley) 4/18/94"); |
| 57 |
__RCSID("$MirOS: src/bin/pax/pax.c,v 1.5 2006/07/16 18:00:33 tg Exp $"); |
__RCSID("$MirOS: src/bin/pax/pax.c,v 1.7 2007/02/17 04:52:41 tg Exp $"); |
| 58 |
|
|
| 59 |
static int gen_init(void); |
static int gen_init(void); |
| 60 |
|
static void sig_cleanup(int) __attribute__((noreturn)); |
| 61 |
|
|
| 62 |
/* |
/* |
| 63 |
* PAX main routines, general globals and some simple start up routines |
* PAX main routines, general globals and some simple start up routines |
| 66 |
/* |
/* |
| 67 |
* Variables that can be accessed by any routine within pax |
* Variables that can be accessed by any routine within pax |
| 68 |
*/ |
*/ |
| 69 |
int act = DEFOP; /* read/write/append/copy */ |
int act = ERROR; /* read/write/append/copy */ |
| 70 |
FSUB *frmt = NULL; /* archive format type */ |
FSUB *frmt = NULL; /* archive format type */ |
| 71 |
int cflag; /* match all EXCEPT pattern/file */ |
int cflag; /* match all EXCEPT pattern/file */ |
| 72 |
int cwdfd; /* starting cwd */ |
int cwdfd; /* starting cwd */ |
| 96 |
int docrc; /* check/create file crc */ |
int docrc; /* check/create file crc */ |
| 97 |
char *dirptr; /* destination dir in a copy */ |
char *dirptr; /* destination dir in a copy */ |
| 98 |
char *ltmfrmt; /* -v locale time format (if any) */ |
char *ltmfrmt; /* -v locale time format (if any) */ |
| 99 |
char *argv0; /* root of argv[0] */ |
const char *argv0; /* root of argv[0] */ |
| 100 |
sigset_t s_mask; /* signal mask for cleanup critical sect */ |
sigset_t s_mask; /* signal mask for cleanup critical sect */ |
| 101 |
FILE *listf; /* fp to print file list to (default stderr) */ |
FILE *listf; /* fp to print file list to (default stderr) */ |
| 102 |
char *tempfile; /* tempfile to use for mkstemp(3) */ |
char *tempfile; /* tempfile to use for mkstemp(3) */ |
| 225 |
int |
int |
| 226 |
main(int argc, char **argv) |
main(int argc, char **argv) |
| 227 |
{ |
{ |
| 228 |
char *tmpdir; |
const char *tmpdir; |
| 229 |
size_t tdlen; |
size_t tdlen; |
| 230 |
|
|
| 231 |
/* |
/* |
| 283 |
copy(); |
copy(); |
| 284 |
break; |
break; |
| 285 |
default: |
default: |
| 286 |
|
act = LIST; /* for ar_io.c &c. */ |
| 287 |
case LIST: |
case LIST: |
| 288 |
list(); |
list(); |
| 289 |
break; |
break; |
| 300 |
* never.... |
* never.... |
| 301 |
*/ |
*/ |
| 302 |
|
|
| 303 |
void |
static void |
| 304 |
sig_cleanup(int which_sig) |
sig_cleanup(int which_sig) |
| 305 |
{ |
{ |
| 306 |
/* XXX signal races */ |
/* XXX signal races */ |