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 * 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 */ 9 #include "libbb.h" 10 skip_whitespace(const char * s)11char* FAST_FUNC skip_whitespace(const char *s) 12 { 13 /* In POSIX/C locale (the only locale we care about: do we REALLY want 14 * to allow Unicode whitespace in, say, .conf files? nuts!) 15 * isspace is only these chars: "\t\n\v\f\r" and space. 16 * "\t\n\v\f\r" happen to have ASCII codes 9,10,11,12,13. 17 * Use that. 18 */ 19 while (*s == ' ' || (unsigned char)(*s - 9) <= (13 - 9)) 20 s++; 21 22 return (char *) s; 23 } 24 skip_non_whitespace(const char * s)25char* FAST_FUNC skip_non_whitespace(const char *s) 26 { 27 while (*s != '\0' && *s != ' ' && (unsigned char)(*s - 9) > (13 - 9)) 28 s++; 29 30 return (char *) s; 31 } 32 skip_dev_pfx(const char * tty_name)33char* FAST_FUNC skip_dev_pfx(const char *tty_name) 34 { 35 char *unprefixed = is_prefixed_with(tty_name, "/dev/"); 36 return unprefixed ? unprefixed : (char*)tty_name; 37 } 38