diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-04-06 18:50:05 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-04-06 18:50:05 +0200 |
| commit | f8d8aa1cea915ce115345e6e729eddc80e86f021 (patch) | |
| tree | abceef94710d221816cf56343b7cadf10de50e5c /libbb | |
| parent | 87fb72032e6aa6abe5ac8fb05d22f43e8dde557b (diff) | |
| download | busybox-w32-f8d8aa1cea915ce115345e6e729eddc80e86f021.tar.gz busybox-w32-f8d8aa1cea915ce115345e6e729eddc80e86f021.tar.bz2 busybox-w32-f8d8aa1cea915ce115345e6e729eddc80e86f021.zip | |
libbb: add skip_dev_pfx()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/skip_whitespace.c | 7 | ||||
| -rw-r--r-- | libbb/utmp.c | 8 |
2 files changed, 7 insertions, 8 deletions
diff --git a/libbb/skip_whitespace.c b/libbb/skip_whitespace.c index 7b123261b..f5a61a3cf 100644 --- a/libbb/skip_whitespace.c +++ b/libbb/skip_whitespace.c | |||
| @@ -30,3 +30,10 @@ char* FAST_FUNC skip_non_whitespace(const char *s) | |||
| 30 | 30 | ||
| 31 | return (char *) s; | 31 | return (char *) s; |
| 32 | } | 32 | } |
| 33 | |||
| 34 | char* FAST_FUNC skip_dev_pfx(const char *tty_name) | ||
| 35 | { | ||
| 36 | if (strncmp(tty_name, "/dev/", 5) == 0) | ||
| 37 | tty_name += 5; | ||
| 38 | return (char*)tty_name; | ||
| 39 | } | ||
diff --git a/libbb/utmp.c b/libbb/utmp.c index d6ba336e3..68c358e9a 100644 --- a/libbb/utmp.c +++ b/libbb/utmp.c | |||
| @@ -15,14 +15,6 @@ static void touch(const char *filename) | |||
| 15 | close(open(filename, O_WRONLY | O_CREAT, 0664)); | 15 | close(open(filename, O_WRONLY | O_CREAT, 0664)); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // TODO: move to libbb | ||
| 19 | static const char* skip_dev_pfx(const char *tty_name) | ||
| 20 | { | ||
| 21 | if (strncmp(tty_name, "/dev/", 5) == 0) | ||
| 22 | tty_name += 5; | ||
| 23 | return tty_name; | ||
| 24 | } | ||
| 25 | |||
| 26 | void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const char *hostname) | 18 | void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const char *hostname) |
| 27 | { | 19 | { |
| 28 | struct utmp utent; | 20 | struct utmp utent; |
