Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Add --list option to errno | 3ebe87776f38e07343d79c14bc2dad3560bf5f8f | Lars Wirzenius | 2012-06-05 13:58:32 |
Add errno manpage | 66a2a6ace9fb99096c2a1d0144a7b12895db59e6 | Lars Wirzenius | 2012-06-04 13:22:42 |
Add copyright statement | 2bc2887fefba2591bd6ede3a1eabbb6c26cf7a25 | Lars Wirzenius | 2012-06-04 13:22:25 |
Add errno to README | 607d5d3888a3af319a06e9a1fd0e7e8aebd41d11 | Lars Wirzenius | 2012-06-04 13:14:39 |
Add errno program | 9433d2b803644098ce690a52e1205c541d09eba5 | Lars Wirzenius | 2012-06-04 13:14:08 |
fix cleanup on error | d6ef4a470f5ba8b7b36d39cd1cb2418d58257fc0 | Joey Hess | 2012-05-22 17:39:24 |
releasing version 0.46 | d4f8bd597243c251d8528b5f6e5e1993dda42ccb | Joey Hess | 2012-04-10 15:48:31 |
cleanup | 4549f5d3e3ac049668bd41b7d3de214c7826f69b | Joey Hess | 2012-04-09 20:19:20 |
combine: Avoid reading files twice, to support data coming from pipes. Closes: #667960 Thanks, Carsten Hey | bbfa7f9a5d262d13c825005f89410f464148fd1d | Joey Hess | 2012-04-09 20:18:21 |
updated debian copyright format url | b70bf8f3b34e03acfe4ed906929e1a3f2b42dd4b | Joey Hess | 2012-02-25 14:53:16 |
Typo. Closes: #649158 | 9991e280ec2364b4605c5b7371829af39c662043 | Joey Hess | 2011-11-18 17:37:25 |
releasing version 0.45 | 929dee9e4544801af94a68a4e4631484fff4a3f3 | Joey Hess | 2011-06-19 20:20:19 |
ts: Support %.s for seconds sinch epoch with subsecond resolution. Closes: #619764 | bb190ff90f192cb50c086abec11459ab09c205f1 | Joey Hess | 2011-04-01 18:36:03 |
releasing version 0.44 | c27365c4f2a7e42841aef3f53b9316b4aaab730a | Joey Hess | 2011-03-10 21:38:58 |
pee: Propigate exit status of commands run. | 6827d8ff8e7c4e2003c6065d1769c780b4f96973 | Joey Hess | 2011-02-19 21:35:32 |
dep5 update | da4a447c4fda5972cd486c3d6e342476429b2733 | Joey Hess | 2011-02-19 21:35:08 |
typo: sed s/agganges/arranges/ | d85a95af34ba2cca2436f18e87a4a49154e170a5 | Barak A. Pearlmutter | 2011-01-24 14:02:44 |
DEP-5 | ec60338bdec33b47872932c9a1c05f352baea1a4 | Joey Hess | 2011-01-13 21:24:02 |
releasing version 0.43 | 3bd91ea4f68fcc0bdc3d4cab3cb51095a87ab1f4 | Joey Hess | 2010-10-31 00:59:44 |
chronic: New command, runs a command quietly, unless it fails. | 11eb9b1ae7b81f3bbf52047a7a8ec995b7808970 | Joey Hess | 2010-10-29 19:49:33 |
File | Lines added | Lines deleted |
---|---|---|
errno.c | 50 | 10 |
errno.docbook | 5 | 0 |
File errno.c changed (mode: 100644) (index 3644c8f..f1e2285) | |||
24 | 24 | #include <stdio.h> | #include <stdio.h> |
25 | 25 | #include <stdlib.h> | #include <stdlib.h> |
26 | 26 | #include <string.h> | #include <string.h> |
27 | #include <unistd.h> | ||
28 | #include <getopt.h> | ||
27 | 29 | ||
28 | 30 | ||
29 | 31 | static struct { | static struct { |
... | ... | report_from_code(int code) | |
70 | 72 | } | } |
71 | 73 | ||
72 | 74 | ||
75 | static struct option | ||
76 | options[] = { | ||
77 | { "list", 0, NULL, 'l' }, | ||
78 | }; | ||
79 | |||
80 | |||
73 | 81 | int | int |
74 | 82 | main(int argc, char **argv) | main(int argc, char **argv) |
75 | 83 | { | { |
76 | 84 | int i; | int i; |
77 | 85 | int exit_code; | int exit_code; |
86 | int index = 0; | ||
87 | enum { lookup_mode, list_mode } mode = lookup_mode; | ||
78 | 88 | ||
89 | for (;;) { | ||
90 | int c = getopt_long(argc, argv, "l", options, &index); | ||
91 | if (c == -1) | ||
92 | break; | ||
93 | |||
94 | switch (c) { | ||
95 | case 'l': | ||
96 | mode = list_mode; | ||
97 | break; | ||
98 | |||
99 | case '?': | ||
100 | break; | ||
101 | |||
102 | default: | ||
103 | fprintf(stderr, "getopt returned 0x%02x\n", c); | ||
104 | return EXIT_FAILURE; | ||
105 | } | ||
106 | } | ||
107 | |||
79 | 108 | exit_code = EXIT_SUCCESS; | exit_code = EXIT_SUCCESS; |
80 | for (i = 1; i < argc; ++i) { | ||
81 | const char *arg = argv[i]; | ||
82 | if (toupper(arg[0]) == 'E') { | ||
83 | if (!report_from_name(arg)) | ||
84 | exit_code = EXIT_FAILURE; | ||
85 | } else if (isdigit(arg[0])) { | ||
86 | if (!report_from_code(atoi(arg))) | ||
109 | |||
110 | switch (mode) { | ||
111 | case lookup_mode: | ||
112 | for (i = 1; i < argc; ++i) { | ||
113 | const char *arg = argv[i]; | ||
114 | if (toupper(arg[0]) == 'E') { | ||
115 | if (!report_from_name(arg)) | ||
116 | exit_code = EXIT_FAILURE; | ||
117 | } else if (isdigit(arg[0])) { | ||
118 | if (!report_from_code(atoi(arg))) | ||
119 | exit_code = EXIT_FAILURE; | ||
120 | } else { | ||
121 | fprintf(stderr, "ERROR: Not understood: %s\n", arg); | ||
87 | 122 | exit_code = EXIT_FAILURE; | exit_code = EXIT_FAILURE; |
88 | } else { | ||
89 | fprintf(stderr, "ERROR: Not understood: %s\n", arg); | ||
90 | exit_code = EXIT_FAILURE; | ||
123 | } | ||
91 | 124 | } | } |
125 | break; | ||
126 | |||
127 | case list_mode: | ||
128 | for (i = 0; i < num_errnos; ++i) | ||
129 | report(errnos[i].name, errnos[i].code); | ||
130 | break; | ||
92 | 131 | } | } |
132 | |||
93 | 133 | return exit_code; | return exit_code; |
94 | 134 | } | } |
File errno.docbook changed (mode: 100644) (index 0ddaba1..0f3c241) | |||
... | ... | with this program; if not, write to the Free Software Foundation, Inc., | |
51 | 51 | <command>errno</command> | <command>errno</command> |
52 | 52 | <arg choice="req"><replaceable>name-or-code</replaceable></arg> | <arg choice="req"><replaceable>name-or-code</replaceable></arg> |
53 | 53 | </cmdsynopsis> | </cmdsynopsis> |
54 | <cmdsynopsis> | ||
55 | <command>errno</command> | ||
56 | <arg>-l</arg> | ||
57 | <arg>--list</arg> | ||
58 | </cmdsynopsis> | ||
54 | 59 | </refsynopsisdiv> | </refsynopsisdiv> |
55 | 60 | ||
56 | 61 | <refsect1> | <refsect1> |