aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-01-30 13:00:58 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2014-01-30 13:00:58 +0200
commit9e2d258c81af9f8cedba2e4b8874fbaea59b43c4 (patch)
treed470f085625c6434d4661b185c981f8065c14d3c /src
parenta3987da2a573bd2438f15df6faa680922025be18 (diff)
downloadcpio-9e2d258c81af9f8cedba2e4b8874fbaea59b43c4.tar.gz
cpio-9e2d258c81af9f8cedba2e4b8874fbaea59b43c4.tar.bz2
Use exit codes consistenly.
Diffstat (limited to 'src')
-rw-r--r--src/copyin.c10
-rw-r--r--src/copyout.c6
-rw-r--r--src/main.c150
-rw-r--r--src/util.c24
4 files changed, 102 insertions, 88 deletions
diff --git a/src/copyin.c b/src/copyin.c
index 3282816..78ffdd7 100644
--- a/src/copyin.c
+++ b/src/copyin.c
@@ -956,7 +956,7 @@ read_in_header (struct cpio_file_stat *file_hdr, int in_des)
956 { 956 {
957 peeked_bytes = tape_buffered_peek (tmpbuf, in_des, 512); 957 peeked_bytes = tape_buffered_peek (tmpbuf, in_des, 512);
958 if (peeked_bytes < 6) 958 if (peeked_bytes < 6)
959 error (1, 0, _("premature end of archive")); 959 error (PAXEXIT_FAILURE, 0, _("premature end of archive"));
960 960
961 if (!strncmp (tmpbuf, "070701", 6)) 961 if (!strncmp (tmpbuf, "070701", 6))
962 archive_format = arf_newascii; 962 archive_format = arf_newascii;
@@ -1289,7 +1289,7 @@ process_copy_in ()
1289 rename_in = fopen (rename_batch_file, "r"); 1289 rename_in = fopen (rename_batch_file, "r");
1290 if (rename_in == NULL) 1290 if (rename_in == NULL)
1291 { 1291 {
1292 error (2, errno, TTY_NAME); 1292 error (PAXEXIT_FAILURE, errno, TTY_NAME);
1293 } 1293 }
1294 } 1294 }
1295 else if (rename_flag) 1295 else if (rename_flag)
@@ -1298,12 +1298,12 @@ process_copy_in ()
1298 tty_in = fopen (TTY_NAME, "r"); 1298 tty_in = fopen (TTY_NAME, "r");
1299 if (tty_in == NULL) 1299 if (tty_in == NULL)
1300 { 1300 {
1301 error (2, errno, TTY_NAME); 1301 error (PAXEXIT_FAILURE, errno, TTY_NAME);
1302 } 1302 }
1303 tty_out = fopen (TTY_NAME, "w"); 1303 tty_out = fopen (TTY_NAME, "w");
1304 if (tty_out == NULL) 1304 if (tty_out == NULL)
1305 { 1305 {
1306 error (2, errno, TTY_NAME); 1306 error (PAXEXIT_FAILURE, errno, TTY_NAME);
1307 } 1307 }
1308 } 1308 }
1309 1309
@@ -1323,7 +1323,7 @@ process_copy_in ()
1323 else 1323 else
1324 { 1324 {
1325 if (fstat (in_file_des, &file_stat)) 1325 if (fstat (in_file_des, &file_stat))
1326 error (1, errno, _("standard input is closed")); 1326 error (PAXEXIT_FAILURE, errno, _("standard input is closed"));
1327 input_is_special = 1327 input_is_special =
1328#ifdef S_ISBLK 1328#ifdef S_ISBLK
1329 S_ISBLK (file_stat.st_mode) || 1329 S_ISBLK (file_stat.st_mode) ||
diff --git a/src/copyout.c b/src/copyout.c
index a5a8931..63785ff 100644
--- a/src/copyout.c
+++ b/src/copyout.c
@@ -48,7 +48,7 @@ read_for_checksum (int in_file_des, int file_size, char *file_name)
48 { 48 {
49 bytes_read = read (in_file_des, buf, BUFSIZ); 49 bytes_read = read (in_file_des, buf, BUFSIZ);
50 if (bytes_read < 0) 50 if (bytes_read < 0)
51 error (1, errno, _("cannot read checksum for %s"), file_name); 51 error (PAXEXIT_FAILURE, errno, _("cannot read checksum for %s"), file_name);
52 if (bytes_read == 0) 52 if (bytes_read == 0)
53 break; 53 break;
54 if (bytes_left < bytes_read) 54 if (bytes_left < bytes_read)
@@ -57,7 +57,7 @@ read_for_checksum (int in_file_des, int file_size, char *file_name)
57 crc += buf[i] & 0xff; 57 crc += buf[i] & 0xff;
58 } 58 }
59 if (lseek (in_file_des, 0L, SEEK_SET)) 59 if (lseek (in_file_des, 0L, SEEK_SET))
60 error (1, errno, _("cannot read checksum for %s"), file_name); 60 error (PAXEXIT_FAILURE, errno, _("cannot read checksum for %s"), file_name);
61 61
62 return crc; 62 return crc;
63} 63}
@@ -606,7 +606,7 @@ process_copy_out ()
606 else 606 else
607 { 607 {
608 if (fstat (out_file_des, &file_stat)) 608 if (fstat (out_file_des, &file_stat))
609 error (1, errno, _("standard output is closed")); 609 error (PAXEXIT_FAILURE, errno, _("standard output is closed"));
610 output_is_special = 610 output_is_special =
611#ifdef S_ISBLK 611#ifdef S_ISBLK
612 S_ISBLK (file_stat.st_mode) || 612 S_ISBLK (file_stat.st_mode) ||
diff --git a/src/main.c b/src/main.c
index d352e25..25320b5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -36,6 +36,7 @@
36#endif 36#endif
37 37
38#include <progname.h> 38#include <progname.h>
39#include <closeout.h>
39 40
40#include "filetypes.h" 41#include "filetypes.h"
41#include "cpiohdr.h" 42#include "cpiohdr.h"
@@ -80,11 +81,13 @@ Examples:\n\
80 # Copy files named in name-list to destination-directory\n\ 81 # Copy files named in name-list to destination-directory\n\
81 cpio -p destination-directory < name-list\n"); 82 cpio -p destination-directory < name-list\n");
82 83
84static void usage (int status);
85
83/* Print usage error message and exit with error. */ 86/* Print usage error message and exit with error. */
84 87
85#define CHECK_USAGE(cond, opt, mode_opt) \ 88#define CHECK_USAGE(cond, opt, mode_opt) \
86 if (cond) \ 89 if (cond) \
87 ERROR((PAXEXIT_FAILURE, 0, _("%s is meaningless with %s"), opt, mode_opt)); 90 USAGE_ERROR ((0, 0, _("%s is meaningless with %s"), opt, mode_opt));
88 91
89static struct argp_option options[] = { 92static struct argp_option options[] = {
90 /* ********** */ 93 /* ********** */
@@ -309,13 +312,13 @@ parse_opt (int key, char *arg, struct argp_state *state)
309 case BLOCK_SIZE_OPTION: /* --block-size */ 312 case BLOCK_SIZE_OPTION: /* --block-size */
310 io_block_size = atoi (arg); 313 io_block_size = atoi (arg);
311 if (io_block_size < 1) 314 if (io_block_size < 1)
312 error (2, 0, _("invalid block size")); 315 USAGE_ERROR ((0, 0, _("invalid block size")));
313 io_block_size *= 512; 316 io_block_size *= 512;
314 break; 317 break;
315 318
316 case 'c': /* Use the old portable ASCII format. */ 319 case 'c': /* Use the old portable ASCII format. */
317 if (archive_format != arf_unknown) 320 if (archive_format != arf_unknown)
318 error (0, EXIT_FAILURE, _("Archive format multiply defined")); 321 USAGE_ERROR ((0, 0, _("Archive format multiply defined")));
319#ifdef SVR4_COMPAT 322#ifdef SVR4_COMPAT
320 archive_format = arf_newascii; /* -H newc. */ 323 archive_format = arf_newascii; /* -H newc. */
321#else 324#else
@@ -326,7 +329,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
326 case 'C': /* Block size. */ 329 case 'C': /* Block size. */
327 io_block_size = atoi (arg); 330 io_block_size = atoi (arg);
328 if (io_block_size < 1) 331 if (io_block_size < 1)
329 error (2, 0, _("invalid block size")); 332 USAGE_ERROR ((0, 0, _("invalid block size")));
330 break; 333 break;
331 334
332 case 'd': /* Create directories where needed. */ 335 case 'd': /* Create directories where needed. */
@@ -351,7 +354,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
351 354
352 case 'H': /* Header format name. */ 355 case 'H': /* Header format name. */
353 if (archive_format != arf_unknown) 356 if (archive_format != arf_unknown)
354 error (PAXEXIT_FAILURE, 0, _("Archive format multiply defined")); 357 USAGE_ERROR ((0, 0, _("Archive format multiply defined")));
355 if (!strcasecmp (arg, "crc")) 358 if (!strcasecmp (arg, "crc"))
356 archive_format = arf_crcascii; 359 archive_format = arf_crcascii;
357 else if (!strcasecmp (arg, "newc")) 360 else if (!strcasecmp (arg, "newc"))
@@ -369,14 +372,14 @@ parse_opt (int key, char *arg, struct argp_state *state)
369 else if (!strcasecmp (arg, "hpbin")) 372 else if (!strcasecmp (arg, "hpbin"))
370 archive_format = arf_hpbinary; 373 archive_format = arf_hpbinary;
371 else 374 else
372 error (2, 0, _("\ 375 USAGE_ERROR ((0, 0, _("\
373invalid archive format `%s'; valid formats are:\n\ 376invalid archive format `%s'; valid formats are:\n\
374crc newc odc bin ustar tar (all-caps also recognized)"), arg); 377crc newc odc bin ustar tar (all-caps also recognized)"), arg));
375 break; 378 break;
376 379
377 case 'i': /* Copy-in mode. */ 380 case 'i': /* Copy-in mode. */
378 if (copy_function != 0) 381 if (copy_function != 0)
379 error (PAXEXIT_FAILURE, 0, _("Mode already defined")); 382 USAGE_ERROR ((0, 0, _("Mode already defined")));
380 copy_function = process_copy_in; 383 copy_function = process_copy_in;
381 break; 384 break;
382 385
@@ -414,14 +417,14 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg);
414 417
415 case NO_PRESERVE_OWNER_OPTION: /* --no-preserve-owner */ 418 case NO_PRESERVE_OWNER_OPTION: /* --no-preserve-owner */
416 if (set_owner_flag || set_group_flag) 419 if (set_owner_flag || set_group_flag)
417 error (PAXEXIT_FAILURE, 0, 420 USAGE_ERROR ((0, 0,
418 _("--no-preserve-owner cannot be used with --owner")); 421 _("--no-preserve-owner cannot be used with --owner")));
419 no_chown_flag = true; 422 no_chown_flag = true;
420 break; 423 break;
421 424
422 case 'o': /* Copy-out mode. */ 425 case 'o': /* Copy-out mode. */
423 if (copy_function != 0) 426 if (copy_function != 0)
424 error (PAXEXIT_FAILURE, 0, _("Mode already defined")); 427 USAGE_ERROR ((0, 0, _("Mode already defined")));
425 copy_function = process_copy_out; 428 copy_function = process_copy_out;
426 break; 429 break;
427 430
@@ -435,7 +438,7 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg);
435 438
436 case 'p': /* Copy-pass mode. */ 439 case 'p': /* Copy-pass mode. */
437 if (copy_function != 0) 440 if (copy_function != 0)
438 error (PAXEXIT_FAILURE, 0, _("Mode already defined")); 441 USAGE_ERROR ((0, 0, _("Mode already defined")));
439 copy_function = process_copy_pass; 442 copy_function = process_copy_pass;
440 break; 443 break;
441 444
@@ -457,15 +460,15 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg);
457 460
458 case 'R': /* Set the owner. */ 461 case 'R': /* Set the owner. */
459 if (no_chown_flag) 462 if (no_chown_flag)
460 error (PAXEXIT_FAILURE, 0, 463 USAGE_ERROR ((0, 0,
461 _("--owner cannot be used with --no-preserve-owner")); 464 _("--owner cannot be used with --no-preserve-owner")));
462 else 465 else
463 { 466 {
464 char *e, *u, *g; 467 char *e, *u, *g;
465 468
466 e = parse_user_spec (arg, &set_owner, &set_group, &u, &g); 469 e = parse_user_spec (arg, &set_owner, &set_group, &u, &g);
467 if (e) 470 if (e)
468 error (PAXEXIT_FAILURE, 0, "%s: %s", arg, e); 471 USAGE_ERROR ((0, 0, "%s: %s", arg, e));
469 if (u) 472 if (u)
470 { 473 {
471 free (u); 474 free (u);
@@ -505,7 +508,7 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg);
505 508
506 case 'W': 509 case 'W':
507 if (warn_control (arg)) 510 if (warn_control (arg))
508 argp_error (state, _("Invalid value for --warning option: %s"), arg); 511 USAGE_ERROR ((0, 0, _("Invalid value for --warning option: %s"), arg));
509 break; 512 break;
510 513
511 case SPARSE_OPTION: 514 case SPARSE_OPTION:
@@ -542,6 +545,14 @@ static struct argp argp = {
542 NULL 545 NULL
543}; 546};
544 547
548static void
549usage (int status)
550{
551 argp_help (&argp, stderr, ARGP_HELP_SEE, (char*) program_name);
552 close_stdout ();
553 exit (status);
554}
555
545/* Process the arguments. Set all options and set up the copy pass 556/* Process the arguments. Set all options and set up the copy pass
546 directory or the copy in patterns. */ 557 directory or the copy in patterns. */
547 558
@@ -564,9 +575,9 @@ process_args (int argc, char *argv[])
564 if (table_flag) 575 if (table_flag)
565 copy_function = process_copy_in; 576 copy_function = process_copy_in;
566 else 577 else
567 error (PAXEXIT_FAILURE, 0, 578 USAGE_ERROR ((0, 0,
568 _("You must specify one of -oipt options.\nTry `%s --help' or `%s --usage' for more information.\n"), 579 _("You must specify one of -oipt options.\nTry `%s --help' or `%s --usage' for more information.\n"),
569 program_name, program_name); 580 program_name, program_name));
570 } 581 }
571 582
572 /* Work around for pcc bug. */ 583 /* Work around for pcc bug. */
@@ -576,24 +587,25 @@ process_args (int argc, char *argv[])
576 if (copy_function == copy_in) 587 if (copy_function == copy_in)
577 { 588 {
578 archive_des = 0; 589 archive_des = 0;
579 CHECK_USAGE(link_flag, "--link", "--extract"); 590 CHECK_USAGE (link_flag, "--link", "--extract");
580 CHECK_USAGE(reset_time_flag, "--reset", "--extract"); 591 CHECK_USAGE (reset_time_flag, "--reset", "--extract");
581 CHECK_USAGE(xstat != lstat, "--dereference", "--extract"); 592 CHECK_USAGE (xstat != lstat, "--dereference", "--extract");
582 CHECK_USAGE(append_flag, "--append", "--extract"); 593 CHECK_USAGE (append_flag, "--append", "--extract");
583 CHECK_USAGE(output_archive_name, "-O", "--extract"); 594 CHECK_USAGE (output_archive_name, "-O", "--extract");
584 if (to_stdout_option) 595 if (to_stdout_option)
585 { 596 {
586 CHECK_USAGE(create_dir_flag, "--make-directories", "--to-stdout"); 597 CHECK_USAGE (create_dir_flag, "--make-directories", "--to-stdout");
587 CHECK_USAGE(rename_flag, "--rename", "--to-stdout"); 598 CHECK_USAGE (rename_flag, "--rename", "--to-stdout");
588 CHECK_USAGE(no_chown_flag, "--no-preserve-owner", "--to-stdout"); 599 CHECK_USAGE (no_chown_flag, "--no-preserve-owner", "--to-stdout");
589 CHECK_USAGE(set_owner_flag||set_group_flag, "--owner", "--to-stdout"); 600 CHECK_USAGE (set_owner_flag||set_group_flag,
590 CHECK_USAGE(retain_time_flag, "--preserve-modification-time", 601 "--owner", "--to-stdout");
591 "--to-stdout"); 602 CHECK_USAGE (retain_time_flag, "--preserve-modification-time",
603 "--to-stdout");
592 } 604 }
593 605
594 if (archive_name && input_archive_name) 606 if (archive_name && input_archive_name)
595 error (PAXEXIT_FAILURE, 0, 607 USAGE_ERROR ((0, 0,
596 _("Both -I and -F are used in copy-in mode")); 608 _("Both -I and -F are used in copy-in mode")));
597 609
598 if (archive_format == arf_crcascii) 610 if (archive_format == arf_crcascii)
599 crc_i_flag = true; 611 crc_i_flag = true;
@@ -605,32 +617,33 @@ process_args (int argc, char *argv[])
605 else if (copy_function == copy_out) 617 else if (copy_function == copy_out)
606 { 618 {
607 if (index != argc) 619 if (index != argc)
608 error (PAXEXIT_FAILURE, 0, _("Too many arguments")); 620 USAGE_ERROR ((0, 0, _("Too many arguments")));
609 621
610 archive_des = 1; 622 archive_des = 1;
611 CHECK_USAGE(create_dir_flag, "--make-directories", "--create"); 623 CHECK_USAGE (create_dir_flag, "--make-directories", "--create");
612 CHECK_USAGE(rename_flag, "--rename", "--create"); 624 CHECK_USAGE (rename_flag, "--rename", "--create");
613 CHECK_USAGE(table_flag, "--list", "--create"); 625 CHECK_USAGE (table_flag, "--list", "--create");
614 CHECK_USAGE(unconditional_flag, "--unconditional", "--create"); 626 CHECK_USAGE (unconditional_flag, "--unconditional", "--create");
615 CHECK_USAGE(link_flag, "--link", "--create"); 627 CHECK_USAGE (link_flag, "--link", "--create");
616 CHECK_USAGE(sparse_flag, "--sparse", "--create"); 628 CHECK_USAGE (sparse_flag, "--sparse", "--create");
617 CHECK_USAGE(retain_time_flag, "--preserve-modification-time", 629 CHECK_USAGE (retain_time_flag, "--preserve-modification-time",
618 "--create"); 630 "--create");
619 CHECK_USAGE(no_chown_flag, "--no-preserve-owner", "--create"); 631 CHECK_USAGE (no_chown_flag, "--no-preserve-owner", "--create");
620 CHECK_USAGE(swap_bytes_flag, "--swap-bytes (--swap)", "--create"); 632 CHECK_USAGE (swap_bytes_flag, "--swap-bytes (--swap)", "--create");
621 CHECK_USAGE(swap_halfwords_flag, "--swap-halfwords (--swap)", 633 CHECK_USAGE (swap_halfwords_flag, "--swap-halfwords (--swap)",
622 "--create"); 634 "--create");
623 CHECK_USAGE(to_stdout_option, "--to-stdout", "--create"); 635 CHECK_USAGE (to_stdout_option, "--to-stdout", "--create");
624 636
625 if (append_flag && !(archive_name || output_archive_name)) 637 if (append_flag && !(archive_name || output_archive_name))
626 error (PAXEXIT_FAILURE, 0, 638 USAGE_ERROR ((0, 0,
627 _("--append is used but no archive file name is given (use -F or -O options)")); 639 _("--append is used but no archive file name "
640 "is given (use -F or -O options)")));
628 641
629 CHECK_USAGE(rename_batch_file, "--rename-batch-file", "--create"); 642 CHECK_USAGE (rename_batch_file, "--rename-batch-file", "--create");
630 CHECK_USAGE(input_archive_name, "-I", "--create"); 643 CHECK_USAGE (input_archive_name, "-I", "--create");
631 if (archive_name && output_archive_name) 644 if (archive_name && output_archive_name)
632 error (PAXEXIT_FAILURE, 0, 645 USAGE_ERROR ((0, 0,
633 _("Both -O and -F are used in copy-out mode")); 646 _("Both -O and -F are used in copy-out mode")));
634 647
635 if (archive_format == arf_unknown) 648 if (archive_format == arf_unknown)
636 archive_format = arf_binary; 649 archive_format = arf_binary;
@@ -641,26 +654,27 @@ process_args (int argc, char *argv[])
641 { 654 {
642 /* Copy pass. */ 655 /* Copy pass. */
643 if (index < argc - 1) 656 if (index < argc - 1)
644 error (PAXEXIT_FAILURE, 0, _("Too many arguments")); 657 USAGE_ERROR ((0, 0, _("Too many arguments")));
645 else if (index > argc - 1) 658 else if (index > argc - 1)
646 error (PAXEXIT_FAILURE, 0, _("Not enough arguments")); 659 USAGE_ERROR ((0, 0, _("Not enough arguments")));
647 660
648 if (archive_format != arf_unknown) 661 if (archive_format != arf_unknown)
649 error (PAXEXIT_FAILURE, 0, 662 USAGE_ERROR ((0, 0,
650 _("Archive format is not specified in copy-pass mode (use --format option)")); 663 _("Archive format is not specified in copy-pass mode "
651 664 "(use --format option)")));
652 CHECK_USAGE(swap_bytes_flag, "--swap-bytes (--swap)", "--pass-through"); 665
653 CHECK_USAGE(swap_halfwords_flag, "--swap-halfwords (--swap)", 666 CHECK_USAGE (swap_bytes_flag, "--swap-bytes (--swap)", "--pass-through");
654 "--pass-through"); 667 CHECK_USAGE (swap_halfwords_flag, "--swap-halfwords (--swap)",
655 CHECK_USAGE(table_flag, "--list", "--pass-through"); 668 "--pass-through");
656 CHECK_USAGE(rename_flag, "--rename", "--pass-through"); 669 CHECK_USAGE (table_flag, "--list", "--pass-through");
657 CHECK_USAGE(append_flag, "--append", "--pass-through"); 670 CHECK_USAGE (rename_flag, "--rename", "--pass-through");
658 CHECK_USAGE(rename_batch_file, "--rename-batch-file", "--pass-through"); 671 CHECK_USAGE (append_flag, "--append", "--pass-through");
659 CHECK_USAGE(no_abs_paths_flag, "--no-absolute-pathnames", 672 CHECK_USAGE (rename_batch_file, "--rename-batch-file", "--pass-through");
660 "--pass-through"); 673 CHECK_USAGE (no_abs_paths_flag, "--no-absolute-pathnames",
661 CHECK_USAGE(no_abs_paths_flag, "--absolute-pathnames", 674 "--pass-through");
662 "--pass-through"); 675 CHECK_USAGE (no_abs_paths_flag, "--absolute-pathnames",
663 CHECK_USAGE(to_stdout_option, "--to-stdout", "--pass-through"); 676 "--pass-through");
677 CHECK_USAGE (to_stdout_option, "--to-stdout", "--pass-through");
664 678
665 directory_name = argv[index]; 679 directory_name = argv[index];
666 } 680 }
diff --git a/src/util.c b/src/util.c
index 2fcab61..f717104 100644
--- a/src/util.c
+++ b/src/util.c
@@ -90,10 +90,10 @@ tape_empty_output_buffer (int out_des)
90 rest_bytes_written = rmtwrite (out_des, output_buffer, 90 rest_bytes_written = rmtwrite (out_des, output_buffer,
91 rest_output_size); 91 rest_output_size);
92 if (rest_bytes_written != rest_output_size) 92 if (rest_bytes_written != rest_output_size)
93 error (1, errno, _("write error")); 93 error (PAXEXIT_FAILURE, errno, _("write error"));
94 } 94 }
95 else 95 else
96 error (1, errno, _("write error")); 96 error (PAXEXIT_FAILURE, errno, _("write error"));
97 } 97 }
98 output_bytes += output_size; 98 output_bytes += output_size;
99 out_buff = output_buffer; 99 out_buff = output_buffer;
@@ -143,9 +143,9 @@ disk_empty_output_buffer (int out_des, bool flush)
143 if (bytes_written != output_size) 143 if (bytes_written != output_size)
144 { 144 {
145 if (bytes_written == -1) 145 if (bytes_written == -1)
146 error (1, errno, _("write error")); 146 error (PAXEXIT_FAILURE, errno, _("write error"));
147 else 147 else
148 error (1, 0, _("write error: partial write")); 148 error (PAXEXIT_FAILURE, 0, _("write error: partial write"));
149 } 149 }
150 output_bytes += output_size; 150 output_bytes += output_size;
151 out_buff = output_buffer; 151 out_buff = output_buffer;
@@ -207,7 +207,7 @@ tape_fill_input_buffer (int in_des, int num_bytes)
207 input_size = rmtread (in_des, input_buffer, num_bytes); 207 input_size = rmtread (in_des, input_buffer, num_bytes);
208 } 208 }
209 if (input_size < 0) 209 if (input_size < 0)
210 error (1, errno, _("read error")); 210 error (PAXEXIT_FAILURE, errno, _("read error"));
211 if (input_size == 0) 211 if (input_size == 0)
212 { 212 {
213 error (0, 0, _("premature end of file")); 213 error (0, 0, _("premature end of file"));
@@ -376,7 +376,7 @@ tape_buffered_peek (char *peek_buf, int in_des, int num_bytes)
376 break; 376 break;
377 } 377 }
378 if (tmp_input_size < 0) 378 if (tmp_input_size < 0)
379 error (1, errno, _("read error")); 379 error (PAXEXIT_FAILURE, errno, _("read error"));
380 input_bytes += tmp_input_size; 380 input_bytes += tmp_input_size;
381 input_size += tmp_input_size; 381 input_size += tmp_input_size;
382 } 382 }
@@ -620,7 +620,7 @@ create_all_directories (char *name)
620#endif 620#endif
621 621
622 if (dir == NULL) 622 if (dir == NULL)
623 error (2, 0, _("virtual memory exhausted")); 623 error (PAXEXIT_FAILURE, 0, _("virtual memory exhausted"));
624 624
625 if (dir[0] != '.' || dir[1] != '\0') 625 if (dir[0] != '.' || dir[1] != '\0')
626 { 626 {
@@ -663,13 +663,13 @@ prepare_append (int out_file_des)
663 start_of_block = start_of_header - useful_bytes_in_block; 663 start_of_block = start_of_header - useful_bytes_in_block;
664 664
665 if (lseek (out_file_des, start_of_block, SEEK_SET) < 0) 665 if (lseek (out_file_des, start_of_block, SEEK_SET) < 0)
666 error (1, errno, _("cannot seek on output")); 666 error (PAXEXIT_FAILURE, errno, _("cannot seek on output"));
667 if (useful_bytes_in_block > 0) 667 if (useful_bytes_in_block > 0)
668 { 668 {
669 tmp_buf = (char *) xmalloc (useful_bytes_in_block); 669 tmp_buf = (char *) xmalloc (useful_bytes_in_block);
670 read (out_file_des, tmp_buf, useful_bytes_in_block); 670 read (out_file_des, tmp_buf, useful_bytes_in_block);
671 if (lseek (out_file_des, start_of_block, SEEK_SET) < 0) 671 if (lseek (out_file_des, start_of_block, SEEK_SET) < 0)
672 error (1, errno, _("cannot seek on output")); 672 error (PAXEXIT_FAILURE, errno, _("cannot seek on output"));
673 /* fix juo -- is this copy_tape_buf_out? or copy_disk? */ 673 /* fix juo -- is this copy_tape_buf_out? or copy_disk? */
674 tape_buffered_write (tmp_buf, out_file_des, useful_bytes_in_block); 674 tape_buffered_write (tmp_buf, out_file_des, useful_bytes_in_block);
675 free (tmp_buf); 675 free (tmp_buf);
@@ -823,10 +823,10 @@ get_next_reel (int tape_des)
823 /* Open files for interactive communication. */ 823 /* Open files for interactive communication. */
824 tty_in = fopen (TTY_NAME, "r"); 824 tty_in = fopen (TTY_NAME, "r");
825 if (tty_in == NULL) 825 if (tty_in == NULL)
826 error (2, errno, TTY_NAME); 826 error (PAXEXIT_FAILURE, errno, TTY_NAME);
827 tty_out = fopen (TTY_NAME, "w"); 827 tty_out = fopen (TTY_NAME, "w");
828 if (tty_out == NULL) 828 if (tty_out == NULL)
829 error (2, errno, TTY_NAME); 829 error (PAXEXIT_FAILURE, errno, TTY_NAME);
830 830
831 old_tape_des = tape_des; 831 old_tape_des = tape_des;
832 tape_offline (tape_des); 832 tape_offline (tape_des);
@@ -891,7 +891,7 @@ get_next_reel (int tape_des)
891 the archive. */ 891 the archive. */
892 892
893 if (tape_des != old_tape_des) 893 if (tape_des != old_tape_des)
894 error (1, 0, _("internal error: tape descriptor changed from %d to %d"), 894 error (PAXEXIT_FAILURE, 0, _("internal error: tape descriptor changed from %d to %d"),
895 old_tape_des, tape_des); 895 old_tape_des, tape_des);
896 896
897 free (new_name.ds_string); 897 free (new_name.ds_string);

Return to:

Send suggestions and report system problems to the System administrator.