mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
die_if_bad_username: shrink: 88 -> 77 bytes
This commit is contained in:
parent
dd5702d696
commit
104d544fd7
@ -18,17 +18,19 @@
|
|||||||
|
|
||||||
void die_if_bad_username(const char *name)
|
void die_if_bad_username(const char *name)
|
||||||
{
|
{
|
||||||
int i = 0;
|
goto skip; /* 1st char being dash isn't valid */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!isalnum(*name)
|
if (*name == '-')
|
||||||
&& !(*name == '_')
|
continue;
|
||||||
&& !(*name == '.')
|
skip:
|
||||||
&& !(*name == '@')
|
if (isalnum(*name)
|
||||||
&& !(*name == '-' && i)
|
|| *name == '_'
|
||||||
&& !(*name == '$' && !*(name + 1))
|
|| *name == '.'
|
||||||
)
|
|| *name == '@'
|
||||||
bb_error_msg_and_die("illegal character '%c'", *name);
|
|| (*name == '$' && !*(name + 1))
|
||||||
i++;
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bb_error_msg_and_die("illegal character '%c'", *name);
|
||||||
} while (*++name);
|
} while (*++name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user