summaryrefslogtreecommitdiffstats
path: root/text-utils
diff options
context:
space:
mode:
Diffstat (limited to 'text-utils')
-rw-r--r--text-utils/conv.c14
-rw-r--r--text-utils/display.c14
-rw-r--r--text-utils/hexdump.c6
-rw-r--r--text-utils/hexsyntax.c14
-rw-r--r--text-utils/parse.c12
5 files changed, 33 insertions, 27 deletions
diff --git a/text-utils/conv.c b/text-utils/conv.c
index 95b8cd296..4f7a248f2 100644
--- a/text-utils/conv.c
+++ b/text-utils/conv.c
@@ -73,12 +73,12 @@ conv_c(PR *pr, u_char *p)
}
if (isprint(*p)) {
*pr->cchar = 'c';
- (void)printf(pr->fmt, *p);
+ printf(pr->fmt, *p);
} else {
- (void)sprintf(buf, "%03o", (int)*p);
+ sprintf(buf, "%03o", (int)*p);
str = buf;
strpr: *pr->cchar = 's';
- (void)printf(pr->fmt, str);
+ printf(pr->fmt, str);
}
}
@@ -95,15 +95,15 @@ conv_u(PR *pr, u_char *p)
/* od used nl, not lf */
if (*p <= 0x1f) {
*pr->cchar = 's';
- (void)printf(pr->fmt, list[*p]);
+ printf(pr->fmt, list[*p]);
} else if (*p == 0x7f) {
*pr->cchar = 's';
- (void)printf(pr->fmt, "del");
+ printf(pr->fmt, "del");
} else if (isprint(*p)) {
*pr->cchar = 'c';
- (void)printf(pr->fmt, *p);
+ printf(pr->fmt, *p);
} else {
*pr->cchar = 'x';
- (void)printf(pr->fmt, (int)*p);
+ printf(pr->fmt, (int)*p);
}
}
diff --git a/text-utils/display.c b/text-utils/display.c
index 2fc781cb5..b2ed9753f 100644
--- a/text-utils/display.c
+++ b/text-utils/display.c
@@ -162,9 +162,17 @@ static void bpad(PR *pr)
pr->flags = F_BPAD;
pr->cchar[0] = 's';
pr->cchar[1] = 0;
- for (p1 = pr->fmt; *p1 != '%'; ++p1);
- for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
- while ((*p2++ = *p1++) != 0) ;
+
+ p1 = pr->fmt;
+ while (*p1 != '%')
+ ++p1;
+
+ p2 = ++p1;
+ while (*p1 && strchr(spec, *p1))
+ ++p1;
+
+ while ((*p2++ = *p1++))
+ ;
}
void display(void)
diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c
index cbf87dcb4..e3c3897ed 100644
--- a/text-utils/hexdump.c
+++ b/text-utils/hexdump.c
@@ -78,10 +78,8 @@ int main(int argc, char **argv)
}
/* rewrite the rules, do syntax checking */
- list_for_each(p, &fshead) {
- tfs = list_entry(p, FS, nextfs);
- rewrite(tfs);
- }
+ list_for_each(p, &fshead)
+ rewrite(list_entry(p, FS, nextfs));
next(argv);
display();
diff --git a/text-utils/hexsyntax.c b/text-utils/hexsyntax.c
index 53ca13575..f7a96c5b7 100644
--- a/text-utils/hexsyntax.c
+++ b/text-utils/hexsyntax.c
@@ -56,7 +56,7 @@ newsyntax(int argc, char ***argvp)
{
int ch;
char **argv;
- char *hex_offt_fmt = "\"%07.7_Ax\n\"";
+ char *hex_offt = "\"%07.7_Ax\n\"";
static const struct option longopts[] = {
{"one-byte-octal", no_argument, NULL, 'b'},
@@ -79,11 +79,11 @@ newsyntax(int argc, char ***argvp)
while ((ch = getopt_long(argc, argv, "bcCde:f:n:os:vxhV", longopts, NULL)) != -1) {
switch (ch) {
case 'b':
- add(hex_offt_fmt);
+ add(hex_offt);
add("\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"");
break;
case 'c':
- add(hex_offt_fmt);
+ add(hex_offt);
add("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"");
break;
case 'C':
@@ -92,7 +92,7 @@ newsyntax(int argc, char ***argvp)
add("\" |\" 16/1 \"%_p\" \"|\\n\"");
break;
case 'd':
- add(hex_offt_fmt);
+ add(hex_offt);
add("\"%07.7_ax \" 8/2 \" %05u \" \"\\n\"");
break;
case 'e':
@@ -105,7 +105,7 @@ newsyntax(int argc, char ***argvp)
length = strtosize_or_err(optarg, _("failed to parse length"));
break;
case 'o':
- add(hex_offt_fmt);
+ add(hex_offt);
add("\"%07.7_ax \" 8/2 \" %06o \" \"\\n\"");
break;
case 's':
@@ -115,7 +115,7 @@ newsyntax(int argc, char ***argvp)
vflag = ALL;
break;
case 'x':
- add(hex_offt_fmt);
+ add(hex_offt);
add("\"%07.7_ax \" 8/2 \" %04x \" \"\\n\"");
break;
case 'h':
@@ -130,7 +130,7 @@ newsyntax(int argc, char ***argvp)
}
if (list_empty(&fshead)) {
- add(hex_offt_fmt);
+ add(hex_offt);
add("\"%07.7_ax \" 8/2 \"%04x \" \"\\n\"");
}
diff --git a/text-utils/parse.c b/text-utils/parse.c
index 544af8799..45052982e 100644
--- a/text-utils/parse.c
+++ b/text-utils/parse.c
@@ -119,7 +119,7 @@ void add(const char *fmt)
tfu->reps = atoi((char *)savep);
tfu->flags = F_SETREP;
/* skip trailing white space */
- while (++p && isspace(*p))
+ while (isspace(*++p))
;
}
@@ -137,7 +137,7 @@ void add(const char *fmt)
badfmt(fmt);
tfu->bcnt = atoi((char *)savep);
/* skip trailing white space */
- while (++p && isspace(*p))
+ while (isspace(*++p))
;
}
@@ -455,10 +455,10 @@ void rewrite(FS *fs)
if (fu->reps > 1) {
if (!list_empty(&fu->nextpr)) {
pr = list_last_entry(&fu->nextpr, PR, nextpr);
- for (p1 = pr->fmt, p2 = NULL; *p1; ++p1)
- p2 = isspace(*p1) ? p1 : NULL;
- if (p2)
- pr->nospace = p2;
+ for (p1 = pr->fmt, p2 = NULL; *p1; ++p1)
+ p2 = isspace(*p1) ? p1 : NULL;
+ if (p2)
+ pr->nospace = p2;
}
}
}