Mercurial > hg > toybox
comparison toys/other/hello.c @ 944:b4faf2ae39e8
This inlines CRC64, and nothing more.
The functions involved were called only once.
author | Isaac Dunham <idunham@lavabit.com> |
---|---|
date | Sat, 06 Jul 2013 11:26:15 -0500 |
parents | aaa638e82e51 |
children | a25239480e7a |
comparison
equal
deleted
inserted
replaced
943:8cb7d65a40e8 | 944:b4faf2ae39e8 |
---|---|
3 * Copyright 2012 Rob Landley <rob@landley.net> | 3 * Copyright 2012 Rob Landley <rob@landley.net> |
4 * | 4 * |
5 * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ | 5 * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ |
6 * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html | 6 * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html |
7 | 7 |
8 USE_HELLO(NEWTOY(hello, "e@d*c#b:a", TOYFLAG_USR|TOYFLAG_BIN)) | 8 // Accept many different kinds of command line argument: |
9 | |
10 USE_HELLO(NEWTOY(hello, "(walrus)(blubber):e@d*c#b:a", TOYFLAG_USR|TOYFLAG_BIN)) | |
9 | 11 |
10 config HELLO | 12 config HELLO |
11 bool "hello" | 13 bool "hello" |
12 default n | 14 default n |
13 help | 15 help |
27 GLOBALS( | 29 GLOBALS( |
28 char *b_string; | 30 char *b_string; |
29 long c_number; | 31 long c_number; |
30 struct arg_list *d_list; | 32 struct arg_list *d_list; |
31 long e_count; | 33 long e_count; |
34 char *blubber_string; | |
32 | 35 |
33 int more_globals; | 36 int more_globals; |
34 ) | 37 ) |
38 | |
39 // Parse many different kinds of command line argument: | |
35 | 40 |
36 void hello_main(void) | 41 void hello_main(void) |
37 { | 42 { |
38 printf("Hello world\n"); | 43 printf("Hello world\n"); |
39 | 44 |
45 if (toys.optflags) printf("flags=%x\n", toys.optflags); | |
40 if (toys.optflags & FLAG_a) printf("Saw a\n"); | 46 if (toys.optflags & FLAG_a) printf("Saw a\n"); |
41 if (toys.optflags & FLAG_b) printf("b=%s\n", TT.b_string); | 47 if (toys.optflags & FLAG_b) printf("b=%s\n", TT.b_string); |
42 if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.c_number); | 48 if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.c_number); |
43 while (TT.d_list) { | 49 while (TT.d_list) { |
44 printf("d=%s\n", TT.d_list->arg); | 50 printf("d=%s\n", TT.d_list->arg); |
45 TT.d_list = TT.d_list->next; | 51 TT.d_list = TT.d_list->next; |
46 } | 52 } |
47 if (TT.e_count) printf("e was seen %ld times", TT.e_count); | 53 if (TT.e_count) printf("e was seen %ld times\n", TT.e_count); |
48 | |
49 while (*toys.optargs) printf("optarg=%s\n", *(toys.optargs++)); | 54 while (*toys.optargs) printf("optarg=%s\n", *(toys.optargs++)); |
55 if (toys.optflags & FLAG_walrus) printf("Saw --walrus\n"); | |
56 if (TT.blubber_string) printf("--blubber=%s\n", TT.blubber_string); | |
50 } | 57 } |