adding help() to test program
This commit is contained in:
parent
c0f3e128aa
commit
c381b61b60
12
serial/t.c
12
serial/t.c
@ -51,6 +51,14 @@ for (count=0; count<iters; count++) {
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
void help(int k)
|
||||
{
|
||||
puts("options : ");
|
||||
puts("\t-d\tserial device to read.");
|
||||
puts("\t-n\tnumber of records to grab.");
|
||||
puts("\t-v\tincrease verbosity.");
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int serial_in;
|
||||
@ -62,12 +70,12 @@ verbosity = 0;
|
||||
nbre = 25;
|
||||
speed = 9600;
|
||||
|
||||
while ((opt = getopt(argc, argv, "d:n:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "d:n:vh")) != -1) {
|
||||
switch (opt) {
|
||||
case 'v': verbosity++; break;
|
||||
case 'n': nbre = atoi(optarg); break;
|
||||
case 'd': device = optarg; break;
|
||||
|
||||
case 'h': help(0); exit(0);
|
||||
default:
|
||||
fprintf(stderr, "%s : uh ?", argv[0]);
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user