Skip to content

Commit 57592ac

Browse files
committedJan 15, 2012
pfpu command: print results always as hex dump and as floats
Before, main_pfpu tried to be a bit too smart and made the output format follow the input format. More often than not, this turned out to be inconvenient. Now we just print both - let the user sort them out.
1 parent 73bc649 commit 57592ac

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed
 

‎src/shellext.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ static int main_pfpu(int argc, char **argv)
179179
};
180180
char **arg;
181181
float *r = regs+PFPU_SPREG_COUNT, *rr;
182-
int hex = 0;
183182
int fd, res;
184183

185184
for(arg = argv+1; arg != argv+argc; arg++) {
@@ -188,7 +187,6 @@ static int main_pfpu(int argc, char **argv)
188187
} else if(!strncmp(*arg, "0x", 2)) {
189188
u.i = strtoul(*arg, NULL, 0);
190189
*r++ = u.f;
191-
hex = 1;
192190
} else if(strlen(*arg) == 8) {
193191
program[td.progsize++] = strtoul(*arg, NULL, 16);
194192
} else {
@@ -213,12 +211,8 @@ static int main_pfpu(int argc, char **argv)
213211
for(rr = regs+PFPU_SPREG_COUNT; r != rr; rr++) {
214212
if(rr != regs+PFPU_SPREG_COUNT)
215213
putchar(' ');
216-
if(hex) {
217-
u.f = *rr;
218-
printf("0x%08x", u.i);
219-
} else {
220-
printf("%g", *rr);
221-
}
214+
u.f = *rr;
215+
printf("0x%08x %g", u.i, *rr);
222216
}
223217
putchar('\n');
224218

0 commit comments

Comments
 (0)
Please sign in to comment.