[hackers] [sbase] code-style: unindent one level of switch || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 20 Feb 2015 14:30:26 +0100 (CET)

commit daefb82c60d6add893f2c57fa4d1b9adc6850e59
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Fri Feb 20 13:27:57 2015 +0100

    code-style: unindent one level of switch

diff --git a/find.c b/find.c
index 0043b95..4f8084a 100644
--- a/find.c
+++ b/find.c
_AT_@ -284,14 +284,14 @@ static int
 pri_type(Arg *arg)
 {
         switch ((char)arg->extra.i) {
- default : return 0; /* impossible, but placate warnings */
- case 'b': return S_ISBLK (arg->st->st_mode);
- case 'c': return S_ISCHR (arg->st->st_mode);
- case 'd': return S_ISDIR (arg->st->st_mode);
- case 'l': return S_ISLNK (arg->st->st_mode);
- case 'p': return S_ISFIFO(arg->st->st_mode);
- case 'f': return S_ISREG (arg->st->st_mode);
- case 's': return S_ISSOCK(arg->st->st_mode);
+ default : return 0; /* impossible, but placate warnings */
+ case 'b': return S_ISBLK (arg->st->st_mode);
+ case 'c': return S_ISCHR (arg->st->st_mode);
+ case 'd': return S_ISDIR (arg->st->st_mode);
+ case 'l': return S_ISLNK (arg->st->st_mode);
+ case 'p': return S_ISFIFO(arg->st->st_mode);
+ case 'f': return S_ISREG (arg->st->st_mode);
+ case 's': return S_ISSOCK(arg->st->st_mode);
         }
 }
 
diff --git a/readlink.c b/readlink.c
index 8c50f47..e785fff 100644
--- a/readlink.c
+++ b/readlink.c
_AT_@ -45,52 +45,52 @@ main(int argc, char *argv[])
 
 #define SWAP_BUF() (b = (b == buf1 ? buf2 : buf1));
         switch (mefflag) {
- case 'm':
- if (argv[0][0] == '/') { /* case when path is on '/' */
- arg[0] = '/';
- arg[1] = '\0';
- p++;
- } else if (!strchr(argv[0], '/')) { /* relative path */
- arg[0] = '.';
- arg[1] = '/';
- arg[2] = '\0';
- } else
- arg[0] = '\0';
- if (strlcat(arg, argv[0], PATH_MAX) >= PATH_MAX)
- eprintf("path too long\n");
- while ((p = strchr(p, '/'))) {
- *p = '\0';
- if (!realpath(arg, b)) {
- *p = '/';
- goto mdone;
- }
- SWAP_BUF();
- lp = p;
- *p++ = '/';
- }
+ case 'm':
+ if (argv[0][0] == '/') { /* case when path is on '/' */
+ arg[0] = '/';
+ arg[1] = '\0';
+ p++;
+ } else if (!strchr(argv[0], '/')) { /* relative path */
+ arg[0] = '.';
+ arg[1] = '/';
+ arg[2] = '\0';
+ } else
+ arg[0] = '\0';
+ if (strlcat(arg, argv[0], PATH_MAX) >= PATH_MAX)
+ eprintf("path too long\n");
+ while ((p = strchr(p, '/'))) {
+ *p = '\0';
                         if (!realpath(arg, b)) {
+ *p = '/';
+ goto mdone;
+ }
+ SWAP_BUF();
+ lp = p;
+ *p++ = '/';
+ }
+ if (!realpath(arg, b)) {
 mdone:
- SWAP_BUF();
- if (lp) {
- /* drop the extra '/' on root */
- lp += (argv[0][0] == '/' &&
- lp - arg == 1);
- if (strlcat(b, lp, PATH_MAX) >= PATH_MAX)
- eprintf("path too long\n");
- }
+ SWAP_BUF();
+ if (lp) {
+ /* drop the extra '/' on root */
+ lp += (argv[0][0] == '/' &&
+ lp - arg == 1);
+ if (strlcat(b, lp, PATH_MAX) >= PATH_MAX)
+ eprintf("path too long\n");
                         }
- break;
- case 'e':
- if (stat(argv[0], &st) < 0)
- eprintf("stat %s:", argv[0]);
- case 'f':
- if (!realpath(argv[0], b))
- eprintf("realpath %s:", argv[0]);
- break;
- default:
- if ((n = readlink(argv[0], b, PATH_MAX - 1)) < 0)
- eprintf("readlink %s:", argv[0]);
- b[n] = '\0';
+ }
+ break;
+ case 'e':
+ if (stat(argv[0], &st) < 0)
+ eprintf("stat %s:", argv[0]);
+ case 'f':
+ if (!realpath(argv[0], b))
+ eprintf("realpath %s:", argv[0]);
+ break;
+ default:
+ if ((n = readlink(argv[0], b, PATH_MAX - 1)) < 0)
+ eprintf("readlink %s:", argv[0]);
+ b[n] = '\0';
         }
         printf("%s", b);
         if (!nflag)
diff --git a/uudecode.c b/uudecode.c
index 943e98e..0bae296 100644
--- a/uudecode.c
+++ b/uudecode.c
_AT_@ -101,30 +101,30 @@ uudecodeb64(FILE *fp, FILE *outfp)
                                 continue;
                         } else if (*pb == '=') {
                                 switch (b) {
- case 0:
- /* expected '=' remaining
- * including footer */
- if (--t) {
- fwrite(out, 1,
- (po - out),
- outfp);
- return;
- }
- continue;
- case 1:
- eprintf("%d: unexpected \"=\""
- "appeared\n", l);
- case 3:
- *po++ = b24[0];
- *po++ = b24[1];
- b = 0;
- t = 6; /* expect 6 '=' */
- continue;
- case 2:
- *po++ = b24[0];
- b = 0;
- t = 5; /* expect 5 '=' */
- continue;
+ case 0:
+ /* expected '=' remaining
+ * including footer */
+ if (--t) {
+ fwrite(out, 1,
+ (po - out),
+ outfp);
+ return;
+ }
+ continue;
+ case 1:
+ eprintf("%d: unexpected \"=\""
+ "appeared\n", l);
+ case 2:
+ *po++ = b24[0];
+ b = 0;
+ t = 5; /* expect 5 '=' */
+ continue;
+ case 3:
+ *po++ = b24[0];
+ *po++ = b24[1];
+ b = 0;
+ t = 6; /* expect 6 '=' */
+ continue;
                                 }
                         } else if ((e = b64dt[(int)*pb]) == -1)
                                 eprintf("%d: invalid byte \"%c\"\n", l, *pb);
Received on Fri Feb 20 2015 - 14:30:26 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 20 2015 - 14:36:09 CET