task

creates a plain-text task file in the current directory
git clone git://brookjeynes.dev/bjeynes/task.git
Log | Files | Refs | README | LICENSE

commit a6dfcc3f59a0b19a8e4831cc64155b0ec5c373d8
parent 15a080b97dbce58fbd087035a41116746dd06546
Author: brookjeynes <me@brookjeynes.dev>
Date:   Wed, 10 Jun 2026 11:50:16 +0000

fix: validation errors

Diffstat:
Mmain.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { exit(1); } - if (argc == 6) { + if (argc > 5) { fprintf(stderr, "err: too many arguments\n"); exit(1); } @@ -36,6 +36,11 @@ int main(int argc, char *argv[]) { exit(1); } + if (strlen(argv[idx + 1]) != 1) { + fprintf(stderr, "err: priority must be a single letter between [A-Z]\n"); + exit(1); + } + cli_args.priority = argv[idx + 1][0]; idx++; continue; @@ -60,6 +65,11 @@ int main(int argc, char *argv[]) { } } + if (cli_args.title == NULL) { + fprintf(stderr, "err: title required\n"); + exit(1); + } + if (cli_args.priority != '\0') { char *alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int is_alphanumeric = 0;