diff --git a/src/main.c b/src/main.c index 1ef007e..2cc3350 100644 --- a/src/main.c +++ b/src/main.c @@ -85,10 +85,8 @@ static struct option long_options[] = { static void usage(const char *prog) { fprintf(stderr, "Usage: %s [option]\n" - " -g, --group=string Set a group for the device(Any printable character except\n" - " space is allowed, with a maximum of 16 characters)\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" + " -g, --group=string Set a group for the device(max 16 chars, no spaces allowed)\n" + " -I, --id=string Set an ID for the device(max 32 chars, no spaces allowed)\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" diff --git a/src/utils.c b/src/utils.c index 029cc9c..9b29f40 100644 --- a/src/utils.c +++ b/src/utils.c @@ -52,14 +52,7 @@ bool valid_id(const char *id, size_t limit) { if (strlen(id) > limit) return false; - - while (*id) { - if (!isprint(*id) || *id == ' ') - return false; - id++; - } - - return true; + return !strchr(id, ' '); } /* reference from https://tools.ietf.org/html/rfc4648#section-4 */