From 2b135d87f5c1f1f307984f5fd78e151f5ee99dae Mon Sep 17 00:00:00 2001 From: zachir Date: Mon, 11 Mar 2024 01:34:22 -0500 Subject: Replace build system with zig Zig is actually handling the building and such, now the Makefile is here just as a wrapper for it. --- main.c | 76 ------------------------------------------------------------------ 1 file changed, 76 deletions(-) delete mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c deleted file mode 100644 index d986924..0000000 --- a/main.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "./main.h" - -void printhelp() { - fprintf(stderr, "even: a binary by ZachIR to check if a number is even or "); - fprintf(stderr, "odd.\n"); - fprintf(stderr, "even [-hcv]\n"); - fprintf(stderr, "even [--help]\n"); - fprintf(stderr, "even [--copyright]\n"); - fprintf(stderr, "even [--version]\n"); - fprintf(stderr, "even [-q] [--quiet] NUMBER\n"); - fprintf(stderr, "\t-h: prints this help message\n"); - fprintf(stderr, "\t-c: prints the copyright information\n"); - fprintf(stderr, "\t-v: prints the version\n"); - fprintf(stderr, "\t-q: just uses error codes, no text\n"); - return; -} - -void printcopyright() { - fprintf(stderr, "Copyright (c) 2024 Zachary Smith\n"); - fprintf(stderr, "even is Free software under the MIT license, and is "); - fprintf(stderr, "provided without warranty of any kind.\n"); - return; -} - -void printversion() { - fprintf(stderr, "even version %s, 2024\n", VERSION); - return; -} - -int main(int argc, char **argv) { - bool quiet; - bool value; - long result; - - quiet = false; - value = false; - result = 0; - char *output; - - if (argc > 1) { - for (size_t i = 1; i < argc; i++) { - if (argv[i][0] == '-') { - switch (argv[i][1]) { - case 'h': - printhelp(); - return SUCCESS; - case 'c': - printcopyright(); - return SUCCESS; - case 'v': - printversion(); - return SUCCESS; - case 'q': - quiet = true; - break; - } - } - result = strtol(argv[i], &output, 10); - value = true; - } - } - if (value) { - if (result % 2 == 0) { - if (quiet) { - fprintf(stdout, "even\n"); - } - return 0; - } else { - if (quiet) { - fprintf(stdout, "odd\n"); - } - return 1; - } - } - return ERR; -} -- cgit v1.2.3