Changeset 3793

Show
Ignore:
Timestamp:
09/06/08 18:06:24 (3 months ago)
Author:
tg
Message:

new version of MirCPIO and helpers; still no diff to upstream
untested, for now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/tools/paxmirabilis/src/Makefile

    r2029 r3793  
    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 
  • trunk/freewrt/tools/paxmirabilis/src/ar_subs.c

    r2029 r3793  
    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 
     
    5150 
    5251__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 $"); 
     52__RCSID("$MirOS: src/bin/pax/ar_subs.c,v 1.6 2007/10/23 20:07:41 tg Exp $"); 
    5453 
    5554static void wr_archive(ARCHD *, int is_app); 
     
    326325                                vfpart = 0; 
    327326                        } 
    328                         continue
     327                        goto popd
    329328                } 
    330329                /* 
     
    337336                        (void)rd_skip(arcn->skip + arcn->pad); 
    338337                        purg_lnk(arcn); 
    339                         continue
     338                        goto popd
    340339                } 
    341340                /* 
     
    353352                        (void)rd_skip(cnt + arcn->pad); 
    354353 
     354popd: 
    355355                /* 
    356356                 * if required, chdir around. 
     
    410410                if (is_app) 
    411411                        goto trailer; 
    412                 else 
    413                         return; 
    414         } 
    415         if (((*frmt->st_wr)() < 0)) 
    416                 return; 
     412                return; 
     413        } else if (((*frmt->st_wr)() < 0)) 
     414                return; 
     415 
    417416        wrf = frmt->wr; 
    418417 
  • trunk/freewrt/tools/paxmirabilis/src/cpio.1

    r2029 r3793  
    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. 
  • trunk/freewrt/tools/paxmirabilis/src/extern.h

    r2029 r3793  
    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.10 2007/10/23 20:07:42 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 
     
    250250extern char *tempfile; 
    251251extern char *tempbase; 
     252extern int havechd; 
    252253 
    253254int main(int, char **); 
  • trunk/freewrt/tools/paxmirabilis/src/ftree.c

    r2029 r3793  
    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 
  • trunk/freewrt/tools/paxmirabilis/src/gen_subs.c

    r2029 r3793  
    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        } 
  • trunk/freewrt/tools/paxmirabilis/src/options.c

    r2029 r3793  
    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.26 2008/08/07 19:40:39 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 
     
    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(); 
     
    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} 
  • trunk/freewrt/tools/paxmirabilis/src/pax.1

    r2029 r3793  
    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. 
  • trunk/freewrt/tools/paxmirabilis/src/pax.h

    r2029 r3793  
    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 
  • trunk/freewrt/tools/paxmirabilis/src/sel_subs.c

    r2029 r3793  
    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 *); 
  • trunk/freewrt/tools/paxmirabilis/src/tables.c

    r2029 r3793  
    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]); 
     
    11001099 
    11011100        dirsize = DIRP_SIZE; 
    1102         if ((dirp = malloc(dirsize * sizeof(DIRDATA))) == NULL) { 
     1101        if ((dirp = calloc(dirsize, sizeof(DIRDATA))) == NULL) { 
    11031102                paxwarn(1, "Unable to allocate memory for directory times"); 
    11041103                return(-1); 
     
    11241123{ 
    11251124        DIRDATA *dblk; 
     1125        char realname[MAXPATHLEN], *rp; 
    11261126 
    11271127        if (dirp == NULL) 
    11281128                return; 
    11291129 
     1130        if (havechd && *name != '/') { 
     1131                if ((rp = realpath(name, realname)) == NULL) { 
     1132                        paxwarn(1, "Cannot canonicalize %s", name); 
     1133                        return; 
     1134                } 
     1135                name = rp; 
     1136        } 
    11301137        if (dircnt == (long)dirsize) { 
    11311138                dblk = realloc(dirp, 2 * dirsize * sizeof(DIRDATA)); 
  • trunk/freewrt/tools/paxmirabilis/src/tables.h

    r204 r3793  
    1 /**     $MirOS: src/bin/pax/tables.h,v 1.2 2005/11/16 13:58:39 tg Exp $ */ 
    2 /*      $OpenBSD: tables.h,v 1.7 2004/11/29 16:23:22 otto Exp $       */ 
     1/**     $MirOS: src/bin/pax/tables.h,v 1.3 2007/10/23 20:07:42 tg Exp $ */ 
     2/*      $OpenBSD: tables.h,v 1.8 2006/08/05 23:05:13 ray Exp $        */ 
    33/*      $NetBSD: tables.h,v 1.3 1995/03/21 09:07:47 cgd Exp $   */ 
    44 
     
    138138 
    139139/* 
    140  * ftree directory access time reset table. When we are done with with
     140 * ftree directory access time reset table. When we are done with
    141141 * subtree we reset the access and mod time of the directory when the tflag is 
    142142 * set. Not really explicitly specified in the pax spec, but easy and fast to 
  • trunk/freewrt/tools/paxmirabilis/src/tar.1

    r2029 r3793  
    1 .\"     $MirOS: src/bin/pax/tar.1,v 1.8 2006/07/21 17:34:59 tg Exp $ 
    2 .\"     $OpenBSD: tar.1,v 1.47 2005/05/24 16:33:45 jaredy Exp $ 
     1.\"     $MirOS: src/bin/pax/tar.1,v 1.10 2008/03/14 17:05:06 tg Exp $ 
     2.\"     $OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $ 
    33.\" 
    44.\" Copyright (c) 1996 SigmaSoft, Th. Lockert 
     
    2525.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    2626.\" 
    27 .\"     $OpenBSD: tar.1,v 1.47 2005/05/24 16:33:45 jaredy Exp $ 
    28 .\" 
    29 .Dd July 21, 2006 
    30 .Dt TAR 1 
    31 .Os MirBSD 
    32 .\" for portability 
     27.\"     $OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $ 
     28.\" 
     29.\"- 
     30.\" Try to make GNU groff and AT&T nroff more compatible 
     31.\" * ` generates ‘ in groff, so use \` 
     32.\" * ' generates ’ in groff, \' generates ´, so use \*(aq 
     33.\" * - generates ‐ in groff, \- generates −, fixed in tmac/mdoc/doc-groff 
     34.\"   thus use - for hyphens and \- for minus signs and option dashes 
     35.\" * ~ is size-reduced and placed atop in groff, so use \*(TI 
     36.\" * ^ is size-reduced and placed atop in groff, so use \*(ha 
     37.\" * \(en does not work in nroff, so use \*(en 
     38.ie \n(.g \{\ 
     39.       ds aq \(aq 
     40.       ds TI \(ti 
     41.       ds ha \(ha 
     42.       ds en \(en 
     43.\} 
     44.el \{\ 
     45.       ds aq ' 
     46.       ds TI ~ 
     47.       ds ha ^ 
     48.       ds en \(em 
     49.\} 
     50.\" 
     51.\" Implement .Dd with the Mdocdate RCS keyword 
     52.rn Dd xD 
     53.de Dd 
     54.ie \\$1$Mdocdate: \{\ 
     55.       xD \\$2 \\$3, \\$4 
     56.\} 
     57.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 
     58.. 
     59.\" 
     60.\" .Dd must come before definition of .Mx, because when called 
     61.\" with -mandoc, it might implement .Mx itself, but we want to 
     62.\" use our own definition. And .Dd must come *first*, always. 
     63.Dd $Mdocdate: March 14 2008 $ 
     64.\" 
     65.\" Implement .Mx (MirBSD) 
    3366.de Mx 
    3467.nr cF \\n(.f 
     
    3669.ds aa \&\f\\n(cF\s\\n(cZ 
    3770.if \\n(aC==0 \{\ 
    38 .       if \\n(.$==0 \&MirBSD\\*(aa 
     71.       ie \\n(.$==0 \&MirOS\\*(aa 
     72.       el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 
    3973.\} 
    40 .if \\n(.$==1 \{\ 
    41 .       if "\\$1"."  \&MirBSD\\$1\\*(aa 
    42 .       if "\\$1","  \&MirBSD\\$1\\*(aa 
     74.if \\n(aC>\\n(aP \{\ 
     75.       nr aP \\n(aP+1 
     76.       ie \\n(C\\n(aP==2 \{\ 
     77.               as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa 
     78.               ie \\n(aC>\\n(aP \{\ 
     79.                       nr aP \\n(aP+1 
     80.                       nR 
     81.               \} 
     82.               el .aZ 
     83.       \} 
     84.       el \{\ 
     85.               as b1 \&MirOS\\*(aa 
     86.               nR 
     87.       \} 
    4388.\} 
    4489.. 
     90.Dt TAR 1 
     91.Os MirBSD 
    4592.Sh NAME 
    4693.Nm tar 
     
    60107.Nm tar 
    61108.No { Ns Fl crtux Ns } 
    62 .Op Fl 014578eHhLmOoPpqvwXZz 
     109.Op Fl 014578eHhLmOoPpqRSvwXZz 
    63110.Op Fl b Ar blocking-factor 
    64111.Op Fl C Ar directory 
    65112.Op Fl f Ar archive 
    66113.Op Fl I Ar file 
    67 .Op Fl M Ar value 
     114.Op Fl M Ar flag 
    68115.Op Fl s Ar replstr 
    69116.Op Ar file ... 
     
    178225.Fl h 
    179226option. 
    180 .It Fl M Ar value 
     227.It Fl M Ar flag 
    181228Configure the archive normaliser. 
    182 .Ar value 
     229.Ar flag 
    183230is either a number or a string, optionally prefixed with 
    184231.Dq no- 
    185 to turn the flag off. 
     232to turn it off. 
    186233See 
    187234.Xr cpio 1 
  • trunk/freewrt/tools/paxmirabilis/strlfun.c

    r2027 r3793  
    1 /* $MirOS: src/lib/libc/string/strlfun.c,v 1.14 2007/01/07 02:11:40 tg Exp $ */ 
    2  
    31/*- 
    4  * Copyright (c) 2006 
    5  *      Thorsten Glaser <tg@mirbsd.de
     2 * Copyright (c) 2006, 2008 
     3 *      Thorsten Glaser <tg@mirbsd.org
    64 * 
    75 * Provided that these terms and disclaimer and all copyright notices 
     
    2018 * of said person's immediate fault when using the work as intended. 
    2119 *- 
    22  * The strlcat() code below has been written by Thorsten Glaser. Bodo 
    23  * Eggert suggested optimising the strlcpy() code, originally written 
    24  * by Todd C. Miller (see below), which was carried out by Th. Glaser 
    25  * as well as merging this code with strxfrm() for ISO-10646-only sy- 
    26  * stems and writing wcslcat(), wcslcpy() and wcsxfrm() equivalents. 
     20 * The original implementations of strlcpy(3) and strlcat(3) are from 
     21 * Todd C. Miller; the licence is reproduced below. However, this ap- 
     22 * plies only to the strlcpy(3) portion of the code, as Thorsten Gla- 
     23 * ser write the following strlcat(3) implementation according to the 
     24 * spec. Both functions below have been optimised according to sugge- 
     25 * stions from Bodo Eggert. Thorsten Glaser also has merged this code 
     26 * with strxfrm(3) for ISO-10646-only systems and wrote the wide char 
     27 * variants wcslcat(3), wcslcpy(3), and wcsxfrm(3) (see wcslfun.c). 
    2728 */ 
    2829 
     
    4142#undef HAVE_STRLCAT 
    4243#else 
     44#include <stddef.h>     /* for size_t in user space (SUSv3) */ 
    4345#if defined(HAVE_CONFIG_H) && (HAVE_CONFIG_H != 0)