Changeset 3816

Show
Ignore:
Timestamp:
10/29/08 18:58:40 (2 months ago)
Author:
tg
Message:

FreeWRT trunk:

• merge new MirCPIO upstream, changes:

– allow multiple -v options not only for tar but also for cpio, pax
– add code to work around broken archives such as the CPIO archive inside

Fedora Core 4 glibc-common-2.3.6-3.i386.rpm which carry the actual data
of hardlinks not in the first but a later (here, the last) occurence of
the file in question: iff hardlinking succeeds (no cross-device!), size
of the linked files is 0, size of the archive member is greater than 0,
we are extracting, but not to stdout, proceed writing out the data.

• add mircpio, mirpax, mirtar links in order to prevent interfering with

native tools when both are in $PATH (this has worked since the last
update, can be used now)

FreeWRT 1.0-stable:

• merge paxmirabilis complete from trunk

note: untested

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/freewrt_1_0/tools/paxmirabilis/Makefile

    r2715 r3816  
    4949        cp $(STAGING_DIR)/bin/pax ${TOPDIR}/lbin/pax 
    5050        cd ${TOPDIR}/lbin && ln pax cpio && ln pax tar 
     51        cd ${TOPDIR}/lbin && ln pax mircpio && ln pax mirpax && ln pax mirtar 
    5152 
    5253install-lbin: 
     
    5455        if [ -e $(STAGING_DIR)/bin/pax ]; then \ 
    5556                cp $(STAGING_DIR)/bin/pax ${TOPDIR}/lbin/pax; \ 
    56                 cd ${TOPDIR}/lbin && ln pax cpio && ln pax tar; \ 
     57                cd ${TOPDIR}/lbin && ln pax cpio && ln pax tar && \ 
     58                    ln pax mircpio && ln pax mirpax && ln pax mirtar; \ 
    5759        else \ 
    5860                rm -f $(TOOLS_STAMP_DIR)/.tools_paxmirabilis-install; \ 
  • branches/freewrt_1_0/tools/paxmirabilis/src/Makefile

    r2715 r3816  
    1 # $MirOS: src/bin/pax/Makefile,v 1.4 2006/08/18 18:21:36 tg Exp $ 
     1# $MirOS: src/bin/pax/Makefile,v 1.6 2008/05/07 13:50:21 tg Exp $ 
    22# $OpenBSD: Makefile,v 1.10 2001/05/26 00:32:20 millert Exp $ 
    33 
     
    1818        tar.c tty_subs.c 
    1919MAN=    pax.1 tar.1 cpio.1 
    20 LINKS=  ${BINDIR}/pax ${BINDIR}/tar ${BINDIR}/pax ${BINDIR}/cpio 
     20LINKS=  ${BINDIR}/pax ${BINDIR}/tar \ 
     21        ${BINDIR}/pax ${BINDIR}/cpio 
    2122 
    22 .if (${MACHINE_OS} == "Interix") || (${MACHINE_OS} == "Linux") 
     23.if (${MACHINE_OS} == "Interix") || (${MACHINE_OS} == "Linux") || (${MACHINE_OS} == "GNU") 
    2324CPPFLAGS+= -DLONG_OFF_T 
    2425.endif 
  • branches/freewrt_1_0/tools/paxmirabilis/src/ar_subs.c

    r2715 r3816  
    1 /**     $MirOS: src/bin/pax/ar_subs.c,v 1.5 2007/02/17 04:52:39 tg Exp $ */ 
    2 /*      $OpenBSD: ar_subs.c,v 1.29 2006/01/25 17:42:08 markus Exp $     */ 
     1/*      $OpenBSD: ar_subs.c,v 1.31 2006/11/17 08:38:04 otto Exp $       */ 
    32/*      $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $  */ 
    43 
    54/*- 
     5 * Copyright (c) 2008 
     6 *      Thorsten Glaser <tg@mirbsd.de> 
    67 * Copyright (c) 1992 Keith Muller. 
    78 * Copyright (c) 1992, 1993 
     
    5152 
    5253__SCCSID("@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"); 
    53 __RCSID("$MirOS: src/bin/pax/ar_subs.c,v 1.5 2007/02/17 04:52:39 tg Exp $"); 
     54__RCSID("$MirOS: src/bin/pax/ar_subs.c,v 1.7 2008/10/29 17:34:48 tg Exp $"); 
    5455 
    5556static void wr_archive(ARCHD *, int is_app); 
     
    312313                         */ 
    313314                        if (!to_stdout) { 
    314                                 if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) 
    315                                         res = lnk_creat(arcn); 
    316                                 else 
     315                                if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) { 
     316                                        res = lnk_creat(arcn, &fd); 
     317                                        if (fd != -1) 
     318                                                goto extdata; 
     319                                } else 
    317320                                        res = node_creat(arcn); 
    318321                        } 
     
    326329                                vfpart = 0; 
    327330                        } 
    328                         continue
     331                        goto popd
    329332                } 
    330333                /* 
     
    337340                        (void)rd_skip(arcn->skip + arcn->pad); 
    338341                        purg_lnk(arcn); 
    339                         continue
     342                        goto popd
    340343                } 
    341344                /* 
     
    343346                 * any unprocessed data 
    344347                 */ 
     348 extdata: 
    345349                res = (*frmt->rd_data)(arcn, fd, &cnt); 
    346350                if (fd != STDOUT_FILENO) 
     
    353357                        (void)rd_skip(cnt + arcn->pad); 
    354358 
     359 popd: 
    355360                /* 
    356361                 * if required, chdir around. 
     
    410415                if (is_app) 
    411416                        goto trailer; 
    412                 else 
    413                         return; 
    414         } 
    415         if (((*frmt->st_wr)() < 0)) 
    416                 return; 
     417                return; 
     418        } else if (((*frmt->st_wr)() < 0)) 
     419                return; 
     420 
    417421        wrf = frmt->wr; 
    418422 
     
    929933                         */ 
    930934                        if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) 
    931                                 res = lnk_creat(arcn); 
     935                                res = lnk_creat(arcn, NULL); 
    932936                        else 
    933937                                res = node_creat(arcn); 
  • branches/freewrt_1_0/tools/paxmirabilis/src/cpio.1

    r2715 r3816  
    1 .\"     $MirOS: src/bin/pax/cpio.1,v 1.15 2006/07/21 17:34:59 tg Exp $ 
    2 .\"     $OpenBSD: cpio.1,v 1.23 2006/01/03 17:22:47 jmc Exp $ 
     1.\"     $MirOS: src/bin/pax/cpio.1,v 1.17 2008/03/14 17:05:06 tg Exp $ 
     2.\"     $OpenBSD: cpio.1,v 1.26 2007/05/31 19:19:15 jmc Exp $ 
    33.\" 
    44.\" Copyright (c) 2005 Thorsten Glaser <tg@66h.42h.de> 
     
    2626.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    2727.\" 
    28 .Dd July 21, 2006 
    29 .Dt CPIO 1 
    30 .Os MirBSD 
    31 .\" for portability 
     28.\"     $OpenBSD: cpio.1,v 1.26 2007/05/31 19:19:15 jmc Exp $ 
     29.\" 
     30.\"- 
     31.\" Try to make GNU groff and AT&T nroff more compatible 
     32.\" * ` generates ‘ in groff, so use \` 
     33.\" * ' generates ’ in groff, \' generates ´, so use \*(aq 
     34.\" * - generates ‐ in groff, \- generates −, fixed in tmac/mdoc/doc-groff 
     35.\"   thus use - for hyphens and \- for minus signs and option dashes 
     36.\" * ~ is size-reduced and placed atop in groff, so use \*(TI 
     37.\" * ^ is size-reduced and placed atop in groff, so use \*(ha 
     38.\" * \(en does not work in nroff, so use \*(en 
     39.ie \n(.g \{\ 
     40.       ds aq \(aq 
     41.       ds TI \(ti 
     42.       ds ha \(ha 
     43.       ds en \(en 
     44.\} 
     45.el \{\ 
     46.       ds aq ' 
     47.       ds TI ~ 
     48.       ds ha ^ 
     49.       ds en \(em 
     50.\} 
     51.\" 
     52.\" Implement .Dd with the Mdocdate RCS keyword 
     53.rn Dd xD 
     54.de Dd 
     55.ie \\$1$Mdocdate: \{\ 
     56.       xD \\$2 \\$3, \\$4 
     57.\} 
     58.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 
     59.. 
     60.\" 
     61.\" .Dd must come before definition of .Mx, because when called 
     62.\" with -mandoc, it might implement .Mx itself, but we want to 
     63.\" use our own definition. And .Dd must come *first*, always. 
     64.Dd $Mdocdate: March 14 2008 $ 
     65.\" 
     66.\" Implement .Mx (MirBSD) 
    3267.de Mx 
    3368.nr cF \\n(.f 
     
    5489.\} 
    5590.. 
     91.Dt CPIO 1 
     92.Os MirBSD 
    5693.Sh NAME 
    5794.Nm cpio 
     
    6097.Nm cpio 
    6198.Fl o 
    62 .Op Fl aABcLvzZ 
     99.Op Fl AaBcLvZz 
    63100.Op Fl C Ar bytes 
    64101.Op Fl F Ar archive 
     
    66103.Op Fl M Ar flag 
    67104.Op Fl O Ar archive 
    68 .Ar "< name-list" 
    69 .Op Ar "> archive" 
     105.Ar \*(Lt name-list 
     106.Op Ar \*(Gt archive 
    70107.Nm cpio 
    71108.Fl i 
    72 .Op Fl bBcdfmrsStuvzZ6 
     109.Op Fl 6BbcdfmrSstuvZz 
    73110.Op Fl C Ar bytes 
    74111.Op Fl E Ar file 
     
    76113.Op Fl H Ar format 
    77114.Op Fl I Ar archive 
    78 .Op Ar "pattern ..." 
    79 .Op Ar "< archive" 
     115.Op Ar pattern ... 
     116.Op Ar \*(Lt archive 
    80117.Nm cpio 
    81118.Fl p 
    82 .Op Fl adlLmuv 
     119.Op Fl adLlmuv 
    83120.Ar destination-directory 
    84 .Ar "< name-list" 
     121.Ar \*(Lt name-list 
    85122.Sh DESCRIPTION 
    86123The 
     
    98135output. 
    99136.Bl -tag -width Ds 
     137.It Fl A 
     138Append to the specified archive. 
    100139.It Fl a 
    101140Reset the access times on files that have been copied to the 
    102141archive. 
    103 .It Fl A 
    104 Append to the specified archive. 
    105142.It Fl B 
    106143Set block size of output to 5120 bytes. 
    107 .It Fl c 
    108 Use ASCII format for 
    109 .Nm 
    110 header for portability. 
    111144.It Fl C Ar bytes 
    112145Set the block size of output to 
    113146.Ar bytes . 
     147.It Fl c 
     148Use ASCII format for 
     149.Nm 
     150header for portability. 
    114151.It Fl F Ar archive 
    115 .It Fl O Ar archive 
    116 Use the specified file name as the archive to write to. 
     152Use the specified file as the input for the archive. 
    117153.It Fl H Ar format 
    118154Write the archive in the specified format. 
     
    197233.Ar links 
    198234specifiers are ignored. 
     235.It Fl O Ar archive 
     236Use the specified file name as the archive to write to. 
    199237.It Fl v 
    200238Be verbose about operations. 
    201239List filenames as they are written to the archive. 
     240.It Fl Z 
     241Compress archive using 
     242.Xr compress 1 
     243format. 
    202244.It Fl z 
    203245Compress archive using 
    204246.Xr gzip 1 
    205 format. 
    206 .It Fl Z 
    207 Compress archive using 
    208 .Xr compress 1 
    209247format. 
    210248.El 
     
    216254that were specified on the command line. 
    217255.Bl -tag -width Ds 
     256.It Fl 6 
     257Process old-style 
     258.Nm 
     259format archives. 
     260.It Fl B 
     261Set the block size of the archive being read to 5120 bytes. 
    218262.It Fl b 
    219263Do byte and word swapping after reading in data from the 
    220264archive, for restoring archives created on systems with 
    221265a different byte order. 
    222 .It Fl B 
    223 Set the block size of the archive being read to 5120 bytes. 
    224 .It Fl c 
    225 Expect the archive headers to be in ASCII format. 
    226266.It Fl C Ar bytes 
    227267Read archive written with a block size of 
    228268.Ar bytes . 
     269.It Fl c 
     270Expect the archive headers to be in ASCII format. 
    229271.It Fl d 
    230272Create any intermediate directories as needed during 
     
    233275Read list of file name patterns to extract or list from 
    234276.Ar file . 
     277.It Fl F Ar archive , Fl I Ar archive 
     278Use the specified file as the input for the archive. 
    235279.It Fl f 
    236280Restore all files except those matching the 
    237281.Ar patterns 
    238282given on the command line. 
    239 .It Fl F Ar archive 
    240 .It Fl I Ar archive 
    241 Use the specified file as the input for the archive. 
    242283.It Fl H Ar format 
    243284Read an archive of the specified format. 
     
    279320.It Fl r 
    280321Rename restored files interactively. 
     322.It Fl S 
     323Swap words after reading data from the archive. 
    281324.It Fl s 
    282325Swap bytes after reading data from the archive. 
    283 .It Fl S 
    284 Swap words after reading data from the archive. 
    285326.It Fl t 
    286327Only list the contents of the archive, no files or 
     
    292333Be verbose about operations. 
    293334List filenames as they are copied in from the archive. 
     335.It Fl Z 
     336Uncompress archive using 
     337.Xr compress 1 
     338format. 
    294339.It Fl z 
    295340Uncompress archive using 
    296341.Xr gzip 1 
    297342format. 
    298 .It Fl Z 
    299 Uncompress archive using 
    300 .Xr compress 1 
    301 format. 
    302 .It Fl 6 
    303 Process old-style 
    304 .Nm 
    305 format archives. 
    306343.El 
    307344.It Fl p 
     
    317354Create any intermediate directories as needed to write 
    318355the files at the new location. 
     356.It Fl L 
     357Follow symbolic links. 
    319358.It Fl l 
    320359When possible, link files rather than creating an 
    321360extra copy. 
    322 .It Fl L 
    323 Follow symbolic links. 
    324361.It Fl m 
    325362Restore modification times on files. 
  • branches/freewrt_1_0/tools/paxmirabilis/src/extern.h

    r2715 r3816  
    1 /**     $MirOS: src/bin/pax/extern.h,v 1.9 2007/02/17 04:52:40 tg Exp $ */ 
    2 /*      $OpenBSD: extern.h,v 1.31 2005/04/28 06:58:07 otto Exp $      */ 
     1/**     $MirOS: src/bin/pax/extern.h,v 1.11 2008/10/29 17:34:48 tg Exp $ */ 
     2/*      $OpenBSD: extern.h,v 1.32 2006/11/17 08:38:04 otto Exp $      */ 
    33/*      $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $   */ 
    44 
     
    146146int file_creat(ARCHD *); 
    147147void file_close(ARCHD *, int); 
    148 int lnk_creat(ARCHD *); 
     148int lnk_creat(ARCHD *, int *); 
    149149int cross_lnk(ARCHD *); 
    150150int chk_same(ARCHD *); 
     
    250250extern char *tempfile; 
    251251extern char *tempbase; 
     252extern int havechd; 
    252253 
    253254int main(int, char **); 
  • branches/freewrt_1_0/tools/paxmirabilis/src/file_subs.c

    r2051 r3816  
    1 /**     $MirOS: src/bin/pax/file_subs.c,v 1.12 2007/02/17 04:52:40 tg Exp $ */ 
     1/**     $MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $ */ 
    22/*      $OpenBSD: file_subs.c,v 1.30 2005/11/09 19:59:06 otto Exp $     */ 
    33/*      $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $        */ 
    44 
    55/*- 
    6  * Copyright (c) 2007 Thorsten Glaser 
     6 * Copyright (c) 2007, 2008 
     7 *      Thorsten Glaser <tg@mirbsd.de> 
    78 * Copyright (c) 1992 Keith Muller. 
    89 * Copyright (c) 1992, 1993 
     
    5657 
    5758__SCCSID("@(#)file_subs.c       8.1 (Berkeley) 5/31/93"); 
    58 __RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.12 2007/02/17 04:52:40 tg Exp $"); 
     59__RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $"); 
    5960 
    6061#ifndef __GLIBC_PREREQ 
     
    185186 *      must exist; 
    186187 * Return: 
    187  *      0 if ok, -1 otherwise 
     188 *      fd+2 if data should be extracted, 
     189 *      0 if ok, 1 if we could not make the link, -1 otherwise 
    188190 */ 
    189191 
    190192int 
    191 lnk_creat(ARCHD *arcn
     193lnk_creat(ARCHD *arcn, int *fdp
    192194{ 
    193195        struct stat sb; 
     196        int rv; 
    194197 
    195198        /* 
     
    209212        } 
    210213 
    211         return(mk_link(arcn->ln_name, &sb, arcn->name, 0)); 
     214        rv = mk_link(arcn->ln_name, &sb, arcn->name, 0); 
     215        if (fdp != NULL && rv == 0 && sb.st_size == 0 && arcn->skip > 0) { 
     216                /* request to write out file data late (broken archive) */ 
     217                if (pmode) 
     218                        set_pmode(arcn->name, 0600); 
     219                if ((*fdp = open(arcn->name, O_WRONLY | O_TRUNC)) == -1) { 
     220                        rv = errno; 
     221                        syswarn(1, rv, "Unable to re-open %s", arcn->name); 
     222                        if (pmode) 
     223                                set_pmode(arcn->name, sb.st_mode); 
     224                } 
     225                rv = 0; 
     226        } else if (fdp != NULL) 
     227                *fdp = -1; 
     228        return (rv); 
    212229} 
    213230 
  • branches/freewrt_1_0/tools/paxmirabilis/src/ftree.c

    r2715 r3816  
    1 /*      $OpenBSD: ftree.c,v 1.26 2005/04/21 21:47:18 beck Exp $       */ 
     1/*      $OpenBSD: ftree.c,v 1.27 2006/12/26 20:58:25 otto Exp $       */ 
    22/*      $NetBSD: ftree.c,v 1.4 1995/03/21 09:07:21 cgd Exp $    */ 
    33 
     
    4949 
    5050__SCCSID("@(#)ftree.c   8.2 (Berkeley) 4/18/94"); 
    51 __RCSID("$MirOS: src/bin/pax/ftree.c,v 1.2 2007/02/17 04:52:40 tg Exp $"); 
     51__RCSID("$MirOS: src/bin/pax/ftree.c,v 1.3 2007/10/23 20:07:42 tg Exp $"); 
    5252 
    5353/* 
     
    350350        for (;;) { 
    351351                if ((ftent = fts_read(ftsp)) == NULL) { 
     352                        if (errno) 
     353                                syswarn(1, errno, "next_file"); 
    352354                        /* 
    353355                         * out of files in this tree, go to next arg, if none 
  • branches/freewrt_1_0/tools/paxmirabilis/src/gen_subs.c

    r2715 r3816  
    1 /**     $MirOS: src/bin/pax/gen_subs.c,v 1.7 2007/02/17 04:52:40 tg Exp $ */ 
    2 /*      $OpenBSD: gen_subs.c,v 1.18 2005/04/28 06:58:07 otto Exp $      */ 
     1/*      $OpenBSD: gen_subs.c,v 1.19 2007/04/04 21:55:10 millert Exp $   */ 
    32/*      $NetBSD: gen_subs.c,v 1.5 1995/03/21 09:07:26 cgd Exp $ */ 
    43 
     
    4039#include <sys/stat.h> 
    4140#include <stdio.h> 
    42 #include <tzfile.h> 
    4341#ifdef __INTERIX 
    4442#include <utmpx.h> 
     
    5654 
    5755__SCCSID("@(#)gen_subs.c        8.1 (Berkeley) 5/31/93"); 
    58 __RCSID("$MirOS: src/bin/pax/gen_subs.c,v 1.7 2007/02/17 04:52:40 tg Exp $"); 
     56__RCSID("$MirOS: src/bin/pax/gen_subs.c,v 1.9 2008/03/14 15:55:21 tg Exp $"); 
    5957 
    6058#ifdef __GLIBC__ 
     
    157155                safe_print(arcn->ln_name, fp); 
    158156        } else if (arcn->type == PAX_SLK) { 
    159                 fputs(" => ", fp); 
     157                fputs(" -> ", fp); 
    160158                safe_print(arcn->ln_name, fp); 
    161159        } 
  • branches/freewrt_1_0/tools/paxmirabilis/src/options.c

    r2715 r3816  
    1 /**     $MirOS: src/bin/pax/options.c,v 1.24 2007/02/17 04:52:41 tg Exp $ */ 
    2 /*      $OpenBSD: options.c,v 1.64 2006/04/09 03:35:34 jaredy Exp $     */ 
     1/*      $OpenBSD: options.c,v 1.67 2007/02/24 09:50:55 jmc Exp $        */ 
    32/*      $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $  */ 
    43 
     
    5857 
    5958__SCCSID("@(#)options.c 8.2 (Berkeley) 4/18/94"); 
    60 __RCSID("$MirOS: src/bin/pax/options.c,v 1.24 2007/02/17 04:52:41 tg Exp $"); 
     59__RCSID("$MirOS: src/bin/pax/options.c,v 1.27 2008/10/29 17:00:07 tg Exp $"); 
    6160 
    6261#ifdef __GLIBC__ 
     
    175174 
    176175/* 
     176 * Do we have -C anywhere? 
     177 */ 
     178int havechd = 0; 
     179 
     180/* 
    177181 * options() 
    178182 *      figure out if we are pax, tar or cpio. Call the appropriate options 
     
    183187options(int argc, char **argv) 
    184188{ 
     189        size_t n; 
    185190 
    186191        /* 
    187192         * Are we acting like pax, tar or cpio (based on argv[0]) 
    188193         */ 
    189         if ((argv0 = strrchr(argv[0], '/')) != NULL) 
    190                 argv0++; 
    191         else 
    192                 argv0 = argv[0]; 
    193  
    194         if (strcmp(NM_TAR, argv0) == 0) { 
     194        if ((n = strlen(argv[0])) >= 3 && !strcmp(argv[0] + n - 3, NM_TAR)) { 
     195                argv0 = NM_TAR; 
    195196                tar_options(argc, argv); 
    196                return; 
    197         } else if (strcmp(NM_CPIO, argv0) == 0) { 
     197        } else if (n >= 4 && !strcmp(argv[0] + n - 4, NM_CPIO)) { 
     198               argv0 = NM_CPIO; 
    198199                cpio_options(argc, argv); 
    199                 return; 
    200         } 
    201         /* 
    202          * assume pax as the default 
    203          */ 
    204         argv0 = NM_PAX; 
    205         pax_options(argc, argv); 
     200        } else { 
     201                argv0 = NM_PAX; 
     202                pax_options(argc, argv); 
     203        } 
    206204} 
    207205 
     
    383381                         * verbose operation mode 
    384382                         */ 
    385                         vflag = 1
     383                        vflag++
    386384                        flg |= VF; 
    387385                        break; 
     
    794792                        break; 
    795793                case 'C': 
     794                        havechd++; 
    796795                        chdname = optarg; 
    797796                        break; 
     
    941940                                                break; 
    942941                                        chdname = *argv++; 
     942                                        havechd++; 
    943943                                } else if (pat_add(*argv++, chdname) < 0) 
    944944                                        tar_usage(); 
     
    10381038                                if (ftree_add(*argv++, 1) < 0) 
    10391039                                        tar_usage(); 
     1040                                havechd++; 
    10401041                        } else if (ftree_add(*argv++, 0) < 0) 
    10411042                                tar_usage(); 
     
    12181219                                 * verbose operation mode 
    12191220                                 */ 
    1220                                 vflag = 1
     1221                                vflag++
    12211222                                break; 
    12221223                        case 'z': 
     
    16371638{ 
    16381639        (void)fputs( 
    1639             "usage: pax [-0cdOnRSvz] [-E limit] [-f archive] [-G group] [-s replstr]\n" 
    1640             "\t  [-T [from_date][,to_date][/[c][m]]] [-U user] [pattern ...]\n" 
    1641             "       pax -r [-0cDdikOnuvzYZz] [-E limit] [-f archive] [-G group]\n" 
    1642             "\t  [-o options] [-p string] [-s replstr] [-T [from_date][,to_date]]\n" 
     1640            "usage: pax [-0cdnOvz] [-E limit] [-f archive] [-G group] [-s replstr]\n" 
     1641            "\t  [-T range] [-U user] [pattern ...]\n" 
     1642            "       pax -r [-0cDdiknOuvYZz] [-E limit] [-f archive] [-G group]\n" 
     1643            "\t  [-o options] [-p string] [-s replstr] [-T range]\n" 
    16431644            "\t  [-U user] [pattern ...]\n" 
    16441645            "       pax -w [-0adHiLOPtuvXz] [-B bytes] [-b blocksize] [-f archive]\n" 
    1645             "\t  [-G group] [-M value] [-o options] [-s replstr]\n" 
    1646             "\t  [-T [from_date][,to_date][/[c][m]]] [-U user] [-x format] [file ...]\n" 
    1647             "       pax -r -w [-0DdHikLlnOPtuvXYZ] [-G group] [-p string] [-s replstr]\n" 
    1648             "\t  [-T [from_date][,to_date][/[c][m]]] [-U user] [file ...] directory\n", 
     1646            "\t  [-G group] [-M flag] [-o options] [-s replstr]\n" 
     1647            "\t  [-T range] [-U user] [-x format] [file ...]\n" 
     1648            "       pax -rw [-0DdHikLlnOPtuvXYZ] [-G group] [-p string] [-s replstr]\n" 
     1649            "\t  [-T range] [-U user] [file ...] directory\n", 
    16491650            stderr); 
    16501651        exit(1); 
     
    16601661{ 
    16611662        (void)fputs( 
    1662             "usage: tar {crtux}[014578befHhLmOoPpqsvwXZz]\n" 
     1663            "usage: tar {crtux}[014578befHhLmOoPpqRSsvwXZz]\n" 
    16631664            "\t  [blocking-factor | archive | replstr] [-C directory] [-I file]\n" 
    16641665            "\t  [file ...]\n" 
    1665             "       tar {-crtux} [-014578eHhLmOoPpqvwXZz] [-b blocking-factor] [-M value]\n" 
     1666            "       tar {-crtux} [-014578eHhLmOoPpqRSvwXZz] [-b blocking-factor] [-M flag]\n" 
    16661667            "\t  [-C directory] [-f archive] [-I file] [-s replstr] [file ...]\n", 
    16671668            stderr); 
     
    16771678cpio_usage(void) 
    16781679{ 
    1679         (void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr); 
    1680         (void)fputs("               [-M flag] [-F archive] <name-list [>archive]\n", stderr); 
    1681         (void)fputs("       cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr); 
    1682         (void)fputs("               [-I archive] [-F archive] [pattern...] [<archive]\n", stderr); 
    1683         (void)fputs("       cpio -p [-adlLmuvV] destination-directory <name-list\n", stderr); 
     1680        (void)fputs("usage: cpio -o [-AaBcLvZz] [-C bytes] [-F archive] [-H format]\n", stderr); 
     1681        (void)fputs("               [-M flag] [-O archive] <name-list [>archive]\n", stderr); 
     1682        (void)fputs("       cpio -i [-6BbcdfmrSstuvZz] [-C bytes] [-E file] [-F archive]\n", stderr); 
     1683        (void)fputs("               [-H format] [-I archive] [pattern...] [<archive]\n", stderr); 
     1684        (void)fputs("       cpio -p [-adLlmuv] destination-directory <name-list\n", stderr); 
    16841685        exit(1); 
    16851686} 
  • branches/freewrt_1_0/tools/paxmirabilis/src/pax.1

    r2715 r3816  
    1 .\"     $MirOS: src/bin/pax/pax.1,v 1.7 2006/07/21 17:34:59 tg Exp $ 
    2 .\"     $OpenBSD: pax.1,v 1.48 2006/05/12 11:55:58 jmc Exp $ 
     1.\"     $MirOS: src/bin/pax/pax.1,v 1.9 2008/03/14 17:05:06 tg Exp $ 
     2.\"     $OpenBSD: pax.1,v 1.52 2007/05/31 19:19:15 jmc Exp $ 
    33.\"     $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $ 
    44.\" 
     
    3737.\"     @(#)pax.1       8.4 (Berkeley) 4/18/94 
    3838.\" 
    39 .Dd July 21, 2006 
    40 .Dt PAX 1 
    41 .Os MirBSD 
    42 .\" for portability 
     39.\"- 
     40.\" Try to make GNU groff and AT&T nroff more compatible 
     41.\" * ` generates ‘ in groff, so use \` 
     42.\" * ' generates ’ in groff, \' generates ´, so use \*(aq 
     43.\" * - generates ‐ in groff, \- generates −, fixed in tmac/mdoc/doc-groff 
     44.\"   thus use - for hyphens and \- for minus signs and option dashes 
     45.\" * ~ is size-reduced and placed atop in groff, so use \*(TI 
     46.\" * ^ is size-reduced and placed atop in groff, so use \*(ha 
     47.\" * \(en does not work in nroff, so use \*(en 
     48.ie \n(.g \{\ 
     49.       ds aq \(aq 
     50.       ds TI \(ti 
     51.       ds ha \(ha 
     52.       ds en \(en 
     53.\} 
     54.el \{\ 
     55.       ds aq ' 
     56.       ds TI ~ 
     57.       ds ha ^ 
     58.       ds en \(em 
     59.\} 
     60.\" 
     61.\" Implement .Dd with the Mdocdate RCS keyword 
     62.rn Dd xD 
     63.de Dd 
     64.ie \\$1$Mdocdate: \{\ 
     65.       xD \\$2 \\$3, \\$4 
     66.\} 
     67.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 
     68.. 
     69.\" 
     70.\" .Dd must come before definition of .Mx, because when called 
     71.\" with -mandoc, it might implement .Mx itself, but we want to 
     72.\" use our own definition. And .Dd must come *first*, always. 
     73.Dd $Mdocdate: March 14 2008 $ 
     74.\" 
     75.\" Implement .Mx (MirBSD) 
    4376.de Mx 
    4477.nr cF \\n(.f 
     
    4679.ds aa \&\f\\n(cF\s\\n(cZ 
    4780.if \\n(aC==0 \{\ 
    48 .       if \\n(.$==0 \&MirOS\\*(aa 
     81.       ie \\n(.$==0 \&MirOS\\*(aa 
     82.       el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 
    4983.\} 
    50 .if \\n(.$==1 \{\ 
    51 .       if "\\$1"."  \&MirOS\\$1\\*(aa 
    52 .       if "\\$1","  \&MirOS\\$1\\*(aa 
     84.if \\n(aC>\\n(aP \{\ 
     85.       nr aP \\n(aP+1 
     86.       ie \\n(C\\n(aP==2 \{\ 
     87.               as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa 
     88.               ie \\n(aC>\\n(aP \{\ 
     89.                       nr aP \\n(aP+1 
     90.                       nR 
     91.               \} 
     92.               el .aZ 
     93.       \} 
     94.       el \{\ 
     95.               as b1 \&MirOS\\*(aa 
     96.               nR 
     97.       \} 
    5398.\} 
    5499.. 
     100.Dt PAX 1 
     101.Os MirBSD 
    55102.Sh NAME 
    56103.Nm pax 
     
    59106.Bk -words 
    60107.Nm pax 
    61 .Op Fl 0cdOnvz 
     108.Op Fl 0cdnOvz 
    62109.Op Fl E Ar limit 
    63110.Op Fl f Ar archive 
     
    69116.Nm pax 
    70117.Fl r 
    71 .Op Fl 0cDdikOnuvYZz 
     118.Op Fl 0cDdiknOuvYZz 
    72119.Op Fl E Ar limit 
    73120.Op Fl f Ar archive 
     
    86133.Op Fl f Ar archive 
    87134.Op Fl G Ar group 
    88 .Op Fl M Ar value 
     135.Op Fl M Ar flag 
    89136.Op Fl o Ar options 
    90137.Op Fl s Ar replstr 
     
    94141.Op Ar file ... 
    95142.Nm pax 
    96 .Fl r 
    97 .Fl w 
     143.Fl rw 
    98144.Op Fl 0DdHikLlnOPtuvXYZ 
    99145.Op Fl G Ar group 
     
    167213operand is also a directory, the entire file hierarchy rooted 
    168214at that directory will be included. 
    169 .It Fl r Fl
     215.It Fl r
    170216.Em Copy . 
    171217.Nm 
     
    474520hard links are made between the source and destination file hierarchies 
    475521whenever possible. 
    476 .It Fl M Ar value 
     522.It Fl M Ar flag 
    477523Configure the archive normaliser. 
    478 .Ar value 
     524.Ar flag 
    479525is either a number or a string, optionally prefixed with 
    480526.Dq no- 
    481 to turn the flag off. 
     527to turn it off. 
    482528See 
    483529.Xr cpio 1 
     
    705751standard error in the following format: 
    706752.Pp 
    707 .D1 Em original-pathname No >> Em new-pathname 
     753.D1 Em original-pathname No \*(Gt\*(Gt Em new-pathname 
    708754.Pp 
    709755File or archive member names that substitute to the empty string 
     
    907953currently supports the following formats: 
    908954.Bl -tag -width "sv4cpio" 
     955.It Cm bcpio 
     956The old binary cpio format. 
     957The default blocksize for this format is 5120 bytes. 
     958This format is not very portable and should not be used when other formats 
     959are available. 
     960Inode and device information about a file (used for detecting file hard links 
     961by this format), which may be truncated by this format, is detected by 
     962.Nm 
     963and is repaired. 
    909964.It Cm cpio 
    910965The extended cpio interchange format specified in the 
     
    912967standard. 
    913968The default blocksize for this format is 5120 bytes. 
    914 Inode and device information about a file (used for detecting file hard links 
    915 by this format), which may be truncated by this format, is detected by 
    916 .Nm 
    917 and is repaired. 
    918 .It Cm bcpio 
    919 The old binary cpio format. 
    920 The default blocksize for this format is 5120 bytes. 
    921 This format is not very portable and should not be used when other formats 
    922 are available. 
    923969Inode and device information about a file (used for detecting file hard links 
    924970by this format), which may be truncated by this format, is detected by 
     
    11041150.Ed 
    11051151.Pp 
    1106 Read the archive 
    1107 .Pa a.pax , 
    1108 with all files rooted in 
     1152Extract files from the archive 
     1153.Pa a.pax . 
     1154Files rooted in 
    11091155.Pa /usr 
    1110 into the archive extracted relative to the current directory: 
    1111 .Pp 
    1112 .Dl $ pax -r -s ',^//*usr//*,,' -f a.pax 
     1156are extracted relative to the current working directory; 
     1157all other files are extracted to their unmodified path. 
     1158.Pp 
     1159.Dl $ pax -r -s ',^/usr/,,' -f a.pax 
    11131160.Pp 
    11141161This can be used to interactively select the files to copy from the 
     
    11861233The 
    11871234.Nm 
    1188 utility is a superset of the 
    1189 .St -p1003.2 
    1190 standard. 
    1191 The options 
    1192 .Fl 0 , 
    1193 .Fl B , 
    1194 .Fl D , 
    1195 .Fl E , 
    1196 .Fl G , 
    1197 .Fl H , 
    1198 .Fl L , 
    1199 .Fl M , 
    1200 .Fl O , 
    1201 .Fl P , 
    1202 .Fl T , 
    1203 .Fl U , 
    1204 .Fl Y , 
    1205 .Fl Z , 
     1235utility is compliant with the 
     1236.St -p1003.1-2004 
     1237specification. 
     1238.Pp 
     1239The flags 
     1240.Op Fl 0BDEGHLMOPTUYZz , 
    12061241the archive formats 
    12071242.Em bcpio , 
     
    12131248and 
    12141249.Em read 
    1215 operations are extensions to the 
    1216 .Tn POSIX 
    1217 standard. 
     1250operations 
     1251are extensions to that specification. 
    12181252.Sh AUTHORS 
    12191253Keith Muller at the University of California, San Diego. 
  • branches/freewrt_1_0/tools/paxmirabilis/src/pax.h

    r2715 r3816  
    1 /**     $MirOS: src/bin/pax/pax.h,v 1.6 2007/01/23 11:55:54 tg Exp $ */ 
     1/**     $MirOS: src/bin/pax/pax.h,v 1.7 2008/03/14 15:55:21 tg Exp $ */ 
    22/*      $OpenBSD: pax.h,v 1.17 2005/11/09 19:59:06 otto Exp $   */ 
    33/*      $NetBSD: pax.h,v 1.3 1995/03/21 09:07:41 cgd Exp $      */ 
     
    252252#define _PAX_           1 
    253253#define _TFILE_BASE     "paxXXXXXXXXXX" 
     254 
     255/* copied from <tzfile.h> */ 
     256#define SECSPERMIN      60 
     257#define MINSPERHOUR     60 
     258#define HOURSPERDAY     24 
     259#define DAYSPERNYEAR    365 
     260#define SECSPERHOUR     (SECSPERMIN * MINSPERHOUR) 
     261#define SECSPERDAY      ((long) SECSPERHOUR * HOURSPERDAY) 
     262#define TM_YEAR_BASE    1900 
  • branches/freewrt_1_0/tools/paxmirabilis/src/sel_subs.c

    r2715 r3816  
    4444#include <stdlib.h> 
    4545#include <string.h> 
    46 #include <tzfile.h> 
    4746#include <unistd.h> 
    4847#include "pax.h" 
     
    5150 
    5251__SCCSID("@(#)sel_subs.c        8.1 (Berkeley) 5/31/93"); 
    53 __RCSID("$MirOS: src/bin/pax/sel_subs.c,v 1.2 2007/02/17 04:52:41 tg Exp $"); 
     52__RCSID("$MirOS: src/bin/pax/sel_subs.c,v 1.3 2008/03/14 15:55:21 tg Exp $"); 
    5453 
    5554static int str_sec(const char *, time_t *); 
  • branches/freewrt_1_0/tools/paxmirabilis/src/tables.c

    r2715 r3816  
    1 /**     $MirOS: src/bin/pax/tables.c,v 1.7 2007/02/17 04:52:41 tg Exp $ */ 
    2 /*      $OpenBSD: tables.c,v 1.23 2005/04/21 21:47:18 beck Exp $        */ 
     1/*      $OpenBSD: tables.c,v 1.25 2007/09/02 15:19:08 deraadt Exp $     */ 
    32/*      $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $   */ 
    43 
     
    5150 
    5251__SCCSID("@(#)tables.c  8.1 (Berkeley) 5/31/93"); 
    53 __RCSID("$MirOS: src/bin/pax/tables.c,v 1.7 2007/02/17 04:52:41 tg Exp $"); 
     52__RCSID("$MirOS: src/bin/pax/tables.c,v 1.8 2007/10/23 20:07:42 tg Exp $"); 
    5453 
    5554/* 
     
    149148        if ((pt = ltab[indx]) != NULL) { 
    150149                /* 
    151                  * it's hash chain in not empty, walk down looking for it 
     150                 * its hash chain in not empty, walk down looking for it 
    152151                 */ 
    153152                ppt = &(ltab[indx]); 
    &he