commit 7dd8136475a838572556070a2234dd647816c33d parent 58a345068ec919e669cebafc4bbdaf3e7eb0aeb8 Author: brookjeynes <me@brookjeynes.dev> Date: Wed, 10 Jun 2026 10:33:27 +0000 feat: validate priority Diffstat:
| M | main.c | | | 12 | ++++++++++++ |
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/main.c b/main.c @@ -59,6 +59,18 @@ int main(int argc, char *argv[]) { } if (cli_args.priority != '\0') { + char *alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + int is_alphanumeric = 0; + for (int idx = 0; idx < 26; idx++) { + if (cli_args.priority == alphabet[idx]) { + is_alphanumeric = 1; + break; + } + } + if (!is_alphanumeric) { + fprintf(stderr, "err: priority must be between [A-Z]\n"); + exit(1); + } printf("(%c)\n", cli_args.priority); }