Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
Add usage message for cpuid
Browse files Browse the repository at this point in the history
Signed-off-by: Jin Kyu Song <[email protected]>
  • Loading branch information
Jin Kyu Song committed Aug 30, 2013
1 parent c975b9e commit 640fd92
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,27 @@ static void dump_levels(int cpu, uint32_t region)
}
}

void usage(void)
{
fprintf(stderr, "Usage: cpuid [processor # (default 0)]\n");
}

int main(int argc, char *argv[])
{
int cpu;
int cpu = 0;
uint32_t n;

cpu = (argc > 1) ? atoi(argv[1]) : 0;
char *endptr;

if (argc > 2) {
usage();
exit(127);
} else if (argc == 2) {
cpu = strtoul(argv[1], &endptr, 0);
if (*endptr || cpu > 255) {
usage();
exit(127);
}
}

printf
("Leaf Subleaf EAX EBX ECX EDX \n");
Expand Down

0 comments on commit 640fd92

Please sign in to comment.