commit 579c1f21d893816eee0f9c160da2c0b4e0607ffd parent 2cf612b0e6892efa2b8254865833c403544e2678 Author: Jacob R. Edwards <jacobouno@protonmail.com> Date: Sun, 29 Aug 2021 00:53:20 -0700 Fix uninitialized flag Reformat the carot test block and fix insert only being set when more than one argument is given. Diffstat:
M | apc/apc.c | | | 15 | +++++++-------- |
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/apc/apc.c b/apc/apc.c @@ -59,14 +59,13 @@ main(int argc, char *argv[]) --argc; ++argv; - if (argc) { - insert = 0; - if (argv[argc - 1][0] == subchr) { - if (argv[argc - 1][1] == '\0') { - insert = 1; - --argc; - } else if (argv[argc - 1][1] == subchr) - ++argv[argc - 1]; + insert = 0; + if (argc && argv[argc - 1][0] == subchr) { + if (argv[argc - 1][1] == subchr) { + ++argv[argc - 1]; + } else if (argv[argc - 1][1] == '\0') { + insert = 1; + --argc; } }