iustin / mt-st

Magnetic tape control tools for Linux SCSI tapes
Other
41 stars 12 forks source link

Code cleanup patch from SUSE package #6

Closed svalx closed 8 years ago

svalx commented 8 years ago

May be this make mt-st better.

Index: mt-st-1.2/mt.c
===================================================================
--- mt-st-1.2.orig/mt.c
+++ mt-st-1.2/mt.c
@@ -28,9 +28,11 @@
 #define DEFTAPE "/dev/tape"     /* default tape device */
 #endif /* DEFTAPE */

-typedef int (* cmdfunc)(/* int, struct cmdef_tr *, int, char ** */);
+typedef struct cmdef_tr cmdef_tr;

-typedef struct cmdef_tr {
+typedef int (* cmdfunc)(int, struct cmdef_tr *, int, char **);
+
+struct cmdef_tr {
     char *cmd_name;
     int cmd_code;
     cmdfunc cmd_function;
@@ -38,7 +40,7 @@ typedef struct cmdef_tr {
     unsigned char cmd_fdtype;
     unsigned char arg_cnt;
     int error_tests;
-} cmdef_tr;
+};

 #define NO_FD      0
 #define FD_RDONLY  1
@@ -163,7 +165,7 @@ static cmdef_tr cmds[] = {
     0 },
     { "stshowoptions", 0,         do_show_options, 0,  FD_RDONLY, ONE_ARG,
     0 },
-    { NULL, 0, 0, 0, 0, 0, 0 }
+    { NULL, 0, 0, 0, NO_FD, NO_ARGS, 0 }
 };

@@ -545,7 +547,8 @@ do_options(int mtfd, cmdef_tr *cmd, int

 /* Tell where the tape is */
        static int
-do_tell(int mtfd, cmdef_tr *cmd, int argc, char **argv)
+do_tell(int mtfd, cmdef_tr *cmd __attribute__((unused)),
+       int argc __attribute__((unused)), char **argv __attribute__((unused)))
 {
     struct mtpos mt_pos;

@@ -560,7 +563,7 @@ do_tell(int mtfd, cmdef_tr *cmd, int arg

 /* Position the tape to a specific location within a specified partition */
        static int
-do_partseek(int mtfd, cmdef_tr *cmd, int argc, char **argv)
+do_partseek(int mtfd, cmdef_tr *cmd __attribute__((unused)), int argc, char **argv)
 {
     struct mtop mt_com;

@@ -583,7 +586,7 @@ do_partseek(int mtfd, cmdef_tr *cmd, int
 /* Position to start of file n. This might be implemented more intelligently
    some day. */
        static int
-do_asf(int mtfd, cmdef_tr *cmd, int argc, char **argv)
+do_asf(int mtfd, cmdef_tr *cmd __attribute__((unused)), int argc, char **argv)
 {
     struct mtop mt_com;

@@ -608,7 +611,9 @@ do_asf(int mtfd, cmdef_tr *cmd, int argc
/*** Decipher the status ***/

        static int
-do_status(int mtfd, cmdef_tr *cmd, int argc, char **argv)
+do_status(int mtfd, cmdef_tr *cmd __attribute__((unused)),
+       int argc __attribute__((unused)),
+       char **argv __attribute__((unused)))
 {
     struct mtget status;
     int dens;
@@ -769,7 +774,10 @@ static int do_show_options(int mtfd, cmd

 /* Print a list of possible density codes */
        static int
-print_densities(int fd, cmdef_tr *cmd, int argc, char **argv)
+print_densities(int fd __attribute__((unused)),
+       cmdef_tr *cmd __attribute__((unused)),
+       int argc __attribute__((unused)),
+       char **argv __attribute__((unused)))
 {
     unsigned int i, offset;

Index: mt-st-1.2/stinit.c
===================================================================
--- mt-st-1.2.orig/stinit.c
+++ mt-st-1.2/stinit.c
@@ -208,7 +208,7 @@ num_arg(char *t)

        static int
-next_block(FILE *dbf, char *buf, int buflen, int limiter)
+next_block(FILE *dbf, char *buf, int buflen __attribute__((unused)), int limiter)
 {
     int len;
     char *cp, *bp;