Skip to content

Commit

Permalink
pfpu command: print results always as hex dump and as floats
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wpwrak committed Jan 15, 2012
1 parent 73bc649 commit 57592ac
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/shellext.c
Expand Up @@ -179,7 +179,6 @@ static int main_pfpu(int argc, char **argv)
};
char **arg;
float *r = regs+PFPU_SPREG_COUNT, *rr;
int hex = 0;
int fd, res;

for(arg = argv+1; arg != argv+argc; arg++) {
Expand All @@ -188,7 +187,6 @@ static int main_pfpu(int argc, char **argv)
} else if(!strncmp(*arg, "0x", 2)) {
u.i = strtoul(*arg, NULL, 0);
*r++ = u.f;
hex = 1;
} else if(strlen(*arg) == 8) {
program[td.progsize++] = strtoul(*arg, NULL, 16);
} else {
Expand All @@ -213,12 +211,8 @@ static int main_pfpu(int argc, char **argv)
for(rr = regs+PFPU_SPREG_COUNT; r != rr; rr++) {
if(rr != regs+PFPU_SPREG_COUNT)
putchar(' ');
if(hex) {
u.f = *rr;
printf("0x%08x", u.i);
} else {
printf("%g", *rr);
}
u.f = *rr;
printf("0x%08x %g", u.i, *rr);
}
putchar('\n');

Expand Down

0 comments on commit 57592ac

Please sign in to comment.