Skip to content
Snippets Groups Projects
Commit 7b42b9be authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Clean-up the initial string/pointer adjustment in show_atcodes()

No functional change.
parent 9c738e3b
No related branches found
No related tags found
No related merge requests found
...@@ -122,13 +122,13 @@ int sbbs_t::show_atcode(const char *instr, JSObject* obj) ...@@ -122,13 +122,13 @@ int sbbs_t::show_atcode(const char *instr, JSObject* obj)
if (*instr != '@') if (*instr != '@')
return 0; return 0;
SAFECOPY(str, instr); SAFECOPY(str, instr + 1);
tp = strchr(str + 1, '@'); tp = strchr(str, '@');
if (!tp) /* no terminating @ */ if (tp == nullptr) /* no terminating @ */
return 0; return 0;
len = (tp - str) + 1; len = (tp - str) + 2;
(*tp) = 0; *tp = '\0';
sp = (str + 1); sp = str;
if (IS_DIGIT(*sp)) // @-codes cannot start with a number if (IS_DIGIT(*sp)) // @-codes cannot start with a number
return 0; return 0;
if (strcspn(sp, " \t\r\n") != strlen(sp)) // white-space before terminating @ if (strcspn(sp, " \t\r\n") != strlen(sp)) // white-space before terminating @
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment