Browse Source

adding help() to test program

tth 1 year ago
parent
commit
c381b61b60
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      serial/t.c

+ 10
- 2
serial/t.c View File

@@ -51,6 +51,14 @@ for (count=0; count<iters; count++) {
51 51
 return 0;
52 52
 }
53 53
 /* ---------------------------------------------------------------- */
54
+void help(int k)
55
+{
56
+puts("options : ");
57
+puts("\t-d\tserial device to read.");
58
+puts("\t-n\tnumber of records to grab.");
59
+puts("\t-v\tincrease verbosity.");
60
+}
61
+/* ---------------------------------------------------------------- */
54 62
 int main (int argc, char *argv[])
55 63
 {
56 64
 int		serial_in;
@@ -62,12 +70,12 @@ verbosity	= 0;
62 70
 nbre		= 25;
63 71
 speed		= 9600;
64 72
 
65
-while ((opt = getopt(argc, argv, "d:n:v")) != -1) {
73
+while ((opt = getopt(argc, argv, "d:n:vh")) != -1) {
66 74
 	switch (opt) {
67 75
 		case 'v':	verbosity++;		break;
68 76
 		case 'n':	nbre = atoi(optarg);	break;
69 77
 		case 'd':	device = optarg;	break;
70
-
78
+		case 'h':	help(0);		exit(0);
71 79
 		default:
72 80
 			fprintf(stderr, "%s : uh ?", argv[0]);
73 81
 			exit(1);

Loading…
Cancel
Save