mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 22:26:31 +00:00
minor cleanups
This commit is contained in:
parent
93e6e0735a
commit
79e3250337
@ -63,6 +63,7 @@ void bb_error_msg_and_die(const char *s, ...)
|
|||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bb_vperror_msg(const char *s, va_list p)
|
void bb_vperror_msg(const char *s, va_list p)
|
||||||
{
|
{
|
||||||
int err=errno;
|
int err=errno;
|
||||||
@ -321,25 +322,8 @@ char *concat_path_file(const char *path, const char *filename)
|
|||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
void bb_show_usage(void)
|
||||||
{
|
{
|
||||||
int opt;
|
|
||||||
FILE *table = stdin;
|
|
||||||
char *rootdir = "./";
|
|
||||||
char *line;
|
|
||||||
int linenum = 0;
|
|
||||||
int ret = EXIT_SUCCESS;
|
|
||||||
|
|
||||||
bb_applet_name = basename(argv[0]);
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "d:")) != -1) {
|
|
||||||
switch(opt) {
|
|
||||||
case 'd':
|
|
||||||
table = bb_xfopen(optarg, "r");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "%s: [-d device_table] rootdir\n\n", bb_applet_name);
|
fprintf(stderr, "%s: [-d device_table] rootdir\n\n", bb_applet_name);
|
||||||
fprintf(stderr, "Creates a batch of special files as specified in a device table.\n");
|
fprintf(stderr, "Creates a batch of special files as specified in a device table.\n");
|
||||||
fprintf(stderr, "Device table entries take the form of:\n");
|
fprintf(stderr, "Device table entries take the form of:\n");
|
||||||
@ -369,14 +353,32 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "/dev/hda\n");
|
fprintf(stderr, "/dev/hda\n");
|
||||||
fprintf(stderr, "/dev/hda[0-15]\n");
|
fprintf(stderr, "/dev/hda[0-15]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int opt;
|
||||||
|
FILE *table = stdin;
|
||||||
|
char *rootdir = NULL;
|
||||||
|
char *line = NULL;
|
||||||
|
int linenum = 0;
|
||||||
|
int ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
|
bb_applet_name = basename(argv[0]);
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "d:")) != -1) {
|
||||||
|
switch(opt) {
|
||||||
|
case 'd':
|
||||||
|
table = bb_xfopen((line=optarg), "r");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind >= argc) {
|
if (optind >= argc || (rootdir=argv[optind])==NULL) {
|
||||||
bb_error_msg_and_die("root directory not speficied");
|
bb_error_msg_and_die("root directory not speficied");
|
||||||
}
|
}
|
||||||
rootdir = argv[optind];
|
|
||||||
|
|
||||||
|
|
||||||
if (chdir(rootdir) != 0) {
|
if (chdir(rootdir) != 0) {
|
||||||
bb_perror_msg_and_die("Couldnt chdir to %s", rootdir);
|
bb_perror_msg_and_die("Couldnt chdir to %s", rootdir);
|
||||||
@ -384,6 +386,13 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
umask(0);
|
umask(0);
|
||||||
|
|
||||||
|
printf("rootdir=%s\n", rootdir);
|
||||||
|
if (line) {
|
||||||
|
printf("table='%s'\n", line);
|
||||||
|
} else {
|
||||||
|
printf("table=<stdin>\n");
|
||||||
|
}
|
||||||
|
|
||||||
while ((line = bb_get_chomped_line_from_file(table))) {
|
while ((line = bb_get_chomped_line_from_file(table))) {
|
||||||
char type;
|
char type;
|
||||||
unsigned int mode = 0755;
|
unsigned int mode = 0755;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user