]> granicus.if.org Git - fortune-mod/commitdiff
Wrap C/etc. oneline blocks in {...}
authorShlomi Fish <shlomif@shlomifish.org>
Thu, 16 Dec 2021 17:35:17 +0000 (19:35 +0200)
committerShlomi Fish <shlomif@shlomifish.org>
Thu, 16 Dec 2021 17:35:17 +0000 (19:35 +0200)
See:
https://fc-solve.shlomifish.org/docs/distro/HACKING.html#one-line-clauses
.

fortune-mod/util/randstr.c
fortune-mod/util/unstr.c

index 4a49f5a2022abbefad4000e8dab4140ff4acf0a7..83ea92fcecfc774aea1da679f2a6f036824adbeb 100644 (file)
@@ -106,6 +106,7 @@ static void getargs(char *argv[])
         input_fn_2_data_fn();
     }
     else
+    {
         /*    {
          * Don't write out errors here, either; trust in exit codes and sh
          * fprintf(stderr, "No input file name\n");
@@ -113,7 +114,8 @@ static void getargs(char *argv[])
          * [outputfile]\n");
          */
         exit(1);
-    /*    } */
+        /*    } */
+    }
 }
 
 /*
@@ -125,7 +127,9 @@ static void get_pos(STRFILE *fp)
 {
     pos = random() % fp->str_numstr;
     if (++(pos) >= (off_t)(fp->str_numstr))
+    {
         pos -= fp->str_numstr;
+    }
 }
 
 /*
@@ -155,13 +159,19 @@ static void display(FILE *fp, STRFILE table)
          i++)
     {
         if (table.str_flags & STR_ROTATED)
+        {
             for (p = line; (ch = *p); ++p)
             {
                 if (isupper(ch))
+                {
                     *p = 'A' + (ch - 'A' + 13) % 26;
+                }
                 else if (islower(ch))
+                {
                     *p = 'a' + (ch - 'a' + 13) % 26;
+                }
             }
+        }
         fputs(line, stdout);
     }
     fflush(stdout);
index 52f35ca445da68e758f16f0d2351f99dce7f34d3..94425ae9c3df5d8e7d78017388378f2efef49e79 100644 (file)
@@ -93,6 +93,7 @@ static void getargs(int argc, char *argv[])
     int ch;
 
     while ((ch = getopt(argc, argv, "c:")) != EOF)
+    {
         switch (ch)
         {
         case 'c':
@@ -109,6 +110,7 @@ static void getargs(int argc, char *argv[])
                 "Usage:\n\tunstr [-c C] datafile[.ext] [outputfile]\n");
             exit(1);
         }
+    }
 
     argv += optind;
 
@@ -183,7 +185,9 @@ int main(int argc, char **argv)
         exit(1);
     }
     if (*output_filename == '\0')
+    {
         Outf = stdout;
+    }
     else if (!(Outf = fopen(output_filename, "w+")))
     {
         perror(output_filename);
@@ -207,9 +211,13 @@ int main(int argc, char **argv)
         exit(1);
     }
     if (new_delimiter_char)
+    {
         delimiter_char = new_delimiter_char;
+    }
     else
+    {
         delimiter_char = (char)tbl.str_delim;
+    }
     order_unstr(&tbl);
     fclose(Inf);
     fclose(Dataf);