fix man page source typos that cause lintian warnings
[debian/cpmtools] / cpmls.c
diff --git a/cpmls.c b/cpmls.c
index 1db4fba2748f6207f14e65893366bb326cbff5db..3721d2e0bb7c3d50e4169024032b0485e74768a5 100644 (file)
--- a/cpmls.c
+++ b/cpmls.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 
 #include "getopt_.h"
 #include "cpmfs.h"
@@ -116,6 +117,10 @@ static void oldddir(char **dirent, int entries, struct cpmInode *ino)
           {
             tmp=localtime(&statbuf.mtime);
             printf("  %02d-%s-%04d %02d:%02d",tmp->tm_mday,month[tmp->tm_mon],tmp->tm_year+1900,tmp->tm_hour,tmp->tm_min);
+          }
+          else if (statbuf.ctime) printf("                   ");
+          if (statbuf.ctime)
+          {
             tmp=localtime(&statbuf.ctime);
             printf("  %02d-%s-%04d %02d:%02d",tmp->tm_mday,month[tmp->tm_mon],tmp->tm_year+1900,tmp->tm_hour,tmp->tm_min);
           }
@@ -189,10 +194,17 @@ static void old3dir(char **dirent, int entries, struct cpmInode *ino)
           else if (attrib & CPM_ATTR_PWWRITE) printf("Write  ");
           else if (attrib & CPM_ATTR_PWDEL)   printf("Delete "); 
           else printf("None   ");
-          tmp=localtime(&statbuf.mtime);
-          printf("%02d/%02d/%02d %02d:%02d  ",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min);
-          tmp=localtime(&statbuf.ctime);
-          printf("%02d/%02d/%02d %02d:%02d",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min);
+          if (statbuf.mtime)
+          {
+            tmp=localtime(&statbuf.mtime);
+            printf("%02d/%02d/%02d %02d:%02d  ",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min);
+          }
+          else if (statbuf.ctime) printf("                ");
+          if (statbuf.ctime)
+          {
+            tmp=localtime(&statbuf.ctime);
+            printf("%02d/%02d/%02d %02d:%02d",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min);
+          }
           putchar('\n');
           ++l;
         }
@@ -325,7 +337,7 @@ int main(int argc, char *argv[])
   /* variables */ /*{{{*/
   const char *err;
   const char *image;
-  const char *format=FORMAT;
+  const char *format;
   const char *devopts=NULL;
   int c,usage=0;
   struct cpmSuperBlock drive;
@@ -340,6 +352,7 @@ int main(int argc, char *argv[])
   /*}}}*/
 
   /* parse options */ /*{{{*/
+  if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
   while ((c=getopt(argc,argv,"cT:f:ih?dDFlA"))!=EOF) switch(c)
   {
     case 'f': format=optarg; break;
@@ -360,21 +373,21 @@ int main(int argc, char *argv[])
 
   if (usage)
   {
-#if HAVE_LIBDSK_H
     fprintf(stderr,"Usage: %s [-f format] [-T libdsk-type] [-d|-D|-F|-A|[-l][-c][-i]] image [file ...]\n",cmd);
-#else
-    fprintf(stderr,"Usage: %s [-f format] [-d|-D|-F|-A|[-l][-c][-i]] image [file ...]\n",cmd);
-#endif
     exit(1);
   }
   /*}}}*/
   /* open image */ /*{{{*/
   if ((err=Device_open(&drive.dev,image,O_RDONLY,devopts))) 
   {
-    fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err);
+    fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
+    exit(1);
+  }
+  if (cpmReadSuper(&drive,&root,format)==-1)
+  {
+    fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
   }
-  cpmReadSuper(&drive,&root,format);
   /*}}}*/
   if (optind<argc) cpmglob(optind,argc,argv,&root,&gargc,&gargv);
   else cpmglob(0,1,star,&root,&gargc,&gargv);