2014-06-29 05:24:33 +02:00
|
|
|
$NetBSD: patch-ai,v 1.5 2014/06/29 03:24:33 dholland Exp $
|
1999-11-12 06:17:20 +01:00
|
|
|
|
2014-06-29 05:24:33 +02:00
|
|
|
- use standard headers
|
|
|
|
- use printf formats matching types
|
|
|
|
- add zoo_pointer and logic related to it, appears to be a bug fix
|
|
|
|
- changes calling gettz() that should be reverted now that gettz() has
|
|
|
|
been fixed up
|
|
|
|
|
|
|
|
--- zoolist.c.orig 1991-07-19 22:57:27.000000000 +0000
|
2007-05-13 18:59:39 +02:00
|
|
|
+++ zoolist.c
|
2014-06-29 05:24:33 +02:00
|
|
|
@@ -18,10 +18,11 @@ duplicate information will be dumped.
|
|
|
|
Copyright (C) 1986, 1987 Rahul Dhesi -- All rights reserved
|
|
|
|
(C) Copyright 1988 Rahul Dhesi -- All rights reserved
|
|
|
|
*/
|
|
|
|
+#include <stdio.h>
|
2009-04-26 01:46:47 +02:00
|
|
|
#include "options.h"
|
|
|
|
#include "portable.h"
|
|
|
|
#include "zoomem.h" /* to get ZOOCOUNT */
|
|
|
|
-
|
|
|
|
+#include <time.h>
|
|
|
|
/* Lists files in archive */
|
|
|
|
#include "zoo.h"
|
|
|
|
#include "errors.i"
|
2014-06-29 05:24:33 +02:00
|
|
|
@@ -92,6 +93,7 @@ int genson = 1; /* enable/disable ge
|
2007-05-13 18:59:39 +02:00
|
|
|
int show_mode = 0; /* show file protection */
|
|
|
|
#endif
|
|
|
|
int first_dir = 1; /* if first direntry -- to adjust dat_ofs */
|
|
|
|
+unsigned long zoo_pointer = 0; /* Track our position in the file */
|
|
|
|
|
|
|
|
while (*option) {
|
|
|
|
switch (*option) {
|
2014-06-29 05:24:33 +02:00
|
|
|
@@ -211,6 +213,9 @@ if (fiz_ofs != 0L) { /* i
|
2007-05-13 18:59:39 +02:00
|
|
|
show_acmt (&zoo_header, zoo_file, 0); /* show archive comment */
|
|
|
|
}
|
|
|
|
|
|
|
|
+ /* Begin tracking our position in the file */
|
|
|
|
+ zoo_pointer = zoo_header.zoo_start;
|
|
|
|
+
|
|
|
|
/* Seek to the beginning of the first directory entry */
|
|
|
|
if (zooseek (zoo_file, zoo_header.zoo_start, 0) != 0) {
|
|
|
|
ercount++;
|
2014-06-29 05:24:33 +02:00
|
|
|
@@ -414,7 +419,7 @@ if (fiz_ofs != 0L) { /* i
|
2009-04-26 01:46:47 +02:00
|
|
|
if (direntry.fattr == 0)
|
|
|
|
printf ("--- ");
|
|
|
|
else if ((direntry.fattr >> 22) == 1)
|
|
|
|
- printf ("%03o ", direntry.fattr & 0x1ff);
|
|
|
|
+ printf ("%03o ", (unsigned int)direntry.fattr & 0x1ff);
|
|
|
|
else
|
|
|
|
printf ("??? ");
|
|
|
|
}
|
2014-06-29 05:24:33 +02:00
|
|
|
@@ -437,6 +442,11 @@ if (fiz_ofs != 0L) { /* i
|
2007-05-13 18:59:39 +02:00
|
|
|
if (verb_list && !fast)
|
|
|
|
show_comment (&direntry, zoo_file, 0, (char *) NULL);
|
|
|
|
} /* end if (lots of conditions) */
|
|
|
|
+
|
|
|
|
+ /* Make sure we are not seeking to already processed data */
|
|
|
|
+ if (direntry.next <= zoo_pointer)
|
|
|
|
+ prterror ('f', "ZOO chain structure is corrupted\n");
|
|
|
|
+ zoo_pointer = direntry.next;
|
|
|
|
|
|
|
|
/* ..seek to next dir entry */
|
|
|
|
zooseek (zoo_file, direntry.next, 0);
|
2014-06-29 05:24:33 +02:00
|
|
|
@@ -539,10 +549,12 @@ int file_tz;
|
1999-11-12 06:17:20 +01:00
|
|
|
{
|
|
|
|
long gettz();
|
|
|
|
int diff_tz; /* timezone difference */
|
2009-04-26 01:46:47 +02:00
|
|
|
+ time_t t;
|
1999-11-12 06:17:20 +01:00
|
|
|
if (file_tz == NO_TZ) /* if no timezone stored ..*/
|
|
|
|
printf (" "); /* .. just pad with blanks */
|
|
|
|
else {
|
|
|
|
- diff_tz = (file_tz / 4) - (int) (gettz() / 3600);
|
|
|
|
+ time(&t);
|
|
|
|
+ diff_tz = (file_tz / 4) - (int) (gettz(t) / 3600);
|
|
|
|
if (diff_tz == 0)
|
|
|
|
printf (" "); /* print nothing if same */
|
|
|
|
else if (diff_tz > 0) /* else print signed difference */
|