projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*: remove some uses of argc
[oweals/busybox.git]
/
e2fsprogs
/
old_e2fsprogs
/
fsck.c
diff --git
a/e2fsprogs/old_e2fsprogs/fsck.c
b/e2fsprogs/old_e2fsprogs/fsck.c
index 0ad62ca0471e3693f83e4969af7235792538b171..687938c24c82e95e684f13f4c6cb54257edd5974 100644
(file)
--- a/
e2fsprogs/old_e2fsprogs/fsck.c
+++ b/
e2fsprogs/old_e2fsprogs/fsck.c
@@
-20,10
+20,7
@@
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
* 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
*
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
* 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
*
- * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
- * %End-Header%
+ * Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
*/
#include <sys/types.h>
@@
-115,7
+112,7
@@
struct fsck_instance {
* Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
* pathames.
*/
* Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
* pathames.
*/
-static const char *
const devfs_hier[] = {
+static const char *const devfs_hier[] = {
"host", "bus", "target", "lun", 0
};
#endif
"host", "bus", "target", "lun", 0
};
#endif
@@
-124,7
+121,7
@@
static char *base_device(const char *device)
{
char *str, *cp;
#ifdef CONFIG_FEATURE_DEVFS
{
char *str, *cp;
#ifdef CONFIG_FEATURE_DEVFS
- const char *
const *hier;
+ const char *const *hier;
const char *disk;
int len;
#endif
const char *disk;
int len;
#endif
@@
-226,7
+223,7
@@
errout:
}
}
-static const char *
const ignored_types[] = {
+static const char *const ignored_types[] = {
"ignore",
"iso9660",
"nfs",
"ignore",
"iso9660",
"nfs",
@@
-238,7
+235,7
@@
static const char * const ignored_types[] = {
NULL
};
NULL
};
-static const char *
const really_wanted[] = {
+static const char *const really_wanted[] = {
"minix",
"ext2",
"ext3",
"minix",
"ext2",
"ext3",
@@
-285,7
+282,7
@@
static char *string_copy(const char *s)
if (!s)
return 0;
if (!s)
return 0;
- ret = strdup(s);
+ ret =
x
strdup(s);
return ret;
}
return ret;
}
@@
-477,8
+474,7
@@
static void load_fs_info(const char *filename)
int old_fstab = 1;
struct fs_info *fs;
int old_fstab = 1;
struct fs_info *fs;
- if ((f = fopen(filename, "r")) == NULL) {
- bb_perror_msg("WARNING: cannot open %s", filename);
+ if ((f = fopen_or_warn(filename, "r")) == NULL) {
return;
}
while (!feof(f)) {
return;
}
while (!feof(f)) {
@@
-534,21
+530,21
@@
static struct fs_info *lookup(char *filesys)
/* Find fsck program for a given fs type. */
static char *find_fsck(char *type)
{
/* Find fsck program for a given fs type. */
static char *find_fsck(char *type)
{
- char *s;
- const char *tpl;
- char *p = string_copy(fsck_path);
- struct stat st;
+
char *s;
+
const char *tpl;
+
char *p = string_copy(fsck_path);
+
struct stat st;
- /* Are we looking for a program or just a type? */
- tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s");
+
/* Are we looking for a program or just a type? */
+
tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s");
-
for
(s = strtok(p, ":"); s; s = strtok(NULL, ":")) {
- s = xasprintf(tpl, s, type);
- if (stat(s, &st) == 0) break;
- free(s);
- }
- free(p);
- return s;
+
for
(s = strtok(p, ":"); s; s = strtok(NULL, ":")) {
+
s = xasprintf(tpl, s, type);
+
if (stat(s, &st) == 0) break;
+
free(s);
+
}
+
free(p);
+
return s;
}
static int progress_active(void)
}
static int progress_active(void)
@@
-613,7
+609,7
@@
static int execute(const char *type, const char *device, const char *mntpt,
mntpt ? mntpt : device);
for (i=0; i < argc; i++)
printf("%s ", argv[i]);
mntpt ? mntpt : device);
for (i=0; i < argc; i++)
printf("%s ", argv[i]);
-
puts(""
);
+
bb_putchar('\n'
);
}
/* Fork and execute the correct program. */
}
/* Fork and execute the correct program. */
@@
-626,7
+622,7
@@
static int execute(const char *type, const char *device, const char *mntpt,
if (!interactive)
close(0);
(void) execv(s, argv);
if (!interactive)
close(0);
(void) execv(s, argv);
- bb_
perror_msg_and_die("%s",
argv[0]);
+ bb_
simple_perror_msg_and_die(
argv[0]);
}
for (i = 1; i < argc; i++)
}
for (i = 1; i < argc; i++)
@@
-886,7
+882,7
@@
static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp)
list = string_copy(fs_type);
num = 0;
s = strtok(list, ",");
list = string_copy(fs_type);
num = 0;
s = strtok(list, ",");
- while(s) {
+ while
(s) {
negate = 0;
if (strncmp(s, "no", 2) == 0) {
s += 2;
negate = 0;
if (strncmp(s, "no", 2) == 0) {
s += 2;
@@
-931,7
+927,7
@@
static int opt_in_list(char *opt, char *optlist)
list = string_copy(optlist);
s = strtok(list, ",");
list = string_copy(optlist);
s = strtok(list, ",");
- while(s) {
+ while
(s) {
if (strcmp(s, opt) == 0) {
free(list);
return 1;
if (strcmp(s, opt) == 0) {
free(list);
return 1;
@@
-1005,7
+1001,7
@@
static int ignore(struct fs_info *fs)
s = find_fsck(fs->type);
if (s == NULL) {
if (wanted)
s = find_fsck(fs->type);
if (s == NULL) {
if (wanted)
- bb_error_msg("can
no
t check %s: fsck.%s not found",
+ bb_error_msg("can
'
t check %s: fsck.%s not found",
fs->device, fs->type);
return 1;
}
fs->device, fs->type);
return 1;
}
@@
-1207,7
+1203,7
@@
static void PRS(int argc, char **argv)
* /proc/partitions isn't found.
*/
if (access("/proc/partitions", R_OK) < 0) {
* /proc/partitions isn't found.
*/
if (access("/proc/partitions", R_OK) < 0) {
- bb_perror_msg_and_die("can
no
t open /proc/partitions "
+ bb_perror_msg_and_die("can
'
t open /proc/partitions "
"(is /proc mounted?)");
}
/*
"(is /proc mounted?)");
}
/*
@@
-1219,7
+1215,7
@@
static void PRS(int argc, char **argv)
"must be root to scan for matching filesystems: %s\n", arg);
else
bb_error_msg_and_die(
"must be root to scan for matching filesystems: %s\n", arg);
else
bb_error_msg_and_die(
- "can
no
t find matching filesystem: %s", arg);
+ "can
'
t find matching filesystem: %s", arg);
}
devices[num_devices++] = dev ? dev : string_copy(arg);
continue;
}
devices[num_devices++] = dev ? dev : string_copy(arg);
continue;
@@
-1321,7
+1317,7
@@
static void PRS(int argc, char **argv)
max_running = atoi(tmp);
}
max_running = atoi(tmp);
}
-int fsck_main(int argc, char **argv);
+int fsck_main(int argc, char **argv)
MAIN_EXTERNALLY_VISIBLE
;
int fsck_main(int argc, char **argv)
{
int i, status = 0;
int fsck_main(int argc, char **argv)
{
int i, status = 0;
@@
-1357,7
+1353,7
@@
int fsck_main(int argc, char **argv)
interactive++;
return check_all();
}
interactive++;
return check_all();
}
- for (i = 0
; i < num_devices; i++) {
+ for (i = 0; i < num_devices; i++) {
if (cancel_requested) {
if (!kill_sent) {
kill_all(SIGTERM);
if (cancel_requested) {
if (!kill_sent) {
kill_all(SIGTERM);