/** rexbacklight Copyright (C) 2018 rexy712 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "config.h" #include "common.h" #include "cmd.h" #include int return_value = RETVAL_SUCCESS; void mem_error(void){ fprintf(stderr, "Failed to allocate memory! Unable to continue!\n"); } //name of the program being run so that we print the correct name in the usage extern const char* executable_name; _Noreturn void version(void){ printf("%s version %d.%d\n", executable_name, REXBACKLIGHT_VERSION_MAJOR, REXBACKLIGHT_VERSION_MINOR); exit(return_value); } _Noreturn void usage(int exit_val){ int i; printf("%s version %d.%d\n\n", executable_name, REXBACKLIGHT_VERSION_MAJOR, REXBACKLIGHT_VERSION_MINOR); printf("Usage: %s [argument] [options] [argument]\n\n", executable_name); printf("Options:\n"); for(i = 0;i < rexbacklight_args_length;++i){ int printed = 0; if(rexbacklight_args[i].lopt){ printf("%s", rexbacklight_args[i].lopt); printed = 1; } if(rexbacklight_args[i].sopt){ if(printed) printf("|"); else printed = 1; printf("%s", rexbacklight_args[i].sopt); } #ifdef XBACKLIGHT_COMPAT_OPTIONS if(rexbacklight_args[i].xopt){ if(printed) printf("|"); printf("%s", rexbacklight_args[i].xopt); } #endif //XBACKLIGHT_COMPAT_OPTIONS printf("\n"); printf(" %s\n", rexbacklight_args[i].desc); } printf("\n"); printf("Arguments:\n"); printf(" =\n"); printf(" -\n"); printf(" +\n"); printf(" off\n"); printf(" max\n"); printf(" min\n"); printf("\n%s Copyright (C) 2018 rexy712\n", executable_name); printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); printf("This is free software, and you are welcome to redistribute it\n"); printf("under certain conditions; see the GNU GPLv3 for details.\n"); printf("A copy of the GPLv3 is available with the source in the file 'LICENSE'\n"); exit(exit_val); }