File cmsfs-sanitize.patch of Package cmsfs

diff -pur cmsfs-1.1.8.orig/cmsfsany.c cmsfs-1.1.8/cmsfsany.c
--- cmsfs-1.1.8.orig/cmsfsany.c	2003-07-18 01:40:14.000000000 +0200
+++ cmsfs-1.1.8/cmsfsany.c	2005-12-12 12:20:21.000000000 +0100
@@ -15,11 +15,49 @@
  *
  */
 
+#include        <stdio.h>
+#include        <unistd.h>
+#include        <malloc.h>
+#include        <string.h>
+#include        <ctype.h>
+#include        <fcntl.h>
+#include        <errno.h>
+#include        <time.h>
+
+#include        "cmsfs.h"
+
+#define         cmsfs_mktime(p)         mktime(p)
+#define be32_to_cpu(i) cmsfsbex((unsigned char *)&(i),4)
+#define be16_to_cpu(i) cmsfsbex((unsigned char *)&(i),2)
+
 /* ------------------------------------------------------------ CMSFSBEX
  *  This function was moved to cmsfsusa.c (the utility source).
  *  FS driver should use kernel header macros for endian conversion.
  */
 
+extern int chratoe(unsigned int c); 
+extern int stratoe(unsigned char *s); 
+extern int chretoa(unsigned int c); 
+extern int stretoa(unsigned char *s); 
+
+/* ------------------------------------------------------------ CMSFSBEX
+ *  Convert a big-endian integer into a local integer the slow way.
+ *  We do it this way in the utility to make it more reliable.
+ *  The driver can leverage kernel macros for optimal performance.
+ *  This function moved to this source file from cmsfsany.c for 1.1.8.
+ */
+int cmsfsbex ( unsigned char *ivalue , int l )
+  {
+    int         i , ovalue ;
+    ovalue = ivalue[0] ;
+    for (i = 1 ; i < l ; i++)
+      {
+        ovalue = ovalue << 8 ;
+        ovalue += ivalue[i] & 0xFF;
+      }
+    return ovalue ;
+  }
+
 /* ------------------------------------------------------------ CMSFSX2I
  *  CMS FS heXadecimal-to-Integer function
  *  The EDF filesystem uses several "packed decimal" fields.
@@ -72,7 +110,6 @@ int cmsfs_find_label(struct CMSSUPER *vo
     if (vol->pbksz == 0 || vol->pbksz == 512) {
 #ifdef  CMSFS_DEBUG
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_find_label(): trying FBA ...");
 #endif  /* CMSFS_DEBUG */
     /*  read FBA block #1 (second record)  */
@@ -175,8 +212,7 @@ int cmsfs_find_label(struct CMSSUPER *vo
 int cmsfs_map_ADT(struct CMSSUPER *vol)
   {
     int         i,      /*  a counter  */
-                rc,     /*  a return code  */
-                bktry;  /*  a trial blocksize  */
+                rc;     /*  a return code  */
 
     /*  partial "ADT" structure (per IBM)  */
     static
@@ -206,7 +242,6 @@ int cmsfs_map_ADT(struct CMSSUPER *vol)
     if (rc <= 0)
       {
         cmsfs_error(
-            (unsigned char*)
             "cmsfs_map_ADT(): cannot find a CMS1 label");
         return -1;
       }
@@ -286,7 +321,6 @@ int cmsfs_map_ADT(struct CMSSUPER *vol)
     if (vol->cmsrooti == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_map_ADT(): cannot allocate CMS directory inode");
         return -1;
       }
@@ -321,7 +355,6 @@ int cmsfs_map_ADT(struct CMSSUPER *vol)
     /*  (announce if debugging) dir inode is now allocd and mapped  */
 #ifdef  CMSFS_DEBUG
     cmsfs_error(
-        (unsigned char *)
         "cmsfs_map_ADT(): CMS dir inode allocated and mapped");
 #endif
 
@@ -561,7 +594,6 @@ void cmsfs_map_EXT(struct CMSINODE * fi)
     if (fi == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_map_EXT(): null CMS inode passed");
         return;
       }
@@ -570,7 +602,6 @@ void cmsfs_map_EXT(struct CMSINODE * fi)
     if (fi->cmssuper == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_map_EXT(): null CMS superblock in CMS inode");
         return;
       }
@@ -583,7 +614,6 @@ void cmsfs_map_EXT(struct CMSINODE * fi)
       {
 #ifdef  CMSFS_DEBUG
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_map_EXT(): initializing filetypes map");
 #endif
         fi->cmssuper->cmsfsext = cmsfsext;
@@ -604,7 +634,7 @@ void cmsfs_map_EXT(struct CMSINODE * fi)
     /*  step through the known types list,  looking for a match  */
     for (i = 0 ; fi->cmssuper->cmsfsext[i].ftype[0] != ' ' ; i++)
       {
-        if (strncmp(fi->ftype,
+        if (memcmp(fi->ftype,
             fi->cmssuper->cmsfsext[i].ftype,8) == 0x0000)
           {
             fi->flags = fi->cmssuper->cmsfsext[i].flags;
@@ -659,7 +689,7 @@ cmsfs_error(cmsfs_ermsg);
     if (rc != inode->cmssuper->blksz)
       {
         (void) sprintf((char*)cmsfs_ermsg,
-        "cmsfsrd2(): cmsfs_bread(,,%d,%d) returned %d",
+        "cmsfsrd2(): cmsfs_bread(,,%d,%ld) returned %d",
                         inode->origin-1+b1,inode->cmssuper->blksz,rc);
         cmsfs_error(cmsfs_ermsg);
         return rc;
@@ -690,7 +720,7 @@ cmsfs_error(cmsfs_ermsg);
         if (rc != inode->cmssuper->blksz)
           {
             (void) sprintf((char*)cmsfs_ermsg,
-            "cmsfsrd2(): cmsfs_bread(,,%d,%d) returned %d",
+            "cmsfsrd2(): cmsfs_bread(,,%d,%ld) returned %d",
                         inode->origin-1+b1,inode->cmssuper->blksz,rc);
             cmsfs_error(cmsfs_ermsg);
             return rc;
@@ -722,14 +752,12 @@ cmsfs_lookup(struct CMSINODE * di,unsign
     if (di->cmssuper == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_lookup(): missing CMS superblock allocation");
         return NULL;
       }
     if (di->cmssuper->cmsrooti == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_lookup(): missing CMS dir (root) inode allocation");
         return NULL;
       }
@@ -739,17 +767,15 @@ cmsfs_lookup(struct CMSINODE * di,unsign
     if (cmsinode == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_lookup(): cannot allocate CMS inode");
         return NULL;
       }
 
     /*  if we're opening the directory as a file, then ...  */
-    if (strncmp(fn,".dir",4) == 0)
+    if (memcmp(fn,".dir",4) == 0)
       {
 #ifdef  CMSFS_DEBUG
         (void) cmsfs_error(
-            (unsigned char *)
             "cmsfs_lookup(): opening directory");
 #endif
         (void) memcpy(cmsinode,
@@ -826,7 +852,7 @@ static  unsigned char buff[4096];
           }
         pp = &buff[j*di->cmssuper->fstsz];
         /*  compare  */
-        rc = strncmp(pp,umatch,16);
+        rc = memcmp(pp,umatch,16);
         if (rc == 0)    /*  found it??  */
           {
             /*  map the inode for the file  */
@@ -834,7 +860,6 @@ static  unsigned char buff[4096];
             if (rc != 0)
               {
             cmsfs_error(
-                    (unsigned char *)
                     "cmsfs_lookup(): cannot map CMS inode (FST)");
                 cmsfs_free(cmsinode);
                 di->cmssuper->inuse -= 1;
@@ -850,7 +875,6 @@ static  unsigned char buff[4096];
 
     di->cmssuper->error = di->cmssuper->cmsrooti->error = CMSFS_ENOENT;
 /*  cmsfs_error(
-        (unsigned char *)
         "cmsfs_lookup(): file not found");  */
     (void) sprintf((char*)cmsfs_ermsg,
         "cmsfs_lookup(): file '%s' not found",fn);
@@ -873,14 +897,12 @@ ssize_t cmsfs_read(struct CMSINODE * cms
     /*  sanity check:  file pointer must non-NULL  */
     if (cmsfil == NULL)
       { cmsfs_error(
-          (unsigned char *)
           "cmsfs_read(): NULL file pointer (inode pointer)");
         return -1; }
 
     /*  sanity check:  superblock pointer must non-NULL  */
     if (cmsfil->cmssuper == NULL)
       { cmsfs_error(
-          (unsigned char *)
           "cmsfs_read(): NULL volume pointer in file struct");
         return -1; }
 
@@ -898,7 +920,6 @@ ssize_t cmsfs_read(struct CMSINODE * cms
       { cmsfil->rdbuf = cmsfs_malloc(cmsfil->cmssuper->blksz);
     if (cmsfil->rdbuf == NULL)
       { cmsfs_error(
-          (unsigned char *)
           "cmsfs_read(): unable to allocate a work buffer");
         return -1; }
 #ifdef  CMSFS_DEBUG
@@ -912,7 +933,6 @@ cmsfs_error(cmsfs_ermsg);
         rc = cmsfsrd2(cmsfil,cmsfil->rdbuf,cmsfil->rdblk);
         if (rc != cmsfil->cmssuper->blksz)
           { cmsfs_error(
-              (unsigned char *)
               "cmsfs_read(): could not read block");
             return -1; }
         cmsfil->rdblk += 1;
@@ -940,7 +960,6 @@ cmsfs_error(cmsfs_ermsg);
                     rc = cmsfsrd2(cmsfil,cmsfil->rdbuf,cmsfil->rdblk);
                     if (rc != cmsfil->cmssuper->blksz)
                       { cmsfs_error(
-                          (unsigned char *)
                           "cmsfs_read(): could not read block");
                         return -1; }
                     cmsfil->rdblk += 1;
@@ -958,7 +977,6 @@ cmsfs_error(cmsfs_ermsg);
                     rc = cmsfsrd2(cmsfil,cmsfil->rdbuf,cmsfil->rdblk);
                     if (rc != cmsfil->cmssuper->blksz)
                       { cmsfs_error(
-                          (unsigned char *)
                           "cmsfs_read(): could not read block");
                         return -1; }
                     cmsfil->rdblk += 1;
@@ -968,7 +986,6 @@ cmsfs_error(cmsfs_ermsg);
                     break;
         default:    /*  Bzzzttt!!!  */
                 cmsfs_error(
-                    (unsigned char *)
                     "cmsfs_read(): RECFM not 'F' or 'V'");
                 return -1;
       }
@@ -976,8 +993,8 @@ cmsfs_error(cmsfs_ermsg);
     if (l > reclen)
       {
         (void) sprintf((char*)cmsfs_ermsg,
-            "cmsfs_read(): record (%d) is longer than buffer (%d)",
-            l,reclen);
+            "cmsfs_read(): record (%d) is longer than buffer (%lu)",
+            l,(unsigned long)reclen);
         cmsfs_error(cmsfs_ermsg);
 /* ADDED FOR DIAGNOSTICS */
         (void) sprintf((char*)cmsfs_ermsg,
@@ -1002,7 +1019,6 @@ cmsfs_error(cmsfs_ermsg);
             rc = cmsfsrd2(cmsfil,cmsfil->rdbuf,cmsfil->rdblk);
             if (rc != cmsfil->cmssuper->blksz)
               { cmsfs_error(
-                  (unsigned char *)
                   "cmsfs_read(): could not read block");
                 return -1; }
             cmsfil->rdblk += 1;
@@ -1069,7 +1085,6 @@ long int cmsfs_bytes(struct CMSINODE * f
             if (fi->rdbuf2 == NULL)
               {
                 cmsfs_error(
-            (unsigned char *)
                     "cmsfs_lookup(): cannot allocate CMS inode");
                 return -1;
               }
@@ -1090,7 +1105,6 @@ long int cmsfs_bytes(struct CMSINODE * f
 
         default:    fi->error = CMSFS_EINTERNAL;  /*  internal error  */
                     cmsfs_error(
-                    (unsigned char *)
                     "cmsfs_bytes(): RECFM not 'F' or 'V'");
                     return 0;
       }
Only in cmsfs-1.1.8: cmsfsany.c~
diff -pur cmsfs-1.1.8.orig/cmsfscat.c cmsfs-1.1.8/cmsfscat.c
--- cmsfs-1.1.8.orig/cmsfscat.c	2003-07-18 02:09:56.000000000 +0200
+++ cmsfs-1.1.8/cmsfscat.c	2005-12-12 12:08:43.000000000 +0100
@@ -22,6 +22,7 @@
 
 #include        <stdlib.h>
 #include        <stdio.h>
+#include        <unistd.h>
 /* cheezy way to get time_t def'd */
 #include        <utime.h>
 
@@ -30,9 +31,9 @@
 #define  USAGE  "Usage: %s [ -d cmsvol ] [ -a | -i ] cmsfile [cmsfile ...]\n"
 
 /* ------------------------------------------------------------------ */
-int main(int argc,unsigned char *argv[])
+int main(int argc,char *argv[])
   {
-    int         i, rc, j, k, l, catflags;
+    int         i, rc, catflags;
     unsigned char *devname, *filename;
     unsigned  char  *buffer;
 
@@ -55,7 +56,7 @@ int main(int argc,unsigned char *argv[])
         (void) printf(USAGE,argv[0]);
                         return 0;
             case 'd':
-            case 'f':   devname = argv[++i] ;
+            case 'f':   devname = (unsigned char *)argv[++i] ;
                         break;
             case 'a':   /* ASCII (plain text) */
                         catflags |= CMSFSTXT;
@@ -88,7 +89,7 @@ int main(int argc,unsigned char *argv[])
     /*  for each source file ...  */
     for ( ; i < argc ; i++ )
       {
-        filename = argv[i];
+        filename = (unsigned char *)argv[i];
 
         /*  open the source file (CMS file)  */
         cmsfile = cmsfs_open(filename,catflags,devname);
Only in cmsfs-1.1.8: cmsfscat.c~
diff -pur cmsfs-1.1.8.orig/cmsfsck.c cmsfs-1.1.8/cmsfsck.c
--- cmsfs-1.1.8.orig/cmsfsck.c	2002-12-30 19:59:19.000000000 +0100
+++ cmsfs-1.1.8/cmsfsck.c	2005-12-12 12:23:06.000000000 +0100
@@ -17,9 +17,9 @@
 
 #define  USAGE  "Usage: %s cmsvol [ cmsvol ... ] \n"
 
-int main(int argc,unsigned char *argv[])
+int main(int argc,char *argv[])
   {
-    int         i, j, k, rc, percent;
+    int         i, rc;
     struct  CMSSUPER  *tempvols;
 
     /*  process options  */
@@ -55,7 +55,7 @@ int main(int argc,unsigned char *argv[])
     while (i < argc)
       {
         /*  'mount'  it to validate the ADT and directory FST  */
-        tempvols = cmsfs_vopen(argv[i]);
+        tempvols = cmsfs_vopen((unsigned char *)argv[i]);
         if (tempvols == NULL)
           {
             (void) fprintf(stderr,"'%s' is not a CMS volume.\n",argv[i]);
Only in cmsfs-1.1.8: cmsfsck.c~
diff -pur cmsfs-1.1.8.orig/cmsfscp.c cmsfs-1.1.8/cmsfscp.c
--- cmsfs-1.1.8.orig/cmsfscp.c	2003-07-18 01:40:52.000000000 +0200
+++ cmsfs-1.1.8/cmsfscp.c	2005-12-12 12:24:47.000000000 +0100
@@ -22,9 +22,11 @@
  *
  */
 
+#include        <unistd.h>
+#include        <string.h>
 #include        <fcntl.h>
 #include        <utime.h>
-/*  #include        <malloc.h>  */
+#include        <malloc.h>
 #include        <sys/stat.h>
 #include        <stdio.h>
 
@@ -32,7 +34,7 @@
 
 #define  USAGE  "Usage: %s [ -d cmsvol ] [ -a | -i ] cmsfile unixfile\n"
 
-int main(int argc,unsigned char *argv[])
+int main(int argc,char *argv[])
   {
     struct  utimbuf  stdtime;
     struct  CMSINODE  *cmsfile;         /*  CMS file handle  */
@@ -60,7 +62,7 @@ int main(int argc,unsigned char *argv[])
         (void) fprintf(stderr,USAGE,argv[0]);
                         return 0;
             case 'd':
-            case 'f':   devname = argv[++i] ;
+            case 'f':   devname = (unsigned char *)argv[++i] ;
                         break;
             case 'a':   /* ASCII (plain text) */
                         cmsflags |= CMSFSTXT;
@@ -100,7 +102,7 @@ int main(int argc,unsigned char *argv[])
 
     /*  target practice:  if more than three args,
         then the last arg (the "target") must be a directory  */
-    target = argv[argc-1];
+    target = (unsigned char *)argv[argc-1];
     rc = stat((char*)target,&targstat);
 
     /*  if stat() failed,  then file probably does not exist,
@@ -117,7 +119,7 @@ int main(int argc,unsigned char *argv[])
     /*  for each source file ...  */
     for ( ; i < argl ; i++ )
       {
-        source = argv[i];
+        source = (unsigned char *)argv[i];
 
         /*  open the source file (CMS file)  */
         cmsfile = cmsfs_open(source,cmsflags,devname);
@@ -134,7 +136,7 @@ int main(int argc,unsigned char *argv[])
                 _bname++;
               }
             if (*sbname == '/') sbname++;
-            if (strlen(target) + strlen(sbname) > 254)
+            if (strlen((char *)target) + strlen((char *)sbname) > 254)
               {
                 (void) fprintf(stderr,"filename too long\n");
                 return -1;
@@ -143,7 +145,7 @@ int main(int argc,unsigned char *argv[])
           }
         else
           {
-            if (strlen(target) > 255)
+            if (strlen((char *)target) > 255)
               {
                 (void) fprintf(stderr,"filename too long\n");
                 return -1;
Only in cmsfs-1.1.8: cmsfscp.c~
diff -pur cmsfs-1.1.8.orig/cmsfs.h cmsfs-1.1.8/cmsfs.h
--- cmsfs-1.1.8.orig/cmsfs.h	2003-07-18 01:40:29.000000000 +0200
+++ cmsfs-1.1.8/cmsfs.h	2005-12-12 12:11:31.000000000 +0100
@@ -462,7 +462,7 @@ struct cmsfs_tm
 /* ------------------------------------------------------------------ *
  *  Function Prototypes used by all CMS FS implementations            *
  * ------------------------------------------------------------------ */
-void cmsfs_error(unsigned char *);
+void cmsfs_error(char *);
 int cmsfs_bread(struct CMSSUPER *,void *,int,int);
 void *cmsfs_malloc(int);
 void cmsfs_free(void *);
@@ -472,6 +472,7 @@ int cmsfs_map_FST(struct CMSINODE *,stru
 void cmsfs_map_EXT(struct CMSINODE *);
 struct CMSINODE * cmsfs_lookup(struct CMSINODE *,unsigned char *);
 ssize_t cmsfs_read(struct CMSINODE *,void *,size_t);
+int cmsfsrd2(struct CMSINODE *inode,void *buffer,int block);
 
 /* ------------------------------------------------------------------ *
  *  Function Prototypes used by the utility                           *
@@ -502,7 +503,7 @@ void cmsfs_xdump(unsigned char *,int);
 /* ------------------------------------------------------------------ *
  *  Global Static (tough on radio reception, eh?)                     *
  * ------------------------------------------------------------------ */
-static unsigned char cmsfs_ermsg[256];
+static char cmsfs_ermsg[256];
 
 
 
Only in cmsfs-1.1.8: cmsfs.h~
diff -pur cmsfs-1.1.8.orig/cmsfslst.c cmsfs-1.1.8/cmsfslst.c
--- cmsfs-1.1.8.orig/cmsfslst.c	2002-12-30 23:07:14.000000000 +0100
+++ cmsfs-1.1.8/cmsfslst.c	2005-12-12 12:10:50.000000000 +0100
@@ -15,9 +15,9 @@
 #define  USAGE  "Usage: %s -d cmsvol\n"
 
 /* ------------------------------------------------------------------ */
-int main(int argc,unsigned char *argv[])
+int main(int argc,char *argv[])
   {
-    int         i, j, k, rc, percent;
+    int         i, j, k, rc;
     unsigned char  *devname;
     struct  CMSSUPER  *tempvols;
     struct  CMSINODE  *dirinode, tmpinode;
@@ -37,7 +37,7 @@ int main(int argc,unsigned char *argv[])
         (void) fprintf(stderr,USAGE,argv[0]);
                         return 0;
             case 'd':
-            case 'f':   devname = argv[++i] ;
+            case 'f':   devname = (unsigned char *)argv[++i] ;
                         break;
             default:
                         (void) fprintf(stderr,
@@ -80,7 +80,7 @@ BLKSZ   FILES  BLKS USED-(%) BLKS LEFT  
     if (dirinode->items != tempvols->files)
       {
         (void) fprintf(stderr,
-            "corrupted filesystem; #files (%d) != #dir items (%d)\n",
+            "corrupted filesystem; #files (%ld) != #dir items (%d)\n",
             tempvols->files,dirinode->items);
         (void) cmsfs_fclose(dirinode);
         (void) cmsfs_vclose(tempvols);
Only in cmsfs-1.1.8: cmsfslst.c~
diff -pur cmsfs-1.1.8.orig/cmsfs.makefile cmsfs-1.1.8/cmsfs.makefile
--- cmsfs-1.1.8.orig/cmsfs.makefile	2005-12-12 11:28:20.000000000 +0100
+++ cmsfs-1.1.8/cmsfs.makefile	2005-12-12 12:16:34.000000000 +0100
@@ -180,10 +180,18 @@ cmsfsls.o:      cmsfsls.c cmsfs.h aecs.h
 
 #
 #
-libcmsfs.a:     cmsfsusa.c cmsfsany.c cmsfs.h aecs.o aecs.h
-                $(CC) $(DEFINES) \
-                        -c cmsfsusa.c -o cmsfsusa.o
-                ar q libcmsfs.a cmsfsusa.o aecs.o
+libcmsfs.a:     cmsfsusa.o cmsfsany.o aecs.o
+                ar q libcmsfs.a cmsfsusa.o cmsfsany.o aecs.o
+
+#
+#
+cmsfsusa.o:	cmsfsusa.c cmsfs.h
+                $(CC) $(DEFINES) -c cmsfsusa.c
+
+#
+#
+cmsfsany.o:	cmsfsany.c cmsfs.h
+                $(CC) $(DEFINES) -c cmsfsany.c
 
 #
 #
diff -pur cmsfs-1.1.8.orig/cmsfsusa.c cmsfs-1.1.8/cmsfsusa.c
--- cmsfs-1.1.8.orig/cmsfsusa.c	2003-07-18 01:41:22.000000000 +0200
+++ cmsfs-1.1.8/cmsfsusa.c	2005-12-12 12:20:18.000000000 +0100
@@ -11,19 +11,23 @@
  *
  */
 
-#include        <time.h>
 #include        <stdio.h>
-/*  #include        <malloc.h>  */
+#include        <unistd.h>
+#include        <malloc.h>
+#include        <string.h>
+#include        <ctype.h>
 #include        <fcntl.h>
 #include        <errno.h>
 
 #include        "cmsfs.h"
 /* #include     "aecs.h" */
 
+extern int chratoe(unsigned int c); 
+
 /* --------------------------------------------------------- CMSFS_ERROR
  *  Generally a printk() operation, not really perror() function.
  */
-void cmsfs_error(unsigned char * string)
+void cmsfs_error(char * string)
   {
     (void) fprintf(stderr,"%s\n",string);
     (void) fflush(stderr);
@@ -53,7 +57,6 @@ int cmsfs_bread(struct CMSSUPER *vol,voi
     if (vol->vfssuper != NULL)  /*  are we in "utility mode"?  */
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_bread(): non-NULL VFS superblock pointer");
         return -1;
       }
@@ -65,7 +68,7 @@ int cmsfs_bread(struct CMSSUPER *vol,voi
         (void) perror("lseek()");
         (void) sprintf((char*)cmsfs_ermsg,
             "cmsfs_bread(): error from lseek(), RC=%d",rc);
-        cmsfs_error((unsigned char *)cmsfs_ermsg);
+        cmsfs_error(cmsfs_ermsg);
         return -1;
       }
 
@@ -102,34 +105,6 @@ void cmsfs_free(void * buffer)
     return;
   }
 
-/* ------------------------------------------------------------ CMSFSBEX
- *  Convert a big-endian integer into a local integer the slow way.
- *  We do it this way in the utility to make it more reliable.
- *  The driver can leverage kernel macros for optimal performance.
- *  This function moved to this source file from cmsfsany.c for 1.1.8.
- */
-int cmsfsbex ( unsigned char *ivalue , int l )
-  {
-    int         i , ovalue ;
-    ovalue = ivalue[0] ;
-    for (i = 1 ; i < l ; i++)
-      {
-        ovalue = ovalue << 8 ;
-        ovalue += ivalue[i] & 0xFF;
-      }
-    return ovalue ;
-  }
-
-
-
-/* ================================================================== */
-/* include the common code here */
-
-
-#define         cmsfs_mktime(p)         mktime(p)
-#define be32_to_cpu(i) cmsfsbex((unsigned char *)&(i),4)
-#define be16_to_cpu(i) cmsfsbex((unsigned char *)&(i),2)
-#include        "cmsfsany.c"
 
 
 /* utility mode stuff follows ... */
@@ -148,7 +123,6 @@ struct CMSSUPER * cmsfs_vopen(unsigned c
     /*  utility mode "volume open"  */
 #ifdef  CMSFS_DEBUG
     cmsfs_error(
-        (unsigned char *)
         "cmsfs_vopen(), aka: cmsfs_mount() from user space");
 #endif
 
@@ -156,7 +130,7 @@ struct CMSSUPER * cmsfs_vopen(unsigned c
     cmssuper = cmsfs_malloc(sizeof(struct CMSSUPER));
     if (cmssuper == NULL)
       {
-        cmsfs_error((unsigned char *)"cannot allocate CMS superblock");
+        cmsfs_error("cannot allocate CMS superblock");
         return NULL;
       }
     cmssuper->vfssuper = NULL;         /*  we are NOT in kernel mode  */
@@ -201,7 +175,6 @@ struct CMSSUPER * cmsfs_vopen(unsigned c
     if (cmssuper->cmsrooti == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_vopen(): cmsfs_map_ADT() set a NULL root inode");
         (void) close(cmssuper->devfd);
         cmsfs_free(cmssuper);
@@ -226,7 +199,7 @@ struct CMSSUPER * cmsfs_vopen(unsigned c
 int cmsfs_vclose(struct CMSSUPER *vol)
   {
 #ifdef  CMSFS_DEBUG
-    cmsfs_error((unsigned char *)"cmsfs_vclose()");
+    cmsfs_error("cmsfs_vclose()");
 #endif
 
     /*  confirm all files in this filesystem are closed  */
@@ -234,7 +207,6 @@ int cmsfs_vclose(struct CMSSUPER *vol)
     if (vol->inuse != 1)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_vclose(): cannot close volume with open files");
         vol->error = CMSFS_EBUSY;
         return -1;
@@ -273,8 +245,6 @@ cmsfs_fopen(unsigned char * fn,struct CM
     int         rc, i, j, k;
     struct  CMSINODE  *cmsinode;
     unsigned char  umatch[18], xmatch[18], *p;
-    struct  CMSFSFST  cmsfst;   /*  "FST" structure (per IBM)  */
-    int         start;
 
     /*  utility mode "file open" operation  */
 #ifdef  CMSFS_DEBUG
@@ -289,14 +259,12 @@ cmsfs_fopen(unsigned char * fn,struct CM
     if (cmssuper->cmsrooti == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_fopen(): NULL directory inode pointer");
         return NULL;
       }
     if (cmssuper->cmsrooti->cmssuper != cmssuper)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_fopen(): corrupted directory inode");
         return NULL;
       }
@@ -306,17 +274,15 @@ cmsfs_fopen(unsigned char * fn,struct CM
     if (cmsinode == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_fopen(): cannot allocate CMS inode");
         return NULL;
       }
 
     /*  if we're opening the directory as a file, then ...  */
-    if (strncmp(fn,".dir",4) == 0)
+    if (memcmp(fn,".dir",4) == 0)
       {
 #ifdef  CMSFS_DEBUG
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_fopen(): opening directory");
 #endif
         (void) memcpy(cmsinode,cmssuper->cmsrooti,sizeof(*cmsinode));
@@ -411,7 +377,7 @@ cmsfs_fopen(unsigned char * fn,struct CM
           }
         pp = &buff[j*cmssuper->fstsz];
         /*  compare  */
-        rc = strncmp(pp,umatch,16);
+        rc = memcmp(pp,umatch,16);
         if (rc == 0)    /*  found it??  */
           {
             /*  map the inode for the file  */
@@ -420,7 +386,6 @@ cmsfs_fopen(unsigned char * fn,struct CM
               {
                 (void) perror("cmsfs_map_FST()");
                 cmsfs_error(
-                    (unsigned char *)
                     "cannot map CMS inode (FST)");
                 cmsfs_free(cmsinode);
                 return NULL;
@@ -433,7 +398,7 @@ cmsfs_fopen(unsigned char * fn,struct CM
       }
 
     cmssuper->error = cmssuper->cmsrooti->error = CMSFS_ENOENT;
-    cmsfs_error((unsigned char *)"file not found");
+    cmsfs_error("file not found");
     return NULL;
   }
 
@@ -443,13 +408,12 @@ cmsfs_fopen(unsigned char * fn,struct CM
 int cmsfs_fclose(struct CMSINODE *inode)
   {
 #ifdef  CMSFS_DEBUG
-    cmsfs_error((unsigned char *)"cmsfs_fclose()");
+    cmsfs_error("cmsfs_fclose()");
 #endif
 
     if (inode->cmssuper->inuse <= 0)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_fclose(): open files count is corrupted");
         inode->cmssuper->error = EMFILE;
         return -1;
@@ -488,7 +452,7 @@ struct CMSINODE * cmsfs_open(unsigned ch
     vn = (unsigned char*) dn;
 
     /*  allocate a work buffer for volid & fileid parsing  */
-    filetemp = cmsfs_malloc(strlen(filepath)+1);
+    filetemp = cmsfs_malloc(strlen((char *)filepath)+1);
     if (filetemp == NULL) return NULL;
 
     /*  copy the string,  looking for slashes  (std path delim)  */
@@ -514,7 +478,6 @@ struct CMSINODE * cmsfs_open(unsigned ch
     if (vn == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_open(): incomplete path or missing volume spec");
         return NULL;
       }
@@ -545,7 +508,6 @@ int cmsfs_close(struct CMSINODE * cms_fi
     if (cms_file == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_close(): NULL file pointer");
         return -1;
       }
@@ -555,7 +517,6 @@ int cmsfs_close(struct CMSINODE * cms_fi
     if (cms_sblk == NULL)
       {
         cmsfs_error(
-            (unsigned char *)
             "cmsfs_close(): NULL volume pointer");
         return -1;
       }
@@ -582,7 +543,7 @@ void cmsfs_xdump(unsigned char *p,int l)
     i = 0;
     while (i < l)
       {
-        q = cmsfs_ermsg;
+        q = (unsigned char *)cmsfs_ermsg;
 
         (void) sprintf(
                 (char*)q,"%02X%02X%02X%02X %02X%02X%02X%02X ",
Only in cmsfs-1.1.8: cmsfsusa.c~
diff -pur cmsfs-1.1.8.orig/cmsfsvol.c cmsfs-1.1.8/cmsfsvol.c
--- cmsfs-1.1.8.orig/cmsfsvol.c	2003-07-18 01:38:57.000000000 +0200
+++ cmsfs-1.1.8/cmsfsvol.c	2005-12-12 12:22:42.000000000 +0100
@@ -15,12 +15,10 @@
 #define  USAGE  "Usage: %s [ -d ] cmsvol [cmsvol ...]\n"
 
 /* ------------------------------------------------------------------ */
-int main(int argc,unsigned char *argv[])
+int main(int argc,char *argv[])
   {
     int         i, percent;
     struct  CMSSUPER  *tempvols;
-    struct  CMSINODE  dirinode, tmpinode;
-    struct tm *ftime;
 
     /*  process options  */
     for (i = 1 ; i < argc && argv[i][0] == '-' ; i++)
@@ -52,12 +50,12 @@ int main(int argc,unsigned char *argv[])
 
     /*  print a header;  looks like CMS  */
     (void) printf("LABEL  VDEV M  STAT   CYL TYPE \
-BLKSZ   FILES  BLKS USED-(%) BLKS LEFT  BLK TOTAL\n");
+BLKSZ   FILES  BLKS USED-(%%) BLKS LEFT  BLK TOTAL\n");
 
     for (      ; i < argc ; i++)
       {
         /*  open the volume  */
-        tempvols = cmsfs_vopen(argv[i]);
+        tempvols = cmsfs_vopen((unsigned char *)argv[i]);
         if (tempvols == NULL)
           {
             (void) fprintf(stderr,"'%s' is not a CMS volume.\n",argv[i]);
@@ -66,8 +64,8 @@ BLKSZ   FILES  BLKS USED-(%) BLKS LEFT  
 
         /*  report on the volume  */
         percent = ( tempvols->bkused * 100 ) / tempvols->blocks;
-        (void) printf("%-6s .... ... R/O %5d .... %4d %8d %10d-%02d %10d \
-%10d\n",tempvols->volid,tempvols->ncyls,tempvols->blksz,tempvols->files,
+        (void) printf("%-6s .... ... R/O %5d .... %4ld %8ld %10ld-%02d %10ld \
+%10ld\n",tempvols->volid,tempvols->ncyls,tempvols->blksz,tempvols->files,
 tempvols->bkused,percent,tempvols->bkfree,tempvols->blocks);
 
         /*  close the volume  */
Only in cmsfs-1.1.8: cmsfsvol.c~