/* * Copyright (c) 2026, Chloe M. * Provided under the BSD-3 clause. */ #include #include #include #include /* Version conversion macros */ #define VERSION_U16(MAJOR, MINOR) \ (((MINOR) << 8) | (MAJOR)) #define VERSION_MAJOR(VERSION) \ ((VERSION) & 0xFF) #define VERSION_MINOR(VERSION) \ (((VERSION) >> 8) & 0xFF) /* * Software version * * XXX: We encode it as a U16 so that we may bundle it * with the file data as binary. */ #define RDAR_VERSION VERSION_U16(1, 0) /* v1.0 */ static void help(void) { printf("usage: ./rdar <... flags>\n"); printf("[-h] Display this help menu\n"); printf("[-v] Display the program version\n"); } static void version(void) { uint16_t Major, Minor; Major = VERSION_MAJOR(RDAR_VERSION); Minor = VERSION_MINOR(RDAR_VERSION); printf("Version v%d.%d\n", Major, Minor); } int main(int argc, char **argv) { int opt; if (argc < 2) { printf("fatal: too few arguments\n"); help(); return -1; } while ((opt = getopt(argc, argv, "hv")) != -1) { switch (opt) { case 'h': help(); return -1; case 'v': version(); return -1; } } }