1 /* ------------------------------------------------------------------------ */
3 /* lharc.c -- append to archive */
5 /* Copyright (C) MCMLXXXIX Yooichi.Tagawa */
6 /* Modified Nobutaka Watazaki */
7 /* Thanks to H.Yoshizaki. (MS-DOS LHarc) */
9 /* Ver. 0.00 Original 1988.05.23 Y.Tagawa */
10 /* Ver. 0.01 Alpha Version (for 4.2BSD) 1989.05.28 Y.Tagawa */
11 /* Ver. 0.02 Alpha Version Rel.2 1989.05.29 Y.Tagawa */
12 /* Ver. 0.03 Release #3 Beta Version 1989.07.02 Y.Tagawa */
13 /* Ver. 0.03a Debug 1989.07.03 Y.Tagawa */
14 /* Ver. 0.03b Modified 1989.07.13 Y.Tagawa */
15 /* Ver. 0.03c Debug (Thanks to void@rena.dit.junet) */
16 /* 1989.08.09 Y.Tagawa */
17 /* Ver. 0.03d Modified (quiet and verbose) 1989.09.14 Y.Tagawa */
18 /* V1.00 Fixed 1989.09.22 Y.Tagawa */
19 /* V1.01 Bug Fixed 1989.12.25 Y.Tagawa */
21 /* DOS-Version Original LHx V C2.01 (C) H.Yohizaki */
23 /* V2.00 UNIX Lharc + DOS LHx -> OSK LHx 1990.11.01 Momozou */
24 /* V2.01 Minor Modified 1990.11.24 Momozou */
26 /* Ver. 0.02 LHx for UNIX 1991.11.18 M.Oki */
27 /* Ver. 0.03 LHa for UNIX 1991.12.17 M.Oki */
28 /* Ver. 0.04 LHa for UNIX beta version 1992.01.20 M.Oki */
29 /* Ver. 1.00 LHa for UNIX Fixed 1992.03.19 M.Oki */
31 /* Ver. 1.10 for Symbolic Link 1993.06.25 N.Watazaki */
32 /* Ver. 1.11 for Symbolic Link Bug Fixed 1993.08.18 N.Watazaki */
33 /* Ver. 1.12 for File Date Check 1993.10.28 N.Watazaki */
34 /* Ver. 1.13 Bug Fixed (Idicator calcurate) 1994.02.21 N.Watazaki */
35 /* Ver. 1.13a Bug Fixed (Sym. Link delete) 1994.03.11 N.Watazaki */
36 /* Ver. 1.13b Bug Fixed (Sym. Link delete) 1994.07.29 N.Watazaki */
37 /* Ver. 1.14 Source All chagned 1995.01.14 N.Watazaki */
38 /* Ver. 1.14b,c Bug Fixed 1996.03.07 t.okamoto */
39 /* Ver. 1.14d Version up 1997.01.12 t.okamoto */
40 /* Ver. 1.14g Bug Fixed 2000.05.06 t.okamoto */
41 /* Ver. 1.14i Modified 2000.10.06 t.okamoto */
42 /* ------------------------------------------------------------------------ */
47 static int cmd = CMD_UNKNOWN;
48 static int error_occurred;
50 /* static functions */
51 static void sort_files();
52 static void print_version();
54 extern int optional_archive_kanji_code;
55 extern int optional_system_kanji_code;
57 /* ------------------------------------------------------------------------ */
59 init_variable() /* Added N.Watazaki */
65 noexec = FALSE; /* debugging option */
68 compress_method = DEFAULT_LZHUFF_METHOD; /* defined in config.h */
70 header_level = 2; /* level 2 */
77 /* view command flags */
78 verbose_listing = FALSE;
80 /* extract command flags */
81 output_to_stdout = FALSE;
83 /* append command flags */
85 update_if_newer = FALSE;
86 delete_after_append = FALSE;
87 generic_format = FALSE;
89 recover_archive_when_interrupt = FALSE;
90 remove_extracting_file_when_interrupt = FALSE;
91 get_filename_from_stdin = FALSE;
92 ignore_directory = FALSE;
96 noconvertcase = FALSE;
98 extract_directory = NULL;
101 #if BACKUP_OLD_ARCHIVE
102 backup_old_archive = TRUE;
104 backup_old_archive = FALSE;
107 extract_broken_archive = FALSE;
110 /* ------------------------------------------------------------------------ */
111 /* NOTES : Text File Format */
112 /* GENERATOR NewLine */
113 /* [generic] 0D 0A */
115 /* [OS9][MacOS] 0D */
117 /* ------------------------------------------------------------------------ */
122 usage: lha [-]<commands>[<options>] [-<options> ...] archive_file [file...]\n\
123 commands: [axelvudmcpt]\n\
124 options: [q[012]vnfto[567]dizg012e[w=<dir>|x=<pattern>]]\n");
131 LHarc for UNIX V 1.02 Copyright(C) 1989 Y.Tagawa\n\
132 LHx for MSDOS V C2.01 Copyright(C) 1990 H.Yoshizaki\n\
133 LHx(arc) for OSK V 2.01 Modified 1990 Momozou\n\
134 LHa for UNIX V 1.00 Copyright(C) 1992 Masaru Oki\n\
135 LHa for UNIX V 1.14 Modified 1995 Nobutaka Watazaki\n\
136 LHa for UNIX V 1.14i Modified 2000 Tsugio Okamoto\n\
137 Autoconfiscated 2001-2004 Koji Arai\n\
143 commands: options:\n\
144 a Add(or replace) to archive q{num} quiet (num:quiet mode)\n\
145 x,e EXtract from archive v verbose\n\
146 l,v List / Verbose List n not execute\n\
147 u Update newer files to archive f force (over write at extract)\n\
148 d Delete from archive t FILES are TEXT file\n");
151 m Move to archive (means 'ad') o[567] compression method (a/u/c)\n\
156 m Move to archive (means 'ad') o use LHarc compatible method (a/u/c)\n\
160 c re-Construct new archive d delete FILES after (a/u/c)\n\
161 p Print to STDOUT from archive i ignore directory path (x/e)\n\
162 t Test file CRC in archive z files not compress (a/u/c)\n\
163 g Generic format (for compatibility)\n\
164 or not convert case when extracting\n\
165 0/1/2 header level (a/u/c)\n\
169 e TEXT code convert from/to EUC\n\
173 w=<dir> specify extract directory (x/e)\n\
174 x=<pattern> eXclude files (a/u/c)\n\
176 #if IGNORE_DOT_FILES /* experimental feature */
178 X ignore dot files (a/u/c)\n\
184 parse_option(int argc, char **argv)
189 argv++; argc--; /* exclude command name */
196 if (strcmp(*argv, "--help") == 0) {
200 if (strcmp(*argv, "--version") == 0) {
205 if (argc == 1 && **argv != '-') {
206 archive_name = *argv++; argc--;
213 opt = *argv++; argc--;
226 output_to_stdout = TRUE;
244 update_if_newer = TRUE;
249 delete_after_append = TRUE;
254 verbose_listing = TRUE;
268 error("unknown command `-%c'", *opt);
280 case '0': /* no quiet */
281 case '1': /* no use the incremental indicator */
282 quiet_mode = *p - '0';
285 case '2': /* no output */
289 /* In quiet mode, no confirm to overwrite */
314 generic_format = TRUE;
315 noconvertcase = TRUE;
319 delete_after_append = TRUE;
324 compress_method = LZHUFF1_METHOD_NUM;
328 compress_method = LZHUFF5_METHOD_NUM;
333 compress_method = LZHUFF6_METHOD_NUM;
337 compress_method = LZHUFF7_METHOD_NUM;
342 error("invalid compression method 'o%c'", *p);
347 compress_method = LZHUFF0_METHOD_NUM; /* Changed N.Watazaki */
350 ignore_directory = TRUE;
356 for (i = 0; exclude_files && exclude_files[i]; i++)
358 exclude_files = (char**)xrealloc(exclude_files,
359 sizeof(char*) * (i+2));
363 error("exclude files does not specified for `-x'");
366 exclude_files[i] = *argv++; argc--;
367 exclude_files[i+1] = 0;
371 exclude_files[i] = p;
372 exclude_files[i+1] = 0;
376 #if IGNORE_DOT_FILES /* experimental feature */
378 for (i = 0; exclude_files && exclude_files[i]; i++)
380 exclude_files = (char**)xrealloc(exclude_files,
381 sizeof(char*) * (i+2));
383 exclude_files[i] = xstrdup(".*");
384 exclude_files[i+1] = 0;
392 error("working directory does not specified for `-w'");
395 extract_directory = *argv++; argc--;
399 extract_directory = p;
413 error("unknown option `-%c'.", p[-1]);
420 if (!opt || opt[0] != '-')
423 /* special archive name */
424 if (strcmp(opt, "-") == 0)
427 /* GNU style long options */
428 if (opt[0] == '-' && opt[1] == '-') {
431 if (strncmp(opt, "system-kanji-code=",
432 sizeof("system-kanji-code=")-1) == 0) {
433 opt += sizeof("system-kanji-code=")-1;
434 if (strcmp(opt, "euc") == 0) {
435 optional_system_kanji_code = CODE_EUC;
437 else if (strcmp(opt, "sjis") == 0) {
438 optional_system_kanji_code = CODE_SJIS;
440 else if (strcmp(opt, "utf8") == 0) {
441 optional_system_kanji_code = CODE_UTF8;
443 else if (strcmp(opt, "cap") == 0) {
444 optional_system_kanji_code = CODE_CAP;
447 error("unknown kanji code \"%s\"", opt);
451 else if (strncmp(opt, "archive-kanji-code=",
452 sizeof("archive-kanji-code=")-1) == 0) {
453 opt += sizeof("archive-kanji-code=")-1;
454 if (strcmp(opt, "euc") == 0) {
455 optional_archive_kanji_code = CODE_EUC;
457 else if (strcmp(opt, "sjis") == 0) {
458 optional_archive_kanji_code = CODE_SJIS;
460 else if (strcmp(opt, "utf8") == 0) {
461 optional_archive_kanji_code = CODE_UTF8;
463 else if (strcmp(opt, "cap") == 0) {
464 optional_archive_kanji_code = CODE_CAP;
467 error("unknown kanji code \"%s\"", opt);
471 else if (strncmp(opt, "extract-broken-archive",
472 sizeof("extract-broken-archive")-1) == 0) {
473 extract_broken_archive = TRUE;
476 error("unknown long option \"--%s\"", opt);
487 archive_name = *argv++; argc--;
496 /* ------------------------------------------------------------------------ */
506 init_variable(); /* Added N.Watazaki */
508 if (parse_option(argc, argv) == -1) {
515 error("archive file does not specified");
521 if (!strcmp(archive_name, "-")) {
522 if (!isatty(1) && cmd == CMD_ADD)
525 #if 0 /* Comment out; IMHO, this feature is useless. by Koji Arai */
527 if (argc == 3 && !isatty(0)) { /* 1999.7.18 */
528 /* Bug(?) on MinGW, isatty() return 0 on Cygwin console.
529 mingw-runtime-1.3-2 and Cygwin 1.3.10(0.51/3/2) on Win2000 */
530 get_filename_from_stdin = TRUE;
535 /* target file name */
536 if (get_filename_from_stdin) {
542 xfilev = (char **)xmalloc(sizeof(char *) * xfilec);
543 while (fgets(inpbuf, sizeof(inpbuf), stdin)) {
544 /* delete \n if it exist */
546 while (i < sizeof(inpbuf) && p != 0) {
554 if (cmd_filec >= xfilec) {
556 xfilev = (char **) xrealloc(xfilev,
557 sizeof(char *) * xfilec);
559 if (strlen(inpbuf) < 1)
561 xfilev[cmd_filec++] = xstrdup(inpbuf);
563 xfilev[cmd_filec] = NULL;
593 /* ------------------------------------------------------------------------ */
597 /* macro PACKAGE_NAME, PACKAGE_VERSION and PLATFORM are
598 defined in config.h by configure script */
599 fprintf(stderr, "%s version %s (%s)\n",
600 PACKAGE_NAME, PACKAGE_VERSION, PLATFORM);
605 message(char *fmt, ...)
607 message(fmt, va_alist)
612 int errno_sv = errno;
615 fprintf(stderr, "LHa: ");
618 vfprintf(stderr, fmt, v);
626 /* ------------------------------------------------------------------------ */
629 warning(char *fmt, ...)
631 warning(fmt, va_alist)
636 int errno_sv = errno;
639 fprintf(stderr, "LHa: Warning: ");
642 vfprintf(stderr, fmt, v);
650 /* ------------------------------------------------------------------------ */
653 error(char *fmt, ...)
660 int errno_sv = errno;
663 fprintf(stderr, "LHa: Error: ");
666 vfprintf(stderr, fmt, v);
678 fatal_error(char *fmt, ...)
680 fatal_error(fmt, va_alist)
685 int errno_sv = errno;
688 fprintf(stderr, "LHa: Fatal error: ");
691 vfprintf(stderr, fmt, v);
695 fprintf(stderr, ": %s\n", strerror(errno_sv));
705 if (temporary_fd != -1) {
708 unlink(temporary_name);
711 if (recover_archive_when_interrupt) {
712 rename(backup_archive_name, archive_name);
713 recover_archive_when_interrupt = FALSE;
715 if (remove_extracting_file_when_interrupt) {
716 message("Removing: %s", writing_filename);
717 unlink(writing_filename);
718 remove_extracting_file_when_interrupt = FALSE;
726 message("Interrupted");
730 signal(SIGINT, SIG_DFL);
732 signal(SIGHUP, SIG_DFL);
734 kill(getpid(), signo);
737 /* ------------------------------------------------------------------------ */
739 /* ------------------------------------------------------------------------ */
744 register char *p, *q;
748 if (generic_format) {
750 c1 = *(unsigned char *) p++;
751 c2 = *(unsigned char *) q++;
763 while (*p == *q && *p != '\0')
765 return *(unsigned char *) p - *(unsigned char *) q;
769 /* ------------------------------------------------------------------------ */
774 qsort(cmd_filev, cmd_filec, sizeof(char *), sort_by_ascii);
777 /* ------------------------------------------------------------------------ */
782 void *p = malloc(size);
784 fatal_error("Not enough memory");
788 /* ------------------------------------------------------------------------ */
794 void *p = (char *) realloc(old, size);
796 fatal_error("Not enough memory");
804 int len = strlen(str);
805 char *p = (char *)xmalloc(len + 1);
810 /* ------------------------------------------------------------------------ */
812 /* ------------------------------------------------------------------------ */
815 +-------------+-------------+------+-------------+----------+
816 | N A M E 1 \0| N A M E 2 \0| .... | N A M E n \0| |
817 +-------------+-------------+------+-------------+----------+
818 ^ ^ ^ buffer+0 buffer+used buffer+size
821 +---------------+---------------+------------- -----------------+
822 | pointer to | pointer to | pointer to ... pointer to |
823 | stringpool | N A M E 1 | N A M E 2 ... N A M E n |
824 +---------------+---------------+------------- -------------+
825 ^ malloc base returned
828 /* ------------------------------------------------------------------------ */
831 struct string_pool *sp;
833 sp->size = 1024 - 8; /* any ( >=0 ) */
836 sp->buffer = (char *) xmalloc(sp->size * sizeof(char));
839 /* ------------------------------------------------------------------------ */
841 add_sp(sp, name, len)
842 struct string_pool *sp;
843 char *name; /* stored '\0' at tail */
844 int len; /* include '\0' */
846 while (sp->used + len > sp->size) {
848 sp->buffer = (char *) xrealloc(sp->buffer, sp->size * sizeof(char));
850 memmove(sp->buffer + sp->used, name, len);
855 /* ------------------------------------------------------------------------ */
857 finish_sp(sp, v_count, v_vector)
858 register struct string_pool *sp;
866 v = (char **) xmalloc((sp->n + 1) * sizeof(char *));
871 for (i = sp->n; i; i--) {
878 /* ------------------------------------------------------------------------ */
884 free(*vector); /* free string pool */
889 /* ------------------------------------------------------------------------ */
890 /* READ DIRECTORY FILES */
891 /* ------------------------------------------------------------------------ */
893 include_path_p(path, name)
899 return (path[-1] == '/' && *n == '\0');
900 return (*n == '/' || (n != name && path[-1] == '/' && n[-1] == '/'));
903 /* ------------------------------------------------------------------------ */
905 cleaning_files(v_filec, v_filev)
912 register char **filev = *v_filev;
913 register int filec = *v_filec;
920 flags = xmalloc(filec * sizeof(char));
922 /* flags & 0x01 : 1: ignore */
923 /* flags & 0x02 : 1: directory, 0 : regular file */
924 /* flags & 0x04 : 1: need delete */
926 for (i = 0; i < filec; i++)
927 if (GETSTAT(filev[i], &stbuf) < 0) {
929 warning("Cannot access \"%s\" : %s; ignored.", filev[i],
933 if (is_regularfile(&stbuf))
935 else if (is_directory(&stbuf))
938 else if (is_symlink(&stbuf)) /* t.okamoto */
943 warning("Cannot archive \"%s\", ignored.", filev[i]);
947 for (i = 0; i < filec; i++) {
949 if ((flags[i] & 0x07) == 0x00) { /* regular file, not
951 for (j = i + 1; j < filec; j++) {
952 if ((flags[j] & 0x07) == 0x00) { /* regular file, not
954 if (STREQU(p, filev[j]))
955 flags[j] = 0x04; /* delete */
959 else if ((flags[i] & 0x07) == 0x02) { /* directory, not
961 for (j = i + 1; j < filec; j++) {
962 if ((flags[j] & 0x07) == 0x00) { /* regular file, not
964 if (include_path_p(p, filev[j]))
965 flags[j] = 0x04; /* delete */
967 else if ((flags[j] & 0x07) == 0x02) { /* directory, not
969 if (include_path_p(p, filev[j]))
970 flags[j] = 0x04; /* delete */
976 for (i = j = 0; i < filec; i++) {
977 if ((flags[i] & 0x04) == 0) {
988 /* ------------------------------------------------------------------------ */
990 find_files(name, v_filec, v_filev)
995 struct string_pool sp;
996 char newname[FILENAME_LENGTH];
1000 struct stat tmp_stbuf, arc_stbuf, fil_stbuf;
1001 int exist_tmp = 1, exist_arc = 1;
1003 strcpy(newname, name);
1005 if (len > 0 && newname[len - 1] != '/') {
1006 newname[len++] = '/';
1010 dirp = opendir(name);
1016 if (GETSTAT(temporary_name, &tmp_stbuf) == -1)
1018 if (GETSTAT(archive_name, &arc_stbuf) == -1)
1021 while ((dp = readdir(dirp)) != NULL) {
1024 /* exclude '.' and '..' */
1025 if (strncmp(dp->d_name, ".", n) == 0
1026 || strncmp(dp->d_name, "..", n) == 0)
1029 /* exclude exclude_files supplied by user */
1030 for (i = 0; exclude_files && exclude_files[i]; i++) {
1031 if (fnmatch(exclude_files[i], dp->d_name,
1032 FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD) == 0)
1036 if (len + n >= sizeof(newname)) {
1037 warning("filename is too long");
1041 strncpy(newname + len, dp->d_name, n);
1042 newname[len + n] = '\0';
1043 if (GETSTAT(newname, &fil_stbuf) < 0)
1046 #if defined(HAVE_STRUCT_STAT_ST_INO) && !__MINGW32__
1047 /* MinGW has meaningless st_ino */
1049 /* exclude temporary file, archive file and these links */
1051 tmp_stbuf.st_dev == fil_stbuf.st_dev &&
1052 tmp_stbuf.st_ino == fil_stbuf.st_ino)
1056 arc_stbuf.st_dev == fil_stbuf.st_dev &&
1057 arc_stbuf.st_ino == fil_stbuf.st_ino)
1060 add_sp(&sp, newname, len+n+1);
1065 finish_sp(&sp, v_filec, v_filev);
1067 qsort(*v_filev, *v_filec, sizeof(char *), sort_by_ascii);
1068 cleaning_files(v_filec, v_filev);
1073 /* ------------------------------------------------------------------------ */
1075 free_files(filec, filev)
1082 /* ------------------------------------------------------------------------ */
1084 /* ------------------------------------------------------------------------ */
1085 /* Build temporary file name and store to TEMPORARY_NAME */
1087 build_temporary_name()
1089 #ifdef TMP_FILENAME_TEMPLATE
1090 /* "/tmp/lhXXXXXX" etc. */
1091 if (extract_directory == NULL) {
1092 strcpy(temporary_name, TMP_FILENAME_TEMPLATE);
1095 xsnprintf(temporary_name, sizeof(temporary_name),
1096 "%s/lhXXXXXX", extract_directory);
1101 strcpy(temporary_name, archive_name);
1102 for (p = temporary_name, s = (char *) 0; *p; p++)
1105 strcpy((s ? s + 1 : temporary_name), "lhXXXXXX");
1111 old_umask = umask(077);
1112 fd = mkstemp(temporary_name);
1120 mktemp(temporary_name);
1121 flags = O_CREAT|O_EXCL|O_RDWR;
1125 return open(temporary_name, flags, 0600);
1130 /* ------------------------------------------------------------------------ */
1132 modify_filename_extention(buffer, ext)
1136 register char *p, *dot;
1138 for (p = buffer, dot = (char *) 0; *p; p++) {
1151 /* ------------------------------------------------------------------------ */
1152 /* build backup file name */
1154 build_backup_name(buffer, original)
1158 strcpy(buffer, original);
1159 modify_filename_extention(buffer, BACKUPNAME_EXTENTION); /* ".bak" */
1162 /* ------------------------------------------------------------------------ */
1164 build_standard_archive_name(buffer, orginal)
1168 strcpy(buffer, orginal);
1169 modify_filename_extention(buffer, ARCHIVENAME_EXTENTION); /* ".lzh" */
1172 /* ------------------------------------------------------------------------ */
1174 /* ------------------------------------------------------------------------ */
1184 for (i = 0; i < cmd_filec; i++) {
1185 if (patmatch(cmd_filev[i], name, 0))
1198 if ((fp = fopen(name, mode)) == NULL)
1199 fatal_error("Cannot open file \"%s\"", name);
1204 /* ------------------------------------------------------------------------ */
1206 /* ------------------------------------------------------------------------ */
1208 open_old_archive_1(name, v_fp)
1215 if (stat(name, &stbuf) >= 0 &&
1216 is_regularfile(&stbuf) &&
1217 (fp = fopen(name, READ_BINARY)) != NULL) {
1219 archive_file_gid = stbuf.st_gid;
1220 archive_file_mode = stbuf.st_mode;
1225 archive_file_gid = -1;
1229 /* ------------------------------------------------------------------------ */
1235 static char expanded_archive_name[FILENAME_LENGTH];
1237 if (!strcmp(archive_name, "-")) {
1238 if (cmd == CMD_EXTRACT || cmd == CMD_LIST) {
1240 setmode(fileno(stdin), O_BINARY);
1247 p = strrchr(archive_name, '.');
1249 if (strcasecmp(".LZH", p) == 0
1250 || strcasecmp(".LZS", p) == 0
1251 || strcasecmp(".COM", p) == 0 /* DOS SFX */
1252 || strcasecmp(".EXE", p) == 0
1253 || strcasecmp(".X", p) == 0 /* HUMAN SFX */
1254 || strcasecmp(".BAK", p) == 0) { /* for BackUp */
1255 open_old_archive_1(archive_name, &fp);
1260 if (open_old_archive_1(archive_name, &fp))
1262 xsnprintf(expanded_archive_name, sizeof(expanded_archive_name),
1263 "%s.lzh", archive_name);
1264 if (open_old_archive_1(expanded_archive_name, &fp)) {
1265 archive_name = expanded_archive_name;
1269 * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
1270 * expanded_archive_name; return NULL; }
1272 xsnprintf(expanded_archive_name, sizeof(expanded_archive_name),
1273 "%s.lzs", archive_name);
1274 if (open_old_archive_1(expanded_archive_name, &fp)) {
1275 archive_name = expanded_archive_name;
1279 * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
1280 * expanded_archive_name; return NULL; }
1283 * sprintf( expanded_archive_name , "%s.lzh",archive_name);
1284 * archive_name = expanded_archive_name;
1289 /* ------------------------------------------------------------------------ */
1291 inquire(msg, name, selective)
1292 char *msg, *name, *selective;
1298 fprintf(stderr, "%s %s ", name, msg);
1301 fgets(buffer, 1024, stdin);
1303 for (p = selective; *p; p++)
1304 if (buffer[0] == *p)
1305 return p - selective;
1310 /* ------------------------------------------------------------------------ */
1312 write_archive_tail(nafp)
1318 /* ------------------------------------------------------------------------ */
1320 copy_old_one(oafp, nafp, hdr)
1325 fseeko(oafp, hdr->header_size + hdr->packed_size, SEEK_CUR);
1328 reading_filename = archive_name;
1329 writing_filename = temporary_name;
1330 copyfile(oafp, nafp, hdr->header_size + hdr->packed_size, 0, 0);