Changeset dbbcad4 in freewrt
- Timestamp:
- Jul 16, 2006, 6:17:53 PM (19 years ago)
- Branches:
- freewrt_1_0, freewrt_2_0
- Children:
- 006f3d5
- Parents:
- 53c89c6
- Location:
- tools/paxmirabilis/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/paxmirabilis/src/ar_subs.c
r53c89c6 rdbbcad4 1 /** $MirOS: src/bin/pax/ar_subs.c,v 1.4 2006/07/16 16:14:50 tg Exp $ */ 1 2 /* $OpenBSD: ar_subs.c,v 1.29 2006/01/25 17:42:08 markus Exp $ */ 2 3 /* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ … … 35 36 */ 36 37 37 #ifndef lint 38 #if 0 39 static const char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; 40 #else 41 static const char rcsid[] = "$OpenBSD: ar_subs.c,v 1.29 2006/01/25 17:42:08 markus Exp $"; 42 #endif 43 #endif /* not lint */ 44 45 #include <sys/types.h> 38 #include <sys/param.h> 46 39 #include <sys/time.h> 47 40 #include <sys/stat.h> 48 #include <sys/param.h>49 41 #include <signal.h> 50 42 #include <string.h> … … 56 48 #include "pax.h" 57 49 #include "extern.h" 50 #include "options.h" 51 52 __SCCSID("@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"); 53 __RCSID("$MirOS: src/bin/pax/ar_subs.c,v 1.4 2006/07/16 16:14:50 tg Exp $"); 58 54 59 55 static void wr_archive(ARCHD *, int is_app); … … 302 298 */ 303 299 if ((arcn->pat != NULL) && (arcn->pat->chdname != NULL)) 304 if ( chdir(arcn->pat->chdname) != 0)300 if (!to_stdout && chdir(arcn->pat->chdname) != 0) 305 301 syswarn(1, errno, "Cannot chdir to %s", 306 302 arcn->pat->chdname); … … 315 311 * header (as determined by the format). 316 312 */ 317 if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) 318 res = lnk_creat(arcn); 319 else 320 res = node_creat(arcn); 313 if (!to_stdout) { 314 if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) 315 res = lnk_creat(arcn); 316 else 317 res = node_creat(arcn); 318 } 321 319 322 320 (void)rd_skip(arcn->skip + arcn->pad); … … 334 332 * over the data and purge the name from hard link table 335 333 */ 336 if ((fd = file_creat(arcn)) < 0) { 334 if (to_stdout) 335 fd = STDOUT_FILENO; 336 else if ((fd = file_creat(arcn)) < 0) { 337 337 (void)rd_skip(arcn->skip + arcn->pad); 338 338 purg_lnk(arcn); … … 344 344 */ 345 345 res = (*frmt->rd_data)(arcn, fd, &cnt); 346 file_close(arcn, fd); 346 if (fd != STDOUT_FILENO) 347 file_close(arcn, fd); 347 348 if (vflag && vfpart) { 348 349 (void)putc('\n', listf); … … 356 357 */ 357 358 if ((arcn->pat != NULL) && (arcn->pat->chdname != NULL)) 358 if ( fchdir(cwdfd) != 0)359 if (!to_stdout && fchdir(cwdfd) != 0) 359 360 syswarn(1, errno, 360 361 "Can't fchdir to starting directory"); … … 398 399 399 400 /* 400 * if this is not append, and there are no files, we do not write a 401 * if this is not append, and there are no files, we do not write a 401 402 * trailer 402 403 */ -
tools/paxmirabilis/src/options.c
r53c89c6 rdbbcad4 1 /** $MirOS: src/bin/pax/options.c,v 1.1 6 2006/06/23 23:03:56tg Exp $ */1 /** $MirOS: src/bin/pax/options.c,v 1.18 2006/07/16 16:14:50 tg Exp $ */ 2 2 /* $OpenBSD: options.c,v 1.64 2006/04/09 03:35:34 jaredy Exp $ */ 3 3 /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ … … 58 58 59 59 __SCCSID("@(#)options.c 8.2 (Berkeley) 4/18/94"); 60 __RCSID("$MirOS: src/bin/pax/options.c,v 1.1 6 2006/06/23 23:03:56tg Exp $");60 __RCSID("$MirOS: src/bin/pax/options.c,v 1.18 2006/07/16 16:14:50 tg Exp $"); 61 61 62 62 /* … … 79 79 static void cpio_options(int, char **); 80 80 static void cpio_usage(void); 81 int mkpath(char *); 81 82 82 83 static void process_M(const char *, void (*)(void)); … … 161 162 int ford[] = {6, 5, 4, 3, 1, 0, -1 }; 162 163 163 /* Normalise archives?*/164 /* normalise archives */ 164 165 int anonarch = 0; 166 167 /* extract to standard output */ 168 int to_stdout = 0; 165 169 166 170 /* … … 690 694 case 'O': 691 695 Oflag = 1; 696 to_stdout = 2; 692 697 break; 693 698 case 'o': … … 858 863 */ 859 864 switch (act) { 865 case EXTRACT: 866 if (to_stdout == 2) 867 to_stdout = 1; 860 868 case LIST: 861 case EXTRACT:862 869 default: 863 870 { 864 871 int sawpat = 0; 865 char *file, *dir ;872 char *file, *dir = NULL; 866 873 867 874 while (nincfiles || *argv != NULL) { … … 955 962 956 963 while (nincfiles || *argv != NULL) { 957 char *file, *dir ;964 char *file, *dir = NULL; 958 965 959 966 /* … … 1016 1023 break; 1017 1024 } 1025 if (to_stdout != 1) 1026 to_stdout = 0; 1018 1027 if (!fstdin && ((arcname == NULL) || (*arcname == '\0'))) { 1019 1028 arcname = getenv("TAPE"); … … 1024 1033 } 1025 1034 } 1026 1027 int mkpath(char *);1028 1035 1029 1036 int … … 1652 1659 process_M(const char *arg, void (*call_usage)(void)) 1653 1660 { 1654 int j, k ;1661 int j, k = 0; 1655 1662 1656 1663 if ((arg[0] >= '0') && (arg[0] <= '9')) { -
tools/paxmirabilis/src/options.h
r53c89c6 rdbbcad4 1 /** $MirOS: src/bin/pax/options.h,v 1. 2 2006/06/19 19:22:08tg Exp $ */1 /** $MirOS: src/bin/pax/options.h,v 1.3 2006/07/16 16:14:50 tg Exp $ */ 2 2 /* $OpenBSD: options.h,v 1.4 2003/06/13 17:51:14 millert Exp $ */ 3 3 /* $NetBSD: options.h,v 1.3 1995/03/21 09:07:32 cgd Exp $ */ … … 127 127 extern int anonarch; 128 128 void anonarch_init(void); 129 130 extern int to_stdout; -
tools/paxmirabilis/src/tar.1
r53c89c6 rdbbcad4 1 .\" $MirOS: src/bin/pax/tar.1,v 1. 6 2006/06/19 20:31:05tg Exp $1 .\" $MirOS: src/bin/pax/tar.1,v 1.7 2006/07/16 16:14:50 tg Exp $ 2 2 .\" $OpenBSD: tar.1,v 1.47 2005/05/24 16:33:45 jaredy Exp $ 3 3 .\" … … 196 196 Do not preserve modification time. 197 197 .It Fl O 198 Write old-style (non-POSIX) archives. 198 If reading, extract files to standard output. 199 .br 200 If writing, write old-style (non-POSIX) archives. 199 201 .It Fl o 200 202 Don't write directory information that the older (V7) style
Note:
See TracChangeset
for help on using the changeset viewer.
