From c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4 Mon Sep 17 00:00:00 2001 From: Tim Riker Date: Wed, 25 Jan 2006 00:08:53 +0000 Subject: just whitespace --- util-linux/Config.in | 4 +- util-linux/fbset.c | 136 +++++++------- util-linux/fdformat.c | 8 +- util-linux/getopt.c | 456 +++++++++++++++++++++++------------------------ util-linux/hwclock.c | 10 +- util-linux/ipcrm.c | 10 +- util-linux/ipcs.c | 44 ++--- util-linux/losetup.c | 16 +- util-linux/mdev.c | 32 ++-- util-linux/mount.c | 16 +- util-linux/nfsmount.c | 10 +- util-linux/pivot_root.c | 2 +- util-linux/rdate.c | 10 +- util-linux/readprofile.c | 4 +- util-linux/switch_root.c | 18 +- 15 files changed, 388 insertions(+), 388 deletions(-) (limited to 'util-linux') diff --git a/util-linux/Config.in b/util-linux/Config.in index bf3e13b2a..27410bf10 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in @@ -214,7 +214,7 @@ config CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS depends on CONFIG_HWCLOCK help Starting with FHS 2.3, the adjtime state file is supposed to exist - at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish + at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish to use the FHS behavior, answer Y here, otherwise answer N for the classic /etc/adjtime path. @@ -406,7 +406,7 @@ config CONFIG_FEATURE_MOUNT_LOOP command will detect you are trying to mount a file instead of a block device, and transparently associate the file with a loopback device. The umount command will also free that loopback device. - + You can still use the 'losetup' utility (to manually associate files with loop devices) if you need to do something advanced, such as specify an offset or cryptographic options to the loopback device. diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 83bf309a3..b1118311f 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -52,7 +52,7 @@ enum { CMD_VSYNC = 7, CMD_LACED = 8, CMD_DOUBLE = 9, -/* CMD_XCOMPAT = 10, */ +/* CMD_XCOMPAT = 10, */ CMD_ALL = 11, CMD_INFO = 12, CMD_CHANGE = 13, @@ -207,70 +207,70 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, while (!feof(f)) { fgets(buf, sizeof(buf), f); - if ((p = strstr(buf, "geometry "))) { - p += 9; - - sscanf(p, "%d %d %d %d %d", - &(base->xres), &(base->yres), - &(base->xres_virtual), &(base->yres_virtual), - &(base->bits_per_pixel)); - } else if ((p = strstr(buf, "timings "))) { - p += 8; - - sscanf(p, "%d %d %d %d %d %d %d", - &(base->pixclock), - &(base->left_margin), &(base->right_margin), - &(base->upper_margin), &(base->lower_margin), - &(base->hsync_len), &(base->vsync_len)); - } else if ((p = strstr(buf, "laced "))) { - p += 6; - - if (strstr(buf, "false")) { - base->vmode &= ~FB_VMODE_INTERLACED; - } else { - base->vmode |= FB_VMODE_INTERLACED; - } - } else if ((p = strstr(buf, "double "))) { - p += 7; - - if (strstr(buf, "false")) { - base->vmode &= ~FB_VMODE_DOUBLE; - } else { - base->vmode |= FB_VMODE_DOUBLE; - } - } else if ((p = strstr(buf, "vsync "))) { - p += 6; - - if (strstr(buf, "low")) { - base->sync &= ~FB_SYNC_VERT_HIGH_ACT; - } else { - base->sync |= FB_SYNC_VERT_HIGH_ACT; - } - } else if ((p = strstr(buf, "hsync "))) { - p += 6; - - if (strstr(buf, "low")) { - base->sync &= ~FB_SYNC_HOR_HIGH_ACT; - } else { - base->sync |= FB_SYNC_HOR_HIGH_ACT; - } - } else if ((p = strstr(buf, "csync "))) { - p += 6; - - if (strstr(buf, "low")) { - base->sync &= ~FB_SYNC_COMP_HIGH_ACT; - } else { - base->sync |= FB_SYNC_COMP_HIGH_ACT; - } - } else if ((p = strstr(buf, "extsync "))) { - p += 8; - - if (strstr(buf, "false")) { - base->sync &= ~FB_SYNC_EXT; - } else { - base->sync |= FB_SYNC_EXT; - } - } + if ((p = strstr(buf, "geometry "))) { + p += 9; + + sscanf(p, "%d %d %d %d %d", + &(base->xres), &(base->yres), + &(base->xres_virtual), &(base->yres_virtual), + &(base->bits_per_pixel)); + } else if ((p = strstr(buf, "timings "))) { + p += 8; + + sscanf(p, "%d %d %d %d %d %d %d", + &(base->pixclock), + &(base->left_margin), &(base->right_margin), + &(base->upper_margin), &(base->lower_margin), + &(base->hsync_len), &(base->vsync_len)); + } else if ((p = strstr(buf, "laced "))) { + p += 6; + + if (strstr(buf, "false")) { + base->vmode &= ~FB_VMODE_INTERLACED; + } else { + base->vmode |= FB_VMODE_INTERLACED; + } + } else if ((p = strstr(buf, "double "))) { + p += 7; + + if (strstr(buf, "false")) { + base->vmode &= ~FB_VMODE_DOUBLE; + } else { + base->vmode |= FB_VMODE_DOUBLE; + } + } else if ((p = strstr(buf, "vsync "))) { + p += 6; + + if (strstr(buf, "low")) { + base->sync &= ~FB_SYNC_VERT_HIGH_ACT; + } else { + base->sync |= FB_SYNC_VERT_HIGH_ACT; + } + } else if ((p = strstr(buf, "hsync "))) { + p += 6; + + if (strstr(buf, "low")) { + base->sync &= ~FB_SYNC_HOR_HIGH_ACT; + } else { + base->sync |= FB_SYNC_HOR_HIGH_ACT; + } + } else if ((p = strstr(buf, "csync "))) { + p += 6; + + if (strstr(buf, "low")) { + base->sync &= ~FB_SYNC_COMP_HIGH_ACT; + } else { + base->sync |= FB_SYNC_COMP_HIGH_ACT; + } + } else if ((p = strstr(buf, "extsync "))) { + p += 8; + + if (strstr(buf, "false")) { + base->sync &= ~FB_SYNC_EXT; + } else { + base->sync |= FB_SYNC_EXT; + } + } if (strstr(buf, "endmode")) return 1; @@ -374,9 +374,9 @@ extern int fbset_main(int argc, char **argv) varset.hsync_len = strtoul(argv[6], 0, 0); varset.vsync_len = strtoul(argv[7], 0, 0); break; - case CMD_CHANGE: - g_options |= OPT_CHANGE; - break; + case CMD_CHANGE: + g_options |= OPT_CHANGE; + break; #ifdef CONFIG_FEATURE_FBSET_FANCY case CMD_XRES: varset.xres = strtoul(argv[1], 0, 0); diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index 768105159..e7dd943bb 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -134,7 +134,7 @@ int fdformat_main(int argc,char **argv) if((read_bytes = safe_read(fd,data,n))!= n ) { if(read_bytes < 0) { bb_perror_msg("Read: "); - } + } bb_error_msg_and_die("Problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes); } /* Check backwards so we don't need a counter */ @@ -147,14 +147,14 @@ int fdformat_main(int argc,char **argv) /* There is no point in freeing blocks at the end of a program, because all of the program's space is given back to the system when the process terminates.*/ - + if (ENABLE_FEATURE_CLEAN_UP) free(data); - + print_and_flush("done\n", NULL); } if (ENABLE_FEATURE_CLEAN_UP) close(fd); - + /* Don't bother closing. Exit does * that, so we can save a few bytes */ return EXIT_SUCCESS; diff --git a/util-linux/getopt.c b/util-linux/getopt.c index fc3b9f97e..16dcbbca0 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -71,7 +71,7 @@ static int alternative; /* 0 is getopt_long, 1 is getopt_long_only */ /* Function prototypes */ static const char *normalize(const char *arg); static int generate_output(char * argv[],int argc,const char *optstr, - const struct option *longopts); + const struct option *longopts); static void add_long_options(char *options); static void add_longopt(const char *name,int has_arg); static void set_shell(const char *new_shell); @@ -88,57 +88,57 @@ static void set_shell(const char *new_shell); */ const char *normalize(const char *arg) { - static char *BUFFER=NULL; - const char *argptr=arg; - char *bufptr; - - free(BUFFER); - - if (!quote) { /* Just copy arg */ - BUFFER=bb_xstrdup(arg); - return BUFFER; - } - - /* Each character in arg may take up to four characters in the result: - For a quote we need a closing quote, a backslash, a quote and an - opening quote! We need also the global opening and closing quote, - and one extra character for '\0'. */ - BUFFER=xmalloc(strlen(arg)*4+3); - - bufptr=BUFFER; - *bufptr++='\''; - - while (*argptr) { - if (*argptr == '\'') { - /* Quote: replace it with: '\'' */ - *bufptr++='\''; - *bufptr++='\\'; - *bufptr++='\''; - *bufptr++='\''; - } else if (shell==TCSH && *argptr=='!') { - /* Exclamation mark: replace it with: \! */ - *bufptr++='\''; - *bufptr++='\\'; - *bufptr++='!'; - *bufptr++='\''; - } else if (shell==TCSH && *argptr=='\n') { - /* Newline: replace it with: \n */ - *bufptr++='\\'; - *bufptr++='n'; - } else if (shell==TCSH && isspace(*argptr)) { - /* Non-newline whitespace: replace it with \ */ - *bufptr++='\''; - *bufptr++='\\'; - *bufptr++=*argptr; - *bufptr++='\''; - } else - /* Just copy */ - *bufptr++=*argptr; - argptr++; - } - *bufptr++='\''; - *bufptr++='\0'; - return BUFFER; + static char *BUFFER=NULL; + const char *argptr=arg; + char *bufptr; + + free(BUFFER); + + if (!quote) { /* Just copy arg */ + BUFFER=bb_xstrdup(arg); + return BUFFER; + } + + /* Each character in arg may take up to four characters in the result: + For a quote we need a closing quote, a backslash, a quote and an + opening quote! We need also the global opening and closing quote, + and one extra character for '\0'. */ + BUFFER=xmalloc(strlen(arg)*4+3); + + bufptr=BUFFER; + *bufptr++='\''; + + while (*argptr) { + if (*argptr == '\'') { + /* Quote: replace it with: '\'' */ + *bufptr++='\''; + *bufptr++='\\'; + *bufptr++='\''; + *bufptr++='\''; + } else if (shell==TCSH && *argptr=='!') { + /* Exclamation mark: replace it with: \! */ + *bufptr++='\''; + *bufptr++='\\'; + *bufptr++='!'; + *bufptr++='\''; + } else if (shell==TCSH && *argptr=='\n') { + /* Newline: replace it with: \n */ + *bufptr++='\\'; + *bufptr++='n'; + } else if (shell==TCSH && isspace(*argptr)) { + /* Non-newline whitespace: replace it with \ */ + *bufptr++='\''; + *bufptr++='\\'; + *bufptr++=*argptr; + *bufptr++='\''; + } else + /* Just copy */ + *bufptr++=*argptr; + argptr++; + } + *bufptr++='\''; + *bufptr++='\0'; + return BUFFER; } /* @@ -149,47 +149,47 @@ const char *normalize(const char *arg) * Other settings are found in global variables. */ int generate_output(char * argv[],int argc,const char *optstr, - const struct option *longopts) + const struct option *longopts) { - int exit_code = 0; /* We assume everything will be OK */ - int opt; - int longindex; - const char *charptr; - - if (quiet_errors) /* No error reporting from getopt(3) */ - opterr=0; - optind=0; /* Reset getopt(3) */ - - while ((opt = (alternative? - getopt_long_only(argc,argv,optstr,longopts,&longindex): - getopt_long(argc,argv,optstr,longopts,&longindex))) - != EOF) - if (opt == '?' || opt == ':' ) - exit_code = 1; - else if (!quiet_output) { - if (opt == LONG_OPT) { - printf(" --%s",longopts[longindex].name); - if (longopts[longindex].has_arg) - printf(" %s", - normalize(optarg?optarg:"")); - } else if (opt == NON_OPT) - printf(" %s",normalize(optarg)); - else { - printf(" -%c",opt); - charptr = strchr(optstr,opt); - if (charptr != NULL && *++charptr == ':') - printf(" %s", - normalize(optarg?optarg:"")); - } - } - - if (! quiet_output) { - printf(" --"); - while (optind < argc) - printf(" %s",normalize(argv[optind++])); - printf("\n"); - } - return exit_code; + int exit_code = 0; /* We assume everything will be OK */ + int opt; + int longindex; + const char *charptr; + + if (quiet_errors) /* No error reporting from getopt(3) */ + opterr=0; + optind=0; /* Reset getopt(3) */ + + while ((opt = (alternative? + getopt_long_only(argc,argv,optstr,longopts,&longindex): + getopt_long(argc,argv,optstr,longopts,&longindex))) + != EOF) + if (opt == '?' || opt == ':' ) + exit_code = 1; + else if (!quiet_output) { + if (opt == LONG_OPT) { + printf(" --%s",longopts[longindex].name); + if (longopts[longindex].has_arg) + printf(" %s", + normalize(optarg?optarg:"")); + } else if (opt == NON_OPT) + printf(" %s",normalize(optarg)); + else { + printf(" -%c",opt); + charptr = strchr(optstr,opt); + if (charptr != NULL && *++charptr == ':') + printf(" %s", + normalize(optarg?optarg:"")); + } + } + + if (! quiet_output) { + printf(" --"); + while (optind < argc) + printf(" %s",normalize(argv[optind++])); + printf("\n"); + } + return exit_code; } static struct option *long_options; @@ -201,32 +201,32 @@ static const int LONG_OPTIONS_INCR = 10; /* Register a long option. The contents of name is copied. */ void add_longopt(const char *name,int has_arg) { - if (!name) { /* init */ - free(long_options); - long_options=NULL; - long_options_length=0; - long_options_nr=0; - } - - if (long_options_nr == long_options_length) { - long_options_length += LONG_OPTIONS_INCR; - long_options=xrealloc(long_options, - sizeof(struct option) * - long_options_length); - } - - long_options[long_options_nr].name=NULL; - long_options[long_options_nr].has_arg=0; - long_options[long_options_nr].flag=NULL; - long_options[long_options_nr].val=0; - - if (long_options_nr) { /* Not for init! */ - long_options[long_options_nr-1].has_arg=has_arg; - long_options[long_options_nr-1].flag=NULL; - long_options[long_options_nr-1].val=LONG_OPT; - long_options[long_options_nr-1].name=bb_xstrdup(name); - } - long_options_nr++; + if (!name) { /* init */ + free(long_options); + long_options=NULL; + long_options_length=0; + long_options_nr=0; + } + + if (long_options_nr == long_options_length) { + long_options_length += LONG_OPTIONS_INCR; + long_options=xrealloc(long_options, + sizeof(struct option) * + long_options_length); + } + + long_options[long_options_nr].name=NULL; + long_options[long_options_nr].has_arg=0; + long_options[long_options_nr].flag=NULL; + long_options[long_options_nr].val=0; + + if (long_options_nr) { /* Not for init! */ + long_options[long_options_nr-1].has_arg=has_arg; + long_options[long_options_nr-1].flag=NULL; + long_options[long_options_nr-1].val=LONG_OPT; + long_options[long_options_nr-1].name=bb_xstrdup(name); + } + long_options_nr++; } @@ -237,43 +237,43 @@ void add_longopt(const char *name,int has_arg) */ void add_long_options(char *options) { - int arg_opt, tlen; - char *tokptr=strtok(options,", \t\n"); - while (tokptr) { - arg_opt=no_argument; + int arg_opt, tlen; + char *tokptr=strtok(options,", \t\n"); + while (tokptr) { + arg_opt=no_argument; tlen=strlen(tokptr); - if (tlen > 0) { - if (tokptr[tlen-1] == ':') { - if (tlen > 1 && tokptr[tlen-2] == ':') { - tokptr[tlen-2]='\0'; + if (tlen > 0) { + if (tokptr[tlen-1] == ':') { + if (tlen > 1 && tokptr[tlen-2] == ':') { + tokptr[tlen-2]='\0'; tlen -= 2; - arg_opt=optional_argument; - } else { - tokptr[tlen-1]='\0'; + arg_opt=optional_argument; + } else { + tokptr[tlen-1]='\0'; tlen -= 1; - arg_opt=required_argument; - } - if (tlen == 0) - bb_error_msg("empty long option after -l or --long argument"); - } - add_longopt(tokptr,arg_opt); - } - tokptr=strtok(NULL,", \t\n"); - } + arg_opt=required_argument; + } + if (tlen == 0) + bb_error_msg("empty long option after -l or --long argument"); + } + add_longopt(tokptr,arg_opt); + } + tokptr=strtok(NULL,", \t\n"); + } } void set_shell(const char *new_shell) { - if (!strcmp(new_shell,"bash")) - shell=BASH; - else if (!strcmp(new_shell,"tcsh")) - shell=TCSH; - else if (!strcmp(new_shell,"sh")) - shell=BASH; - else if (!strcmp(new_shell,"csh")) - shell=TCSH; - else - bb_error_msg("unknown shell after -s or --shell argument"); + if (!strcmp(new_shell,"bash")) + shell=BASH; + else if (!strcmp(new_shell,"tcsh")) + shell=TCSH; + else if (!strcmp(new_shell,"sh")) + shell=BASH; + else if (!strcmp(new_shell,"csh")) + shell=TCSH; + else + bb_error_msg("unknown shell after -s or --shell argument"); } @@ -287,16 +287,16 @@ void set_shell(const char *new_shell) static const struct option longopts[]= { - {"options",required_argument,NULL,'o'}, - {"longoptions",required_argument,NULL,'l'}, - {"quiet",no_argument,NULL,'q'}, - {"quiet-output",no_argument,NULL,'Q'}, - {"shell",required_argument,NULL,'s'}, - {"test",no_argument,NULL,'T'}, - {"unquoted",no_argument,NULL,'u'}, - {"alternative",no_argument,NULL,'a'}, - {"name",required_argument,NULL,'n'}, - {NULL,0,NULL,0} + {"options",required_argument,NULL,'o'}, + {"longoptions",required_argument,NULL,'l'}, + {"quiet",no_argument,NULL,'q'}, + {"quiet-output",no_argument,NULL,'Q'}, + {"shell",required_argument,NULL,'s'}, + {"test",no_argument,NULL,'T'}, + {"unquoted",no_argument,NULL,'u'}, + {"alternative",no_argument,NULL,'a'}, + {"name",required_argument,NULL,'n'}, + {NULL,0,NULL,0} }; /* Stop scanning as soon as a non-option argument is found! */ @@ -305,77 +305,77 @@ static const char shortopts[]="+ao:l:n:qQs:Tu"; int getopt_main(int argc, char *argv[]) { - const char *optstr = NULL; - char *name = NULL; - int opt; - int compatible=0; - - init_longopt(); - - if (getenv("GETOPT_COMPATIBLE")) - compatible=1; - - if (argc == 1) { - if (compatible) { - /* For some reason, the original getopt gave no error - when there were no arguments. */ - printf(" --\n"); - return 0; - } else - bb_error_msg_and_die("missing optstring argument"); - } - - if (argv[1][0] != '-' || compatible) { + const char *optstr = NULL; + char *name = NULL; + int opt; + int compatible=0; + + init_longopt(); + + if (getenv("GETOPT_COMPATIBLE")) + compatible=1; + + if (argc == 1) { + if (compatible) { + /* For some reason, the original getopt gave no error + when there were no arguments. */ + printf(" --\n"); + return 0; + } else + bb_error_msg_and_die("missing optstring argument"); + } + + if (argv[1][0] != '-' || compatible) { char *s; - - quote=0; - s=xmalloc(strlen(argv[1])+1); - strcpy(s,argv[1]+strspn(argv[1],"-+")); - argv[1]=argv[0]; - return (generate_output(argv+1,argc-1,s,long_options)); - } - - while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) - switch (opt) { - case 'a': - alternative=1; - break; - case 'o': - optstr = optarg; - break; - case 'l': - add_long_options(optarg); - break; - case 'n': - name = optarg; - break; - case 'q': - quiet_errors=1; - break; - case 'Q': - quiet_output=1; - break; - case 's': - set_shell(optarg); - break; - case 'T': - return 4; - case 'u': - quote=0; - break; - default: - bb_show_usage(); - } - - if (!optstr) { - if (optind >= argc) - bb_error_msg_and_die("missing optstring argument"); - else optstr=argv[optind++]; - } - if (name) - argv[optind-1]=name; - else - argv[optind-1]=argv[0]; + + quote=0; + s=xmalloc(strlen(argv[1])+1); + strcpy(s,argv[1]+strspn(argv[1],"-+")); + argv[1]=argv[0]; + return (generate_output(argv+1,argc-1,s,long_options)); + } + + while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) + switch (opt) { + case 'a': + alternative=1; + break; + case 'o': + optstr = optarg; + break; + case 'l': + add_long_options(optarg); + break; + case 'n': + name = optarg; + break; + case 'q': + quiet_errors=1; + break; + case 'Q': + quiet_output=1; + break; + case 's': + set_shell(optarg); + break; + case 'T': + return 4; + case 'u': + quote=0; + break; + default: + bb_show_usage(); + } + + if (!optstr) { + if (optind >= argc) + bb_error_msg_and_die("missing optstring argument"); + else optstr=argv[optind++]; + } + if (name) + argv[optind-1]=name; + else + argv[optind-1]=argv[0]; return (generate_output(argv+optind-1,argc-optind+1,optstr,long_options)); } diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index 5b990df0c..00abe10a6 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c @@ -67,7 +67,7 @@ static time_t read_rtc(int utc) if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 ) bb_perror_msg_and_die ( "Could not access RTC" ); } - memset ( &tm, 0, sizeof( struct tm )); + memset ( &tm, 0, sizeof( struct tm )); if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 ) bb_perror_msg_and_die ( "Could not read time from RTC" ); tm. tm_isdst = -1; // not known @@ -187,10 +187,10 @@ static int check_utc(void) } #define HWCLOCK_OPT_LOCALTIME 0x01 -#define HWCLOCK_OPT_UTC 0x02 -#define HWCLOCK_OPT_SHOW 0x04 -#define HWCLOCK_OPT_HCTOSYS 0x08 -#define HWCLOCK_OPT_SYSTOHC 0x10 +#define HWCLOCK_OPT_UTC 0x02 +#define HWCLOCK_OPT_SHOW 0x04 +#define HWCLOCK_OPT_HCTOSYS 0x08 +#define HWCLOCK_OPT_SYSTOHC 0x10 extern int hwclock_main ( int argc, char **argv ) { diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index 9e18752a3..f4abf6839 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c @@ -94,7 +94,7 @@ remove_ids(type_id type, int argc, char **argv) { case MSG: ret = msgctl (id, IPC_RMID, NULL); break; - + case SHM: ret = shmctl (id, IPC_RMID, NULL); break; @@ -109,7 +109,7 @@ remove_ids(type_id type, int argc, char **argv) { argc--; argv++; } - + return(nb_errors); } @@ -119,7 +119,7 @@ static int deprecated_main(int argc, char **argv) bb_show_usage(); bb_fflush_stdout_and_exit(1); } - + if (!strcmp(argv[1], "shm")) { if (remove_ids(SHM, argc-2, &argv[2])) bb_fflush_stdout_and_exit(1); @@ -127,7 +127,7 @@ static int deprecated_main(int argc, char **argv) else if (!strcmp(argv[1], "msg")) { if (remove_ids(MSG, argc-2, &argv[2])) bb_fflush_stdout_and_exit(1); - } + } else if (!strcmp(argv[1], "sem")) { if (remove_ids(SEM, argc-2, &argv[2])) bb_fflush_stdout_and_exit(1); @@ -228,7 +228,7 @@ int ipcrm_main(int argc, char **argv) } result = ((c == 'q') ? msgctl(id, IPC_RMID, NULL) : - (c == 'm') ? shmctl(id, IPC_RMID, NULL) : + (c == 'm') ? shmctl(id, IPC_RMID, NULL) : semctl(id, 0, IPC_RMID, arg)); if (result < 0) { diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index ea5e412ea..f1463a8e3 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c @@ -29,12 +29,12 @@ * 19:30:41 1996 by janl@math.uio.no to add code missing in case PID: * clauses. * - * Patches from Mike Jagdis (jaggy@purplet.demon.co.uk) applied - * Wed Feb 8 12:12:21 1995 by faith@cs.unc.edu to print numeric uids + * Patches from Mike Jagdis (jaggy@purplet.demon.co.uk) applied + * Wed Feb 8 12:12:21 1995 by faith@cs.unc.edu to print numeric uids * if no passwd file entry. * * Modified Sat Oct 9 10:55:28 1993 for 0.99.13 - * Original author unknown, may be "krishna balasub@cis.ohio-state.edu" + * Original author unknown, may be "krishna balasub@cis.ohio-state.edu" * */ @@ -136,7 +136,7 @@ static void print_msg (int id); static void print_sem (int id); int ipcs_main (int argc, char **argv) { - int opt, msg = 0, sem = 0, shm = 0, id=0, print=0; + int opt, msg = 0, sem = 0, shm = 0, id=0, print=0; char format = 0; char options[] = "atclupsmqi:ih?"; @@ -173,7 +173,7 @@ int ipcs_main (int argc, char **argv) { case 'u': format = STATUS; break; - case 'h': + case 'h': case '?': bb_show_usage(); bb_fflush_stdout_and_exit (0); @@ -181,11 +181,11 @@ int ipcs_main (int argc, char **argv) { } if (print) { - if (shm) { + if (shm) { print_shm (id); bb_fflush_stdout_and_exit (0); } - if (sem) { + if (sem) { print_sem (id); bb_fflush_stdout_and_exit (0); } @@ -201,15 +201,15 @@ int ipcs_main (int argc, char **argv) { msg = sem = shm = 1; bb_printf ("\n"); - if (shm) { + if (shm) { do_shm (format); bb_printf ("\n"); } - if (sem) { + if (sem) { do_sem (format); bb_printf ("\n"); } - if (msg) { + if (msg) { do_msg (format); bb_printf ("\n"); } @@ -258,7 +258,7 @@ void do_shm (char format) bb_printf ("kernel not configured for shared memory\n"); return; } - + switch (format) { case LIMITS: bb_printf ("------ Shared Memory Limits --------\n"); @@ -282,7 +282,7 @@ void do_shm (char format) bb_printf ("pages allocated %ld\n", shm_info.shm_tot); bb_printf ("pages resident %ld\n", shm_info.shm_rss); bb_printf ("pages swapped %ld\n", shm_info.shm_swp); - bb_printf ("Swap performance: %ld attempts\t %ld successes\n", + bb_printf ("Swap performance: %ld attempts\t %ld successes\n", shm_info.swap_attempts, shm_info.swap_successes); return; @@ -313,7 +313,7 @@ void do_shm (char format) for (id = 0; id <= maxid; id++) { shmid = shmctl (id, SHM_STAT, &shmseg); - if (shmid < 0) + if (shmid < 0) continue; if (format == CREATOR) { print_perms (shmid, ipcp); @@ -321,7 +321,7 @@ void do_shm (char format) } pw = getpwuid(ipcp->uid); switch (format) { - case TIME: + case TIME: if (pw) bb_printf ("%-10d %-10.10s", shmid, pw->pw_name); else @@ -342,14 +342,14 @@ void do_shm (char format) bb_printf (" %-10d %-10d\n", shmseg.shm_cpid, shmseg.shm_lpid); break; - + default: bb_printf("0x%08x ",ipcp->KEY ); if (pw) bb_printf ("%-10d %-10.10s", shmid, pw->pw_name); else bb_printf ("%-10d %-10d", shmid, ipcp->uid); - bb_printf ("%-10o %-10lu %-10ld %-6s %-6s\n", + bb_printf ("%-10o %-10lu %-10ld %-6s %-6s\n", ipcp->mode & 0777, /* * earlier: int, Austin has size_t @@ -384,7 +384,7 @@ void do_sem (char format) bb_printf ("kernel not configured for semaphores\n"); return; } - + switch (format) { case LIMITS: bb_printf ("------ Semaphore Limits --------\n"); @@ -421,7 +421,7 @@ void do_sem (char format) default: bb_printf ("------ Semaphore Arrays --------\n"); - bb_printf ("%-10s %-10s %-10s %-10s %-10s\n", + bb_printf ("%-10s %-10s %-10s %-10s %-10s\n", "key","semid","owner","perms","nsems"); break; } @@ -437,7 +437,7 @@ void do_sem (char format) } pw = getpwuid(ipcp->uid); switch (format) { - case TIME: + case TIME: if (pw) bb_printf ("%-8d %-10.10s", semid, pw->pw_name); else @@ -449,7 +449,7 @@ void do_sem (char format) break; case PID: break; - + default: bb_printf("0x%08x ", ipcp->KEY); if (pw) @@ -484,7 +484,7 @@ void do_msg (char format) bb_printf ("kernel not configured for message queues\n"); return; } - + switch (format) { case LIMITS: if ((msgctl (0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0 ) @@ -662,7 +662,7 @@ void print_sem (int semid) bb_printf ("nsems = %ld\n", (long) semds.sem_nsems); bb_printf ("otime = %-26.24s\n", semds.sem_otime ? ctime (&semds.sem_otime) : "Not set"); - bb_printf ("ctime = %-26.24s\n", ctime (&semds.sem_ctime)); + bb_printf ("ctime = %-26.24s\n", ctime (&semds.sem_ctime)); bb_printf ("%-10s %-10s %-10s %-10s %-10s\n", "semnum","value","ncount","zcount","pid"); diff --git a/util-linux/losetup.c b/util-linux/losetup.c index f03889663..c2d3339e0 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c @@ -31,16 +31,16 @@ die_failed: case -1: /* losetup takes two argument:, loop_device and file */ if(optind+2==argc) { - if(set_loop(&argv[optind], argv[optind + 1], offset)>=0) - return EXIT_SUCCESS; - else goto die_failed; + if(set_loop(&argv[optind], argv[optind + 1], offset)>=0) + return EXIT_SUCCESS; + else goto die_failed; } if(optind+1==argc) { - char *s=query_loop(argv[optind]); - if (!s) goto die_failed; - printf("%s: %s\n",argv[optind],s); - if(ENABLE_FEATURE_CLEAN_UP) free(s); - return EXIT_SUCCESS; + char *s=query_loop(argv[optind]); + if (!s) goto die_failed; + printf("%s: %s\n",argv[optind],s); + if(ENABLE_FEATURE_CLEAN_UP) free(s); + return EXIT_SUCCESS; } break; } diff --git a/util-linux/mdev.c b/util-linux/mdev.c index a18e44835..b8c0090fa 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -1,7 +1,7 @@ /* vi:set ts=4: - * + * * mdev - Mini udev for busybox - * + * * Copyright 2005 Rob Landley * Copyright 2005 Frank Sorenson * @@ -38,21 +38,21 @@ static void make_device(char *path) RESERVE_CONFIG_BUFFER(temp,PATH_MAX); /* Try to read major/minor string */ - + snprintf(temp, PATH_MAX, "%s/dev", path); fd = open(temp, O_RDONLY); len = read(fd, temp, PATH_MAX-1); if (len<1) goto end; close(fd); - + /* Determine device name, type, major and minor */ - + device_name = strrchr(path, '/') + 1; type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK; if(sscanf(temp, "%d:%d", &major, &minor) != 2) goto end; /* If we have a config file, look up permissions for this device */ - + if (ENABLE_FEATURE_MDEV_CONF) { char *conf,*pos,*end; @@ -67,7 +67,7 @@ static void make_device(char *path) for (pos=conf;pos-conf