Last change
on this file since 3709 was 3621, checked in by Bruno Cornec, 8 years ago |
New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.
|
File size:
938 bytes
|
Rev | Line | |
---|
[821] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * skip_whitespace implementation for busybox
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
|
---|
| 6 | *
|
---|
[2725] | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 8 | */
|
---|
| 9 |
|
---|
| 10 | #include "libbb.h"
|
---|
| 11 |
|
---|
[2725] | 12 | char* FAST_FUNC skip_whitespace(const char *s)
|
---|
[821] | 13 | {
|
---|
[2725] | 14 | /* In POSIX/C locale (the only locale we care about: do we REALLY want
|
---|
| 15 | * to allow Unicode whitespace in, say, .conf files? nuts!)
|
---|
| 16 | * isspace is only these chars: "\t\n\v\f\r" and space.
|
---|
| 17 | * "\t\n\v\f\r" happen to have ASCII codes 9,10,11,12,13.
|
---|
| 18 | * Use that.
|
---|
| 19 | */
|
---|
| 20 | while (*s == ' ' || (unsigned char)(*s - 9) <= (13 - 9))
|
---|
| 21 | s++;
|
---|
[821] | 22 |
|
---|
| 23 | return (char *) s;
|
---|
| 24 | }
|
---|
[1765] | 25 |
|
---|
[2725] | 26 | char* FAST_FUNC skip_non_whitespace(const char *s)
|
---|
[1765] | 27 | {
|
---|
[2725] | 28 | while (*s != '\0' && *s != ' ' && (unsigned char)(*s - 9) > (13 - 9))
|
---|
| 29 | s++;
|
---|
[1765] | 30 |
|
---|
| 31 | return (char *) s;
|
---|
| 32 | }
|
---|
[2725] | 33 |
|
---|
| 34 | char* FAST_FUNC skip_dev_pfx(const char *tty_name)
|
---|
| 35 | {
|
---|
[3621] | 36 | if (is_prefixed_with(tty_name, "/dev/"))
|
---|
[2725] | 37 | tty_name += 5;
|
---|
| 38 | return (char*)tty_name;
|
---|
| 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.