aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-02-22 17:01:00 +0000
committerRob Landley <rob@landley.net>2006-02-22 17:01:00 +0000
commit0a7c8ef6e220b5f8fff4f2cb0af630255a2a6a58 (patch)
treef32eb89325299a3abade721ffe149b0e516747c1 /miscutils
parentfb16d5c6aa8aef30d313356b5a83ef0a60114c9a (diff)
downloadbusybox-0a7c8ef6e220b5f8fff4f2cb0af630255a2a6a58.tar.gz
Patch from Denis Vlasenko to constify things and fix a few typos.
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/devfsd.c69
-rw-r--r--miscutils/hdparm.c4
2 files changed, 40 insertions, 33 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index fd5f54763..f99a94628 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -606,17 +606,18 @@ static void process_config_line (const char *line, unsigned long *event_mask)
char name[STRING_LENGTH];
char * msg="";
char *ptr;
+ int i;
/* !!!! Only Uppercase Keywords in devsfd.conf */
- const char *options[] = { "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE",
- "PERMISSIONS", "MODLOAD", "EXECUTE", "COPY", "IGNORE",
- "MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT", 0 };
-
- int i;
+ static const char *const options[] = {
+ "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE",
+ "RESTORE", "PERMISSIONS", "MODLOAD", "EXECUTE",
+ "COPY", "IGNORE", "MKOLDCOMPAT", "MKNEWCOMPAT",
+ "RMOLDCOMPAT", "RMNEWCOMPAT", 0
+ };
debug_msg_logger(LOG_INFO, __FUNCTION__);
-
for (count = 0; count < MAX_ARGS; ++count) p[count][0] = '\0';
num_args = sscanf (line, "%s %s %s %s %s %s %s %s %s %s",
when, name, what,
@@ -678,7 +679,7 @@ static void process_config_line (const char *line, unsigned long *event_mask)
if ( ( ptr = strchr (p[0], '.') ) == NULL )
{
msg="UID.GID";
- goto process_config_line_err; /*"missing '.' in UID.GID */
+ goto process_config_line_err; /*"missing '.' in UID.GID"*/
}
*ptr++ = '\0';
@@ -993,17 +994,19 @@ static void action_compat (const struct devfsd_notify_struct *info, unsigned int
unsigned int i;
char rewind_;
/* 1 to 5 "scsi/" , 6 to 9 "ide/host" */
- const char *fmt[] = { NULL ,
- "sg/c%db%dt%du%d", /* scsi/generic */
- "sd/c%db%dt%du%d", /* scsi/disc */
- "sr/c%db%dt%du%d", /* scsi/cd */
- "sd/c%db%dt%du%dp%d", /* scsi/part */
- "st/c%db%dt%du%dm%d%c", /* scsi/mt */
- "ide/hd/c%db%dt%du%d", /* ide/host/disc */
- "ide/cd/c%db%dt%du%d", /* ide/host/cd */
- "ide/hd/c%db%dt%du%dp%d", /* ide/host/part */
- "ide/mt/c%db%dt%du%d%s", /* ide/host/mt */
- NULL };
+ static const char *const fmt[] = {
+ NULL ,
+ "sg/c%db%dt%du%d", /* scsi/generic */
+ "sd/c%db%dt%du%d", /* scsi/disc */
+ "sr/c%db%dt%du%d", /* scsi/cd */
+ "sd/c%db%dt%du%dp%d", /* scsi/part */
+ "st/c%db%dt%du%dm%d%c", /* scsi/mt */
+ "ide/hd/c%db%dt%du%d", /* ide/host/disc */
+ "ide/cd/c%db%dt%du%d", /* ide/host/cd */
+ "ide/hd/c%db%dt%du%dp%d", /* ide/host/part */
+ "ide/mt/c%db%dt%du%d%s", /* ide/host/mt */
+ NULL
+ };
/* First construct compatibility name */
switch (action)
@@ -1596,20 +1599,22 @@ const char *get_old_name (const char *devname, unsigned int namelen,
const char *pty2;
size_t len;
/* 1 to 5 "scsi/" , 6 to 9 "ide/host", 10 sbp/, 11 vcc/, 12 pty/ */
- const char *fmt[] = { NULL ,
- "sg%u", /* scsi/generic */
- NULL, /* scsi/disc */
- "sr%u", /* scsi/cd */
- NULL, /* scsi/part */
- "nst%u%c", /* scsi/mt */
- "hd%c" , /* ide/host/disc */
- "hd%c" , /* ide/host/cd */
- "hd%c%s", /* ide/host/part */
- "%sht%d", /* ide/host/mt */
- "sbpcd%u", /* sbp/ */
- "vcs%s", /* vcc/ */
- "%cty%c%c", /* pty/ */
- NULL };
+ static const char *const fmt[] = {
+ NULL ,
+ "sg%u", /* scsi/generic */
+ NULL, /* scsi/disc */
+ "sr%u", /* scsi/cd */
+ NULL, /* scsi/part */
+ "nst%u%c", /* scsi/mt */
+ "hd%c" , /* ide/host/disc */
+ "hd%c" , /* ide/host/cd */
+ "hd%c%s", /* ide/host/part */
+ "%sht%d", /* ide/host/mt */
+ "sbpcd%u", /* sbp/ */
+ "vcs%s", /* vcc/ */
+ "%cty%c%c", /* pty/ */
+ NULL
+ };
debug_msg_logger(LOG_INFO, __FUNCTION__);
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 750cb499b..e733c9172 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -1305,10 +1305,12 @@ static const char * const BuffType[] = {"unknown", "1Sect", "DualPort", "DualPor
static void dump_identity (const struct hd_driveid *id)
{
int i;
- char pmodes[64] = {0,}, dmodes[128]={0,}, umodes[128]={0,};
+ char pmodes[64], dmodes[128], umodes[128];
const unsigned short int *id_regs= (const void*) id;
unsigned long capacity;
+ pmodes[0] = dmodes[0] = umodes[0] = '\0';
+
printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={",
id->model, id->fw_rev, id->serial_no);
for (i=0; i<=15; i++)