Whamcloud - gitweb
ChangeLog, debugfs.8.in, debugfs.c:
authorTheodore Ts'o <tytso@mit.edu>
Sat, 27 Jun 1998 05:11:14 +0000 (05:11 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 27 Jun 1998 05:11:14 +0000 (05:11 +0000)
  Add a -V option which displays the current version.
ChangeLog, unix.c:
  unix.c (e2fsck_update_progress): Remove unused variables.
ChangeLog, inode.c:
  inode.c (get_next_blockgroup): Fix bug where if get_next_blockgroup()
   is called early because of a missing inode table in a block group, the
   current_inode counter wasn't incremented correctly.
ChangeLog, tst_uuid.c:
  tst_uuid.c (main): Fixed bogus declaration of the main's argv parameter.
ChangeLog, test_icount.c:
  test_icount.c (main): Fix main() declaration so that it returns int,
   not void.
Many files:
  fsck.c (ignore): Remove unused variable cp.
  chattr.c (fatal_error):
  tune2fs.c (usage):
  lsattr.c (usage):
  dumpe2fs.c (usage):
  badblocks.c (usage): Remove volatile from declaration.
  fsck.c: Change use of strdup to be string_copy, since we don't trust
   what glibc is doing with strdup.  (Whatever it is, it isn't pretty.)

20 files changed:
debugfs/ChangeLog
debugfs/debugfs.8.in
debugfs/debugfs.c
e2fsck/ChangeLog
e2fsck/unix.c
lib/ext2fs/ChangeLog
lib/ext2fs/inode.c
lib/uuid/ChangeLog
lib/uuid/tst_uuid.c
misc/ChangeLog
misc/badblocks.c
misc/chattr.c
misc/dumpe2fs.c
misc/fsck.c
misc/lsattr.c
misc/mke2fs.8.in
misc/mke2fs.c
misc/tune2fs.c
tests/progs/ChangeLog
tests/progs/test_icount.c

index bac2536..55ed7c0 100644 (file)
@@ -1,3 +1,7 @@
+1998-06-27  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * debugfs.c: Add a -V option which displays the current version.
+
 1998-03-31  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * Makefile.in: Change to use new installation directory variables
index 0e81ca1..bc4928e 100644 (file)
@@ -8,9 +8,6 @@ debugfs \- ext2 file system debugger
 .SH SYNOPSIS
 .B debugfs
 [
-.B \-w
-]
-[
 .B \-f 
 cmd_file
 ]
@@ -19,8 +16,14 @@ cmd_file
 request
 ]
 [
+.B \-V
+]
+[
+.B \-w
+[
 device
 ]
+]
 .SH DESCRIPTION
 The 
 .B debugfs 
@@ -52,6 +55,11 @@ Causes
 to execute the single command 
 .IR request ,
 and then exit.
+.TP
+.I -V
+print the version number of 
+.B debugfs
+and exit.
 .SH COMMANDS
 .B debugfs
 is an interactive debugger. It understands a number of commands.
index 3c66795..2cbad64 100644 (file)
@@ -35,6 +35,8 @@ extern int optreset;          /* defined by BSD, but not others */
 #include "debugfs.h"
 #include "uuid/uuid.h"
 
+#include "../version.h"
+
 extern ss_request_table debug_cmds;
 
 ext2_filsys current_fs = NULL;
@@ -1353,7 +1355,7 @@ int main(int argc, char **argv)
 {
        int             retval;
        int             sci_idx;
-       const char      *usage = "Usage: debugfs [[-w] device]";
+       const char      *usage = "Usage: debugfs [-f cmd_file] [-R request] [-V] [[-w] device]";
        int             c;
        int             open_flags = 0;
        char            *request = 0;
@@ -1361,8 +1363,11 @@ int main(int argc, char **argv)
        char            *cmd_file = 0;
        
        initialize_ext2_error_table();
+       fprintf (stderr, "debugfs %s, %s for EXT2 FS %s, %s\n",
+                E2FSPROGS_VERSION, E2FSPROGS_DATE,
+                EXT2FS_VERSION, EXT2FS_DATE);
 
-       while ((c = getopt (argc, argv, "wR:f:")) != EOF) {
+       while ((c = getopt (argc, argv, "wR:f:V")) != EOF) {
                switch (c) {
                case 'R':
                        request = optarg;
@@ -1373,6 +1378,11 @@ int main(int argc, char **argv)
                case 'w':
                        open_flags = EXT2_FLAG_RW;
                        break;
+               case 'V':
+                       /* Print version number and exit */
+                       fprintf(stderr, "\tUsing %s\n",
+                               error_message(EXT2_ET_BASE));
+                       exit(0);
                default:
                        com_err(argv[0], 0, usage);
                        return 1;
index d9566f1..61d9d11 100644 (file)
@@ -1,3 +1,7 @@
+1998-06-25  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * unix.c (e2fsck_update_progress): Remove unused variables.
+
 1998-06-10  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * pass1.c, problem.h: Change blkcnt_t to be e2_blkcnt_t to avoid
index e674b71..9ef7a1d 100644 (file)
@@ -227,8 +227,6 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass,
                                  unsigned long cur, unsigned long max)
 {
        const char spinner[] = "\\|/-";
-       int percent;
-       struct e2_progress_struct *prog_struct;
        char buf[80];
        
        if (ctx->progress_fd) {
index ccb74d4..6ed3497 100644 (file)
@@ -1,3 +1,10 @@
+1998-06-18  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * inode.c (get_next_blockgroup): Fix bug where if
+               get_next_blockgroup() is called early because of a missing
+               inode table in a block group, the current_inode counter
+               wasn't incremented correctly.
+
 1998-06-16  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * read_bb.c (ext2fs_read_bb_inode): Make function more robust
index 0edee7f..7c9c8bc 100644 (file)
@@ -210,6 +210,9 @@ static errcode_t get_next_blockgroup(ext2_inode_scan scan)
        scan->current_block = scan->fs->
                group_desc[scan->current_group].bg_inode_table;
 
+       scan->current_inode = scan->current_group *
+               EXT2_INODES_PER_GROUP(scan->fs->super);
+
        scan->bytes_left = 0;
        scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
        scan->blocks_left = scan->fs->inode_blocks_per_group;
@@ -221,7 +224,6 @@ errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
 {
        scan->current_group = group - 1;
        scan->groups_left = scan->fs->group_desc_count - group;
-       scan->current_inode = group * EXT2_INODES_PER_GROUP(scan->fs->super);
        return get_next_blockgroup(scan);
 }
 
@@ -344,6 +346,27 @@ static errcode_t get_next_blocks(ext2_inode_scan scan)
        return 0;
 }
 
+#if 0
+/*
+ * Returns 1 if the entire inode_buffer has a non-zero size and
+ * contains all zeros.  (Not just deleted inodes, since that means
+ * that part of the inode table was used at one point; we want all
+ * zeros, which means that the inode table is pristine.)
+ */
+static inline int is_empty_scan(ext2_inode_scan scan)
+{
+       int     i;
+       
+       if (scan->bytes_left == 0)
+               return 0;
+
+       for (i=0; i < scan->bytes_left; i++)
+               if (scan->ptr[i])
+                       return 0;
+       return 1;
+}
+#endif
+
 errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
                                struct ext2_inode *inode)
 {
@@ -356,7 +379,7 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
         * Do we need to start reading a new block group?
         */
        if (scan->inodes_left <= 0) {
-       retry:
+       force_new_group:
                if (scan->done_group) {
                        retval = (scan->done_group)
                                (scan->fs, scan, scan->current_group,
@@ -378,7 +401,7 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
         */
        if (scan->current_block == 0) {
                if (scan->scan_flags & EXT2_SF_SKIP_MISSING_ITABLE) {
-                       goto retry;
+                       goto force_new_group;
                } else
                        return EXT2_ET_MISSING_INODE_TABLE;
        }
@@ -395,6 +418,14 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
                retval = get_next_blocks(scan);
                if (retval)
                        return retval;
+#if 0
+               /*
+                * XXX test  Need check for used inode somehow.
+                * (Note: this is hard.)
+                */
+               if (is_empty_scan(scan))
+                       goto force_new_group;
+#endif
        }
 
        retval = 0;
index 9e9a4e0..e837f5e 100644 (file)
@@ -1,3 +1,8 @@
+1998-06-25  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * tst_uuid.c (main): Fixed bogus declaration of the main's argv
+               parameter.
+
 1998-04-26  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * uuidP.h: Use asm/types.h instead of linux/types.h to avoid a
index c60e9f8..c474af7 100644 (file)
@@ -15,7 +15,7 @@
 #include "uuid.h"
 
 int
-main(int argc, char *argv)
+main(int argc, char **argv)
 {
        uuid_t          buf, tst;
        char            str[100];
index 9500526..5868c97 100644 (file)
@@ -1,3 +1,22 @@
+1998-06-25  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * fsck.c (ignore): Remove unused variable cp.
+
+       * chattr.c (fatal_error): 
+       * tune2fs.c (usage): 
+       * lsattr.c (usage): 
+       * dumpe2fs.c (usage): 
+       * badblocks.c (usage): Remove volatile from declaration.
+
+       * fsck.c: Change use of strdup to be string_copy, since we don't
+               trust what glibc is doing with strdup.  (Whatever it is,
+               it isn't pretty.)
+
+1998-06-19  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * mke2fs.c (PRS): Add a -V option which prints the version number
+               and exit.
+
 1998-05-14  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * fsck.c (ignore): Remove check for filesystems with the noauto 
index 81dc891..f955193 100644 (file)
@@ -50,7 +50,7 @@ int v_flag = 0;                       /* verbose */
 int w_flag = 0;                        /* do r/w test */
 int s_flag = 0;                        /* show progress of test */
 
-static volatile void usage (void)
+static void usage(void)
 {
        fprintf (stderr, "Usage: %s [-b block_size] [-o output_file] [-svw] device blocks_count\n [start_count]\n",
                 program_name);
@@ -298,14 +298,14 @@ int main (int argc, char ** argv)
                        w_flag = 1;
                        break;
                default:
-                       usage ();
+                       usage();
                }
        }
        if (optind > argc - 1)
-               usage ();
+               usage();
        device_name = argv[optind++];
        if (optind > argc - 1)
-               usage ();
+               usage();
        blocks_count = strtoul (argv[optind], &tmp, 0);
        if (*tmp)
        {
index 7f40f88..c8c9245 100644 (file)
@@ -51,13 +51,13 @@ unsigned long af;
 unsigned long rf;
 unsigned long sf;
 
-static void volatile fatal_error (const char * fmt_string, int errcode)
+static void fatal_error(const char * fmt_string, int errcode)
 {
        fprintf (stderr, fmt_string, program_name);
        exit (errcode);
 }
 
-#define usage() fatal_error ("usage: %s [-RV] [-+=AacdisSu] [-v version] files...\n", \
+#define usage() fatal_error("usage: %s [-RV] [-+=AacdisSu] [-v version] files...\n", \
                             1)
 
 static int decode_arg (int * i, int argc, char ** argv)
index e8c6b8d..a090847 100644 (file)
@@ -41,7 +41,7 @@
 const char * program_name = "dumpe2fs";
 char * device_name = NULL;
 
-static volatile void usage (void)
+static void usage(void)
 {
        fprintf (stderr, "usage: %s [-bV] device\n", program_name);
        exit (1);
@@ -198,11 +198,11 @@ int main (int argc, char ** argv)
                                error_message(EXT2_ET_BASE));
                        exit(0);
                default:
-                       usage ();
+                       usage();
                }
        }
        if (optind > argc - 1)
-               usage ();
+               usage();
        device_name = argv[optind++];
        retval = ext2fs_open (device_name, 0, 0, 0, unix_io_manager, &fs);
        if (retval) {
index 29c8741..c30997e 100644 (file)
@@ -133,12 +133,7 @@ const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc";
 char *fsck_path = 0;
 static int ignore(struct fs_info *);
 
-#ifdef HAVE_STRDUP
-#ifdef _POSIX_SOURCE
-extern char *strdup(const char *s);
-#endif
-#else
-static char *strdup(const char *s)
+static char *string_copy(const char *s)
 {
        char    *ret;
 
@@ -147,7 +142,6 @@ static char *strdup(const char *s)
                strcpy(ret, s);
        return ret;
 }
-#endif
 
 static void free_instance(struct fsck_instance *i)
 {
@@ -182,10 +176,10 @@ static void load_fs_info(NOARGS)
        while ((mp = getmntent(mntfile)) != NULL) {
                fs = malloc(sizeof(struct fs_info));
                memset(fs, 0, sizeof(struct fs_info));
-               fs->device = strdup(mp->mnt_fsname);
-               fs->mountpt = strdup(mp->mnt_dir);
-               fs->type = strdup(mp->mnt_type);
-               fs->opts = strdup(mp->mnt_opts);
+               fs->device = string_copy(mp->mnt_fsname);
+               fs->mountpt = string_copy(mp->mnt_dir);
+               fs->type = string_copy(mp->mnt_type);
+               fs->opts = string_copy(mp->mnt_opts);
                fs->freq = mp->mnt_freq;
                fs->passno = mp->mnt_passno;
                fs->next = NULL;
@@ -241,7 +235,7 @@ static char *find_fsck(char *type)
   char *s;
   const char *tpl;
   static char prog[256];
-  char *p = strdup(fsck_path);
+  char *p = string_copy(fsck_path);
   struct stat st;
 
   /* Are we looking for a program or just a type? */
@@ -266,13 +260,13 @@ static int execute(char *prog, char *device)
        struct fsck_instance *inst;
        pid_t   pid;
 
-       argv[0] = strdup(prog);
+       argv[0] = string_copy(prog);
        argc = 1;
        
        for (i=0; i <num_args; i++)
-               argv[argc++] = strdup(args[i]);
+               argv[argc++] = string_copy(args[i]);
 
-       argv[argc++] = strdup(device);
+       argv[argc++] = string_copy(device);
        argv[argc] = 0;
 
        s = find_fsck(prog);
@@ -304,8 +298,8 @@ static int execute(char *prog, char *device)
                return ENOMEM;
        memset(inst, 0, sizeof(struct fsck_instance));
        inst->pid = pid;
-       inst->prog = strdup(prog);
-       inst->device = strdup(device);
+       inst->prog = string_copy(prog);
+       inst->device = string_copy(device);
        inst->next = instance_list;
        instance_list = inst;
        
@@ -460,7 +454,6 @@ static int fs_match(char *type, char *fs_type)
 /* Check if we should ignore this filesystem. */
 static int ignore(struct fs_info *fs)
 {
-       const char *cp;
        const char **ip;
        int wanted = 0;
 
@@ -661,7 +654,7 @@ static void PRS(int argc, char *argv[])
                                        progname);
                                exit(1);
                        }
-                       devices[num_devices++] = strdup(arg);
+                       devices[num_devices++] = string_copy(arg);
                        continue;
                }
                if (arg[0] != '-') {
@@ -670,7 +663,7 @@ static void PRS(int argc, char *argv[])
                                        progname);
                                exit(1);
                        }
-                       args[num_args++] = strdup(arg);
+                       args[num_args++] = string_copy(arg);
                        continue;
                }
                for (j=1; arg[j]; j++) {
@@ -705,12 +698,12 @@ static void PRS(int argc, char *argv[])
                                break;
                        case 't':
                                if (arg[j+1]) {
-                                       fstype = strdup(arg+j+1);
+                                       fstype = string_copy(arg+j+1);
                                        goto next_arg;
                                }
                                if ((i+1) < argc) {
                                        i++;
-                                       fstype = strdup(argv[i]);
+                                       fstype = string_copy(argv[i]);
                                        goto next_arg;
                                }
                                usage();
@@ -733,7 +726,7 @@ static void PRS(int argc, char *argv[])
                                        progname);
                                exit(1);
                        }
-                       args[num_args++] = strdup(options);
+                       args[num_args++] = string_copy(options);
                        opt = 0;
                }
        }
@@ -759,7 +752,7 @@ int main(int argc, char *argv[])
                strcat (fsck_path, ":");
                strcat (fsck_path, oldpath);
        } else {
-               fsck_path = strdup(fsck_prefix_path);
+               fsck_path = string_copy(fsck_prefix_path);
        }
        
        /* If -A was specified ("check all"), do that! */
index 839df0f..73823cc 100644 (file)
@@ -49,10 +49,10 @@ int l_opt = 0;
 int recursive = 0;
 int v_opt = 0;
 
-static void volatile usage (void)
+static void usage(void)
 {
-       fprintf (stderr, "Usage: %s [-Radlv] [files...]\n", program_name);
-       exit (1);
+       fprintf(stderr, "Usage: %s [-Radlv] [files...]\n", program_name);
+       exit(1);
 }
 
 static void list_attributes (const char * name)
@@ -148,7 +148,7 @@ int main (int argc, char ** argv)
                                v_opt = 1;
                                break;
                        default:
-                               usage ();
+                               usage();
                }
 
        if (optind > argc - 1)
index 6bb5877..7b10937 100644 (file)
@@ -65,6 +65,9 @@ mke2fs \- create a Linux second extended file system
 [
 .B \-S
 ]
+[
+.B \-V
+]
 .I device
 [
 .I blocks-count
@@ -175,6 +178,11 @@ and the block and inode bitmaps.  The
 .B e2fsck
 program should be run immediately after this option is used, and there
 is no guarantee that any data will be salvageable.
+.TP
+.I -V
+print the version number of 
+.B mke2fs
+and exit.
 .SH AUTHOR
 This version of
 .B mke2fs
index 0ec17ba..5eacdad 100644 (file)
@@ -88,7 +88,7 @@ static void usage(NOARGS)
 {
        fprintf(stderr, "Usage: %s [-c|-t|-l filename] [-b block-size] "
        "[-f fragment-size]\n\t[-i bytes-per-inode] "
-       "[-m reserved-blocks-percentage] [-qvS]\n\t"
+       "[-m reserved-blocks-percentage] [-qvSV]\n\t"
        "[-o creator-os] [-g blocks-per-group] [-L volume-label]\n\t"
        "[-M last-mounted-directory] [-r fs-revision] [-R raid_opts]\n\t"
        "device [blocks-count]\n",
@@ -636,7 +636,7 @@ static void PRS(int argc, char *argv[])
        if (argc && *argv)
                program_name = *argv;
        while ((c = getopt (argc, argv,
-                           "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:")) != EOF)
+                           "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:V")) != EOF)
                switch (c) {
                case 'b':
                        size = strtoul(optarg, &tmp, 0);
@@ -740,6 +740,11 @@ static void PRS(int argc, char *argv[])
                case 'S':
                        super_only = 1;
                        break;
+               case 'V':
+                       /* Print version number and exit */
+                       fprintf(stderr, "\tUsing %s\n",
+                               error_message(EXT2_ET_BASE));
+                       exit(0);
                default:
                        usage();
                }
index a82ed5c..b5582a5 100644 (file)
@@ -90,9 +90,9 @@ static int strcasecmp (char *s1, char *s2)
 }
 #endif
 
-static volatile void usage (void)
+static void usage(void)
 {
-       fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] "
+       fprintf(stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] "
                 "[-g group]\n"
                 "\t[-i interval[d|m|w]] [-l] [-s] [-m reserved-blocks-percent]\n"
                 "\t[-r reserved-blocks-count] [-u user] [-C mount-count]\n"
@@ -123,24 +123,22 @@ int main (int argc, char ** argv)
                {
                        case 'c':
                                max_mount_count = strtoul (optarg, &tmp, 0);
-                               if (*tmp || max_mount_count > 16000)
-                               {
+                               if (*tmp || max_mount_count > 16000) {
                                        com_err (program_name, 0,
                                                 "bad mounts count - %s",
                                                 optarg);
-                                       usage ();
+                                       usage();
                                }
                                c_flag = 1;
                                open_flag = EXT2_FLAG_RW;
                                break;
                        case 'C':
                                mount_count = strtoul (optarg, &tmp, 0);
-                               if (*tmp || mount_count > 16000)
-                               {
+                               if (*tmp || mount_count > 16000) {
                                        com_err (program_name, 0,
                                                 "bad mounts count - %s",
                                                 optarg);
-                                       usage ();
+                                       usage();
                                }
                                C_flag = 1;
                                open_flag = EXT2_FLAG_RW;
@@ -152,20 +150,18 @@ int main (int argc, char ** argv)
                                        errors = EXT2_ERRORS_RO;
                                else if (strcmp (optarg, "panic") == 0)
                                        errors = EXT2_ERRORS_PANIC;
-                               else
-                               {
+                               else {
                                        com_err (program_name, 0,
                                                 "bad error behavior - %s",
                                                 optarg);
-                                       usage ();
+                                       usage();
                                }
                                e_flag = 1;
                                open_flag = EXT2_FLAG_RW;
                                break;
                        case 'g':
                                resgid = strtoul (optarg, &tmp, 0);
-                               if (*tmp)
-                               {
+                               if (*tmp) {
                                        gr = getgrnam (optarg);
                                        if (gr == NULL)
                                                tmp = optarg;
@@ -174,12 +170,11 @@ int main (int argc, char ** argv)
                                                *tmp =0;
                                        }
                                }
-                               if (*tmp)
-                               {
+                               if (*tmp) {
                                        com_err (program_name, 0,
                                                 "bad gid/group name - %s",
                                                 optarg);
-                                       usage ();
+                                       usage();
                                }
                                g_flag = 1;
                                open_flag = EXT2_FLAG_RW;
@@ -208,11 +203,10 @@ int main (int argc, char ** argv)
                                        tmp++;
                                        break;
                                }
-                               if (*tmp || interval > (365 * 86400))
-                               {
+                               if (*tmp || interval > (365 * 86400)) {
                                        com_err (program_name, 0,
                                                 "bad interval - %s", optarg);
-                                       usage ();
+                                       usage();
                                }
                                i_flag = 1;
                                open_flag = EXT2_FLAG_RW;
@@ -227,12 +221,11 @@ int main (int argc, char ** argv)
                                break;
                        case 'm':
                                reserved_ratio = strtoul (optarg, &tmp, 0);
-                               if (*tmp || reserved_ratio > 50)
-                               {
+                               if (*tmp || reserved_ratio > 50) {
                                        com_err (program_name, 0,
                                                 "bad reserved block ratio - %s",
                                                 optarg);
-                                       usage ();
+                                       usage();
                                }
                                m_flag = 1;
                                open_flag = EXT2_FLAG_RW;
@@ -244,12 +237,11 @@ int main (int argc, char ** argv)
                                break;
                        case 'r':
                                reserved_blocks = strtoul (optarg, &tmp, 0);
-                               if (*tmp)
-                               {
+                               if (*tmp) {
                                        com_err (program_name, 0,
                                                 "bad reserved blocks count - %s",
                                                 optarg);
-                                       usage ();
+                                       usage();
                                }
                                r_flag = 1;
                                open_flag = EXT2_FLAG_RW;
@@ -260,8 +252,7 @@ int main (int argc, char ** argv)
                                break;
                        case 'u':
                                resuid = strtoul (optarg, &tmp, 0);
-                               if (*tmp)
-                               {
+                               if (*tmp) {
                                        pw = getpwnam (optarg);
                                        if (pw == NULL)
                                                tmp = optarg;
@@ -270,12 +261,11 @@ int main (int argc, char ** argv)
                                                *tmp = 0;
                                        }
                                }
-                               if (*tmp)
-                               {
+                               if (*tmp) {
                                        com_err (program_name, 0,
                                                 "bad uid/user name - %s",
                                                 optarg);
-                                       usage ();
+                                       usage();
                                }
                                u_flag = 1;
                                open_flag = EXT2_FLAG_RW;
@@ -286,17 +276,16 @@ int main (int argc, char ** argv)
                                open_flag = EXT2_FLAG_RW;
                                break;
                        default:
-                               usage ();
+                               usage();
                }
        if (optind < argc - 1 || optind == argc)
-               usage ();
+               usage();
        if (!open_flag && !l_flag)
                usage();
        device_name = argv[optind];
        retval = ext2fs_open (device_name, open_flag, 0, 0,
                              unix_io_manager, &fs);
-        if (retval)
-       {
+        if (retval) {
                com_err (program_name, retval, "while trying to open %s",
                         device_name);
                printf("Couldn't find valid filesystem superblock.\n");
@@ -332,24 +321,20 @@ int main (int argc, char ** argv)
                         "The -g option is not supported by this version -- "
                         "Recompile with a newer kernel");
 #endif
-       if (i_flag)
-       {
+       if (i_flag) {
                fs->super->s_checkinterval = interval;
                ext2fs_mark_super_dirty(fs);
                printf ("Setting interval between check %lu seconds\n", interval);
        }
-       if (m_flag)
-       {
+       if (m_flag) {
                fs->super->s_r_blocks_count = (fs->super->s_blocks_count / 100)
                        * reserved_ratio;
                ext2fs_mark_super_dirty(fs);
                printf ("Setting reserved blocks percentage to %lu (%u blocks)\n",
                        reserved_ratio, fs->super->s_r_blocks_count);
        }
-       if (r_flag)
-       {
-               if (reserved_blocks >= fs->super->s_blocks_count)
-               {
+       if (r_flag) {
+               if (reserved_blocks >= fs->super->s_blocks_count) {
                        com_err (program_name, 0,
                                 "reserved blocks count is too big (%ul)",
                                 reserved_blocks);
index cdb19ce..6ab454b 100644 (file)
@@ -1,3 +1,8 @@
+1998-06-25  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * test_icount.c (main): Fix main() declaration so that it returns
+               int, not void.
+
 1998-03-31  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * Makefile.in: Add uninstall target (which is a just a no-op).
index 53cc420..896ded9 100644 (file)
@@ -290,7 +290,7 @@ static int source_file(const char *cmd_file, int sci_idx)
        return exit_status;
 }
 
-void main(int argc, char **argv)
+int main(int argc, char **argv)
 {
        int             retval;
        int             sci_idx;
@@ -326,7 +326,7 @@ void main(int argc, char **argv)
                        break;
                default:
                        com_err(argv[0], 0, usage);
-                       return;
+                       exit(1);
                }
        }
        sci_idx = ss_create_invocation("test_icount", "0.0", (char *) NULL,
@@ -354,6 +354,5 @@ void main(int argc, char **argv)
                ss_listen(sci_idx);
        }
 
-       exit(exit_status);
+       return(exit_status);
 }
-