diff options
Diffstat (limited to 'modules/about/src/about.c')
-rw-r--r-- | modules/about/src/about.c | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/modules/about/src/about.c b/modules/about/src/about.c deleted file mode 100644 index bc21f3e..0000000 --- a/modules/about/src/about.c +++ /dev/null @@ -1,123 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2015 Alejandro Colomar Andrés * - ******************************************************************************/ - - -/****************************************************************************** - ******* headers ************************************************************** - ******************************************************************************/ -/* Standard C ----------------------------------------------------------------*/ - #include <stdio.h> - #include <stdlib.h> -/* libalx ------------------------------------------------------------------*/ - #include "libalx/io/alx_file.h" -/* Project -------------------------------------------------------------------*/ - #include "about.h" - - -/****************************************************************************** - ******* macros *************************************************************** - ******************************************************************************/ - # define BUFF_SIZE_TEXT (1048576) - -#if defined OS_LINUX - # define BEGINNING "\n┌──────────────────────────────────────────────────────────────────────────────┐\n" - # define ENDING "└──────────────────────────────────────────────────────────────────────────────┘\n\n" -#elif defined OS_WIN - # define BEGINNING "\n________________________________________________________________________________\n" - # define ENDING "________________________________________________________________________________\n\n" -#endif - - -/****************************************************************************** - ******* variables ************************************************************ - ******************************************************************************/ -char share_path [FILENAME_MAX]; - - -/****************************************************************************** - ******* main ***************************************************************** - ******************************************************************************/ -void about_init (void) -{ - if (snprintf(share_path, FILENAME_MAX, "%s/%s/", - INSTALL_SHARE_DIR, - SHARE_DIR) >= FILENAME_MAX) { - goto err_path; - } - - return; - - -err_path: - printf("Path is too large and has been truncated\n"); - exit(EXIT_FAILURE); -} - -void snprint_share_file (char *dest, int destsize, int share_file) -{ - char file_name [FILENAME_MAX]; - - switch (share_file) { - case SHARE_COPYRIGHT: - if (snprintf(file_name, FILENAME_MAX, "%s/%s", - share_path, - "COPYRIGHT.txt") >= FILENAME_MAX) { - goto err_path; - } - break; - case SHARE_DISCLAIMER: - if (snprintf(file_name, FILENAME_MAX, "%s/%s", - share_path, - "DISCLAIMER.txt") >= FILENAME_MAX) { - goto err_path; - } - break; - case SHARE_HELP: - if (snprintf(file_name, FILENAME_MAX, "%s/%s", - share_path, - "HELP.txt") >= FILENAME_MAX) { - goto err_path; - } - break; - case SHARE_LICENSE: - if (snprintf(file_name, FILENAME_MAX, "%s/%s", - share_path, - "LICENSE.txt") >= FILENAME_MAX) { - goto err_path; - } - break; - case SHARE_USAGE: - if (snprintf(file_name, FILENAME_MAX, "%s/%s", - share_path, - "USAGE.txt") >= FILENAME_MAX) { - goto err_path; - } - break; - } - - alx_snprint_file(dest, destsize, file_name); - - return; - - -err_path: - printf("Path is too large and has been truncated\n"); - printf("File could not be shown!\n"); -} - -void print_share_file (int share_file) -{ - char str [BUFF_SIZE_TEXT]; - - snprint_share_file(str, BUFF_SIZE_TEXT, share_file); - - printf(BEGINNING); - printf("%s", str); - printf(ENDING); -} - -void print_version (void) -{ - printf("" PROG_NAME " " PROG_VERSION "\n\n"); -} |