Mail Archives: djgpp-workers/2011/02/19/16:40:04
Using djtar I observed that if a filename change file contains an empty line
the extraction of the file named in the previous line is skipped. E.g.:
/dir/foobar1.txt /dir/fb1.txt
/dir/foobar2.txt /dir/fb2.txt
/dir/foobar3.txt /dir/fb3.txt
in this case the file foobar1.txt would not be extracted as fb1.txt but
its extraction simply skipped. If the empty line between foobar1.txt and
foobar2.txt is removed all 3 files will be extracted and renamed according
to the specification given above. I assume that this behaviour is not
intentional. Any objections if the changes are commited.
Regards,
Juan M. Guerrero
diff -aprNU5 djgpp.orig/src/docs/kb/wc204.txi djgpp/src/docs/kb/wc204.txi
--- djgpp.orig/src/docs/kb/wc204.txi 2010-06-08 02:04:12 +0000
+++ djgpp/src/docs/kb/wc204.txi 2011-02-19 21:36:42 +0000
@@ -1193,5 +1193,10 @@ with other C compilers.
@findex realpath AT r{, and POSIX.1-2008 compliance}
If the pointer that shall point to the buffer that shall contain the resolved
path is a @code{NULL} pointer, then @code{realpath} will call @code{malloc} to allocate
a buffer of @code{PATH_MAX} bytes to store the resolved path name and return this
pointer to the caller.
+
+@pindex djtar AT r{, and empty lines in the filename change file}
+@code{djtar} now ignores empty lines in filename change files instead
+of skipping the extraction of the file named in the line before the
+empty line.
diff -aprNU5 djgpp.orig/src/utils/djtar/djtar.c djgpp/src/utils/djtar/djtar.c
--- djgpp.orig/src/utils/djtar/djtar.c 2011-02-17 11:32:32 +0000
+++ djgpp/src/utils/djtar/djtar.c 2011-02-19 21:28:16 +0000
@@ -101,31 +101,34 @@ static void
DoNameChanges(char *fname)
{
struct skip_dir_list * new_entry;
FILE *f = fopen(fname, "r");
char from[PATH_MAX], to[PATH_MAX];
- char line[PATH_MAX*2 + 10];
+ char line[PATH_MAX * 2 + 10];
if (f == 0)
{
perror(fname);
exit(1);
}
while (1)
{
fgets(line, sizeof(line), f);
if (feof(f))
break;
- to[0] = 0;
+ from[0] = to[0] = 0;
sscanf(line, "%s %s", from, to);
- if (to[0])
- store_entry(from, to);
- else
+ if (from[0])
{
- new_entry = xmalloc(sizeof(struct skip_dir_list));
- new_entry->skip_dir = xstrdup(from);
- new_entry->next = skip_dirs;
- skip_dirs = new_entry;
+ if (to[0])
+ store_entry(from, to);
+ else
+ {
+ new_entry = xmalloc(sizeof(struct skip_dir_list));
+ new_entry->skip_dir = xstrdup(from);
+ new_entry->next = skip_dirs;
+ skip_dirs = new_entry;
+ }
}
}
fclose(f);
}
- Raw text -