aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-06-30 08:04:05 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-06-30 08:04:05 +0000
commitdc757aa16ce53d9784fa3953b0c3762dfa8ccda9 (patch)
tree2eee7a83dcbd38fcfbcdbec8b5d52f4baff3326f /miscutils
parentf7d07b1723c15ee818f0c1f5cce96c55274024a6 (diff)
downloadbusybox-dc757aa16ce53d9784fa3953b0c3762dfa8ccda9.tar.gz
introduce and use bb_basename()
function old new delta bb_basename - 26 +26 sv_main 1226 1225 -1 passwd_main 1985 1983 -2 showdirs 482 478 -4 sendCgi 1811 1807 -4 make_device 1354 1350 -4 handleIncoming 2443 2439 -4 func_name 82 78 -4 service_name 2292 2285 -7 main 909 901 -8 cmp_main 555 547 -8 test_main 434 422 -12 act 228 216 -12 find_pair 180 164 -16 rmmod_main 298 280 -18 find_pid_by_name 156 134 -22 modprobe_main 1606 1576 -30 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/16 up/down: 26/-156) Total: -130 bytes text data bss dec hex filename 734933 3028 14400 752361 b7ae9 busybox_old 734801 3028 14400 752229 b7a65 busybox_unstripped
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/devfsd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index dfb616abe..9daf4e1cc 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -240,8 +240,8 @@ static void do_ioctl_and_die(int fd, int request, unsigned long event_mask_flag)
static void fork_and_execute(int die, char *arg0, char **arg);
static int get_uid_gid(int, const char *);
static void safe_memcpy(char * dest, const char * src, int len);
-static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr);
-static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr);
+static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, const char *ptr);
+static unsigned int scan_dev_name(const char *d, unsigned int n, const char *ptr);
/* Structs and vars */
static struct config_entry_struct *first_config = NULL;
@@ -369,7 +369,7 @@ static void safe_memcpy(char *dest, const char *src, int len)
dest[len] = '\0';
}
-static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr)
+static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, const char *ptr)
{
if (d[n - 4] == 'd' && d[n - 3] == 'i' && d[n - 2] == 's' && d[n - 1] == 'c')
return 2 + addendum;
@@ -382,7 +382,7 @@ static unsigned int scan_dev_name_common(const char *d, unsigned int n, int adde
return 0;
}
-static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr)
+static unsigned int scan_dev_name(const char *d, unsigned int n, const char *ptr)
{
if (d[0] == 's' && d[1] == 'c' && d[2] == 's' && d[3] == 'i' && d[4] == '/') {
if (d[n - 7] == 'g' && d[n - 6] == 'e' && d[n - 5] == 'n'
@@ -926,7 +926,7 @@ static void action_compat(const struct devfsd_notify_struct *info, unsigned int
int ret;
const char *compat_name = NULL;
const char *dest_name = info->devname;
- char *ptr=NULL;
+ const char *ptr;
char compat_buf[STRING_LENGTH], dest_buf[STRING_LENGTH];
int mode, host, bus, target, lun;
unsigned int i;
@@ -954,7 +954,7 @@ static void action_compat(const struct devfsd_notify_struct *info, unsigned int
break;
case AC_MKNEWCOMPAT:
case AC_RMNEWCOMPAT:
- ptr = strrchr(info->devname, '/') + 1;
+ ptr = bb_basename(info->devname);
i = scan_dev_name(info->devname, info->namelen, ptr);
/* nothing found */
@@ -1460,7 +1460,7 @@ const char *get_old_name(const char *devname, unsigned int namelen,
*/
{
const char *compat_name = NULL;
- char *ptr;
+ const char *ptr;
struct translate_struct *trans;
unsigned int i;
char mode;
@@ -1497,7 +1497,7 @@ const char *get_old_name(const char *devname, unsigned int namelen,
}
}
- ptr = (strrchr(devname, '/') + 1);
+ ptr = bb_basename(devname);
i = scan_dev_name(devname, namelen, ptr);
if (i > 0 && i < 13)