code-style: unindent one level of switch

This commit is contained in:
Hiltjo Posthuma 2015-02-20 13:27:57 +01:00
parent 5a6715c0cf
commit 6c7ff5fda5
3 changed files with 76 additions and 76 deletions

16
find.c
View File

@ -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);
}
}

View File

@ -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)) {
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");
}
*p = '/';
goto mdone;
}
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';
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");
}
}
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)

View File

@ -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);