commit 6c7ff5fda5a49392d2700df70fb61aab80eefd07
parent 5a6715c0cf8de7022d7f7c2e0772412518c65356
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 20 Feb 2015 13:27:57 +0100
code-style: unindent one level of switch
Diffstat:
M | find.c | | | 16 | ++++++++-------- |
M | readlink.c | | | 86 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
M | uudecode.c | | | 48 | ++++++++++++++++++++++++------------------------ |
3 files changed, 75 insertions(+), 75 deletions(-)
diff --git a/find.c b/find.c
@@ -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
@@ -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
@@ -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);