diff options
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/makedevs.c | 44 | ||||
-rw-r--r-- | miscutils/watchdog.c | 34 |
2 files changed, 16 insertions, 62 deletions
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index e988400eb..7bfe54fc1 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <fcntl.h> | 6 | #include <fcntl.h> |
7 | #include <getopt.h> | ||
8 | #include <time.h> | 7 | #include <time.h> |
9 | #include <ctype.h> | 8 | #include <ctype.h> |
10 | #include <unistd.h> | 9 | #include <unistd.h> |
@@ -76,40 +75,20 @@ int makedevs_main(int argc, char **argv) | |||
76 | 75 | ||
77 | #elif defined CONFIG_FEATURE_MAKEDEVS_TABLE | 76 | #elif defined CONFIG_FEATURE_MAKEDEVS_TABLE |
78 | 77 | ||
79 | /* | 78 | /* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ |
80 | * This program is free software; you can redistribute it and/or modify | ||
81 | * it under the terms of the GNU General Public License version 2 as | ||
82 | * published by the Free Software Foundation. | ||
83 | * | ||
84 | * This program is distributed in the hope that it will be useful, | ||
85 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
86 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
87 | * GNU Library General Public License for more details. | ||
88 | * | ||
89 | * You should have received a copy of the GNU General Public License | ||
90 | * along with this program; if not, write to the Free Software | ||
91 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
92 | * | ||
93 | */ | ||
94 | 79 | ||
95 | extern int makedevs_main(int argc, char **argv) | 80 | extern int makedevs_main(int argc, char **argv) |
96 | { | 81 | { |
97 | int opt; | ||
98 | FILE *table = stdin; | 82 | FILE *table = stdin; |
99 | char *rootdir = NULL; | 83 | char *rootdir = NULL; |
100 | char *line = NULL; | 84 | char *line = NULL; |
101 | int linenum = 0; | 85 | int linenum = 0; |
102 | int ret = EXIT_SUCCESS; | 86 | int ret = EXIT_SUCCESS; |
103 | 87 | ||
104 | while ((opt = getopt(argc, argv, "d:")) != -1) { | 88 | unsigned long flags; |
105 | switch(opt) { | 89 | flags = bb_getopt_ulflags(argc, argv, "d:", &line); |
106 | case 'd': | 90 | if (line) |
107 | table = bb_xfopen((line=optarg), "r"); | 91 | table = bb_xfopen(line, "r"); |
108 | break; | ||
109 | default: | ||
110 | bb_show_usage(); | ||
111 | } | ||
112 | } | ||
113 | 92 | ||
114 | if (optind >= argc || (rootdir=argv[optind])==NULL) { | 93 | if (optind >= argc || (rootdir=argv[optind])==NULL) { |
115 | bb_error_msg_and_die("root directory not specified"); | 94 | bb_error_msg_and_die("root directory not specified"); |
@@ -159,16 +138,9 @@ extern int makedevs_main(int argc, char **argv) | |||
159 | if (name[0] == '#') { | 138 | if (name[0] == '#') { |
160 | continue; | 139 | continue; |
161 | } | 140 | } |
162 | if (group) { | 141 | |
163 | gid = get_ug_id(group, bb_xgetgrnam); | 142 | gid = group ? get_ug_id(group, bb_xgetgrnam) : getgid(); |
164 | } else { | 143 | uid = user ? get_ug_id(user, bb_xgetpwnam) : getuid(); |
165 | gid = getgid(); | ||
166 | } | ||
167 | if (user) { | ||
168 | uid = get_ug_id(user, bb_xgetpwnam); | ||
169 | } else { | ||
170 | uid = getuid(); | ||
171 | } | ||
172 | full_name = concat_path_file(rootdir, name); | 144 | full_name = concat_path_file(rootdir, name); |
173 | 145 | ||
174 | if (type == 'd') { | 146 | if (type == 'd') { |
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index 276fadebd..4b00e50c6 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c | |||
@@ -4,20 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> | 5 | * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | * | ||
21 | */ | 8 | */ |
22 | 9 | ||
23 | #include <stdio.h> | 10 | #include <stdio.h> |
@@ -40,19 +27,14 @@ static void watchdog_shutdown(int unused) | |||
40 | exit(0); | 27 | exit(0); |
41 | } | 28 | } |
42 | 29 | ||
43 | extern int watchdog_main(int argc, char **argv) | 30 | int watchdog_main(int argc, char **argv) |
44 | { | 31 | { |
45 | int opt; | 32 | |
46 | 33 | char *t_arg; | |
47 | while ((opt = getopt(argc, argv, "t:")) > 0) { | 34 | unsigned long flags; |
48 | switch (opt) { | 35 | flags = bb_getopt_ulflags(argc, argv, "t:", &t_arg); |
49 | case 't': | 36 | if (flags & 1) |
50 | timer_duration = bb_xgetlarg(optarg, 10, 0, INT_MAX); | 37 | timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX); |
51 | break; | ||
52 | default: | ||
53 | bb_show_usage(); | ||
54 | } | ||
55 | } | ||
56 | 38 | ||
57 | /* We're only interested in the watchdog device .. */ | 39 | /* We're only interested in the watchdog device .. */ |
58 | if (optind < argc - 1 || argc == 1) | 40 | if (optind < argc - 1 || argc == 1) |