| 2 |
/* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ |
/* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ |
| 3 |
|
|
| 4 |
/*- |
/*- |
| 5 |
|
* Copyright (c) 2008 |
| 6 |
|
* Thorsten Glaser <tg@mirbsd.de> |
| 7 |
* Copyright (c) 1992 Keith Muller. |
* Copyright (c) 1992 Keith Muller. |
| 8 |
* Copyright (c) 1992, 1993 |
* Copyright (c) 1992, 1993 |
| 9 |
* The Regents of the University of California. All rights reserved. |
* The Regents of the University of California. All rights reserved. |
| 51 |
#include "options.h" |
#include "options.h" |
| 52 |
|
|
| 53 |
__SCCSID("@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"); |
__SCCSID("@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"); |
| 54 |
__RCSID("$MirOS: src/bin/pax/ar_subs.c,v 1.6 2007/10/23 20:07:41 tg Exp $"); |
__RCSID("$MirOS: src/bin/pax/ar_subs.c,v 1.7 2008/10/29 17:34:48 tg Exp $"); |
| 55 |
|
|
| 56 |
static void wr_archive(ARCHD *, int is_app); |
static void wr_archive(ARCHD *, int is_app); |
| 57 |
static int get_arc(void); |
static int get_arc(void); |
| 312 |
* header (as determined by the format). |
* header (as determined by the format). |
| 313 |
*/ |
*/ |
| 314 |
if (!to_stdout) { |
if (!to_stdout) { |
| 315 |
if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) |
if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) { |
| 316 |
res = lnk_creat(arcn); |
res = lnk_creat(arcn, &fd); |
| 317 |
else |
if (fd != -1) |
| 318 |
|
goto extdata; |
| 319 |
|
} else |
| 320 |
res = node_creat(arcn); |
res = node_creat(arcn); |
| 321 |
} |
} |
| 322 |
|
|
| 345 |
* extract the file from the archive and skip over padding and |
* extract the file from the archive and skip over padding and |
| 346 |
* any unprocessed data |
* any unprocessed data |
| 347 |
*/ |
*/ |
| 348 |
|
extdata: |
| 349 |
res = (*frmt->rd_data)(arcn, fd, &cnt); |
res = (*frmt->rd_data)(arcn, fd, &cnt); |
| 350 |
if (fd != STDOUT_FILENO) |
if (fd != STDOUT_FILENO) |
| 351 |
file_close(arcn, fd); |
file_close(arcn, fd); |
| 356 |
if (!res) |
if (!res) |
| 357 |
(void)rd_skip(cnt + arcn->pad); |
(void)rd_skip(cnt + arcn->pad); |
| 358 |
|
|
| 359 |
popd: |
popd: |
| 360 |
/* |
/* |
| 361 |
* if required, chdir around. |
* if required, chdir around. |
| 362 |
*/ |
*/ |
| 932 |
* create a link or special file |
* create a link or special file |
| 933 |
*/ |
*/ |
| 934 |
if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) |
if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) |
| 935 |
res = lnk_creat(arcn); |
res = lnk_creat(arcn, NULL); |
| 936 |
else |
else |
| 937 |
res = node_creat(arcn); |
res = node_creat(arcn); |
| 938 |
if (res < 0) |
if (res < 0) |