mirror of
https://github.com/zhaojh329/rtty.git
synced 2026-02-27 09:53:17 +08:00
Update device ID validation rules and help description
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
@@ -84,8 +84,8 @@ static struct option long_options[] = {
|
||||
static void usage(const char *prog)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [option]\n"
|
||||
" -I, --id=string Set an ID for the device(Maximum 63 bytes, valid\n"
|
||||
" character:letter, number, underline and short line)\n"
|
||||
" -I, --id=string Set an ID for the device(Any printable character except\n"
|
||||
" space is allowed, with a maximum of 32 characters)\n"
|
||||
" -h, --host=string Server's host or ipaddr(Default is localhost)\n"
|
||||
" -p, --port=number Server port(Default is 5912)\n"
|
||||
" -d, --description=string Add a description to the device(Maximum 126 bytes)\n"
|
||||
|
||||
@@ -50,8 +50,11 @@ int find_login(char *buf, int len)
|
||||
|
||||
bool valid_id(const char *id)
|
||||
{
|
||||
if (strlen(id) > 32)
|
||||
return false;
|
||||
|
||||
while (*id) {
|
||||
if (!isalnum(*id) && *id != '-' && *id != '_')
|
||||
if (!isprint(*id) || *id == ' ')
|
||||
return false;
|
||||
id++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user