From 4078ea6ed0932c2096f539eff1e084b0f103b796 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Tue, 2 Apr 2019 20:07:21 -0400 Subject: [PATCH] src: clang-format Adds `make fmt` as well. --- .clang-format | 109 +++ Makefile | 7 +- src/arrays.c | 49 +- src/colors.h | 2 +- src/disp.c | 692 ++++++--------- src/disp.h | 8 +- src/error_flag.h | 2 +- src/logos.c | 1657 +++++++++++++++++------------------- src/main.c | 162 ++-- src/plat/bsd/detect.c | 563 ++++++------- src/plat/darwin/detect.c | 538 ++++++------ src/plat/linux/detect.c | 1710 ++++++++++++++++---------------------- src/plat/sun/detect.c | 549 ++++++------ src/plat/win32/bitmap.c | 157 ++-- src/plat/win32/detect.c | 767 ++++++++--------- src/tests/gltest.c | 5 +- src/tests/x11test.c | 5 +- src/util.c | 218 +++-- src/util.h | 6 +- 19 files changed, 3221 insertions(+), 3985 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..c939fda --- /dev/null +++ b/.clang-format @@ -0,0 +1,109 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Right +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentPPDirectives: None +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +ReflowComments: true +SortIncludes: false +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 2 +UseTab: Never +... + diff --git a/Makefile b/Makefile index ba0956d..be0fcd5 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ PREFIX = /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 +ALL_SOURCES = $(shell find . -type f \( -name '*.c' -o -name '*.h' \)) + SOURCES = $(wildcard ./src/*.c) OBJS = $(SOURCES:.c=.o) @@ -103,7 +105,10 @@ clean: rm -f gltest rm -f screenfetch-c screenfetch-c.exe +fmt: + clang-format -i -style=file $(ALL_SOURCES) + $(OLDTARGETS): all -.PHONY: all install uninstall clean $(OLDTARGETS) +.PHONY: all install uninstall clean fmt $(OLDTARGETS) diff --git a/src/arrays.c b/src/arrays.c index d67d0b8..d1ed4ba 100644 --- a/src/arrays.c +++ b/src/arrays.c @@ -6,7 +6,6 @@ ** initialized in this file. */ - #include "arrays.h" #include "misc.h" #include "colors.h" @@ -32,44 +31,12 @@ char font_str[MAX_STRLEN] = "Unknown"; char host_color[MAX_STRLEN] = TNRM; -char *detected_arr[DETECTED_ARR_LEN] = -{ - host_str, - distro_str, - kernel_str, - cpu_str, - gpu_str, - shell_str, - pkgs_str, - disk_str, - mem_str, - uptime_str, - res_str, - de_str, - wm_str, - wm_theme_str, - gtk_str, - icon_str, - font_str -}; +char *detected_arr[DETECTED_ARR_LEN] = {host_str, distro_str, kernel_str, cpu_str, gpu_str, + shell_str, pkgs_str, disk_str, mem_str, uptime_str, + res_str, de_str, wm_str, wm_theme_str, gtk_str, + icon_str, font_str}; -char *detected_arr_names[DETECTED_ARR_LEN] = -{ - "", - "OS: ", - "Kernel: ", - "CPU: ", - "GPU: ", - "Shell: ", - "Packages: ", - "Disk: ", - "Memory: ", - "Uptime: ", - "Resolution: ", - "DE: ", - "WM: ", - "WM Theme: ", - "GTK: ", - "Icon Theme: ", - "Font: " -}; +char *detected_arr_names[DETECTED_ARR_LEN] = { + "", "OS: ", "Kernel: ", "CPU: ", "GPU: ", "Shell: ", + "Packages: ", "Disk: ", "Memory: ", "Uptime: ", "Resolution: ", "DE: ", + "WM: ", "WM Theme: ", "GTK: ", "Icon Theme: ", "Font: "}; diff --git a/src/colors.h b/src/colors.h index 373ba6b..4b051db 100644 --- a/src/colors.h +++ b/src/colors.h @@ -31,7 +31,7 @@ #else -#define TNRM "\x1B[0m" /* normal */ +#define TNRM "\x1B[0m" /* normal */ #define TBLK "\x1B[0;30m" /* black */ #define TRED "\x1B[0;31m" /* red */ #define TGRN "\x1B[0;32m" /* green */ diff --git a/src/disp.c b/src/disp.c index d9eb119..eb82a00 100644 --- a/src/disp.c +++ b/src/disp.c @@ -21,234 +21,149 @@ #include "arrays.h" /* display_version - called if the -V (--version) flag is tripped + called if the -V (--version) flag is tripped */ -void display_version(void) -{ - printf("%s\n", "screenfetch-c - Version " SCREENFETCH_C_VERSION_MAJOR "." - SCREENFETCH_C_VERSION_MINOR ", revision " - SCREENFETCH_C_VERSION_RELEASE "."); - return; +void display_version(void) { + printf("%s\n", "screenfetch-c - Version " SCREENFETCH_C_VERSION_MAJOR + "." SCREENFETCH_C_VERSION_MINOR ", revision " SCREENFETCH_C_VERSION_RELEASE "."); + return; } /* display_help - called if the -h (--help) flag is tripped + called if the -h (--help) flag is tripped */ -void display_help(void) -{ - display_version(); - printf("\n%s\n", "Options:\n" - " -v, --verbose\t\t\t Enable verbosity during output.\n" - " -s, --screenshot\t\t Take a screenshot.\n" - " -n, --no-logo\t\t\t Print output without a logo.\n" - " -D, --distro [DISTRO]\t\t Print output with DISTRO's logo.\n" - " -E, --suppress-errors\t\t Suppress error output.\n" - " -p, --portrait\t\t Print output in portrait mode.\n" - " -V, --version\t\t\t Output screenfetch-c's version and exit.\n" - " -h, --help\t\t\t Output this help information.\n" - " -L, --logo-only [DISTRO]\t Output only DISTRO's logo.\n" - "For more information, consult screenfetch-c's man page.\n"); +void display_help(void) { + display_version(); + printf("\n%s\n", "Options:\n" + " -v, --verbose\t\t\t Enable verbosity during output.\n" + " -s, --screenshot\t\t Take a screenshot.\n" + " -n, --no-logo\t\t\t Print output without a logo.\n" + " -D, --distro [DISTRO]\t\t Print output with DISTRO's logo.\n" + " -E, --suppress-errors\t\t Suppress error output.\n" + " -p, --portrait\t\t Print output in portrait mode.\n" + " -V, --version\t\t\t Output screenfetch-c's version and exit.\n" + " -h, --help\t\t\t Output this help information.\n" + " -L, --logo-only [DISTRO]\t Output only DISTRO's logo.\n" + "For more information, consult screenfetch-c's man page.\n"); - return; + return; } /* display_verbose - called if the -v (--verbose) flag is tripped - arguments: char *data[], *data_names[] the system data and names + called if the -v (--verbose) flag is tripped + arguments: char *data[], *data_names[] the system data and names */ -void display_verbose(char *data[], char *data_names[]) -{ - int i = 0; - for (i = 0; i < DETECTED_ARR_LEN; i++) - VERBOSE_OUT(data_names[i], data[i]); +void display_verbose(char *data[], char *data_names[]) { + int i = 0; + for (i = 0; i < DETECTED_ARR_LEN; i++) + VERBOSE_OUT(data_names[i], data[i]); - return; + return; } /* process_logo_only - output handling for output_logo_only - argument char *distro: the output logo - argument unsigned short int num: the length of the logo in lines + output handling for output_logo_only + argument char *distro: the output logo + argument unsigned short int num: the length of the logo in lines */ -void process_logo_only(char *distro[], unsigned short int num) -{ - unsigned short int x = 0; +void process_logo_only(char *distro[], unsigned short int num) { + unsigned short int x = 0; - for (x = 0; x < num; x++) - printf("%s\n", distro[x]); + for (x = 0; x < num; x++) + printf("%s\n", distro[x]); - return; + return; } /* output_logo_only - outputs an ASCII logo based upon the distro name passed to it - argument char *distro: the name of the distro to output + outputs an ASCII logo based upon the distro name passed to it + argument char *distro: the name of the distro to output */ -void output_logo_only(char *distro) -{ - if (STREQ(distro, "Windows")) - { - process_logo_only(windows_logo, 16); - } - else if (strstr(distro, "OS X")) - { - process_logo_only(macosx_logo, 16); - } - else if (STREQ(distro, "Arch Linux - Old")) - { - process_logo_only(oldarch_logo, 18); - } - else if (STREQ(distro, "Arch Linux")) - { - process_logo_only(arch_logo, 19); - } - else if (STREQ(distro, "LinuxMint")) - { - process_logo_only(mint_logo, 18); - } - else if (STREQ(distro, "LMDE")) - { - process_logo_only(lmde_logo, 18); - } - else if (STREQ(distro, "Ubuntu") || STREQ(distro, "Lubuntu") - || STREQ(distro, "Xubuntu")) - { - process_logo_only(ubuntu_logo, 18); - } - else if (STREQ(distro, "Debian")) - { - process_logo_only(debian_logo, 18); - } - else if (STREQ(distro, "CrunchBang")) - { - process_logo_only(crunchbang_logo, 18); - } - else if (STREQ(distro, "Gentoo")) - { - process_logo_only(gentoo_logo, 18); - } - else if (STREQ(distro, "Funtoo")) - { - process_logo_only(funtoo_logo, 18); - } - else if (STREQ(distro, "Fedora")) - { - process_logo_only(fedora_logo, 18); - } - else if (STREQ(distro, "Mandriva") || STREQ(distro, "Mandrake")) - { - process_logo_only(mandriva_mandrake_logo, 18); - } - else if (STREQ(distro, "OpenSUSE")) - { - process_logo_only(opensuse_logo, 18); - } - else if (STREQ(distro, "Slackware")) - { - process_logo_only(slackware_logo, 21); - } - else if (STREQ(distro, "Red Hat Linux")) - { - process_logo_only(redhat_logo, 18); - } - else if (STREQ(distro, "Frugalware")) - { - process_logo_only(frugalware_logo, 23); - } - else if (STREQ(distro, "Peppermint")) - { - process_logo_only(peppermint_logo, 19); - } - else if (STREQ(distro, "SolusOS")) - { - process_logo_only(solusos_logo, 18); - } - else if (STREQ(distro, "Mageia")) - { - process_logo_only(mageia_logo, 18); - } - else if (STREQ(distro, "ParabolaGNU/Linux-libre")) - { - process_logo_only(parabolagnu_linuxlibre_logo, 18); - } - else if (STREQ(distro, "Viperr")) - { - process_logo_only(viperr_logo, 18); - } - else if (STREQ(distro, "LinuxDeepin")) - { - process_logo_only(linuxdeepin_logo, 18); - } - else if (STREQ(distro, "Chakra")) - { - process_logo_only(chakra_logo, 18); - } - else if (STREQ(distro, "Fuduntu")) - { - process_logo_only(fuduntu_logo, 21); - } - else if (STREQ(distro, "Trisquel")) - { - process_logo_only(trisquel_logo, 18); - } - else if (STREQ(distro, "Manjaro")) - { - process_logo_only(manjaro_logo, 18); - } - else if (STREQ(distro, "elementary OS")) - { - process_logo_only(elementaryos_logo, 18); - } - else if (STREQ(distro, "Scientific Linux")) - { - process_logo_only(scientificlinux_logo, 20); - } - else if (STREQ(distro, "Backtrack Linux")) - { - process_logo_only(backtracklinux_logo, 21); - } - else if (STREQ(distro, "Kali Linux")) - { - process_logo_only(kalilinux_logo, 21); - } - else if (STREQ(distro, "Sabayon")) - { - process_logo_only(sabayon_logo, 18); - } - else if (STREQ(distro, "FreeBSD")) - { - process_logo_only(freebsd_logo, 18); - } - else if (STREQ(distro, "OpenBSD")) - { - process_logo_only(openbsd_logo, 23); - } - else if (STREQ(distro, "NetBSD")) - { - process_logo_only(netbsd_logo, 20); - } - else if (STREQ(distro, "DragonFly BSD")) - { - process_logo_only(dragonflybsd_logo, 18); - } - else if (STREQ(distro, "Android")) - { - process_logo_only(android_logo, 16); - } - else if (STREQ(distro, "Solaris")) - { - process_logo_only(solaris_logo, 17); - } - else if (STREQ(distro, "Angstrom")) - { - process_logo_only(angstrom_logo, 16); - } - else /* if (STREQ(distro_str, "Linux")) */ - { - process_logo_only(linux_logo, 16); - } +void output_logo_only(char *distro) { + if (STREQ(distro, "Windows")) { + process_logo_only(windows_logo, 16); + } else if (strstr(distro, "OS X")) { + process_logo_only(macosx_logo, 16); + } else if (STREQ(distro, "Arch Linux - Old")) { + process_logo_only(oldarch_logo, 18); + } else if (STREQ(distro, "Arch Linux")) { + process_logo_only(arch_logo, 19); + } else if (STREQ(distro, "LinuxMint")) { + process_logo_only(mint_logo, 18); + } else if (STREQ(distro, "LMDE")) { + process_logo_only(lmde_logo, 18); + } else if (STREQ(distro, "Ubuntu") || STREQ(distro, "Lubuntu") || STREQ(distro, "Xubuntu")) { + process_logo_only(ubuntu_logo, 18); + } else if (STREQ(distro, "Debian")) { + process_logo_only(debian_logo, 18); + } else if (STREQ(distro, "CrunchBang")) { + process_logo_only(crunchbang_logo, 18); + } else if (STREQ(distro, "Gentoo")) { + process_logo_only(gentoo_logo, 18); + } else if (STREQ(distro, "Funtoo")) { + process_logo_only(funtoo_logo, 18); + } else if (STREQ(distro, "Fedora")) { + process_logo_only(fedora_logo, 18); + } else if (STREQ(distro, "Mandriva") || STREQ(distro, "Mandrake")) { + process_logo_only(mandriva_mandrake_logo, 18); + } else if (STREQ(distro, "OpenSUSE")) { + process_logo_only(opensuse_logo, 18); + } else if (STREQ(distro, "Slackware")) { + process_logo_only(slackware_logo, 21); + } else if (STREQ(distro, "Red Hat Linux")) { + process_logo_only(redhat_logo, 18); + } else if (STREQ(distro, "Frugalware")) { + process_logo_only(frugalware_logo, 23); + } else if (STREQ(distro, "Peppermint")) { + process_logo_only(peppermint_logo, 19); + } else if (STREQ(distro, "SolusOS")) { + process_logo_only(solusos_logo, 18); + } else if (STREQ(distro, "Mageia")) { + process_logo_only(mageia_logo, 18); + } else if (STREQ(distro, "ParabolaGNU/Linux-libre")) { + process_logo_only(parabolagnu_linuxlibre_logo, 18); + } else if (STREQ(distro, "Viperr")) { + process_logo_only(viperr_logo, 18); + } else if (STREQ(distro, "LinuxDeepin")) { + process_logo_only(linuxdeepin_logo, 18); + } else if (STREQ(distro, "Chakra")) { + process_logo_only(chakra_logo, 18); + } else if (STREQ(distro, "Fuduntu")) { + process_logo_only(fuduntu_logo, 21); + } else if (STREQ(distro, "Trisquel")) { + process_logo_only(trisquel_logo, 18); + } else if (STREQ(distro, "Manjaro")) { + process_logo_only(manjaro_logo, 18); + } else if (STREQ(distro, "elementary OS")) { + process_logo_only(elementaryos_logo, 18); + } else if (STREQ(distro, "Scientific Linux")) { + process_logo_only(scientificlinux_logo, 20); + } else if (STREQ(distro, "Backtrack Linux")) { + process_logo_only(backtracklinux_logo, 21); + } else if (STREQ(distro, "Kali Linux")) { + process_logo_only(kalilinux_logo, 21); + } else if (STREQ(distro, "Sabayon")) { + process_logo_only(sabayon_logo, 18); + } else if (STREQ(distro, "FreeBSD")) { + process_logo_only(freebsd_logo, 18); + } else if (STREQ(distro, "OpenBSD")) { + process_logo_only(openbsd_logo, 23); + } else if (STREQ(distro, "NetBSD")) { + process_logo_only(netbsd_logo, 20); + } else if (STREQ(distro, "DragonFly BSD")) { + process_logo_only(dragonflybsd_logo, 18); + } else if (STREQ(distro, "Android")) { + process_logo_only(android_logo, 16); + } else if (STREQ(distro, "Solaris")) { + process_logo_only(solaris_logo, 17); + } else if (STREQ(distro, "Angstrom")) { + process_logo_only(angstrom_logo, 16); + } else /* if (STREQ(distro_str, "Linux")) */ + { + process_logo_only(linux_logo, 16); + } - return; + return; } /* process_data @@ -259,268 +174,131 @@ void output_logo_only(char *distro) argument unsigned short int num1, num2: indices for the data argument char *col1..3: colors for the output */ -void process_data(char *data[], char *data_names[], char *logo[], unsigned short int num1, unsigned short int num2, char *col1, char *col2, char *col3) -{ - unsigned short int x = 0; +void process_data(char *data[], char *data_names[], char *logo[], unsigned short int num1, + unsigned short int num2, char *col1, char *col2, char *col3) { + unsigned short int x = 0; - if (0 == num2) - { - for (x = 0; x < num1; x++) - { - printf("%s %s%s%s%s%s%s\n", logo[x], col1, col2, col3, - data_names[x], TNRM, data[x]); - } - } - else - { - for (x = 0; x < num1; x++) - { - if (x < num2) - { - printf("%s %s%s%s%s%s%s\n", logo[x], col1, col2, col3, - data_names[x], TNRM, data[x]); - } - else - { - printf("%s\n", logo[x]); - } - } - } + if (0 == num2) { + for (x = 0; x < num1; x++) { + printf("%s %s%s%s%s%s%s\n", logo[x], col1, col2, col3, data_names[x], TNRM, data[x]); + } + } else { + for (x = 0; x < num1; x++) { + if (x < num2) { + printf("%s %s%s%s%s%s%s\n", logo[x], col1, col2, col3, data_names[x], TNRM, data[x]); + } else { + printf("%s\n", logo[x]); + } + } + } - return; + return; } /* main_ascii_output - the primary output for screenfetch-c - arguments char *data[], char *data_names[]: + the primary output for screenfetch-c + arguments char *data[], char *data_names[]: */ -void main_ascii_output(char *data[], char *data_names[]) -{ - if (strstr(data[1], "Microsoft Windows 8") || - strstr(data[1], "Microsoft Windows 10")) - { - process_data(data, data_names, windows_modern_logo, 19, - DETECTED_ARR_LEN, TLBL, TNRM, TLBL); - } - else if (strstr(data[1], "Microsoft")) - { - process_data(data, data_names, windows_logo, 16, - DETECTED_ARR_LEN, TRED, TWHT, TRED); - } - else if (strstr(data[1], "OS X")) - { - process_data(data, data_names, macosx_logo, 16, - DETECTED_ARR_LEN, TLBL, TNRM, TLBL); - } - else if (STREQ(data[1], "Arch Linux - Old")) - { - process_data(data, data_names, oldarch_logo, 18, - DETECTED_ARR_LEN, TLBL, TNRM, TLBL); - } - else if (STREQ(data[1], "Arch Linux")) - { - process_data(data, data_names, arch_logo, 19, - DETECTED_ARR_LEN, TLCY, TNRM, TLCY); - } - else if (STREQ(data[1], "LinuxMint")) - { - process_data(data, data_names, mint_logo, 18, - DETECTED_ARR_LEN, TLGN, TNRM, TLGN); - } - else if (STREQ(data[1], "LMDE")) - { - process_data(data, data_names, lmde_logo, 18, - DETECTED_ARR_LEN, TLGN, TNRM, TLGN); - } - else if (STREQ(data[1], "Ubuntu") || STREQ(data[1], "Lubuntu") - || STREQ(data[1], "Xubuntu")) - { - process_data(data, data_names, ubuntu_logo, 18, DETECTED_ARR_LEN, TLRD, - TNRM, TLRD); - } - else if (STREQ(data[1], "Debian")) - { - process_data(data, data_names, debian_logo, 18, DETECTED_ARR_LEN, TLRD, - TNRM, TLRD); - } - else if (STREQ(data[1], "CrunchBang")) - { - process_data(data, data_names, crunchbang_logo, 18, DETECTED_ARR_LEN, - TDGY, TNRM, TDGY); - } - else if (STREQ(data[1], "Gentoo")) - { - process_data(data, data_names, gentoo_logo, 18, DETECTED_ARR_LEN, TLPR, - TNRM, TLPR); - } - else if (STREQ(data[1], "Funtoo")) - { - process_data(data, data_names, funtoo_logo, 18, DETECTED_ARR_LEN, TLPR, - TNRM, TLPR); - } - else if (STREQ(data[1], "Fedora")) - { - process_data(data, data_names, fedora_logo, 18, DETECTED_ARR_LEN, TLBL, - TNRM, TLBL); - } - else if (STREQ(data[1], "Mandriva") || STREQ(data[1], "Mandrake")) - { - process_data(data, data_names, mandriva_mandrake_logo, 18, - DETECTED_ARR_LEN, TLBL, TNRM, TLBL); - } - else if (STREQ(data[1], "OpenSUSE")) - { - process_data(data, data_names, opensuse_logo, 18, DETECTED_ARR_LEN, - TLGN, TNRM, TLGN); - } - else if (STREQ(data[1], "Slackware")) - { - process_data(data, data_names, slackware_logo, 21, DETECTED_ARR_LEN, - TLBL, TNRM, TLBL); - } - else if (STREQ(data[1], "Red Hat Linux")) - { - process_data(data, data_names, redhat_logo, 18, DETECTED_ARR_LEN, TRED, - TNRM, TRED); - } - else if (STREQ(data[1], "Frugalware")) - { - process_data(data, data_names, frugalware_logo, 23, DETECTED_ARR_LEN, - TLCY, TNRM, TLCY); - } - else if (STREQ(data[1], "Peppermint")) - { - process_data(data, data_names, peppermint_logo, 18, DETECTED_ARR_LEN, - TLRD, TNRM, TLRD); - } - else if (STREQ(data[1], "SolusOS")) - { - process_data(data, data_names, solusos_logo, 18, DETECTED_ARR_LEN, - TLGY, TNRM, TLGY); - } - else if (STREQ(data[1], "Mageia")) - { - process_data(data, data_names, mageia_logo, 18, DETECTED_ARR_LEN, - TLGY, TNRM, TLGY); - } - else if (STREQ(data[1], "ParabolaGNU/Linux-libre")) - { - process_data(data, data_names, parabolagnu_linuxlibre_logo, 18, - DETECTED_ARR_LEN, TLGY, TLPR, TLGY); - } - else if (STREQ(data[1], "Viperr")) - { - process_data(data, data_names, viperr_logo, 18, DETECTED_ARR_LEN, TLGY, - TNRM, TLGY); - } - else if (STREQ(data[1], "LinuxDeepin")) - { - process_data(data, data_names, linuxdeepin_logo, 18, DETECTED_ARR_LEN, - TLGN, TNRM, TLGN); - } - else if (STREQ(data[1], "Chakra")) - { - process_data(data, data_names, chakra_logo, 18, DETECTED_ARR_LEN, - TLBL, TNRM, TLBL); - } - else if (STREQ(data[1], "Fuduntu")) - { - process_data(data, data_names, fuduntu_logo, 21, DETECTED_ARR_LEN, - TLRD, TNRM, TLRD); - } - else if (STREQ(data[1], "Trisquel")) - { - process_data(data, data_names, trisquel_logo, 18, DETECTED_ARR_LEN, - TLBL, TNRM, TLBL); - } - else if (STREQ(data[1], "Manjaro")) - { - process_data(data, data_names, manjaro_logo, 18, - DETECTED_ARR_LEN, TNRM, TNRM, TNRM); - } - else if (STREQ(data[1], "elementary OS")) - { - process_data(data, data_names, elementaryos_logo, 18, - DETECTED_ARR_LEN, TLGN, TNRM, TLGN); - } - else if (STREQ(data[1], "Scientific Linux")) - { - process_data(data, data_names, scientificlinux_logo, 20, - DETECTED_ARR_LEN, TLRD, TNRM, TLRD); - } - else if (STREQ(data[1], "Backtrack Linux")) - { - process_data(data, data_names, backtracklinux_logo, 21, - DETECTED_ARR_LEN, TLRD, TNRM, TLRD); - } - else if (STREQ(data[1], "Kali Linux")) - { - process_data(data, data_names, backtracklinux_logo, 21, - DETECTED_ARR_LEN, TLBL, TNRM, TLBL); - } - else if (STREQ(data[1], "Sabayon")) - { - process_data(data, data_names, sabayon_logo, 18, DETECTED_ARR_LEN, TLBL, - TNRM, TLBL); - } - else if (STREQ(data[1], "Android")) - { - process_data(data, data_names, android_logo, 16, DETECTED_ARR_LEN, TLGN, - TNRM, TLGN); - } - else if (STREQ(data[1], "Angstrom")) - { - process_data(data, data_names, angstrom_logo, 16, DETECTED_ARR_LEN, - TNRM, TNRM, TNRM); - } - else if (STREQ(data[1], "Linux")) - { - process_data(data, data_names, linux_logo, 18, DETECTED_ARR_LEN, - TLGY, TNRM, TLGY); - } - else if (STREQ(data[1], "FreeBSD")) - { - process_data(data, data_names, freebsd_logo, 18, DETECTED_ARR_LEN, TLRD, - TNRM, TLRD); - } - else if (STREQ(data[1], "OpenBSD")) - { - process_data(data, data_names, openbsd_logo, 23, DETECTED_ARR_LEN, TNRM, - TNRM, TNRM); - } - else if (STREQ(data[1], "NetBSD")) - { - process_data(data, data_names, netbsd_logo, 23, DETECTED_ARR_LEN, TNRM, - TNRM, TNRM); - } - else if (STREQ(data[1], "DragonFly BSD")) - { - process_data(data, data_names, dragonflybsd_logo, 23, DETECTED_ARR_LEN, - TNRM, TNRM, TNRM); - } - else if (STREQ(data[1], "SunOS")) - { - process_data(data, data_names, solaris_logo, 17, DETECTED_ARR_LEN, TNRM, - TNRM, TNRM); - } - else - { - ERR_REPORT("Could not find a logo for the distro."); - } +void main_ascii_output(char *data[], char *data_names[]) { + if (strstr(data[1], "Microsoft Windows 8") || strstr(data[1], "Microsoft Windows 10")) { + process_data(data, data_names, windows_modern_logo, 19, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (strstr(data[1], "Microsoft")) { + process_data(data, data_names, windows_logo, 16, DETECTED_ARR_LEN, TRED, TWHT, TRED); + } else if (strstr(data[1], "OS X")) { + process_data(data, data_names, macosx_logo, 16, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Arch Linux - Old")) { + process_data(data, data_names, oldarch_logo, 18, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Arch Linux")) { + process_data(data, data_names, arch_logo, 19, DETECTED_ARR_LEN, TLCY, TNRM, TLCY); + } else if (STREQ(data[1], "LinuxMint")) { + process_data(data, data_names, mint_logo, 18, DETECTED_ARR_LEN, TLGN, TNRM, TLGN); + } else if (STREQ(data[1], "LMDE")) { + process_data(data, data_names, lmde_logo, 18, DETECTED_ARR_LEN, TLGN, TNRM, TLGN); + } else if (STREQ(data[1], "Ubuntu") || STREQ(data[1], "Lubuntu") || STREQ(data[1], "Xubuntu")) { + process_data(data, data_names, ubuntu_logo, 18, DETECTED_ARR_LEN, TLRD, TNRM, TLRD); + } else if (STREQ(data[1], "Debian")) { + process_data(data, data_names, debian_logo, 18, DETECTED_ARR_LEN, TLRD, TNRM, TLRD); + } else if (STREQ(data[1], "CrunchBang")) { + process_data(data, data_names, crunchbang_logo, 18, DETECTED_ARR_LEN, TDGY, TNRM, TDGY); + } else if (STREQ(data[1], "Gentoo")) { + process_data(data, data_names, gentoo_logo, 18, DETECTED_ARR_LEN, TLPR, TNRM, TLPR); + } else if (STREQ(data[1], "Funtoo")) { + process_data(data, data_names, funtoo_logo, 18, DETECTED_ARR_LEN, TLPR, TNRM, TLPR); + } else if (STREQ(data[1], "Fedora")) { + process_data(data, data_names, fedora_logo, 18, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Mandriva") || STREQ(data[1], "Mandrake")) { + process_data(data, data_names, mandriva_mandrake_logo, 18, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "OpenSUSE")) { + process_data(data, data_names, opensuse_logo, 18, DETECTED_ARR_LEN, TLGN, TNRM, TLGN); + } else if (STREQ(data[1], "Slackware")) { + process_data(data, data_names, slackware_logo, 21, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Red Hat Linux")) { + process_data(data, data_names, redhat_logo, 18, DETECTED_ARR_LEN, TRED, TNRM, TRED); + } else if (STREQ(data[1], "Frugalware")) { + process_data(data, data_names, frugalware_logo, 23, DETECTED_ARR_LEN, TLCY, TNRM, TLCY); + } else if (STREQ(data[1], "Peppermint")) { + process_data(data, data_names, peppermint_logo, 18, DETECTED_ARR_LEN, TLRD, TNRM, TLRD); + } else if (STREQ(data[1], "SolusOS")) { + process_data(data, data_names, solusos_logo, 18, DETECTED_ARR_LEN, TLGY, TNRM, TLGY); + } else if (STREQ(data[1], "Mageia")) { + process_data(data, data_names, mageia_logo, 18, DETECTED_ARR_LEN, TLGY, TNRM, TLGY); + } else if (STREQ(data[1], "ParabolaGNU/Linux-libre")) { + process_data(data, data_names, parabolagnu_linuxlibre_logo, 18, DETECTED_ARR_LEN, TLGY, TLPR, + TLGY); + } else if (STREQ(data[1], "Viperr")) { + process_data(data, data_names, viperr_logo, 18, DETECTED_ARR_LEN, TLGY, TNRM, TLGY); + } else if (STREQ(data[1], "LinuxDeepin")) { + process_data(data, data_names, linuxdeepin_logo, 18, DETECTED_ARR_LEN, TLGN, TNRM, TLGN); + } else if (STREQ(data[1], "Chakra")) { + process_data(data, data_names, chakra_logo, 18, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Fuduntu")) { + process_data(data, data_names, fuduntu_logo, 21, DETECTED_ARR_LEN, TLRD, TNRM, TLRD); + } else if (STREQ(data[1], "Trisquel")) { + process_data(data, data_names, trisquel_logo, 18, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Manjaro")) { + process_data(data, data_names, manjaro_logo, 18, DETECTED_ARR_LEN, TNRM, TNRM, TNRM); + } else if (STREQ(data[1], "elementary OS")) { + process_data(data, data_names, elementaryos_logo, 18, DETECTED_ARR_LEN, TLGN, TNRM, TLGN); + } else if (STREQ(data[1], "Scientific Linux")) { + process_data(data, data_names, scientificlinux_logo, 20, DETECTED_ARR_LEN, TLRD, TNRM, TLRD); + } else if (STREQ(data[1], "Backtrack Linux")) { + process_data(data, data_names, backtracklinux_logo, 21, DETECTED_ARR_LEN, TLRD, TNRM, TLRD); + } else if (STREQ(data[1], "Kali Linux")) { + process_data(data, data_names, backtracklinux_logo, 21, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Sabayon")) { + process_data(data, data_names, sabayon_logo, 18, DETECTED_ARR_LEN, TLBL, TNRM, TLBL); + } else if (STREQ(data[1], "Android")) { + process_data(data, data_names, android_logo, 16, DETECTED_ARR_LEN, TLGN, TNRM, TLGN); + } else if (STREQ(data[1], "Angstrom")) { + process_data(data, data_names, angstrom_logo, 16, DETECTED_ARR_LEN, TNRM, TNRM, TNRM); + } else if (STREQ(data[1], "Linux")) { + process_data(data, data_names, linux_logo, 18, DETECTED_ARR_LEN, TLGY, TNRM, TLGY); + } else if (STREQ(data[1], "FreeBSD")) { + process_data(data, data_names, freebsd_logo, 18, DETECTED_ARR_LEN, TLRD, TNRM, TLRD); + } else if (STREQ(data[1], "OpenBSD")) { + process_data(data, data_names, openbsd_logo, 23, DETECTED_ARR_LEN, TNRM, TNRM, TNRM); + } else if (STREQ(data[1], "NetBSD")) { + process_data(data, data_names, netbsd_logo, 23, DETECTED_ARR_LEN, TNRM, TNRM, TNRM); + } else if (STREQ(data[1], "DragonFly BSD")) { + process_data(data, data_names, dragonflybsd_logo, 23, DETECTED_ARR_LEN, TNRM, TNRM, TNRM); + } else if (STREQ(data[1], "SunOS")) { + process_data(data, data_names, solaris_logo, 17, DETECTED_ARR_LEN, TNRM, TNRM, TNRM); + } else { + ERR_REPORT("Could not find a logo for the distro."); + } - return; + return; } /* main_text_output - the secondary output for screenfetch-c - all info WITHOUT ASCII art - arguments char *data[], char *data_names[] + the secondary output for screenfetch-c - all info WITHOUT ASCII art + arguments char *data[], char *data_names[] */ -void main_text_output(char *data[], char *data_names[]) -{ - int i; +void main_text_output(char *data[], char *data_names[]) { + int i; - for (i = 0; i < DETECTED_ARR_LEN; i++) - printf("%s %s\n", data_names[i], data[i]); + for (i = 0; i < DETECTED_ARR_LEN; i++) + printf("%s %s\n", data_names[i], data[i]); - return; + return; } diff --git a/src/disp.h b/src/disp.h index c0abe0d..4415989 100644 --- a/src/disp.h +++ b/src/disp.h @@ -17,12 +17,14 @@ void display_help(void); void display_verbose(char *data[], char *data_names[]); void process_logo_only(char *distro[], unsigned short int num); void output_logo_only(char *distro); -void process_data(char *data[], char *data_names[], char *logo[], unsigned short int num1, unsigned short int num2, char *col1, char *col2, char *col3); +void process_data(char *data[], char *data_names[], char *logo[], unsigned short int num1, + unsigned short int num2, char *col1, char *col2, char *col3); void main_ascii_output(char *data[], char *data_names[]); void main_text_output(char *data[], char *data_names[]); -#define ERR_REPORT(str) (fprintf(stderr, TWHT "[[ " TLRD "!" TWHT " ]] " TNRM \ - "Error: %s (%s:%d)\n", str, __FILE__, __LINE__)) +#define ERR_REPORT(str) \ + (fprintf(stderr, TWHT "[[ " TLRD "!" TWHT " ]] " TNRM "Error: %s (%s:%d)\n", str, __FILE__, \ + __LINE__)) #define VERBOSE_OUT(str1, str2) (fprintf(stdout, TLRD ":: " TNRM "%s%s\n", str1, str2)) #endif /* SCREENFETCH_C_DISP_H */ diff --git a/src/error_flag.h b/src/error_flag.h index 9f54398..bcf8439 100644 --- a/src/error_flag.h +++ b/src/error_flag.h @@ -1,7 +1,7 @@ /* error_flag.h ** Author: William Woodruff ** ------------- -** +** ** screenfetch-c's error flag is externalized in this file. ** Like the rest of screenfetch-c, this file is licensed under the MIT license. */ diff --git a/src/logos.c b/src/logos.c index f9ef4b9..24dd00e 100644 --- a/src/logos.c +++ b/src/logos.c @@ -9,967 +9,858 @@ #include "colors.h" /* 18 */ -char *oldarch_logo[] = -{ - TWHT " __ " TNRM, - TWHT " _=(SDGJT=_ " TNRM, - TWHT " _GTDJHGGFCVS) " TNRM, - TWHT " ,GTDJGGDTDFBGX0 " TNRM, - TWHT " JDJDIJHRORVFSBSVL"TLBL"-=+=,_ " TNRM, - TWHT " IJFDUFHJNXIXCDXDSV,"TLBL" \"DEBL " TNRM, - TWHT " [LKDSDJTDU=OUSCSBFLD."TLBL" '?ZWX, " TNRM, - TWHT " ,LMDSDSWH' `DCBOSI"TLBL" DRDS], " TNRM, - TWHT " SDDFDFH' !YEWD,"TLBL" )HDROD " TNRM, - TWHT " !KMDOCG &GSU|"TLBL"_GFHRGO' " TNRM, - TWHT " HKLSGP'"TLBL" __"TWHT"TKM0"TLBL"GHRBV)' " TNRM, - TWHT " JSNRVW'"TLBL" __+MNAEC"TWHT"IOI,"TLBL"BN' " TNRM, - TWHT " HELK['"TLBL" __,=OFFXCBGHC"TWHT"FD) " TNRM, - TWHT " ?KGHE "TLBL"_-#DASDFLSV='"TWHT" 'EF " TNRM, - TWHT " 'EHTI !H " TNRM, - TWHT " `0F' '! " TNRM, - " " TNRM, - " " TNRM -}; +char *oldarch_logo[] = {TWHT " __ " TNRM, + TWHT " _=(SDGJT=_ " TNRM, + TWHT " _GTDJHGGFCVS) " TNRM, + TWHT " ,GTDJGGDTDFBGX0 " TNRM, + TWHT " JDJDIJHRORVFSBSVL" TLBL "-=+=,_ " TNRM, + TWHT " IJFDUFHJNXIXCDXDSV," TLBL " \"DEBL " TNRM, + TWHT " [LKDSDJTDU=OUSCSBFLD." TLBL " '?ZWX, " TNRM, + TWHT " ,LMDSDSWH' `DCBOSI" TLBL " DRDS], " TNRM, + TWHT " SDDFDFH' !YEWD," TLBL " )HDROD " TNRM, + TWHT " !KMDOCG &GSU|" TLBL "_GFHRGO' " TNRM, + TWHT " HKLSGP'" TLBL " __" TWHT "TKM0" TLBL "GHRBV)' " TNRM, + TWHT " JSNRVW'" TLBL " __+MNAEC" TWHT "IOI," TLBL "BN' " TNRM, + TWHT " HELK['" TLBL " __,=OFFXCBGHC" TWHT "FD) " TNRM, + TWHT " ?KGHE " TLBL "_-#DASDFLSV='" TWHT " 'EF " TNRM, + TWHT " 'EHTI !H " TNRM, + TWHT " `0F' '! " TNRM, + " " TNRM, + " " TNRM}; /* 19 */ -char *arch_logo[] = -{ - ""TLCY" -` " TNRM, - ""TLCY" .o+` " TNRM, - ""TLCY" `ooo/ " TNRM, - ""TLCY" `+oooo: " TNRM, - ""TLCY" `+oooooo: " TNRM, - ""TLCY" -+oooooo+: " TNRM, - ""TLCY" `/:-:++oooo+: " TNRM, - ""TLCY" `/++++/+++++++: " TNRM, - ""TLCY" `/++++++++++++++: " TNRM, - ""TLCY" `/+++o"TCYN"oooooooo"TLCY"oooo/` " TNRM, - ""TCYN" "TLCY"./"TCYN"ooosssso++osssssso"TLCY"+` " TNRM, - ""TCYN" .oossssso-````/ossssss+` " TNRM, - ""TCYN" -osssssso. :ssssssso. " TNRM, - ""TCYN" :osssssss/ osssso+++. " TNRM, - ""TCYN" /ossssssss/ +ssssooo/- " TNRM, - ""TCYN" `/ossssso+/:- -:/+osssso+- " TNRM, - ""TCYN" `+sso+:-` `.-/+oso: " TNRM, - ""TCYN" `++:. `-/+/" TNRM, - ""TCYN" .` `/" TNRM -}; +char *arch_logo[] = {"" TLCY " -` " TNRM, + "" TLCY " .o+` " TNRM, + "" TLCY " `ooo/ " TNRM, + "" TLCY " `+oooo: " TNRM, + "" TLCY " `+oooooo: " TNRM, + "" TLCY " -+oooooo+: " TNRM, + "" TLCY " `/:-:++oooo+: " TNRM, + "" TLCY " `/++++/+++++++: " TNRM, + "" TLCY " `/++++++++++++++: " TNRM, + "" TLCY " `/+++o" TCYN "oooooooo" TLCY "oooo/` " TNRM, + "" TCYN " " TLCY "./" TCYN "ooosssso++osssssso" TLCY "+` " TNRM, + "" TCYN " .oossssso-````/ossssss+` " TNRM, + "" TCYN " -osssssso. :ssssssso. " TNRM, + "" TCYN " :osssssss/ osssso+++. " TNRM, + "" TCYN " /ossssssss/ +ssssooo/- " TNRM, + "" TCYN " `/ossssso+/:- -:/+osssso+- " TNRM, + "" TCYN " `+sso+:-` `.-/+oso: " TNRM, + "" TCYN " `++:. `-/+/" TNRM, + "" TCYN " .` `/" TNRM}; /* 18 */ -char *mint_logo[] = -{ - " " TNRM, - TLGN " MMMMMMMMMMMMMMMMMMMMMMMMMmds+. " TNRM, - TLGN " MMm----::-://////////////oymNMd+` " TNRM, - TLGN " MMd "TWHT"/++ "TLGN"-sNMd: " TNRM, - TLGN " MMNso/` "TWHT"dMM `.::-. .-::.` "TLGN".hMN: " TNRM, - TLGN " ddddMMh "TWHT"dMM :hNMNMNhNMNMNh: "TLGN"`NMm " TNRM, - TLGN " NMm "TWHT"dMM .NMN/-+MMM+-/NMN` "TLGN"dMM " TNRM, - TLGN " NMm "TWHT"dMM -MMm `MMM dMM. "TLGN"dMM " TNRM, - TLGN " NMm "TWHT"dMM -MMm `MMM dMM. "TLGN"dMM " TNRM, - TLGN " NMm "TWHT"dMM .mmd `mmm yMM. "TLGN"dMM " TNRM, - TLGN " NMm "TWHT"dMM` ..` ... ydm. "TLGN"dMM " TNRM, - TLGN " hMM- "TWHT"+MMd/-------...-:sdds "TLGN"dMM " TNRM, - TLGN " -NMm- "TWHT":hNMNNNmdddddddddy/` "TLGN"dMM " TNRM, - TLGN " -dMNs-"TWHT"``-::::-------.`` "TLGN"dMM " TNRM, - TLGN " `/dMNmy+/:-------------:/yMMM " TNRM, - TLGN " ./ydNMMMMMMMMMMMMMMMMMMMMM " TNRM, - TLGN " .MMMMMMMMMMMMMMMMMMM " TNRM, - " " TNRM -}; +char *mint_logo[] = {" " TNRM, + TLGN " MMMMMMMMMMMMMMMMMMMMMMMMMmds+. " TNRM, + TLGN " MMm----::-://////////////oymNMd+` " TNRM, + TLGN " MMd " TWHT "/++ " TLGN "-sNMd: " TNRM, + TLGN " MMNso/` " TWHT "dMM `.::-. .-::.` " TLGN ".hMN: " TNRM, + TLGN " ddddMMh " TWHT "dMM :hNMNMNhNMNMNh: " TLGN "`NMm " TNRM, + TLGN " NMm " TWHT "dMM .NMN/-+MMM+-/NMN` " TLGN "dMM " TNRM, + TLGN " NMm " TWHT "dMM -MMm `MMM dMM. " TLGN "dMM " TNRM, + TLGN " NMm " TWHT "dMM -MMm `MMM dMM. " TLGN "dMM " TNRM, + TLGN " NMm " TWHT "dMM .mmd `mmm yMM. " TLGN "dMM " TNRM, + TLGN " NMm " TWHT "dMM` ..` ... ydm. " TLGN "dMM " TNRM, + TLGN " hMM- " TWHT "+MMd/-------...-:sdds " TLGN "dMM " TNRM, + TLGN " -NMm- " TWHT ":hNMNNNmdddddddddy/` " TLGN "dMM " TNRM, + TLGN " -dMNs-" TWHT "``-::::-------.`` " TLGN "dMM " TNRM, + TLGN " `/dMNmy+/:-------------:/yMMM " TNRM, + TLGN " ./ydNMMMMMMMMMMMMMMMMMMMMM " TNRM, + TLGN " .MMMMMMMMMMMMMMMMMMM " TNRM, + " " TNRM}; /* 18 */ -char *lmde_logo[] = -{ - " "TWHT"`.-::---.. " TNRM, - TLGN " .:++++ooooosssoo:. " TNRM, - TLGN " .+o++::. `.:oos+. " TNRM, - TLGN " :oo:.` -+oo"TWHT": " TNRM, - TLGN " "TWHT"`"TLGN"+o/` ."TWHT"::::::"TLGN"-. .++-"TWHT"` " TNRM, - TLGN " "TWHT"`"TLGN"/s/ .yyyyyyyyyyo: +o-"TWHT"` " TNRM, - TLGN " "TWHT"`"TLGN"so .ss ohyo` :s-"TWHT": " TNRM, - TLGN " "TWHT"`"TLGN"s/ .ss h m myy/ /s`"TWHT"` " TNRM, - TLGN " `s: `oo s m Myy+-o:` " TNRM, - TLGN " `oo :+sdoohyoydyso/. " TNRM, - TLGN " :o. .:////////++: " TNRM, - TLGN " `/++ "TWHT"-:::::- " TNRM, - TLGN " "TWHT"`"TLGN"++- " TNRM, - TLGN " "TWHT"`"TLGN"/+- " TNRM, - TLGN " "TWHT"."TLGN"+/. " TNRM, - TLGN " "TWHT"."TLGN":+-. " TNRM, - TLGN " `--.`` " TNRM, - " " TNRM -}; +char *lmde_logo[] = {" " TWHT "`.-::---.. " TNRM, + TLGN " .:++++ooooosssoo:. " TNRM, + TLGN " .+o++::. `.:oos+. " TNRM, + TLGN " :oo:.` -+oo" TWHT ": " TNRM, + TLGN " " TWHT "`" TLGN "+o/` ." TWHT "::::::" TLGN "-. .++-" TWHT + "` " TNRM, + TLGN " " TWHT "`" TLGN "/s/ .yyyyyyyyyyo: +o-" TWHT "` " TNRM, + TLGN " " TWHT "`" TLGN "so .ss ohyo` :s-" TWHT ": " TNRM, + TLGN " " TWHT "`" TLGN "s/ .ss h m myy/ /s`" TWHT "` " TNRM, + TLGN " `s: `oo s m Myy+-o:` " TNRM, + TLGN " `oo :+sdoohyoydyso/. " TNRM, + TLGN " :o. .:////////++: " TNRM, + TLGN " `/++ " TWHT "-:::::- " TNRM, + TLGN " " TWHT "`" TLGN "++- " TNRM, + TLGN " " TWHT "`" TLGN "/+- " TNRM, + TLGN " " TWHT "." TLGN "+/. " TNRM, + TLGN " " TWHT "." TLGN ":+-. " TNRM, + TLGN " `--.`` " TNRM, + " " TNRM}; /* 18 */ -char *ubuntu_logo[] = -{ - TLRD " ./+o+- " TNRM, - TWHT " yyyyy- "TLRD"-yyyyyy+ " TNRM, - TWHT " "TWHT"://+//////"TLRD"-yyyyyyo " TNRM, - TYLW " .++ "TWHT".:/++++++/-"TLRD".+sss/` " TNRM, - TYLW " .:++o: "TWHT"/++++++++/:--:/- " TNRM, - TYLW " o:+o+:++."TWHT"`..```.-/oo+++++/ " TNRM, - TYLW " .:+o:+o/."TWHT" `+sssoo+/ " TNRM, - TWHT " .++/+:"TYLW"+oo+o:`"TWHT" /sssooo. " TNRM, - TWHT " /+++//+:"TYLW"`oo+o"TWHT" /::--:. " TNRM, - TWHT " +/+o+++"TYLW"`o++o"TLRD" ++////. " TNRM, - TWHT " .++.o+"TYLW"++oo+:`"TLRD" /dddhhh. " TNRM, - TYLW " .+.o+oo:."TLRD" `oddhhhh+ " TNRM, - TYLW " +.++o+o``-``"TLRD"``.:ohdhhhhh+ " TNRM, - TYLW " `:o+++ "TLRD"`ohhhhhhhhyo++os: " TNRM, - TYLW " .o:"TLRD"`.syhhhhhhh/"TYLW".oo++o` " TNRM, - TLRD " /osyyyyyyo"TYLW"++ooo+++/ " TNRM, - TLRD " ````` "TYLW"+oo+++o: " TNRM, - TYLW " `oo++. " TNRM -}; +char *ubuntu_logo[] = {TLRD " ./+o+- " TNRM, + TWHT " yyyyy- " TLRD "-yyyyyy+ " TNRM, + TWHT " " TWHT "://+//////" TLRD "-yyyyyyo " TNRM, + TYLW " .++ " TWHT ".:/++++++/-" TLRD ".+sss/` " TNRM, + TYLW " .:++o: " TWHT "/++++++++/:--:/- " TNRM, + TYLW " o:+o+:++." TWHT "`..```.-/oo+++++/ " TNRM, + TYLW " .:+o:+o/." TWHT " `+sssoo+/ " TNRM, + TWHT " .++/+:" TYLW "+oo+o:`" TWHT " /sssooo. " TNRM, + TWHT " /+++//+:" TYLW "`oo+o" TWHT " /::--:. " TNRM, + TWHT " +/+o+++" TYLW "`o++o" TLRD " ++////. " TNRM, + TWHT " .++.o+" TYLW "++oo+:`" TLRD " /dddhhh. " TNRM, + TYLW " .+.o+oo:." TLRD " `oddhhhh+ " TNRM, + TYLW " +.++o+o``-``" TLRD "``.:ohdhhhhh+ " TNRM, + TYLW " `:o+++ " TLRD "`ohhhhhhhhyo++os: " TNRM, + TYLW " .o:" TLRD "`.syhhhhhhh/" TYLW ".oo++o` " TNRM, + TLRD " /osyyyyyyo" TYLW "++ooo+++/ " TNRM, + TLRD " ````` " TYLW "+oo+++o: " TNRM, + TYLW " `oo++. " TNRM}; /* 18 */ -char *debian_logo[] = -{ - " " TWHT " _,met$$$$$gg. " TNRM, - " " TWHT " ,g$$$$$$$$$$$$$$$P. " TNRM, - " " TWHT " ,g$$P\"\" \"\"\"Y$$.\". " TNRM, - " " TWHT " ,$$P' `$$$. " TNRM, - " " TWHT "',$$P ,ggs. `$$b: " TNRM, - " " TWHT "`d$$' ,$P\"\' "TLRD"."TWHT" $$$ " TNRM, - " " TWHT " $$P d$\' "TLRD","TWHT" $$P " TNRM, - " " TWHT " $$: $$. "TLRD"-"TWHT" ,d$$' " TNRM, - " " TWHT " $$; Y$b._ _,d$P' " TNRM, - " " TWHT " Y$$. "TLRD"`."TWHT"`\"Y$$$$P\"' " TNRM, - " " TWHT " `$$b "TLRD"\"-.__ " TNRM, - " " TWHT " `Y$$ " TNRM, - " " TWHT " `Y$$. " TNRM, - " " TWHT " `$$b. " TNRM, - " " TWHT " `Y$$b. " TNRM, - " " TWHT " `\"Y$b._ " TNRM, - " " TWHT " `\"\"\"\" " TNRM, - " " TNRM -}; +char *debian_logo[] = {" " TWHT " _,met$$$$$gg. " TNRM, + " " TWHT " ,g$$$$$$$$$$$$$$$P. " TNRM, + " " TWHT " ,g$$P\"\" \"\"\"Y$$.\". " TNRM, + " " TWHT " ,$$P' `$$$. " TNRM, + " " TWHT "',$$P ,ggs. `$$b: " TNRM, + " " TWHT "`d$$' ,$P\"\' " TLRD "." TWHT " $$$ " TNRM, + " " TWHT " $$P d$\' " TLRD "," TWHT " $$P " TNRM, + " " TWHT " $$: $$. " TLRD "-" TWHT " ,d$$' " TNRM, + " " TWHT " $$; Y$b._ _,d$P' " TNRM, + " " TWHT " Y$$. " TLRD "`." TWHT "`\"Y$$$$P\"' " TNRM, + " " TWHT " `$$b " TLRD "\"-.__ " TNRM, + " " TWHT " `Y$$ " TNRM, + " " TWHT " `Y$$. " TNRM, + " " TWHT " `$$b. " TNRM, + " " TWHT " `Y$$b. " TNRM, + " " TWHT " `\"Y$b._ " TNRM, + " " TWHT " `\"\"\"\" " TNRM, + " " TNRM}; /* 18 */ -char *crunchbang_logo[] = -{ - " "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"████████████████████████████ "TWHT"███ "TNRM"", - " "TWHT"████████████████████████████ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"████████████████████████████ "TWHT"███ "TNRM"", - " "TWHT"████████████████████████████ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TWHT"███ "TWHT"███ "TWHT"███ "TNRM"", - " "TNRM"" -}; +char *crunchbang_logo[] = {" " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "████████████████████████████ " TWHT "███ " TNRM "", + " " TWHT "████████████████████████████ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "████████████████████████████ " TWHT "███ " TNRM "", + " " TWHT "████████████████████████████ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TWHT "███ " TWHT "███ " TWHT "███ " TNRM "", + " " TNRM ""}; /* 18 */ -char *gentoo_logo[] = -{ - TLPR " -/oyddmdhs+:. " TNRM, - TLPR " -o"TWHT"dNMMMMMMMMNNmhy+"TLPR"-` " TNRM, - TLPR " -y"TWHT"NMMMMMMMMMMMNNNmmdhy"TLPR"+- " TNRM, - TLPR " `o"TWHT"mMMMMMMMMMMMMNmdmmmmddhhy"TLPR"/` " TNRM, - TLPR " om"TWHT"MMMMMMMMMMMN"TLPR"hhyyyo"TWHT"hmdddhhhd"TLPR"o` " TNRM, - TLPR ".y"TWHT"dMMMMMMMMMMd"TLPR"hs++so/s"TWHT"mdddhhhhdm"TLPR"+` " TNRM, - TLPR " oy"TWHT"hdmNMMMMMMMN"TLPR"dyooy"TWHT"dmddddhhhhyhN"TLPR"d. " TNRM, - TLPR " :o"TWHT"yhhdNNMMMMMMMNNNmmdddhhhhhyym"TLPR"Mh " TNRM, - TLPR " .:"TWHT"+sydNMMMMMNNNmmmdddhhhhhhmM"TLPR"my " TNRM, - TLPR " /m"TWHT"MMMMMMNNNmmmdddhhhhhmMNh"TLPR"s: " TNRM, - TLPR " `o"TWHT"NMMMMMMMNNNmmmddddhhdmMNhs"TLPR"+` " TNRM, - TLPR " `s"TWHT"NMMMMMMMMNNNmmmdddddmNMmhs"TLPR"/. " TNRM, - TLPR " /N"TWHT"MMMMMMMMNNNNmmmdddmNMNdso"TLPR":` " TNRM, - TLPR "+M"TWHT"MMMMMMNNNNNmmmmdmNMNdso"TLPR"/- " TNRM, - TLPR "yM"TWHT"MNNNNNNNmmmmmNNMmhs+/"TLPR"-` " TNRM, - TLPR "/h"TWHT"MMNNNNNNNNMNdhs++/"TLPR"-` " TNRM, - TLPR "`/"TWHT"ohdmmddhys+++/:"TLPR".` " TNRM, - TLPR " `-//////:--. " TNRM -}; +char *gentoo_logo[] = { + TLPR " -/oyddmdhs+:. " TNRM, + TLPR " -o" TWHT "dNMMMMMMMMNNmhy+" TLPR "-` " TNRM, + TLPR " -y" TWHT "NMMMMMMMMMMMNNNmmdhy" TLPR "+- " TNRM, + TLPR " `o" TWHT "mMMMMMMMMMMMMNmdmmmmddhhy" TLPR "/` " TNRM, + TLPR " om" TWHT "MMMMMMMMMMMN" TLPR "hhyyyo" TWHT "hmdddhhhd" TLPR "o` " TNRM, + TLPR ".y" TWHT "dMMMMMMMMMMd" TLPR "hs++so/s" TWHT "mdddhhhhdm" TLPR "+` " TNRM, + TLPR " oy" TWHT "hdmNMMMMMMMN" TLPR "dyooy" TWHT "dmddddhhhhyhN" TLPR "d. " TNRM, + TLPR " :o" TWHT "yhhdNNMMMMMMMNNNmmdddhhhhhyym" TLPR "Mh " TNRM, + TLPR " .:" TWHT "+sydNMMMMMNNNmmmdddhhhhhhmM" TLPR "my " TNRM, + TLPR " /m" TWHT "MMMMMMNNNmmmdddhhhhhmMNh" TLPR "s: " TNRM, + TLPR " `o" TWHT "NMMMMMMMNNNmmmddddhhdmMNhs" TLPR "+` " TNRM, + TLPR " `s" TWHT "NMMMMMMMMNNNmmmdddddmNMmhs" TLPR "/. " TNRM, + TLPR " /N" TWHT "MMMMMMMMNNNNmmmdddmNMNdso" TLPR ":` " TNRM, + TLPR "+M" TWHT "MMMMMMNNNNNmmmmdmNMNdso" TLPR "/- " TNRM, + TLPR "yM" TWHT "MNNNNNNNmmmmmNNMmhs+/" TLPR "-` " TNRM, + TLPR "/h" TWHT "MMNNNNNNNNMNdhs++/" TLPR "-` " TNRM, + TLPR "`/" TWHT "ohdmmddhys+++/:" TLPR ".` " TNRM, + TLPR " `-//////:--. " TNRM}; /* 18 */ -char *funtoo_logo[] = -{ - " " TNRM, - " " TNRM, - " " TNRM, - " " TNRM, - TWHT " _______ ____ " TNRM, - TWHT " /MMMMMMM/ /MMMM| _____ _____ " TNRM, - TWHT " __/M"TLPR".MMM."TWHT"M/_____________|M"TLPR".M"TWHT"MM|/MMMMM\\/MMMMM\\ " TNRM, - TWHT "|MMMM"TLPR"MM'"TWHT"MMMMMMMMMMMMMMMMMMM"TLPR"MM"TWHT"MMMM"TLPR".MMMM..MMMM."TWHT"MM\\ " TNRM, - TWHT "|MM"TLPR"MMMMMMM"TWHT"/m"TLPR"MMMMMMMMMMMMMMMMMMMMMM"TWHT"MMMM"TLPR"MM"TWHT"MMMM"TLPR"MM"TWHT"MM| " TNRM, - TWHT "|MMMM"TLPR"MM"TWHT"MMM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MMMMM"TLPR"\\MMM"TWHT"MMM"TLPR"MM"TWHT"MMMM"TLPR"MM"TWHT"MMMM"TLPR"MM"TWHT"MM| " TNRM, - TWHT " |MM"TLPR"MM"TWHT"MMM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MMM"TWHT"MMMM"TLPR"'MMMM''MMMM'"TWHT"MM/ " TNRM, - TWHT " |MM"TLPR"MM"TWHT"MMM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MMM"TWHT"MMM\\MMMMM/\\MMMMM/ " TNRM, - TWHT " |MM"TLPR"MM"TWHT"MMM"TLPR"MM"TWHT"MMMMMM"TLPR"MM"TWHT"MM"TLPR"MM"TWHT"MM"TLPR"MMMMM'"TWHT"M| " TNRM, - TWHT " |MM"TLPR"MM"TWHT"MMM"TLPR"MMMMMMMMMMMMMMMMM MM'"TWHT"M/ " TNRM, - TWHT " |MMMMMMMMMMMMMMMMMMMMMMMMMMMM/ " TNRM, - " " TNRM, - " " TNRM, - " " TNRM -}; +char *funtoo_logo[] = { + " " TNRM, + " " TNRM, + " " TNRM, + " " TNRM, + TWHT " _______ ____ " TNRM, + TWHT " /MMMMMMM/ /MMMM| _____ _____ " TNRM, + TWHT " __/M" TLPR ".MMM." TWHT "M/_____________|M" TLPR ".M" TWHT + "MM|/MMMMM\\/MMMMM\\ " TNRM, + TWHT "|MMMM" TLPR "MM'" TWHT "MMMMMMMMMMMMMMMMMMM" TLPR "MM" TWHT "MMMM" TLPR + ".MMMM..MMMM." TWHT "MM\\ " TNRM, + TWHT "|MM" TLPR "MMMMMMM" TWHT "/m" TLPR "MMMMMMMMMMMMMMMMMMMMMM" TWHT "MMMM" TLPR "MM" TWHT + "MMMM" TLPR "MM" TWHT "MM| " TNRM, + TWHT "|MMMM" TLPR "MM" TWHT "MMM" TLPR "MM" TWHT "MM" TLPR "MM" TWHT "MM" TLPR "MM" TWHT + "MMMMM" TLPR "\\MMM" TWHT "MMM" TLPR "MM" TWHT "MMMM" TLPR "MM" TWHT "MMMM" TLPR "MM" TWHT + "MM| " TNRM, + TWHT " |MM" TLPR "MM" TWHT "MMM" TLPR "MM" TWHT "MM" TLPR "MM" TWHT "MM" TLPR "MM" TWHT + "MM" TLPR "MM" TWHT "MM" TLPR "MMM" TWHT "MMMM" TLPR "'MMMM''MMMM'" TWHT "MM/ " TNRM, + TWHT " |MM" TLPR "MM" TWHT "MMM" TLPR "MM" TWHT "MM" TLPR "MM" TWHT "MM" TLPR "MM" TWHT + "MM" TLPR "MM" TWHT "MM" TLPR "MMM" TWHT "MMM\\MMMMM/\\MMMMM/ " TNRM, + TWHT " |MM" TLPR "MM" TWHT "MMM" TLPR "MM" TWHT "MMMMMM" TLPR "MM" TWHT "MM" TLPR "MM" TWHT + "MM" TLPR "MMMMM'" TWHT "M| " TNRM, + TWHT " |MM" TLPR "MM" TWHT "MMM" TLPR "MMMMMMMMMMMMMMMMM MM'" TWHT + "M/ " TNRM, + TWHT " |MMMMMMMMMMMMMMMMMMMMMMMMMMMM/ " TNRM, + " " TNRM, + " " TNRM, + " " TNRM}; /* 18 */ -char *fedora_logo[] = -{ - TLBL " :/------------:// " TNRM, - TLBL " :------------------:// " TNRM, - TLBL " :-----------"TWHT"/shhdhyo/"TLBL"-:// " TNRM, - TLBL " /-----------"TWHT"omMMMNNNMMMd/"TLBL"-:/ " TNRM, - TLBL " :-----------"TWHT"sMMMdo:/"TLBL" -:/ " TNRM, - TLBL " :-----------"TWHT":MMMd"TLBL"------- --:/ " TNRM, - TLBL " /-----------"TWHT":MMMy"TLBL"------- ---/ " TNRM, - TLBL " :------ --"TWHT"/+MMMh/"TLBL"-- ---: " TNRM, - TLBL " :--- "TWHT"oNMMMMMMMMMNho"TLBL" -----: " TNRM, - TLBL " :-- "TWHT"+shhhMMMmhhy++"TLBL" ------: " TNRM, - TLBL " :- -----"TWHT":MMMy"TLBL"--------------/ " TNRM, - TLBL " :- ------"TWHT"/MMMy"TLBL"-------------: " TNRM, - TLBL " :- ----"TWHT"/hMMM+"TLBL"------------: " TNRM, - TLBL " :--"TWHT":dMMNdhhdNMMNo"TLBL"-----------: " TNRM, - TLBL " :---"TWHT":sdNMMMMNds:"TLBL"----------: " TNRM, - TLBL " :------"TWHT":://:"TLBL"-----------:// " TNRM, - TLBL " :--------------------:// " TNRM, - " " TNRM -}; +char *fedora_logo[] = {TLBL " :/------------:// " TNRM, + TLBL " :------------------:// " TNRM, + TLBL " :-----------" TWHT "/shhdhyo/" TLBL "-:// " TNRM, + TLBL " /-----------" TWHT "omMMMNNNMMMd/" TLBL "-:/ " TNRM, + TLBL " :-----------" TWHT "sMMMdo:/" TLBL " -:/ " TNRM, + TLBL " :-----------" TWHT ":MMMd" TLBL "------- --:/ " TNRM, + TLBL " /-----------" TWHT ":MMMy" TLBL "------- ---/ " TNRM, + TLBL " :------ --" TWHT "/+MMMh/" TLBL "-- ---: " TNRM, + TLBL " :--- " TWHT "oNMMMMMMMMMNho" TLBL " -----: " TNRM, + TLBL " :-- " TWHT "+shhhMMMmhhy++" TLBL " ------: " TNRM, + TLBL " :- -----" TWHT ":MMMy" TLBL "--------------/ " TNRM, + TLBL " :- ------" TWHT "/MMMy" TLBL "-------------: " TNRM, + TLBL " :- ----" TWHT "/hMMM+" TLBL "------------: " TNRM, + TLBL " :--" TWHT ":dMMNdhhdNMMNo" TLBL "-----------: " TNRM, + TLBL " :---" TWHT ":sdNMMMMNds:" TLBL "----------: " TNRM, + TLBL " :------" TWHT ":://:" TLBL "-----------:// " TNRM, + TLBL " :--------------------:// " TNRM, + " " TNRM}; /* 18 */ -char *freebsd_logo[] = -{ - " " TNRM, - " "TWHT"``` "TLRD"` " TNRM, - " "TWHT"` `.....---..."TLRD"....--.``` -/ " TNRM, - " "TWHT"+o .--` "TLRD"/y:` +. " TNRM, - " "TWHT" yo`:. "TLRD":o `+- " TNRM, - " "TWHT"y/ "TLRD"-/` -o/ " TNRM, - " "TWHT".- "TLRD"::/sy+:. " TNRM, - " "TWHT"/ "TLRD"`-- / " TNRM, - " "TWHT"`: "TLRD":` " TNRM, - " "TWHT"`: "TLRD":` " TNRM, - " "TWHT"/ "TLRD"/ " TNRM, - " "TWHT".- "TLRD"-. " TNRM, - " "TWHT"-- "TLRD"-. " TNRM, - " "TWHT"`:` "TLRD"`:` " TNRM, - " "TLRD".-- `--. " TNRM, - " "TLRD" .---.....----. " TNRM, - " " TNRM, - " " TNRM -}; +char *freebsd_logo[] = {" " TNRM, + " " TWHT "``` " TLRD "` " TNRM, + " " TWHT "` `.....---..." TLRD "....--.``` -/ " TNRM, + " " TWHT "+o .--` " TLRD "/y:` +. " TNRM, + " " TWHT " yo`:. " TLRD ":o `+- " TNRM, + " " TWHT "y/ " TLRD "-/` -o/ " TNRM, + " " TWHT ".- " TLRD "::/sy+:. " TNRM, + " " TWHT "/ " TLRD "`-- / " TNRM, + " " TWHT "`: " TLRD ":` " TNRM, + " " TWHT "`: " TLRD ":` " TNRM, + " " TWHT "/ " TLRD "/ " TNRM, + " " TWHT ".- " TLRD "-. " TNRM, + " " TWHT "-- " TLRD "-. " TNRM, + " " TWHT "`:` " TLRD "`:` " TNRM, + " " TLRD ".-- `--. " TNRM, + " " TLRD " .---.....----. " TNRM, + " " TNRM, + " " TNRM}; /* 23 */ -char *openbsd_logo[] = -{ - " "TLCY" _ "TNRM"", - " "TLCY"(_) "TNRM"", - TYLW " | . "TNRM"", - TYLW " . |L /| . "TLCY" _ " TNRM, - TYLW " _ . |\\ _| \\--+._/| . "TLCY"(_) " TNRM, - TYLW " / ||\\| Y J ) / |/| ./ " TNRM, - TYLW " J |)'( | ` F`.'/ "TLCY" _ " TNRM, - TYLW " -<| F __ .-< "TLCY"(_) " TNRM, - TYLW " | / .-'"TLCY". "TYLW"`. /"TLCY"-. "TYLW"L___ " TNRM, - TYLW " J \\ < "TLCY"\\ "TYLW" | | "TDGY"O"TLCY"\\"TYLW"|.-' "TLCY" _ " TNRM, - TYLW " _J \\ .- \\"TLCY"/ "TDGY"O "TLCY"| "TYLW"| \\ |"TYLW"F "TLCY"(_) " TNRM, - TYLW " '-F -<_. \\ .-' `-' L__ " TNRM, - TYLW "__J _ _. >-' "TBRN")"TLRD"._. "TYLW"|-' "TNRM, - TYLW " `-|.' /_. "TLRD"\\_| "TYLW" F "TNRM, - TYLW " /.- . _.< " TNRM, - TYLW " /' /.' .' `\\ " TNRM, - TYLW " /L /' |/ _.-'-\\ "TNRM, - TYLW " /'J ___.---'\\| " TNRM, - TYLW " |\\ .--' V | `. ` "TNRM, - TYLW " |/`. `-. `._) " TNRM, - TYLW " / .-.\\ " TNRM, - TYLW " \\ ( `\\ "TNRM"", - TYLW " `.\\ "TNRM"" -}; +char *openbsd_logo[] = { + " " TLCY " _ " TNRM "", + " " TLCY "(_) " TNRM "", + TYLW " | . " TNRM "", + TYLW " . |L /| . " TLCY " _ " TNRM, + TYLW " _ . |\\ _| \\--+._/| . " TLCY "(_) " TNRM, + TYLW " / ||\\| Y J ) / |/| ./ " TNRM, + TYLW " J |)'( | ` F`.'/ " TLCY " _ " TNRM, + TYLW " -<| F __ .-< " TLCY "(_) " TNRM, + TYLW " | / .-'" TLCY ". " TYLW "`. /" TLCY "-. " TYLW "L___ " TNRM, + TYLW " J \\ < " TLCY "\\ " TYLW " | | " TDGY "O" TLCY "\\" TYLW "|.-' " TLCY + " _ " TNRM, + TYLW " _J \\ .- \\" TLCY "/ " TDGY "O " TLCY "| " TYLW "| \\ |" TYLW "F " TLCY + "(_) " TNRM, + TYLW " '-F -<_. \\ .-' `-' L__ " TNRM, + TYLW "__J _ _. >-' " TBRN ")" TLRD "._. " TYLW "|-' " TNRM, + TYLW " `-|.' /_. " TLRD "\\_| " TYLW " F " TNRM, + TYLW " /.- . _.< " TNRM, + TYLW " /' /.' .' `\\ " TNRM, + TYLW " /L /' |/ _.-'-\\ " TNRM, + TYLW " /'J ___.---'\\| " TNRM, + TYLW " |\\ .--' V | `. ` " TNRM, + TYLW " |/`. `-. `._) " TNRM, + TYLW " / .-.\\ " TNRM, + TYLW " \\ ( `\\ " TNRM "", + TYLW " `.\\ " TNRM ""}; /* 18 */ -char *dragonflybsd_logo[] = -{ - " "TLRD" | " TNRM, - " "TLRD" .-. " TNRM, - " "TYLW" ()"TLRD"I"TYLW"() " TNRM, - " "TLRD" \"==.__:-:__.==\" " TNRM, - " "TLRD"\"==.__/~|~\\__.==\" " TNRM, - " "TLRD"\"==._( Y )_.==\" " TNRM, - " "TWHT".-'~~\"\"~=--...,__"TLRD"\\/|\\/"TWHT"__,...--=~\"\"~~'-. " TNRM, - " "TWHT"( ..="TLRD"\\="TLRD"/"TWHT"=.. )" TNRM, - " "TWHT"`'-. ,.-\"`;"TLRD"/=\\"TWHT" ;\"-.,_ .-'`" TNRM, - " "TWHT" `~\"-=-~` .-~` "TLRD"|=|"TWHT" `~-. `~-=-\"~` " TNRM, - " "TWHT" .-~` /"TLRD"|=|"TWHT"\\ `~-. " TNRM, - " "TWHT" .~` / "TLRD"|=|"TWHT" \\ `~. " TNRM, - " "TWHT" .-~` .' "TLRD"|=|"TWHT" \\`. `~-. " TNRM, - " "TWHT" (` _,.-=\"` "TLRD" |=|"TWHT" `\"=-.,_ `) " TNRM, - " "TWHT" `~\"~\"` "TLRD" |=|"TWHT" `\"~\"~` " TNRM, - " "TLRD" /=\\ " TNRM, - " "TLRD" \\=/ " TNRM, - " "TLRD" ^ " TNRM -}; +char *dragonflybsd_logo[] = { + " " TLRD " | " TNRM, + " " TLRD " .-. " TNRM, + " " TYLW " ()" TLRD "I" TYLW "() " TNRM, + " " TLRD " \"==.__:-:__.==\" " TNRM, + " " TLRD "\"==.__/~|~\\__.==\" " TNRM, + " " TLRD "\"==._( Y )_.==\" " TNRM, + " " TWHT ".-'~~\"\"~=--...,__" TLRD "\\/|\\/" TWHT "__,...--=~\"\"~~'-. " TNRM, + " " TWHT "( ..=" TLRD "\\=" TLRD "/" TWHT "=.. )" TNRM, + " " TWHT "`'-. ,.-\"`;" TLRD "/=\\" TWHT " ;\"-.,_ .-'`" TNRM, + " " TWHT " `~\"-=-~` .-~` " TLRD "|=|" TWHT " `~-. `~-=-\"~` " TNRM, + " " TWHT " .-~` /" TLRD "|=|" TWHT "\\ `~-. " TNRM, + " " TWHT " .~` / " TLRD "|=|" TWHT " \\ `~. " TNRM, + " " TWHT " .-~` .' " TLRD "|=|" TWHT " \\`. `~-. " TNRM, + " " TWHT " (` _,.-=\"` " TLRD " |=|" TWHT " `\"=-.,_ `) " TNRM, + " " TWHT " `~\"~\"` " TLRD " |=|" TWHT " `\"~\"~` " TNRM, + " " TLRD " /=\\ " TNRM, + " " TLRD " \\=/ " TNRM, + " " TLRD " ^ " TNRM}; /* 20 */ -char *netbsd_logo[] = -{ - " "TLRD"__,gnnnOCCCCCOObaau,_ " TNRM, - " "TWHT"_._ "TLRD"__,gnnCCCCCCCCOPF\"'' " TNRM, - " "TWHT"(N\\\\\\"TLRD"XCbngg,._____.,gnnndCCCCCCCCCCCCF\"___,,,,___ " TNRM, - " "TWHT"\\\\N\\\\"TLRD"XCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOPYvv. " TNRM, - " "TWHT"\\\\N\\\\"TLRD"XCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPF\"'' " TNRM, - " "TWHT"\\\\N\\\\"TLRD"XCCCCCCCCCCCCCCCCCCCCCCCCCOF\"' " TNRM, - " "TWHT"\\\\N\\\\"TLRD"XCCCCCCCCCCCCCCCCCCCCOF\"' " TNRM, - " "TWHT"\\\\N\\\\"TLRD"XCCCCCCCCCCCCCCCPF\"' " TNRM, - " "TWHT"\\\\N\\\\"TLRD"\"PCOCCCOCCFP\"\" " TNRM, - " "TWHT"\\\\N\\ " TNRM, - " "TWHT"\\\\N\\ " TNRM, - " "TWHT"\\\\N\\ " TNRM, - " "TWHT"\\\\NN\\ " TNRM, - " "TWHT"\\\\NN\\ " TNRM, - " "TWHT"\\\\NNA. " TNRM, - " "TWHT"\\\\NNA, " TNRM, - " "TWHT"\\\\NNN, " TNRM, - " "TWHT"\\\\NNN\\ " TNRM, - " "TWHT"\\\\NNN\\ " TNRM, - " "TWHT"\\\\NNNA" TNRM -}; +char *netbsd_logo[] = { + " " TLRD "__,gnnnOCCCCCOObaau,_ " TNRM, + " " TWHT "_._ " TLRD "__,gnnCCCCCCCCOPF\"'' " TNRM, + " " TWHT "(N\\\\\\" TLRD "XCbngg,._____.,gnnndCCCCCCCCCCCCF\"___,,,,___ " TNRM, + " " TWHT "\\\\N\\\\" TLRD "XCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOOPYvv. " TNRM, + " " TWHT "\\\\N\\\\" TLRD "XCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPF\"'' " TNRM, + " " TWHT "\\\\N\\\\" TLRD "XCCCCCCCCCCCCCCCCCCCCCCCCCOF\"' " TNRM, + " " TWHT "\\\\N\\\\" TLRD "XCCCCCCCCCCCCCCCCCCCCOF\"' " TNRM, + " " TWHT "\\\\N\\\\" TLRD "XCCCCCCCCCCCCCCCPF\"' " TNRM, + " " TWHT "\\\\N\\\\" TLRD "\"PCOCCCOCCFP\"\" " TNRM, + " " TWHT "\\\\N\\ " TNRM, + " " TWHT "\\\\N\\ " TNRM, + " " TWHT "\\\\N\\ " TNRM, + " " TWHT "\\\\NN\\ " TNRM, + " " TWHT "\\\\NN\\ " TNRM, + " " TWHT "\\\\NNA. " TNRM, + " " TWHT "\\\\NNA, " TNRM, + " " TWHT "\\\\NNN, " TNRM, + " " TWHT "\\\\NNN\\ " TNRM, + " " TWHT "\\\\NNN\\ " TNRM, + " " TWHT "\\\\NNNA" TNRM}; /* 18 */ -char *mandriva_mandrake_logo[] = -{ - " " TNRM, - TYLW " `` " TNRM, - TYLW " `-. " TNRM, - TLBL " ` "TYLW".--- " TNRM, - TLBL " -/ "TYLW"-::--` " TNRM, - TLBL " `++ "TYLW"`----...```-:::::. " TNRM, - TLBL " `os. "TYLW".::::::::::::::-``` ` ` " TNRM, - TLBL " +s+ "TYLW".::::::::::::::::---...--` " TNRM, - TLBL " -ss: "TYLW"`-::::::::::::::::-.``.`` " TNRM, - TLBL " /ss- "TYLW".::::::::::::-.`` ` " TNRM, - TLBL " +ss: "TYLW".::::::::::::- " TNRM, - TLBL " /sso "TYLW".::::::-::::::- " TNRM, - TLBL " .sss/ "TYLW"-:::-.` .::::: " TNRM, - TLBL " /sss+. "TYLW"..`"TLBL" `--` "TYLW".::: " TNRM, - TLBL " -ossso+/:://+/-` "TYLW".:` " TNRM, - TLBL " -/+ooo+/-. "TYLW"` " TNRM, - " " TNRM, - " " TNRM -}; +char *mandriva_mandrake_logo[] = {" " TNRM, + TYLW " `` " TNRM, + TYLW " `-. " TNRM, + TLBL " ` " TYLW ".--- " TNRM, + TLBL " -/ " TYLW "-::--` " TNRM, + TLBL " `++ " TYLW "`----...```-:::::. " TNRM, + TLBL " `os. " TYLW ".::::::::::::::-``` ` ` " TNRM, + TLBL " +s+ " TYLW ".::::::::::::::::---...--` " TNRM, + TLBL " -ss: " TYLW "`-::::::::::::::::-.``.`` " TNRM, + TLBL " /ss- " TYLW ".::::::::::::-.`` ` " TNRM, + TLBL " +ss: " TYLW ".::::::::::::- " TNRM, + TLBL " /sso " TYLW ".::::::-::::::- " TNRM, + TLBL " .sss/ " TYLW "-:::-.` .::::: " TNRM, + TLBL " /sss+. " TYLW "..`" TLBL " `--` " TYLW + ".::: " TNRM, + TLBL " -ossso+/:://+/-` " TYLW ".:` " TNRM, + TLBL " -/+ooo+/-. " TYLW "` " TNRM, + " " TNRM, + " " TNRM}; /* 18 */ -char *opensuse_logo[] = -{ - TWHT " .;ldkO0000Okdl;. " TNRM, - TWHT " .;d00xl:,'....';:ok00d;. " TNRM, - TWHT " .d00l' ,o00d. " TNRM, - TWHT " .d0Kd."TLGN" :Okxol:;'. "TWHT":O0d. " TNRM, - TWHT " 'OK"TLGN"KKK0kOKKKKKKKKKKOxo:' "TWHT"lKO' " TNRM, - TWHT " ,0K"TLGN"KKKKKKKKKKKKKKK0d:"TWHT",,,"TLGN":dx:"TWHT" ;00, " TNRM, - TWHT " .OK"TLGN"KKKKKKKKKKKKKKKk."TWHT".oOkdl."TLGN"'0k."TWHT" cKO. " TNRM, - TWHT " :KK"TLGN"KKKKKKKKKKKKKKK: "TWHT"kKx..od "TLGN"lKd"TWHT" .OK: " TNRM, - TWHT " dKK"TLGN"KKKKKKKKKOx0KKKd "TWHT";0KKKO, "TLGN"kKKc"TWHT" dKd " TNRM, - TWHT " dKK"TLGN"KKKKKKKKKK;.;oOKx,.."TWHT"'"TLGN"..;kKKK0."TWHT" dKd " TNRM, - TWHT " :KK"TLGN"KKKKKKKKKK0o;...;cdxxOK0Oxc,. "TWHT".0K: " TNRM, - TWHT " kKK"TLGN"KKKKKKKKKKKKK0xl;'......,cdo "TWHT"lKk " TNRM, - TWHT " '0K"TLGN"KKKKKKKKKKKKKKKKKKKK00KKOo; "TWHT"c00' " TNRM, - TWHT " .kK"TLGN"KKOxddxkOO00000Okxoc;'. "TWHT".dKk. " TNRM, - TWHT " l0Ko. .c00l. " TNRM, - TWHT " .l0Kk:. .;xK0l. " TNRM, - TWHT " ,lkK0xl:;,,,,;:ldO0kl, " TNRM, - TWHT " .':ldxkkkkxdl:'. " TNRM -}; +char *opensuse_logo[] = { + TWHT " .;ldkO0000Okdl;. " TNRM, + TWHT " .;d00xl:,'....';:ok00d;. " TNRM, + TWHT " .d00l' ,o00d. " TNRM, + TWHT " .d0Kd." TLGN " :Okxol:;'. " TWHT ":O0d. " TNRM, + TWHT " 'OK" TLGN "KKK0kOKKKKKKKKKKOxo:' " TWHT "lKO' " TNRM, + TWHT " ,0K" TLGN "KKKKKKKKKKKKKKK0d:" TWHT ",,," TLGN ":dx:" TWHT " ;00, " TNRM, + TWHT " .OK" TLGN "KKKKKKKKKKKKKKKk." TWHT ".oOkdl." TLGN "'0k." TWHT " cKO. " TNRM, + TWHT " :KK" TLGN "KKKKKKKKKKKKKKK: " TWHT "kKx..od " TLGN "lKd" TWHT " .OK: " TNRM, + TWHT " dKK" TLGN "KKKKKKKKKOx0KKKd " TWHT ";0KKKO, " TLGN "kKKc" TWHT " dKd " TNRM, + TWHT " dKK" TLGN "KKKKKKKKKK;.;oOKx,.." TWHT "'" TLGN "..;kKKK0." TWHT " dKd " TNRM, + TWHT " :KK" TLGN "KKKKKKKKKK0o;...;cdxxOK0Oxc,. " TWHT ".0K: " TNRM, + TWHT " kKK" TLGN "KKKKKKKKKKKKK0xl;'......,cdo " TWHT "lKk " TNRM, + TWHT " '0K" TLGN "KKKKKKKKKKKKKKKKKKKK00KKOo; " TWHT "c00' " TNRM, + TWHT " .kK" TLGN "KKOxddxkOO00000Okxoc;'. " TWHT ".dKk. " TNRM, + TWHT " l0Ko. .c00l. " TNRM, + TWHT " .l0Kk:. .;xK0l. " TNRM, + TWHT " ,lkK0xl:;,,,,;:ldO0kl, " TNRM, + TWHT " .':ldxkkkkxdl:'. " TNRM}; /* 21 */ -char *slackware_logo[] = -{ - TLBL " :::::::", - TLBL " ::::::::::::::::::: " TNRM, - TLBL " ::::::::::::::::::::::::: " TNRM, - TLBL " ::::::::"TWHT"cllcccccllllllll"TLBL":::::: " TNRM, - TLBL " :::::::::"TWHT"lc dc"TLBL"::::::: " TNRM, - TLBL " ::::::::"TWHT"cl clllccllll oc"TLBL"::::::::: " TNRM, - TLBL " :::::::::"TWHT"o lc"TLBL"::::::::"TWHT"co oc"TLBL":::::::::: " TNRM, - TLBL " ::::::::::"TWHT"o cccclc"TLBL":::::"TWHT"clcc"TLBL":::::::::::: " TNRM, - TLBL " :::::::::::"TWHT"lc cclccclc"TLBL"::::::::::::: " TNRM, - TLBL " ::::::::::::::"TWHT"lcclcc lc"TLBL":::::::::::: " TNRM, - TLBL " ::::::::::"TWHT"cclcc"TLBL":::::"TWHT"lccclc oc"TLBL"::::::::::: " TNRM, - TLBL " ::::::::::"TWHT"o l"TLBL"::::::::::"TWHT"l lc"TLBL"::::::::::: " TNRM, - TLBL " :::::"TWHT"cll"TLBL":"TWHT"o clcllcccll o"TLBL"::::::::::: " TNRM, - TLBL " :::::"TWHT"occ"TLBL":"TWHT"o clc"TLBL"::::::::::: " TNRM, - TLBL " ::::"TWHT"ocl"TLBL":"TWHT"ccslclccclclccclclc"TLBL"::::::::::::: " TNRM, - TLBL " :::"TWHT"oclcccccccccccccllllllllllllll"TLBL"::::: " TNRM, - TLBL " ::"TWHT"lcc1lcccccccccccccccccccccccco"TLBL":::: " TNRM, - TLBL " :::::::::::::::::::::::::::::::: " TNRM, - TLBL " :::::::::::::::::::::::::::: " TNRM, - TLBL " ::::::::::::::::::::::" TNRM, - TLBL " ::::::::::::" TNRM -}; +char *slackware_logo[] = { + TLBL " :::::::", + TLBL " ::::::::::::::::::: " TNRM, + TLBL " ::::::::::::::::::::::::: " TNRM, + TLBL " ::::::::" TWHT "cllcccccllllllll" TLBL ":::::: " TNRM, + TLBL " :::::::::" TWHT "lc dc" TLBL "::::::: " TNRM, + TLBL " ::::::::" TWHT "cl clllccllll oc" TLBL "::::::::: " TNRM, + TLBL " :::::::::" TWHT "o lc" TLBL "::::::::" TWHT "co oc" TLBL ":::::::::: " TNRM, + TLBL " ::::::::::" TWHT "o cccclc" TLBL ":::::" TWHT "clcc" TLBL ":::::::::::: " TNRM, + TLBL " :::::::::::" TWHT "lc cclccclc" TLBL "::::::::::::: " TNRM, + TLBL " ::::::::::::::" TWHT "lcclcc lc" TLBL ":::::::::::: " TNRM, + TLBL " ::::::::::" TWHT "cclcc" TLBL ":::::" TWHT "lccclc oc" TLBL "::::::::::: " TNRM, + TLBL " ::::::::::" TWHT "o l" TLBL "::::::::::" TWHT "l lc" TLBL "::::::::::: " TNRM, + TLBL " :::::" TWHT "cll" TLBL ":" TWHT "o clcllcccll o" TLBL "::::::::::: " TNRM, + TLBL " :::::" TWHT "occ" TLBL ":" TWHT "o clc" TLBL "::::::::::: " TNRM, + TLBL " ::::" TWHT "ocl" TLBL ":" TWHT "ccslclccclclccclclc" TLBL "::::::::::::: " TNRM, + TLBL " :::" TWHT "oclcccccccccccccllllllllllllll" TLBL "::::: " TNRM, + TLBL " ::" TWHT "lcc1lcccccccccccccccccccccccco" TLBL ":::: " TNRM, + TLBL " :::::::::::::::::::::::::::::::: " TNRM, + TLBL " :::::::::::::::::::::::::::: " TNRM, + TLBL " ::::::::::::::::::::::" TNRM, + TLBL " ::::::::::::" TNRM}; /* 18 */ -char *redhat_logo[] = -{ - " " TNRM, - TLRD " `.-..........` " TNRM, - TLRD " `////////::.`-/. " TNRM, - TLRD " -: ....-////////. " TNRM, - TLRD " //:-::///////////` " TNRM, - TLRD " `--::: `-://////////////: " TNRM, - TLRD " //////- ``.-:///////// .` " TNRM, - TLRD " `://////:-.` :///////::///:` " TNRM, - TLRD " .-/////////:---/////////////: " TNRM, - TLRD " .-://////////////////////. " TNRM, - TWHT " yMN+`.-"TLRD"::///////////////-` " TNRM, - TWHT " .-`:NMMNMs` `..-------..` " TNRM, - TWHT " MN+/mMMMMMhoooyysshsss " TNRM, - TWHT " MMM MMMMMMMMMMMMMMyyddMMM+ " TNRM, - TWHT " MMMM MMMMMMMMMMMMMNdyNMMh` hyhMMM " TNRM, - TWHT " MMMMMMMMMMMMMMMMyoNNNMMM+. MMMMMMMM " TNRM, - TWHT " MMNMMMNNMMMMMNM+ mhsMNyyyyMNMMMMsMM " TNRM, - " " TNRM -}; +char *redhat_logo[] = {" " TNRM, + TLRD " `.-..........` " TNRM, + TLRD " `////////::.`-/. " TNRM, + TLRD " -: ....-////////. " TNRM, + TLRD " //:-::///////////` " TNRM, + TLRD " `--::: `-://////////////: " TNRM, + TLRD " //////- ``.-:///////// .` " TNRM, + TLRD " `://////:-.` :///////::///:` " TNRM, + TLRD " .-/////////:---/////////////: " TNRM, + TLRD " .-://////////////////////. " TNRM, + TWHT " yMN+`.-" TLRD "::///////////////-` " TNRM, + TWHT " .-`:NMMNMs` `..-------..` " TNRM, + TWHT " MN+/mMMMMMhoooyysshsss " TNRM, + TWHT " MMM MMMMMMMMMMMMMMyyddMMM+ " TNRM, + TWHT " MMMM MMMMMMMMMMMMMNdyNMMh` hyhMMM " TNRM, + TWHT " MMMMMMMMMMMMMMMMyoNNNMMM+. MMMMMMMM " TNRM, + TWHT " MMNMMMNNMMMMMNM+ mhsMNyyyyMNMMMMsMM " TNRM, + " " TNRM}; /* 23 */ -char *frugalware_logo[] = -{ - TLBL " `++/::-.` " TNRM, - TLBL " /o+++++++++/::-.` " TNRM, - TLBL " `o+++++++++++++++o++/::-.` " TNRM, - TLBL " /+++++++++++++++++++++++oo++/:-.`` " TNRM, - TLBL " .o+ooooooooooooooooooosssssssso++oo++/:-` " TNRM, - TLBL " ++osoooooooooooosssssssssssssyyo+++++++o: " TNRM, - TLBL " -o+ssoooooooooooosssssssssssssyyo+++++++s` " TNRM, - TLBL " o++ssoooooo++++++++++++++sssyyyyo++++++o: " TNRM, - TLBL " :o++ssoooooo"TWHT"/-------------"TLBL"+syyyyyo+++++oo " TNRM, - TLBL " `o+++ssoooooo"TWHT"/-----"TLBL"+++++ooosyyyyyyo++++os: " TNRM, - TLBL " /o+++ssoooooo"TWHT"/-----"TLBL"ooooooosyyyyyyyo+oooss " TNRM, - TLBL " .o++++ssooooos"TWHT"/------------"TLBL"syyyyyyhsosssy- " TNRM, - TLBL " ++++++ssooooss"TWHT"/-----"TLBL"+++++ooyyhhhhhdssssso " TNRM, - TLBL " -s+++++syssssss"TWHT"/-----"TLBL"yyhhhhhhhhhhhddssssy. " TNRM, - TLBL " sooooooyhyyyyyh"TWHT"/-----"TLBL"hhhhhhhhhhhddddyssy+ " TNRM, - TLBL " :yooooooyhyyyhhhyyyyyyhhhhhhhhhhdddddyssy` " TNRM, - TLBL " yoooooooyhyyhhhhhhhhhhhhhhhhhhhddddddysy/ " TNRM, - TLBL "-ysooooooydhhhhhhhhhhhddddddddddddddddssy " TNRM, - TLBL " .-:/+osssyyyysyyyyyyyyyyyyyyyyyyyyyyssy: " TNRM, - TLBL " ``.-/+oosysssssssssssssssssssssss " TNRM, - TLBL " ``.:/+osyysssssssssssssh. " TNRM, - TLBL " `-:/+osyyssssyo", - TLBL " .-:+++`" TNRM -}; +char *frugalware_logo[] = { + TLBL " `++/::-.` " TNRM, + TLBL " /o+++++++++/::-.` " TNRM, + TLBL " `o+++++++++++++++o++/::-.` " TNRM, + TLBL " /+++++++++++++++++++++++oo++/:-.`` " TNRM, + TLBL " .o+ooooooooooooooooooosssssssso++oo++/:-` " TNRM, + TLBL " ++osoooooooooooosssssssssssssyyo+++++++o: " TNRM, + TLBL " -o+ssoooooooooooosssssssssssssyyo+++++++s` " TNRM, + TLBL " o++ssoooooo++++++++++++++sssyyyyo++++++o: " TNRM, + TLBL " :o++ssoooooo" TWHT "/-------------" TLBL "+syyyyyo+++++oo " TNRM, + TLBL " `o+++ssoooooo" TWHT "/-----" TLBL "+++++ooosyyyyyyo++++os: " TNRM, + TLBL " /o+++ssoooooo" TWHT "/-----" TLBL "ooooooosyyyyyyyo+oooss " TNRM, + TLBL " .o++++ssooooos" TWHT "/------------" TLBL "syyyyyyhsosssy- " TNRM, + TLBL " ++++++ssooooss" TWHT "/-----" TLBL "+++++ooyyhhhhhdssssso " TNRM, + TLBL " -s+++++syssssss" TWHT "/-----" TLBL "yyhhhhhhhhhhhddssssy. " TNRM, + TLBL " sooooooyhyyyyyh" TWHT "/-----" TLBL "hhhhhhhhhhhddddyssy+ " TNRM, + TLBL " :yooooooyhyyyhhhyyyyyyhhhhhhhhhhdddddyssy` " TNRM, + TLBL " yoooooooyhyyhhhhhhhhhhhhhhhhhhhddddddysy/ " TNRM, + TLBL "-ysooooooydhhhhhhhhhhhddddddddddddddddssy " TNRM, + TLBL " .-:/+osssyyyysyyyyyyyyyyyyyyyyyyyyyyssy: " TNRM, + TLBL " ``.-/+oosysssssssssssssssssssssss " TNRM, + TLBL " ``.:/+osyysssssssssssssh. " TNRM, + TLBL " `-:/+osyyssssyo", + TLBL " .-:+++`" TNRM}; /* 19 */ -char *peppermint_logo[] = -{ - TLRD " 8ZZZZZZ"TWHT"MMMMM " TNRM, - TLRD " .ZZZZZZZZZ"TWHT"MMMMMMM. " TNRM, - TWHT " MM"TLRD"ZZZZZZZZZ"TWHT"MMMMMMM"TLRD"ZZZZ " TNRM, - TWHT " MMMMM"TLRD"ZZZZZZZZ"TWHT"MMMMM"TLRD"ZZZZZZZM " TNRM, - TWHT " MMMMMMM"TLRD"ZZZZZZZ"TWHT"MMMM"TLRD"ZZZZZZZZZ. " TNRM, - TWHT " MMMMMMMMM"TLRD"ZZZZZZ"TWHT"MMM"TLRD"ZZZZZZZZZZZI " TNRM, - TWHT " MMMMMMMMMMM"TLRD"ZZZZZZ"TWHT"MM"TLRD"ZZZZZZZZZZ"TWHT"MMM " TNRM, - TLRD " .ZZZ"TWHT"MMMMMMMMMM"TLRD"IZZ"TWHT"MM"TLRD"ZZZZZ"TWHT"MMMMMMMMM " TNRM, - TLRD " ZZZZZZZ"TWHT"MMMMMMMM"TLRD"ZZ"TWHT"M"TLRD"ZZZZ"TWHT"MMMMMMMMMMM " TNRM, - TLRD " ZZZZZZZZZZZZZZZZ"TWHT"M"TLRD"Z"TWHT"MMMMMMMMMMMMMMM " TNRM, - TLRD " .ZZZZZZZZZZZZZ"TWHT"MMM"TLRD"Z"TWHT"M"TLRD"ZZZZZZZZZZ"TWHT"MMMM " TNRM, - TLRD " .ZZZZZZZZZZZ"TWHT"MMM"TLRD"7ZZ"TWHT"MM"TLRD"ZZZZZZZZZZ7"TWHT"M " TNRM, - TLRD " ZZZZZZZZZ"TWHT"MMMM"TLRD"ZZZZ"TWHT"MMMM"TLRD"ZZZZZZZ77 " TNRM, - TWHT " MMMMMMMMMMMM"TLRD"ZZZZZ"TWHT"MMMM"TLRD"ZZZZZ77 " TNRM, - TWHT " MMMMMMMMMM"TLRD"7ZZZZZZ"TWHT"MMMMM"TLRD"ZZ77 " TNRM, - TWHT " .MMMMMMM"TLRD"ZZZZZZZZ"TWHT"MMMMM"TLRD"Z7Z " TNRM, - TWHT " MMMMM"TLRD"ZZZZZZZZZ"TWHT"MMMMMMM " TNRM, - TLRD " NZZZZZZZZZZZ"TWHT"MMMMM " TNRM, - TLRD " ZZZZZZZZZ"TWHT"MM" TNRM -}; +char *peppermint_logo[] = { + TLRD " 8ZZZZZZ" TWHT "MMMMM " TNRM, + TLRD " .ZZZZZZZZZ" TWHT "MMMMMMM. " TNRM, + TWHT " MM" TLRD "ZZZZZZZZZ" TWHT "MMMMMMM" TLRD "ZZZZ " TNRM, + TWHT " MMMMM" TLRD "ZZZZZZZZ" TWHT "MMMMM" TLRD "ZZZZZZZM " TNRM, + TWHT " MMMMMMM" TLRD "ZZZZZZZ" TWHT "MMMM" TLRD "ZZZZZZZZZ. " TNRM, + TWHT " MMMMMMMMM" TLRD "ZZZZZZ" TWHT "MMM" TLRD "ZZZZZZZZZZZI " TNRM, + TWHT " MMMMMMMMMMM" TLRD "ZZZZZZ" TWHT "MM" TLRD "ZZZZZZZZZZ" TWHT "MMM " TNRM, + TLRD " .ZZZ" TWHT "MMMMMMMMMM" TLRD "IZZ" TWHT "MM" TLRD "ZZZZZ" TWHT "MMMMMMMMM " TNRM, + TLRD " ZZZZZZZ" TWHT "MMMMMMMM" TLRD "ZZ" TWHT "M" TLRD "ZZZZ" TWHT "MMMMMMMMMMM " TNRM, + TLRD " ZZZZZZZZZZZZZZZZ" TWHT "M" TLRD "Z" TWHT "MMMMMMMMMMMMMMM " TNRM, + TLRD " .ZZZZZZZZZZZZZ" TWHT "MMM" TLRD "Z" TWHT "M" TLRD "ZZZZZZZZZZ" TWHT "MMMM " TNRM, + TLRD " .ZZZZZZZZZZZ" TWHT "MMM" TLRD "7ZZ" TWHT "MM" TLRD "ZZZZZZZZZZ7" TWHT "M " TNRM, + TLRD " ZZZZZZZZZ" TWHT "MMMM" TLRD "ZZZZ" TWHT "MMMM" TLRD "ZZZZZZZ77 " TNRM, + TWHT " MMMMMMMMMMMM" TLRD "ZZZZZ" TWHT "MMMM" TLRD "ZZZZZ77 " TNRM, + TWHT " MMMMMMMMMM" TLRD "7ZZZZZZ" TWHT "MMMMM" TLRD "ZZ77 " TNRM, + TWHT " .MMMMMMM" TLRD "ZZZZZZZZ" TWHT "MMMMM" TLRD "Z7Z " TNRM, + TWHT " MMMMM" TLRD "ZZZZZZZZZ" TWHT "MMMMMMM " TNRM, + TLRD " NZZZZZZZZZZZ" TWHT "MMMMM " TNRM, + TLRD " ZZZZZZZZZ" TWHT "MM" TNRM}; /* 18 */ -char *solusos_logo[] = -{ - TWHT " e e " TNRM, - TWHT " eee ee " TNRM, - TWHT " eeee eee " TNRM, - TDGY " wwwwwwwww"TWHT"eeeeee " TNRM, - TDGY " wwwwwwwwwwwwwww"TWHT"eee " TNRM, - TDGY " wwwwwwwwwwwwwwwwwww"TWHT"eeeeeeee " TNRM, - TDGY " wwwww "TWHT"eeeee"TDGY"wwwwww"TWHT"eeee " TNRM, - TDGY " www "TWHT"eeee"TDGY"wwwwww"TWHT"e " TNRM, - TDGY " ww "TWHT"ee"TDGY"wwwwww " TNRM, - TDGY " w wwwww " TNRM, - TDGY " wwwww " TNRM, - TDGY " wwwww " TNRM, - TDGY " wwwww " TNRM, - TDGY " wwww " TNRM, - TDGY " wwww " TNRM, - TDGY " wwww " TNRM, - TDGY " www " TNRM, - TDGY " ww " TNRM -}; +char *solusos_logo[] = {TWHT " e e " TNRM, + TWHT " eee ee " TNRM, + TWHT " eeee eee " TNRM, + TDGY " wwwwwwwww" TWHT "eeeeee " TNRM, + TDGY " wwwwwwwwwwwwwww" TWHT "eee " TNRM, + TDGY " wwwwwwwwwwwwwwwwwww" TWHT "eeeeeeee " TNRM, + TDGY " wwwww " TWHT "eeeee" TDGY "wwwwww" TWHT "eeee " TNRM, + TDGY " www " TWHT "eeee" TDGY "wwwwww" TWHT "e " TNRM, + TDGY " ww " TWHT "ee" TDGY "wwwwww " TNRM, + TDGY " w wwwww " TNRM, + TDGY " wwwww " TNRM, + TDGY " wwwww " TNRM, + TDGY " wwwww " TNRM, + TDGY " wwww " TNRM, + TDGY " wwww " TNRM, + TDGY " wwww " TNRM, + TDGY " www " TNRM, + TDGY " ww " TNRM}; /* 18 */ -char *mageia_logo[] = -{ - TLCY " .°°. " TNRM, - TLCY " °° .°°. " TNRM, - TLCY " .°°°. °° " TNRM, - TLCY " . . " TNRM, - TLCY " °°° .°°°. " TNRM, - TLCY " .°°°. '___' " TNRM, - TWHT " ."TLCY"'___' "TWHT" . " TNRM, - TWHT " :dkxc;'. ..,cxkd; " TNRM, - TWHT " .dkk. kkkkkkkkkk .kkd. " TNRM, - TWHT " .dkk. ';cloolc;. .kkd " TNRM, - TWHT " ckk. .kk; " TNRM, - TWHT " xO: cOd " TNRM, - TWHT " xO: lOd " TNRM, - TWHT " lOO. .OO: " TNRM, - TWHT " .k00. .00x " TNRM, - TWHT " .k00; ;00O. " TNRM, - TWHT " .lO0Kc;,,,,,,;c0KOc. " TNRM, - TWHT " ;d00KKKKKK00d; " TNRM, - TWHT " .,KKKK,. " TNRM -}; +char *mageia_logo[] = {TLCY " .°°. " TNRM, + TLCY " °° .°°. " TNRM, + TLCY " .°°°. °° " TNRM, + TLCY " . . " TNRM, + TLCY " °°° .°°°. " TNRM, + TLCY " .°°°. '___' " TNRM, + TWHT " ." TLCY "'___' " TWHT " . " TNRM, + TWHT " :dkxc;'. ..,cxkd; " TNRM, + TWHT " .dkk. kkkkkkkkkk .kkd. " TNRM, + TWHT " .dkk. ';cloolc;. .kkd " TNRM, + TWHT " ckk. .kk; " TNRM, + TWHT " xO: cOd " TNRM, + TWHT " xO: lOd " TNRM, + TWHT " lOO. .OO: " TNRM, + TWHT " .k00. .00x " TNRM, + TWHT " .k00; ;00O. " TNRM, + TWHT " .lO0Kc;,,,,,,;c0KOc. " TNRM, + TWHT " ;d00KKKKKK00d; " TNRM, + TWHT " .,KKKK,. " TNRM}; /* 18 */ -char *parabolagnu_linuxlibre_logo[] = -{ - " " TNRM, - TLPR " eeeeeeeee " TNRM, - TLPR " eeeeeeeeeeeeeee " TNRM, - TLPR " eeeeee"TWHT"//////////"TLPR"eeeee " TNRM, - TLPR " eeeee"TWHT"///////////////"TLPR"eeeee " TNRM, - TLPR " eeeee"TWHT"/// ////"TLPR"eeee " TNRM, - TLPR " eeee"TWHT"// ///"TLPR"eeeee " TNRM, - TLPR " eee "TWHT"///"TLPR"eeeee " TNRM, - TLPR "ee "TWHT"//"TLPR"eeeeee " TNRM, - TLPR "e "TWHT"/"TLPR"eeeeeee " TNRM, - TLPR " eeeeeee " TNRM, - TLPR " eeeeee " TNRM, - TLPR " eeeeee " TNRM, - TLPR " eeeee " TNRM, - TLPR " eeee " TNRM, - TLPR " eee " TNRM, - TLPR " ee " TNRM, - TLPR " e " TNRM -}; +char *parabolagnu_linuxlibre_logo[] = { + " " TNRM, + TLPR " eeeeeeeee " TNRM, + TLPR " eeeeeeeeeeeeeee " TNRM, + TLPR " eeeeee" TWHT "//////////" TLPR "eeeee " TNRM, + TLPR " eeeee" TWHT "///////////////" TLPR "eeeee " TNRM, + TLPR " eeeee" TWHT "/// ////" TLPR "eeee " TNRM, + TLPR " eeee" TWHT "// ///" TLPR "eeeee " TNRM, + TLPR " eee " TWHT "///" TLPR "eeeee " TNRM, + TLPR "ee " TWHT "//" TLPR "eeeeee " TNRM, + TLPR "e " TWHT "/" TLPR "eeeeeee " TNRM, + TLPR " eeeeeee " TNRM, + TLPR " eeeeee " TNRM, + TLPR " eeeeee " TNRM, + TLPR " eeeee " TNRM, + TLPR " eeee " TNRM, + TLPR " eee " TNRM, + TLPR " ee " TNRM, + TLPR " e " TNRM}; /* 18 */ -char *viperr_logo[] = -{ - TWHT " wwzapd dlzazw " TNRM, - TWHT " an"TDGY"#"TWHT"zncmqzepweeirzpas"TDGY"#"TWHT"xz " TNRM, - TWHT " apez"TDGY"##"TWHT"qzdkawweemvmzdm"TDGY"##"TWHT"dcmv " TNRM, - TWHT "zwepd"TDGY"####"TWHT"qzdweewksza"TDGY"####"TWHT"ezqpa " TNRM, - TWHT "ezqpdkapeifjeeazezqpdkazdkwqz " TNRM, - TWHT " ezqpdksz"TDGY"##"TWHT"wepuizp"TDGY"##"TWHT"wzeiapdk " TNRM, - TWHT " zqpakdpa"TDGY"#"TWHT"azwewep"TDGY"#"TWHT"zqpdkqze " TNRM, - TWHT " apqxalqpewenwazqmzazq " TNRM, - TWHT " mn"TDGY"##"TWHT"=="TDGY"#######"TWHT"=="TDGY"##"TWHT"qp " TNRM, - TWHT " qw"TDGY"##"TWHT"="TDGY"#######"TWHT"="TDGY"##"TWHT"zl " TNRM, - TWHT " z0"TDGY"######"TWHT"="TDGY"######"TWHT"0a " TNRM, - TWHT " qp"TDGY"#####"TWHT"="TDGY"#####"TWHT"mq " TNRM, - TWHT " az"TDGY"####"TWHT"==="TDGY"####"TWHT"mn " TNRM, - TWHT " ap"TDGY"#########"TWHT"qz " TNRM, - TWHT " 9qlzskwdewz " TNRM, - TWHT " zqwpakaiw " TNRM, - TWHT " qoqpe " TNRM, - " " TNRM -}; +char *viperr_logo[] = { + TWHT " wwzapd dlzazw " TNRM, + TWHT " an" TDGY "#" TWHT "zncmqzepweeirzpas" TDGY "#" TWHT "xz " TNRM, + TWHT " apez" TDGY "##" TWHT "qzdkawweemvmzdm" TDGY "##" TWHT "dcmv " TNRM, + TWHT "zwepd" TDGY "####" TWHT "qzdweewksza" TDGY "####" TWHT "ezqpa " TNRM, + TWHT "ezqpdkapeifjeeazezqpdkazdkwqz " TNRM, + TWHT " ezqpdksz" TDGY "##" TWHT "wepuizp" TDGY "##" TWHT "wzeiapdk " TNRM, + TWHT " zqpakdpa" TDGY "#" TWHT "azwewep" TDGY "#" TWHT "zqpdkqze " TNRM, + TWHT " apqxalqpewenwazqmzazq " TNRM, + TWHT " mn" TDGY "##" TWHT "==" TDGY "#######" TWHT "==" TDGY "##" TWHT "qp " TNRM, + TWHT " qw" TDGY "##" TWHT "=" TDGY "#######" TWHT "=" TDGY "##" TWHT "zl " TNRM, + TWHT " z0" TDGY "######" TWHT "=" TDGY "######" TWHT "0a " TNRM, + TWHT " qp" TDGY "#####" TWHT "=" TDGY "#####" TWHT "mq " TNRM, + TWHT " az" TDGY "####" TWHT "===" TDGY "####" TWHT "mn " TNRM, + TWHT " ap" TDGY "#########" TWHT "qz " TNRM, + TWHT " 9qlzskwdewz " TNRM, + TWHT " zqwpakaiw " TNRM, + TWHT " qoqpe " TNRM, + " " TNRM}; /* 18 */ -char *linuxdeepin_logo[] = -{ - TLGN " eeeeeeeeeeeeeeeeeeeeeeeeeeee " TNRM, - TLGN " eee eeeeeee eeeeeeee " TNRM, - TLGN "ee eeeeeeeee eeeeeeeee ee " TNRM, - TLGN "e eeeeeeeee eeeeeeeee e " TNRM, - TLGN "e eeeeeee eeeeeeeeee e " TNRM, - TLGN "e eeeeee eeeee e " TNRM, - TLGN "e eeeee eee eee e " TNRM, - TLGN "e eeeee ee eeeeee e " TNRM, - TLGN "e eeeee eee eee e " TNRM, - TLGN "e eeeeeeeeee eeee e " TNRM, - TLGN "e eeeee eeee e " TNRM, - TLGN "e eeeeee e " TNRM, - TLGN "e eeeeeee e " TNRM, - TLGN "e eee eeeeeeee e " TNRM, - TLGN "eeeeeeeeeeeeeeee e " TNRM, - TLGN "eeeeeeeeeeeee ee " TNRM, - TLGN " eeeeeeeeeee eee " TNRM, - TLGN " eeeeeeeeeeeeeeeeeeeeeeeeeeee " TNRM, - " " TNRM -}; +char *linuxdeepin_logo[] = { + TLGN " eeeeeeeeeeeeeeeeeeeeeeeeeeee " TNRM, TLGN " eee eeeeeee eeeeeeee " TNRM, + TLGN "ee eeeeeeeee eeeeeeeee ee " TNRM, TLGN "e eeeeeeeee eeeeeeeee e " TNRM, + TLGN "e eeeeeee eeeeeeeeee e " TNRM, TLGN "e eeeeee eeeee e " TNRM, + TLGN "e eeeee eee eee e " TNRM, TLGN "e eeeee ee eeeeee e " TNRM, + TLGN "e eeeee eee eee e " TNRM, TLGN "e eeeeeeeeee eeee e " TNRM, + TLGN "e eeeee eeee e " TNRM, TLGN "e eeeeee e " TNRM, + TLGN "e eeeeeee e " TNRM, TLGN "e eee eeeeeeee e " TNRM, + TLGN "eeeeeeeeeeeeeeee e " TNRM, TLGN "eeeeeeeeeeeee ee " TNRM, + TLGN " eeeeeeeeeee eee " TNRM, TLGN " eeeeeeeeeeeeeeeeeeeeeeeeeeee " TNRM, + " " TNRM}; /* 18 */ -char *chakra_logo[] = -{ - TLBL " _ _ _ \"kkkkkkkk. " TNRM, - TLBL " ,kkkkkkkk., \'kkkkkkkkk, " TNRM, - TLBL " ,kkkkkkkkkkkk., \'kkkkkkkkk. " TNRM, - TLBL " ,kkkkkkkkkkkkkkkk,\'kkkkkkkk, " TNRM, - TLBL " ,kkkkkkkkkkkkkkkkkkk\'kkkkkkk. " TNRM, - TLBL " \"\'\'\"\'\'\',;::,,\"\'\'kkk\'\'kkkkk; __ " TNRM, - TLBL " ,kkkkkkkkkk, \"k\'\'kkkkk\' ,kkkk " TNRM, - TLBL " ,kkkkkkk\' ., \' .: \'kkkk\',kkkkkk " TNRM, - TLBL " ,kkkkkkkk\'.k\' , ,kkkk;kkkkkkkkk " TNRM, - TLBL " ,kkkkkkkk\';kk \'k \"\'k\',kkkkkkkkkkkk " TNRM, - TLBL " .kkkkkkkkk.kkkk.\'kkkkkkkkkkkkkkkkkk\' " TNRM, - TLBL " ;kkkkkkkk\'\'kkkkkk;\'kkkkkkkkkkkkk\'\' " TNRM, - TLBL " \'kkkkkkk; \'kkkkkkkk.,\"\"\'\'\"\'\'\"\" " TNRM, - TLBL " \'\'kkkk; \'kkkkkkkkkk., " TNRM, - TLBL " \';\' \'kkkkkkkkkkkk., " TNRM, - TLBL " ';kkkkkkkkkk\' " TNRM, - TLBL " ';kkkkkk\' " TNRM, - TLBL " \"\'\'\" " TNRM -}; +char *chakra_logo[] = {TLBL " _ _ _ \"kkkkkkkk. " TNRM, + TLBL " ,kkkkkkkk., \'kkkkkkkkk, " TNRM, + TLBL " ,kkkkkkkkkkkk., \'kkkkkkkkk. " TNRM, + TLBL " ,kkkkkkkkkkkkkkkk,\'kkkkkkkk, " TNRM, + TLBL " ,kkkkkkkkkkkkkkkkkkk\'kkkkkkk. " TNRM, + TLBL " \"\'\'\"\'\'\',;::,,\"\'\'kkk\'\'kkkkk; __ " TNRM, + TLBL " ,kkkkkkkkkk, \"k\'\'kkkkk\' ,kkkk " TNRM, + TLBL " ,kkkkkkk\' ., \' .: \'kkkk\',kkkkkk " TNRM, + TLBL " ,kkkkkkkk\'.k\' , ,kkkk;kkkkkkkkk " TNRM, + TLBL " ,kkkkkkkk\';kk \'k \"\'k\',kkkkkkkkkkkk " TNRM, + TLBL " .kkkkkkkkk.kkkk.\'kkkkkkkkkkkkkkkkkk\' " TNRM, + TLBL " ;kkkkkkkk\'\'kkkkkk;\'kkkkkkkkkkkkk\'\' " TNRM, + TLBL " \'kkkkkkk; \'kkkkkkkk.,\"\"\'\'\"\'\'\"\" " TNRM, + TLBL " \'\'kkkk; \'kkkkkkkkkk., " TNRM, + TLBL " \';\' \'kkkkkkkkkkkk., " TNRM, + TLBL " ';kkkkkkkkkk\' " TNRM, + TLBL " ';kkkkkk\' " TNRM, + TLBL " \"\'\'\" " TNRM}; /* 21 */ -char *fuduntu_logo[] = -{ - TDGY " `dwoapfjsod`"TYLW" `dwoapfjsod` " TNRM, - TDGY " `xdwdsfasdfjaapz`"TYLW" `dwdsfasdfjaapzx` " TNRM, - TDGY " `wadladfladlafsozmm`"TYLW" `wadladfladlafsozmm` " TNRM, - TDGY " `aodowpwafjwodisosoaas`"TYLW" `odowpwafjwodisosoaaso` " TNRM, - TDGY " `adowofaowiefawodpmmxs`"TYLW" `dowofaowiefawodpmmxso` " TNRM, - TDGY " `asdjafoweiafdoafojffw`"TYLW" `sdjafoweiafdoafojffwq` " TNRM, - TDGY " `dasdfjalsdfjasdlfjdd`"TYLW" `asdfjalsdfjasdlfjdda` " TNRM, - TDGY " `dddwdsfasdfjaapzxaw`"TYLW" `ddwdsfasdfjaapzxawo` " TNRM, - TDGY " `dddwoapfjsowzocmw`"TYLW" `ddwoapfjsowzocmwp` " TNRM, - TDGY " `ddasowjfowiejao`"TYLW" `dasowjfowiejaow` " TNRM, - " " TNRM, - TLRD " `ddasowjfowiejao`"TWHT" `dasowjfowiejaow` " TNRM, - TLRD " `dddwoapfjsowzocmw`"TWHT" `ddwoapfjsowzocmwp` " TNRM, - TLRD " `dddwdsfasdfjaapzxaw`"TWHT" `ddwdsfasdfjaapzxawo` " TNRM, - TLRD " `dasdfjalsdfjasdlfjdd`"TWHT" `asdfjalsdfjasdlfjdda` " TNRM, - TLRD " `asdjafoweiafdoafojffw`"TWHT" `sdjafoweiafdoafojffwq` " TNRM, - TLRD " `adowofaowiefawodpmmxs`"TWHT" `dowofaowiefawodpmmxso` " TNRM, - TLRD " `aodowpwafjwodisosoaas`"TWHT" `odowpwafjwodisosoaaso` " TNRM, - TLRD " `wadladfladlafsozmm`"TWHT" `wadladfladlafsozmm` " TNRM, - TLRD " `dwdsfasdfjaapzx`"TWHT" `dwdsfasdfjaapzx`" TNRM, - TLRD " `woapfjsod`"TWHT" `woapfjsod`" TNRM -}; +char *fuduntu_logo[] = {TDGY " `dwoapfjsod`" TYLW " `dwoapfjsod` " TNRM, + TDGY " `xdwdsfasdfjaapz`" TYLW " `dwdsfasdfjaapzx` " TNRM, + TDGY " `wadladfladlafsozmm`" TYLW " `wadladfladlafsozmm` " TNRM, + TDGY " `aodowpwafjwodisosoaas`" TYLW " `odowpwafjwodisosoaaso` " TNRM, + TDGY " `adowofaowiefawodpmmxs`" TYLW " `dowofaowiefawodpmmxso` " TNRM, + TDGY " `asdjafoweiafdoafojffw`" TYLW " `sdjafoweiafdoafojffwq` " TNRM, + TDGY " `dasdfjalsdfjasdlfjdd`" TYLW " `asdfjalsdfjasdlfjdda` " TNRM, + TDGY " `dddwdsfasdfjaapzxaw`" TYLW " `ddwdsfasdfjaapzxawo` " TNRM, + TDGY " `dddwoapfjsowzocmw`" TYLW " `ddwoapfjsowzocmwp` " TNRM, + TDGY " `ddasowjfowiejao`" TYLW " `dasowjfowiejaow` " TNRM, + " " TNRM, + TLRD " `ddasowjfowiejao`" TWHT " `dasowjfowiejaow` " TNRM, + TLRD " `dddwoapfjsowzocmw`" TWHT " `ddwoapfjsowzocmwp` " TNRM, + TLRD " `dddwdsfasdfjaapzxaw`" TWHT " `ddwdsfasdfjaapzxawo` " TNRM, + TLRD " `dasdfjalsdfjasdlfjdd`" TWHT " `asdfjalsdfjasdlfjdda` " TNRM, + TLRD " `asdjafoweiafdoafojffw`" TWHT " `sdjafoweiafdoafojffwq` " TNRM, + TLRD " `adowofaowiefawodpmmxs`" TWHT " `dowofaowiefawodpmmxso` " TNRM, + TLRD " `aodowpwafjwodisosoaas`" TWHT " `odowpwafjwodisosoaaso` " TNRM, + TLRD " `wadladfladlafsozmm`" TWHT " `wadladfladlafsozmm` " TNRM, + TLRD " `dwdsfasdfjaapzx`" TWHT " `dwdsfasdfjaapzx`" TNRM, + TLRD " `woapfjsod`" TWHT " `woapfjsod`" TNRM}; /* 16 */ -char *macosx_logo[] = -{ - " ", - TGRN " -/+:. " TNRM, - TGRN " :++++. " TNRM, - TGRN " /+++/. " TNRM, - TGRN " .:-::- .+/:-``.::- " TNRM, - TGRN " .:/++++++/::::/++++++/:` " TNRM, - TBRN " .:///////////////////////:` " TNRM, - TBRN " ////////////////////////` " TNRM, - TLRD " -+++++++++++++++++++++++` " TNRM, - TLRD " /++++++++++++++++++++++/ " TNRM, - TRED " /sssssssssssssssssssssss. " TNRM, - TRED " :ssssssssssssssssssssssss- " TNRM, - TPUR " osssssssssssssssssssssssso/` " TNRM, - TPUR " `syyyyyyyyyyyyyyyyyyyyyyyy+` " TNRM, - TBLU " `ossssssssssssssssssssss/ " TNRM, - TBLU " :ooooooooooooooooooo+. " TNRM, - TBLU " `:+oo+/:-..-:/+o+/- "TNRM"", +char *macosx_logo[] = { + " ", + TGRN " -/+:. " TNRM, + TGRN " :++++. " TNRM, + TGRN " /+++/. " TNRM, + TGRN " .:-::- .+/:-``.::- " TNRM, + TGRN " .:/++++++/::::/++++++/:` " TNRM, + TBRN " .:///////////////////////:` " TNRM, + TBRN " ////////////////////////` " TNRM, + TLRD " -+++++++++++++++++++++++` " TNRM, + TLRD " /++++++++++++++++++++++/ " TNRM, + TRED " /sssssssssssssssssssssss. " TNRM, + TRED " :ssssssssssssssssssssssss- " TNRM, + TPUR " osssssssssssssssssssssssso/` " TNRM, + TPUR " `syyyyyyyyyyyyyyyyyyyyyyyy+` " TNRM, + TBLU " `ossssssssssssssssssssss/ " TNRM, + TBLU " :ooooooooooooooooooo+. " TNRM, + TBLU " `:+oo+/:-..-:/+o+/- " TNRM "", }; /* 16 */ -char *windows_logo[] = -{ - TLRD " ,.=:!!t3Z3z., " TNRM, - TLRD " :tt:::tt333EE3 " TNRM, - TLRD " Et:::ztt33EEEL"TLGN" @Ee., .., " TNRM, - TLRD " ;tt:::tt333EE7"TLGN" ;EEEEEEttttt33# " TNRM, - TLRD " :Et:::zt333EEQ."TLGN" $EEEEEttttt33QL " TNRM, - TLRD " it::::tt333EEF"TLGN" @EEEEEEttttt33F " TNRM, - TLRD " ;3=*^```\"*4EEV"TLGN" :EEEEEEttttt33@. " TNRM, - TLBL " ,.=::::!t=., "TLRD"`"TLGN" @EEEEEEtttz33QF " TNRM, - TLBL " ;::::::::zt33)"TLGN" \"4EEEtttji3P* " TNRM, - TLBL " :t::::::::tt33."TYLW":Z3z.."TLGN" ``"TYLW" ,..g. " TNRM, - TLBL " i::::::::zt33F"TYLW" AEEEtttt::::ztF " TNRM, - TLBL " ;:::::::::t33V"TYLW" ;EEEttttt::::t3 " TNRM, - TLBL " E::::::::zt33L"TYLW" @EEEtttt::::z3F " TNRM, - TLBL "{3=*^```\"*4E3)"TYLW" ;EEEtttt:::::tZ` " TNRM, - TLBL " `"TYLW" :EEEEtttt::::z7 " TNRM, - TYLW " \"VEzjt:;;z>*` " TNRM -}; +char *windows_logo[] = {TLRD " ,.=:!!t3Z3z., " TNRM, + TLRD " :tt:::tt333EE3 " TNRM, + TLRD " Et:::ztt33EEEL" TLGN " @Ee., .., " TNRM, + TLRD " ;tt:::tt333EE7" TLGN " ;EEEEEEttttt33# " TNRM, + TLRD " :Et:::zt333EEQ." TLGN " $EEEEEttttt33QL " TNRM, + TLRD " it::::tt333EEF" TLGN " @EEEEEEttttt33F " TNRM, + TLRD " ;3=*^```\"*4EEV" TLGN " :EEEEEEttttt33@. " TNRM, + TLBL " ,.=::::!t=., " TLRD "`" TLGN " @EEEEEEtttz33QF " TNRM, + TLBL " ;::::::::zt33)" TLGN " \"4EEEtttji3P* " TNRM, + TLBL " :t::::::::tt33." TYLW ":Z3z.." TLGN " ``" TYLW " ,..g. " TNRM, + TLBL " i::::::::zt33F" TYLW " AEEEtttt::::ztF " TNRM, + TLBL " ;:::::::::t33V" TYLW " ;EEEttttt::::t3 " TNRM, + TLBL " E::::::::zt33L" TYLW " @EEEtttt::::z3F " TNRM, + TLBL "{3=*^```\"*4E3)" TYLW " ;EEEtttt:::::tZ` " TNRM, + TLBL " `" TYLW " :EEEEtttt::::z7 " TNRM, + TYLW " \"VEzjt:;;z>*` " TNRM}; /* 19 */ -char *windows_modern_logo[] = -{ - TLBL " .., " TNRM, - TLBL " ....,,:;+ccllll " TNRM, - TLBL " ...,,+:; cllllllllllllllllll " TNRM, - TLBL " ,cclllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " llllllllllllll lllllllllllllllllll " TNRM, - TLBL " `'ccllllllllll lllllllllllllllllll " TNRM, - TLBL " `'\"\"*:: :ccllllllllllllllll " TNRM, - TLBL " ````''\"*::cll " TNRM, - TLBL " `` " TNRM -}; +char *windows_modern_logo[] = {TLBL " .., " TNRM, + TLBL " ....,,:;+ccllll " TNRM, + TLBL " ...,,+:; cllllllllllllllllll " TNRM, + TLBL " ,cclllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " llllllllllllll lllllllllllllllllll " TNRM, + TLBL " `'ccllllllllll lllllllllllllllllll " TNRM, + TLBL " `'\"\"*:: :ccllllllllllllllll " TNRM, + TLBL " ````''\"*::cll " TNRM, + TLBL " `` " TNRM}; /* 18 */ -char *trisquel_logo[] = -{ - TLBL " ▄▄▄▄▄▄ " TNRM, - TLBL " ▄█████████▄ " TNRM, - TLBL " ▄▄▄▄▄▄ ████▀ ▀████ " TNRM, - TLBL " ▄██████████▄ ████▀ ▄▄ ▀███ " TNRM, - TLBL " ▄███▀▀ ▀▀████ ███▄ ▄█ ███ " TNRM, - TLBL " ▄███ ▄▄▄ ████▄ ▀██████ ▄███ " TNRM, - TLBL " ███ █▀▀██▄ █████▄ ▀▀ ▄████ " TNRM, - TLBL " ▀███ ███ ███████▄▄ ▄▄██████ " TNRM, - TLBL " ▀███▄ ▄███ █████████████"TLCY"████▀ " TNRM, - TLBL " ▀█████████ ███████"TLCY"███▀▀▀ " TNRM, - TLBL " ▀▀███▀▀ ██"TLCY"████▀▀ " TNRM, - TLCY " ██████▀ ▄▄▄▄ " TNRM, - TLCY " █████▀ ████████ " TNRM, - TLCY " █████ ███▀ ▀███ " TNRM, - TLCY " ████▄ ██▄▄▄ ███ " TNRM, - TLCY " █████▄ ▀▀ ▄██ " TNRM, - TLCY " ██████▄▄▄████ " TNRM, - TLCY " ▀▀█████▀▀ " TNRM -}; +char *trisquel_logo[] = {TLBL " ▄▄▄▄▄▄ " TNRM, + TLBL " ▄█████████▄ " TNRM, + TLBL " ▄▄▄▄▄▄ ████▀ ▀████ " TNRM, + TLBL " ▄██████████▄ ████▀ ▄▄ ▀███ " TNRM, + TLBL " ▄███▀▀ ▀▀████ ███▄ ▄█ ███ " TNRM, + TLBL " ▄███ ▄▄▄ ████▄ ▀██████ ▄███ " TNRM, + TLBL " ███ █▀▀██▄ █████▄ ▀▀ ▄████ " TNRM, + TLBL " ▀███ ███ ███████▄▄ ▄▄██████ " TNRM, + TLBL " ▀███▄ ▄███ █████████████" TLCY "████▀ " TNRM, + TLBL " ▀█████████ ███████" TLCY "███▀▀▀ " TNRM, + TLBL " ▀▀███▀▀ ██" TLCY "████▀▀ " TNRM, + TLCY " ██████▀ ▄▄▄▄ " TNRM, + TLCY " █████▀ ████████ " TNRM, + TLCY " █████ ███▀ ▀███ " TNRM, + TLCY " ████▄ ██▄▄▄ ███ " TNRM, + TLCY " █████▄ ▀▀ ▄██ " TNRM, + TLCY " ██████▄▄▄████ " TNRM, + TLCY " ▀▀█████▀▀ " TNRM}; /* 18 */ -char *manjaro_logo[] = -{ - TLGN " ██████████████████ ████████ " TNRM, - TLGN " ██████████████████ ████████ " TNRM, - TLGN " ██████████████████ ████████ " TNRM, - TLGN " ██████████████████ ████████ " TNRM, - TLGN " ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - TLGN " ████████ ████████ ████████ " TNRM, - " " TNRM -}; +char *manjaro_logo[] = { + TLGN " ██████████████████ ████████ " TNRM, TLGN " ██████████████████ ████████ " TNRM, + TLGN " ██████████████████ ████████ " TNRM, TLGN " ██████████████████ ████████ " TNRM, + TLGN " ████████ ████████ " TNRM, TLGN " ████████ ████████ ████████ " TNRM, + TLGN " ████████ ████████ ████████ " TNRM, TLGN " ████████ ████████ " TNRM, + TLGN " ████████ ████████ ████████ " TNRM, TLGN " ████████ ████████ ████████ " TNRM, + TLGN " ████████ ████████ ████████ " TNRM, TLGN " ████████ ████████ ████████ " TNRM, + TLGN " ████████ ████████ ████████ " TNRM, TLGN " ████████ ████████ ████████ " TNRM, + TLGN " ████████ ████████ ████████ " TNRM, TLGN " ████████ ████████ ████████ " TNRM, + TLGN " ████████ ████████ ████████ " TNRM, " " TNRM}; /* 18 */ -char *elementaryos_logo[] = -{ - " ", - TWHT " $?77777$$$IO " TNRM, - TWHT " $III777ZZZZ$$$ZZ$8 " TNRM, - TWHT " ZI777 OZZZ$ " TNRM, - TWHT " Z777 O7ZZO8 " TNRM, - TWHT " Z777 O$ZZZ8 " TNRM, - TWHT " I$$ O$ZZZD " TNRM, - TWHT " 0$$O O$$ZZ " TNRM, - TWHT " 0$$O 8$$$$ " TNRM, - TWHT " 0$$O 8$$$$ " TNRM, - TWHT " $ZZ O$$ZZ D " TNRM, - TWHT " ZZZ8ZZZZ O88 " TNRM, - TWHT " DZZZZ8 D888 " TNRM, - TWHT " ZZZZDMMMMMMMMMMDO888 " TNRM, - TWHT " ZOOOOOOOOOOOO888 " TNRM, - TWHT " N8OOOOOOO8D " TNRM, - " " TNRM, - " " TNRM -}; +char *elementaryos_logo[] = { + " ", TWHT " $?77777$$$IO " TNRM, + TWHT " $III777ZZZZ$$$ZZ$8 " TNRM, TWHT " ZI777 OZZZ$ " TNRM, + TWHT " Z777 O7ZZO8 " TNRM, TWHT " Z777 O$ZZZ8 " TNRM, + TWHT " I$$ O$ZZZD " TNRM, TWHT " 0$$O O$$ZZ " TNRM, + TWHT " 0$$O 8$$$$ " TNRM, TWHT " 0$$O 8$$$$ " TNRM, + TWHT " $ZZ O$$ZZ D " TNRM, TWHT " ZZZ8ZZZZ O88 " TNRM, + TWHT " DZZZZ8 D888 " TNRM, TWHT " ZZZZDMMMMMMMMMMDO888 " TNRM, + TWHT " ZOOOOOOOOOOOO888 " TNRM, TWHT " N8OOOOOOO8D " TNRM, + " " TNRM, " " TNRM}; /* 20 */ -char *scientificlinux_logo[] = -{ - TLBL " =/;;/- " TNRM, - TLBL " +: // " TNRM, - TLBL " /; /; " TNRM, - TLBL " -X H. " TNRM, - TLBL " .//;;;:;;-, X= :+ .-;:=;:;#;. " TNRM, - TLBL " M- ,=;;;#:, ,:#;;:=, ,@ " TNRM, - TLBL " :# :#.=/++++/=.$= #= " TNRM, - TLBL " ,#; #/:+/;,,/++:+/ ;+. " TNRM, - TLBL " ,+/. ,;@+, ,#H;, ,/+, " TNRM, - TLBL " ;+;;/= @. "TLRD".H"TWHT"#"TLRD"#X "TLBL"-X :///+; " TNRM, - TLBL " ;+=;;;.@, "TWHT".X"TLRD"M"TWHT"@$. "TLBL"=X.//;=#/. " TNRM, - TLBL " ,;: :@#= =$H: .+#- " TNRM, - TLBL " ,#= #;-///==///-// =#, " TNRM, - TLBL " ;+ :#-;;;:;;;;-X- +: " TNRM, - TLBL " @- .-;;;;M- =M/;;;-. -X " TNRM, - TLBL " :;;::;;-. #- :+ ,-;;-;:== " TNRM, - TLBL " ,X H. " TNRM, - TLBL " ;/ #= " TNRM, - TLBL " // +; " TNRM, - TLBL " '////'" TNRM -}; +char *scientificlinux_logo[] = { + TLBL " =/;;/- " TNRM, + TLBL " +: // " TNRM, + TLBL " /; /; " TNRM, + TLBL " -X H. " TNRM, + TLBL " .//;;;:;;-, X= :+ .-;:=;:;#;. " TNRM, + TLBL " M- ,=;;;#:, ,:#;;:=, ,@ " TNRM, + TLBL " :# :#.=/++++/=.$= #= " TNRM, + TLBL " ,#; #/:+/;,,/++:+/ ;+. " TNRM, + TLBL " ,+/. ,;@+, ,#H;, ,/+, " TNRM, + TLBL " ;+;;/= @. " TLRD ".H" TWHT "#" TLRD "#X " TLBL "-X :///+; " TNRM, + TLBL " ;+=;;;.@, " TWHT ".X" TLRD "M" TWHT "@$. " TLBL "=X.//;=#/. " TNRM, + TLBL " ,;: :@#= =$H: .+#- " TNRM, + TLBL " ,#= #;-///==///-// =#, " TNRM, + TLBL " ;+ :#-;;;:;;;;-X- +: " TNRM, + TLBL " @- .-;;;;M- =M/;;;-. -X " TNRM, + TLBL " :;;::;;-. #- :+ ,-;;-;:== " TNRM, + TLBL " ,X H. " TNRM, + TLBL " ;/ #= " TNRM, + TLBL " // +; " TNRM, + TLBL " '////'" TNRM}; /* 20 */ -char *backtracklinux_logo[] = -{ - TWHT ".............. " TNRM, - TWHT " ..,;:ccc,. " TNRM, - TWHT " ......''';lxO. " TNRM, - TWHT ".....''''..........,:ld; " TNRM, - TWHT " .';;;:::;,,.x, " TNRM, - TWHT " ..'''. 0Xxoc:,. ... " TNRM, - TWHT " .... ,ONkc;,;cokOdc',. " TNRM, - TWHT " . OMo ':"TLRD"dd"TWHT"o. " TNRM, - TWHT " dMc :OO; " TNRM, - TWHT " 0M. .:o. " TNRM, - TWHT " ;Wd " TNRM, - TWHT " ;XO, " TNRM, - TWHT " ,d0Odlc;,.. " TNRM, - TWHT " ..',;:cdOOd::,. " TNRM, - TWHT " .:d;.':;. " TNRM, - TWHT " 'd, .' " TNRM, - TWHT " ;l .." TNRM, - TWHT " .o " TNRM, - TWHT " c " TNRM, - TWHT " .' " TNRM, - TWHT " . " TNRM -}; +char *backtracklinux_logo[] = {TWHT ".............. " TNRM, + TWHT " ..,;:ccc,. " TNRM, + TWHT " ......''';lxO. " TNRM, + TWHT ".....''''..........,:ld; " TNRM, + TWHT " .';;;:::;,,.x, " TNRM, + TWHT " ..'''. 0Xxoc:,. ... " TNRM, + TWHT " .... ,ONkc;,;cokOdc',. " TNRM, + TWHT " . OMo ':" TLRD "dd" TWHT + "o. " TNRM, + TWHT " dMc :OO; " TNRM, + TWHT " 0M. .:o. " TNRM, + TWHT " ;Wd " TNRM, + TWHT " ;XO, " TNRM, + TWHT " ,d0Odlc;,.. " TNRM, + TWHT " ..',;:cdOOd::,. " TNRM, + TWHT " .:d;.':;. " TNRM, + TWHT " 'd, .' " TNRM, + TWHT " ;l .." TNRM, + TWHT " .o " TNRM, + TWHT " c " TNRM, + TWHT " .' " TNRM, + TWHT " . " TNRM}; /* 20 */ -char *kalilinux_logo[] = -{ - TLBL ".............. " TNRM, - TLBL " ..,;:ccc,. " TNRM, - TLBL " ......''';lxO. " TNRM, - TLBL ".....''''..........,:ld; " TNRM, - TLBL " .';;;:::;,,.x, " TNRM, - TLBL " ..'''. 0Xxoc:,. ... " TNRM, - TLBL " .... ,ONkc;,;cokOdc',. " TNRM, - TLBL " . OMo ':"TBLK"dd"TLBL"o. " TNRM, - TLBL " dMc :OO; " TNRM, - TLBL " 0M. .:o. " TNRM, - TLBL " ;Wd " TNRM, - TLBL " ;XO, " TNRM, - TLBL " ,d0Odlc;,.. " TNRM, - TLBL " ..',;:cdOOd::,. " TNRM, - TLBL " .:d;.':;. " TNRM, - TLBL " 'd, .' " TNRM, - TLBL " ;l .." TNRM, - TLBL " .o " TNRM, - TLBL " c " TNRM, - TLBL " .' " TNRM, - TLBL " . " TNRM -}; +char *kalilinux_logo[] = {TLBL ".............. " TNRM, + TLBL " ..,;:ccc,. " TNRM, + TLBL " ......''';lxO. " TNRM, + TLBL ".....''''..........,:ld; " TNRM, + TLBL " .';;;:::;,,.x, " TNRM, + TLBL " ..'''. 0Xxoc:,. ... " TNRM, + TLBL " .... ,ONkc;,;cokOdc',. " TNRM, + TLBL " . OMo ':" TBLK "dd" TLBL + "o. " TNRM, + TLBL " dMc :OO; " TNRM, + TLBL " 0M. .:o. " TNRM, + TLBL " ;Wd " TNRM, + TLBL " ;XO, " TNRM, + TLBL " ,d0Odlc;,.. " TNRM, + TLBL " ..',;:cdOOd::,. " TNRM, + TLBL " .:d;.':;. " TNRM, + TLBL " 'd, .' " TNRM, + TLBL " ;l .." TNRM, + TLBL " .o " TNRM, + TLBL " c " TNRM, + TLBL " .' " TNRM, + TLBL " . " TNRM}; /* 18 */ -char *sabayon_logo[] = -{ - TLBL " ........... " TNRM, - TLBL " .. .. " TNRM, - TLBL " .. .. " TNRM, - TLBL " .. "TWHT"o "TLBL".. " TNRM, - TLBL " .. "TWHT":W' "TLBL".. " TNRM, - TLBL " .. "TWHT".d. "TLBL".. " TNRM, - TLBL ":. "TWHT".KNO "TLBL".: " TNRM, - TLBL ":. "TWHT"cNNN. "TLBL".: " TNRM, - TLBL ": "TWHT"dXXX, "TLBL": " TNRM, - TLBL ": "TWHT". dXXX, .cd, "TLBL": " TNRM, - TLBL ": "TWHT"'kc .. dKKK. ,ll;:' "TLBL": " TNRM, - TLBL ": "TWHT".xkkxc;..dkkkc',cxkkl "TLBL": " TNRM, - TLBL ":. "TWHT".,cdddddddddddddo:. "TLBL".: " TNRM, - TLBL " .. "TWHT":lllllll: "TLBL".. " TNRM, - TLBL " .. "TWHT"',,,,, "TLBL".. " TNRM, - TLBL " .. .. " TNRM, - TLBL " .. .. " TNRM, - TLBL " ............... " TNRM -}; +char *sabayon_logo[] = {TLBL " ........... " TNRM, + TLBL " .. .. " TNRM, + TLBL " .. .. " TNRM, + TLBL " .. " TWHT "o " TLBL ".. " TNRM, + TLBL " .. " TWHT ":W' " TLBL ".. " TNRM, + TLBL " .. " TWHT ".d. " TLBL ".. " TNRM, + TLBL ":. " TWHT ".KNO " TLBL ".: " TNRM, + TLBL ":. " TWHT "cNNN. " TLBL ".: " TNRM, + TLBL ": " TWHT "dXXX, " TLBL ": " TNRM, + TLBL ": " TWHT ". dXXX, .cd, " TLBL ": " TNRM, + TLBL ": " TWHT "'kc .. dKKK. ,ll;:' " TLBL ": " TNRM, + TLBL ": " TWHT ".xkkxc;..dkkkc',cxkkl " TLBL ": " TNRM, + TLBL ":. " TWHT ".,cdddddddddddddo:. " TLBL ".: " TNRM, + TLBL " .. " TWHT ":lllllll: " TLBL ".. " TNRM, + TLBL " .. " TWHT "',,,,, " TLBL ".. " TNRM, + TLBL " .. .. " TNRM, + TLBL " .. .. " TNRM, + TLBL " ............... " TNRM}; /* 16 */ -char *android_logo[] = -{ - TLGN " ▀▄ ▂▂▂▂▂ ▄▀ " TNRM, - TLGN " ▗▟█████████▙▖ " TNRM, - TLGN " ▟██▀▀█████▀▀██▙ " TNRM, - TLGN " ███▄▄█████▄▄███▌ " TNRM, - TLGN " █████████████████ " TNRM, - TLGN "▟█▙ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▟█▙" TNRM, - TLGN "███ █████████████████ ███" TNRM, - TLGN "███ █████████████████ ███" TNRM, - TLGN "███ █████████████████ ███" TNRM, - TLGN "███ █████████████████ ███" TNRM, - TLGN "███ █████████████████ ███" TNRM, - TLGN "▜█▛ █████████████████ ▜█▛" TNRM, - TLGN " ▀███████████████▀ " TNRM, - TLGN " ████ ████ " TNRM, - TLGN " ████ ████ " TNRM, - TLGN " ▜██▛ ▜██▛ " TNRM -}; +char *android_logo[] = { + TLGN " ▀▄ ▂▂▂▂▂ ▄▀ " TNRM, TLGN " ▗▟█████████▙▖ " TNRM, + TLGN " ▟██▀▀█████▀▀██▙ " TNRM, TLGN " ███▄▄█████▄▄███▌ " TNRM, + TLGN " █████████████████ " TNRM, TLGN "▟█▙ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▟█▙" TNRM, + TLGN "███ █████████████████ ███" TNRM, TLGN "███ █████████████████ ███" TNRM, + TLGN "███ █████████████████ ███" TNRM, TLGN "███ █████████████████ ███" TNRM, + TLGN "███ █████████████████ ███" TNRM, TLGN "▜█▛ █████████████████ ▜█▛" TNRM, + TLGN " ▀███████████████▀ " TNRM, TLGN " ████ ████ " TNRM, + TLGN " ████ ████ " TNRM, TLGN " ▜██▛ ▜██▛ " TNRM}; /* 18 */ -char *linux_logo[] = -{ - " " TNRM, - " " TNRM, - " " TNRM, - TDGY " ##### " TNRM, - TDGY " ####### " TNRM, - TDGY " ##"TWHT"O"TDGY"#"TWHT"O"TDGY"## " TNRM, - TDGY " #"TYLW"#####"TDGY"# " TNRM, - TDGY " ##"TWHT"##"TYLW"###"TWHT"##"TDGY"## " TNRM, - TDGY " #"TWHT"##########"TDGY"## " TNRM, - TDGY " #"TWHT"############"TDGY"## " TNRM, - TDGY " #"TWHT"############"TDGY"### " TNRM, - TYLW " ##"TDGY"#"TWHT"###########"TDGY"##"TYLW"# " TNRM, - TYLW " ######"TDGY"#"TWHT"#######"TDGY"#"TYLW"###### " TNRM, - TYLW " #######"TDGY"#"TWHT"#####"TDGY"#"TYLW"####### " TNRM, - TYLW " #####"TDGY"#######"TYLW"##### " TNRM, - " " TNRM, - " " TNRM, - " " TNRM -}; +char *linux_logo[] = {" " TNRM, + " " TNRM, + " " TNRM, + TDGY " ##### " TNRM, + TDGY " ####### " TNRM, + TDGY " ##" TWHT "O" TDGY "#" TWHT "O" TDGY "## " TNRM, + TDGY " #" TYLW "#####" TDGY "# " TNRM, + TDGY " ##" TWHT "##" TYLW "###" TWHT "##" TDGY "## " TNRM, + TDGY " #" TWHT "##########" TDGY "## " TNRM, + TDGY " #" TWHT "############" TDGY "## " TNRM, + TDGY " #" TWHT "############" TDGY "### " TNRM, + TYLW " ##" TDGY "#" TWHT "###########" TDGY "##" TYLW "# " TNRM, + TYLW " ######" TDGY "#" TWHT "#######" TDGY "#" TYLW "###### " TNRM, + TYLW " #######" TDGY "#" TWHT "#####" TDGY "#" TYLW "####### " TNRM, + TYLW " #####" TDGY "#######" TYLW "##### " TNRM, + " " TNRM, + " " TNRM, + " " TNRM}; /* 17 */ -char *solaris_logo[] = -{ - TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"TWHT"██"TBLU"MMMM$MMMMMMMMMMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"TWHT"█"TBLU"MMMM"TWHT"██"TBLU"MMMM"TWHT"█"TBLU"MMMMMMMMMMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"TWHT"████████████"TBLU"MMMMMMMMMMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMM"TWHT"██"TBLU"M"TWHT"██████████████"TBLU"MM"TWHT"█"TBLU"MMMMMMMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMM"TWHT"████████████████████"TBLU"MMMMMMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMM"TWHT"███████████████████"TBLU"MMMMMNMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMM"TWHT"██████████████████████████████"TBLU"MMMM"TNRM, - TBLU "MMMMMMMMMMMMMMMMMMMMMMMM"TWHT"█████████████████████████"TBLU"MMMMMM"TNRM, - TLBL "======================================================="TNRM, - TBLU "MMM"TWHT"###"TBLU"NMMMMM"TWHT"####"TBLU"MMMM"TWHT"##"TBLU"MMMMMM"TWHT"####"TBLU"MMMMM"TWHT"#####"TBLU"MM"TWHT"##"TBLU"MMMM"TWHT"###"TBLU"MM"TNRM, - TBLU "MM"TWHT"##"TBLU"MMMMMM"TWHT"###"TBLU"MM"TWHT"###"TBLU"MM"TWHT"##"TBLU"MMMM"TWHT"##"TBLU"MMM"TWHT"##"TBLU"MMMM"TWHT"###"TBLU"MMMM"TWHT"##"TBLU"MM"TWHT"###"TBLU"MMMM"TNRM, - TBLU "M"TWHT"##"TBLU"MMMMMMM"TWHT"##"TBLU"MMMM"TWHT"##"TBLU"MM"TWHT"##"TBLU"MMMMMMMMMM"TWHT"##"TBLU"MMM"TWHT"##"TBLU"MMMMM"TWHT"##"TBLU"MM"TWHT"##"TBLU"MMMMM"TNRM, - TBLU "MM"TWHT"####"TBLU"MMM"TWHT"###"TBLU"MMMM"TWHT"##"TBLU"MM"TWHT"##"TBLU"MMMMM"TWHT"#######"TBLU"MMM"TWHT"##"TBLU"MMMMM"TWHT"##"TBLU"MMM"TWHT"####"TBLU"MM"TNRM, - TBLU "MMMMM"TWHT"###"TBLU"MM"TWHT"##"TBLU"MMMM"TWHT"##"TBLU"MM"TWHT"##"TBLU"MMMM"TWHT"##"TBLU"MMMM"TWHT"##"TBLU"MMM"TWHT"##"TBLU"MMMMM"TWHT"##"TBLU"MMMMMN"TWHT"##"TBLU"M"TNRM, - TBLU "MMMMMM"TWHT"##"TBLU"MM"TWHT"###"TBLU"MM"TWHT"###"TBLU"MM"TWHT"##"TBLU"MMMM"TWHT"##"TBLU"MMM"TWHT"###"TBLU"MMM"TWHT"##"TBLU"MMMMM"TWHT"##"TBLU"MMMMMM"TWHT"##"TBLU"M"TNRM, - TBLU "M"TWHT"######"TBLU"MMMMM"TWHT"####"TBLU"MMMM="TWHT"####"TBLU"MM"TWHT"#######"TBLU"MMM"TWHT"##"TBLU"MMMMM"TWHT"##"TBLU"MM"TWHT"#####"TBLU"MM"TNRM -}; +char *solaris_logo[] = { + TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" TWHT "██" TBLU "MMMM$MMMMMMMMMMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" TWHT "█" TBLU "MMMM" TWHT "██" TBLU "MMMM" TWHT "█" TBLU + "MMMMMMMMMMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" TWHT "████████████" TBLU "MMMMMMMMMMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMM" TWHT "██" TBLU "M" TWHT "██████████████" TBLU "MM" TWHT + "█" TBLU "MMMMMMMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMM" TWHT "████████████████████" TBLU "MMMMMMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMMMMMMMM" TWHT "███████████████████" TBLU "MMMMMNMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMM" TWHT "██████████████████████████████" TBLU "MMMM" TNRM, + TBLU "MMMMMMMMMMMMMMMMMMMMMMMM" TWHT "█████████████████████████" TBLU "MMMMMM" TNRM, + TLBL "=======================================================" TNRM, + TBLU "MMM" TWHT "###" TBLU "NMMMMM" TWHT "####" TBLU "MMMM" TWHT "##" TBLU "MMMMMM" TWHT + "####" TBLU "MMMMM" TWHT "#####" TBLU "MM" TWHT "##" TBLU "MMMM" TWHT "###" TBLU "MM" TNRM, + TBLU "MM" TWHT "##" TBLU "MMMMMM" TWHT "###" TBLU "MM" TWHT "###" TBLU "MM" TWHT "##" TBLU + "MMMM" TWHT "##" TBLU "MMM" TWHT "##" TBLU "MMMM" TWHT "###" TBLU "MMMM" TWHT "##" TBLU + "MM" TWHT "###" TBLU "MMMM" TNRM, + TBLU "M" TWHT "##" TBLU "MMMMMMM" TWHT "##" TBLU "MMMM" TWHT "##" TBLU "MM" TWHT "##" TBLU + "MMMMMMMMMM" TWHT "##" TBLU "MMM" TWHT "##" TBLU "MMMMM" TWHT "##" TBLU "MM" TWHT "##" TBLU + "MMMMM" TNRM, + TBLU "MM" TWHT "####" TBLU "MMM" TWHT "###" TBLU "MMMM" TWHT "##" TBLU "MM" TWHT "##" TBLU + "MMMMM" TWHT "#######" TBLU "MMM" TWHT "##" TBLU "MMMMM" TWHT "##" TBLU "MMM" TWHT + "####" TBLU "MM" TNRM, + TBLU "MMMMM" TWHT "###" TBLU "MM" TWHT "##" TBLU "MMMM" TWHT "##" TBLU "MM" TWHT "##" TBLU + "MMMM" TWHT "##" TBLU "MMMM" TWHT "##" TBLU "MMM" TWHT "##" TBLU "MMMMM" TWHT "##" TBLU + "MMMMMN" TWHT "##" TBLU "M" TNRM, + TBLU "MMMMMM" TWHT "##" TBLU "MM" TWHT "###" TBLU "MM" TWHT "###" TBLU "MM" TWHT "##" TBLU + "MMMM" TWHT "##" TBLU "MMM" TWHT "###" TBLU "MMM" TWHT "##" TBLU "MMMMM" TWHT "##" TBLU + "MMMMMM" TWHT "##" TBLU "M" TNRM, + TBLU "M" TWHT "######" TBLU "MMMMM" TWHT "####" TBLU "MMMM=" TWHT "####" TBLU "MM" TWHT + "#######" TBLU "MMM" TWHT "##" TBLU "MMMMM" TWHT "##" TBLU "MM" TWHT "#####" TBLU + "MM" TNRM}; /* 16 */ -char *angstrom_logo[] = -{ - " ", - " ", - " ", - " ", - ".---O---. ", - "| | .-. o o ", - "| | |-----.-----.-----.| | .----..-----.-----.", - "| | | __ | ---'| '--.| .-'| | |", - "| | | | | |--- || --'| | | ' | | | |", - "'---'---'--'--'--. |-----''----''--' '-----'-'-'-'", - " -' | ", - " '---' ", - " ", - " ", - " ", - " " -}; +char *angstrom_logo[] = {" ", + " ", + " ", + " ", + ".---O---. ", + "| | .-. o o ", + "| | |-----.-----.-----.| | .----..-----.-----.", + "| | | __ | ---'| '--.| .-'| | |", + "| | | | | |--- || --'| | | ' | | | |", + "'---'---'--'--'--. |-----''----''--' '-----'-'-'-'", + " -' | ", + " '---' ", + " ", + " ", + " ", + " "}; diff --git a/src/main.c b/src/main.c index 0e7cef1..88a3317 100644 --- a/src/main.c +++ b/src/main.c @@ -4,7 +4,7 @@ ** ** screenfetch-c is a rewrite of screenFetch.sh in C. ** This is primarily an experiment borne out of an awareness of the -** slow execution time on the screenfetch-dev.sh script. +** slow execution time on the screenfetch-dev.sh script. ** Hopefully this rewrite will execute faster, although it's more for ** self education than anything else. ** @@ -30,98 +30,86 @@ #include "util.h" #include "error_flag.h" -int main(int argc, char **argv) -{ - bool logo = true, portrait = false; - bool verbose = false, screenshot = false; +int main(int argc, char **argv) { + bool logo = true, portrait = false; + bool verbose = false, screenshot = false; - struct option options[] = - { - { "verbose", no_argument, 0, 'v' }, - { "no-logo", no_argument, 0, 'n' }, - { "screenshot", no_argument, 0, 's' }, - { "distro", required_argument, 0, 'D' }, - { "suppress-errors", no_argument, 0, 'E' }, - { "portrait", no_argument, 0, 'p'}, - { "version", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { "logo-only", required_argument, 0, 'L' }, - { 0, 0, 0, 0 } - }; + struct option options[] = { + {"verbose", no_argument, 0, 'v'}, {"no-logo", no_argument, 0, 'n'}, + {"screenshot", no_argument, 0, 's'}, {"distro", required_argument, 0, 'D'}, + {"suppress-errors", no_argument, 0, 'E'}, {"portrait", no_argument, 0, 'p'}, + {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, + {"logo-only", required_argument, 0, 'L'}, {0, 0, 0, 0}}; - signed char c; - int index = 0; - while ((c = getopt_long(argc, argv, "vnsD:EpVhL:", options, &index)) != -1) - { - switch (c) - { - case 'v': - verbose = true; - break; - case 'n': - logo = false; - break; - case 's': - screenshot = true; - break; - case 'D': - SET_GIVEN_DISTRO(optarg); - break; - case 'E': - error = false; - break; - case 'p': - portrait = true; - break; - case 'V': - display_version(); - return EXIT_SUCCESS; - case 'h': - display_help(); - return EXIT_SUCCESS; - case 'L': - output_logo_only(optarg); - return EXIT_SUCCESS; - default: - return EXIT_FAILURE; - } - } + signed char c; + int index = 0; + while ((c = getopt_long(argc, argv, "vnsD:EpVhL:", options, &index)) != -1) { + switch (c) { + case 'v': + verbose = true; + break; + case 'n': + logo = false; + break; + case 's': + screenshot = true; + break; + case 'D': + SET_GIVEN_DISTRO(optarg); + break; + case 'E': + error = false; + break; + case 'p': + portrait = true; + break; + case 'V': + display_version(); + return EXIT_SUCCESS; + case 'h': + display_help(); + return EXIT_SUCCESS; + case 'L': + output_logo_only(optarg); + return EXIT_SUCCESS; + default: + return EXIT_FAILURE; + } + } - detect_distro(); - detect_host(); - detect_kernel(); - detect_uptime(); - detect_pkgs(); - detect_cpu(); - detect_gpu(); - detect_disk(); - detect_mem(); - detect_shell(); - detect_res(); - detect_de(); - detect_wm(); - detect_wm_theme(); - detect_gtk(); + detect_distro(); + detect_host(); + detect_kernel(); + detect_uptime(); + detect_pkgs(); + detect_cpu(); + detect_gpu(); + detect_disk(); + detect_mem(); + detect_shell(); + detect_res(); + detect_de(); + detect_wm(); + detect_wm_theme(); + detect_gtk(); - /* if the user specified a different OS to display, set distro_set to it */ - if (!STREQ(given_distro_str, "Unknown")) - safe_strncpy(distro_str, given_distro_str, MAX_STRLEN); + /* if the user specified a different OS to display, set distro_set to it */ + if (!STREQ(given_distro_str, "Unknown")) + safe_strncpy(distro_str, given_distro_str, MAX_STRLEN); - if (verbose) - display_verbose(detected_arr, detected_arr_names); + if (verbose) + display_verbose(detected_arr, detected_arr_names); - if (portrait) - { - output_logo_only(distro_str); - main_text_output(detected_arr, detected_arr_names); - } - else if (logo) - main_ascii_output(detected_arr, detected_arr_names); - else - main_text_output(detected_arr, detected_arr_names); + if (portrait) { + output_logo_only(distro_str); + main_text_output(detected_arr, detected_arr_names); + } else if (logo) + main_ascii_output(detected_arr, detected_arr_names); + else + main_text_output(detected_arr, detected_arr_names); - if (screenshot) - take_screenshot(verbose); + if (screenshot) + take_screenshot(verbose); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/src/plat/bsd/detect.c b/src/plat/bsd/detect.c index 5be7222..e14e019 100644 --- a/src/plat/bsd/detect.c +++ b/src/plat/bsd/detect.c @@ -18,12 +18,12 @@ #include #include #if defined(__FreeBSD__) - #include +#include #elif defined(__NetBSD__) #elif defined(__OpenBSD__) - #include +#include #elif defined(__DragonFly__) - #include +#include #endif /* program includes */ @@ -35,414 +35,371 @@ #include "../../error_flag.h" /* detect_distro - detects the computer's distribution + detects the computer's distribution */ -void detect_distro(void) -{ - struct utsname distro_info; +void detect_distro(void) { + struct utsname distro_info; - uname(&distro_info); - snprintf(distro_str, MAX_STRLEN, "%s", distro_info.sysname); + uname(&distro_info); + snprintf(distro_str, MAX_STRLEN, "%s", distro_info.sysname); #if defined(__FreeBSD__) - safe_strncpy(host_color, TLRD, MAX_STRLEN); + safe_strncpy(host_color, TLRD, MAX_STRLEN); #endif - return; + return; } /* detect_host - detects the computer's hostname and active user and formats them + detects the computer's hostname and active user and formats them */ -void detect_host(void) -{ - char *given_user = "Unknown"; - char given_host[MAX_STRLEN] = "Unknown"; - struct utsname host_info; +void detect_host(void) { + char *given_user = "Unknown"; + char given_host[MAX_STRLEN] = "Unknown"; + struct utsname host_info; - given_user = getlogin(); - uname(&host_info); - safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); + given_user = getlogin(); + uname(&host_info); + safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); - snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", - host_color, given_user, TNRM, TWHT, TNRM, host_color, given_host, TNRM); + snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", host_color, given_user, TNRM, TWHT, TNRM, + host_color, given_host, TNRM); - return; + return; } /* detect_kernel - detects the computer's kernel + detects the computer's kernel */ -void detect_kernel(void) -{ - struct utsname kern_info; +void detect_kernel(void) { + struct utsname kern_info; - uname(&kern_info); - snprintf(kernel_str, MAX_STRLEN, "%s", kern_info.release); + uname(&kern_info); + snprintf(kernel_str, MAX_STRLEN, "%s", kern_info.release); - return; + return; } /* detect_uptime - detects the computer's uptime + detects the computer's uptime */ -void detect_uptime(void) -{ - long uptime = 0; +void detect_uptime(void) { + long uptime = 0; #if !defined(__NetBSD__) - long currtime = 0, boottime = 0; + long currtime = 0, boottime = 0; #endif - FILE *uptime_file; - unsigned int secs = 0; - unsigned int mins = 0; - unsigned int hrs = 0; - unsigned int days = 0; + FILE *uptime_file; + unsigned int secs = 0; + unsigned int mins = 0; + unsigned int hrs = 0; + unsigned int days = 0; #if defined(__NetBSD__) - uptime_file = popen("cut -d ' ' -f 1 < /proc/uptime", "r"); - fscanf(uptime_file, "%ld", &uptime); - pclose(uptime_file); + uptime_file = popen("cut -d ' ' -f 1 < /proc/uptime", "r"); + fscanf(uptime_file, "%ld", &uptime); + pclose(uptime_file); #elif defined(__FreeBSD__) || defined(__DragonFly__) - uptime_file = popen("sysctl -n kern.boottime | cut -d '=' -f 2 | " - "cut -d ',' -f 1", "r"); - fscanf(uptime_file, "%ld", &boottime); /* get boottime in secs */ - pclose(uptime_file); + uptime_file = popen("sysctl -n kern.boottime | cut -d '=' -f 2 | " + "cut -d ',' -f 1", + "r"); + fscanf(uptime_file, "%ld", &boottime); /* get boottime in secs */ + pclose(uptime_file); - currtime = time(NULL); + currtime = time(NULL); - uptime = currtime - boottime; + uptime = currtime - boottime; #elif defined(__OpenBSD__) - uptime_file = popen("sysctl -n kern.boottime", "r"); - fscanf(uptime_file, "%ld", &boottime); /* get boottime in secs */ - pclose(uptime_file); + uptime_file = popen("sysctl -n kern.boottime", "r"); + fscanf(uptime_file, "%ld", &boottime); /* get boottime in secs */ + pclose(uptime_file); - currtime = time(NULL); + currtime = time(NULL); - uptime = currtime - boottime; + uptime = currtime - boottime; #endif - split_uptime(uptime, &secs, &mins, &hrs, &days); + split_uptime(uptime, &secs, &mins, &hrs, &days); - if (days > 0) - snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); - else - snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); + if (days > 0) + snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); + else + snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); - return; + return; } /* detect_pkgs - detects the number of packages installed on the computer + detects the number of packages installed on the computer */ -void detect_pkgs(void) -{ - int packages = 0; +void detect_pkgs(void) { + int packages = 0; #if defined(__FreeBSD__) || defined(__OpenBSD__) - FILE *pkgs_file; + FILE *pkgs_file; #endif #if defined(__FreeBSD__) - pkgs_file = popen("pkg info | wc -l", "r"); - fscanf(pkgs_file, "%d", &packages); - pclose(pkgs_file); + pkgs_file = popen("pkg info | wc -l", "r"); + fscanf(pkgs_file, "%d", &packages); + pclose(pkgs_file); #elif defined(__OpenBSD__) - pkgs_file = popen("pkg_info | wc -l", "r"); - fscanf(pkgs_file, "%d", &packages); - pclose(pkgs_file); + pkgs_file = popen("pkg_info | wc -l", "r"); + fscanf(pkgs_file, "%d", &packages); + pclose(pkgs_file); #else - safe_strncpy(pkgs_str, "Not Found", MAX_STRLEN); + safe_strncpy(pkgs_str, "Not Found", MAX_STRLEN); - if (error) - ERR_REPORT("Could not find packages on current OS."); + if (error) + ERR_REPORT("Could not find packages on current OS."); #endif - snprintf(pkgs_str, MAX_STRLEN, "%d", packages); + snprintf(pkgs_str, MAX_STRLEN, "%d", packages); - return; + return; } /* detect_cpu - detects the computer's CPU brand/name-string + detects the computer's CPU brand/name-string */ -void detect_cpu(void) -{ - FILE *cpu_file; +void detect_cpu(void) { + FILE *cpu_file; #if defined(__NetBSD__) - cpu_file = popen("awk 'BEGIN{FS=\":\"} /model name/ { print $2; exit }' " - "/proc/cpuinfo | sed -e 's/ @/\\n/' -e 's/^ *//g' -e 's/ *$//g' " - "| head -1 | tr -d '\\n'", "r"); - fgets(cpu_str, MAX_STRLEN, cpu_file); - pclose(cpu_file); + cpu_file = popen("awk 'BEGIN{FS=\":\"} /model name/ { print $2; exit }' " + "/proc/cpuinfo | sed -e 's/ @/\\n/' -e 's/^ *//g' -e 's/ *$//g' " + "| head -1 | tr -d '\\n'", + "r"); + fgets(cpu_str, MAX_STRLEN, cpu_file); + pclose(cpu_file); #else - cpu_file = popen("sysctl -n hw.model | tr -d '\\n'", "r"); - fgets(cpu_str, MAX_STRLEN, cpu_file); - pclose(cpu_file); + cpu_file = popen("sysctl -n hw.model | tr -d '\\n'", "r"); + fgets(cpu_str, MAX_STRLEN, cpu_file); + pclose(cpu_file); #endif - return; + return; } /* detect_gpu - detects the computer's GPU brand/name-string + detects the computer's GPU brand/name-string */ -void detect_gpu(void) -{ - FILE *gpu_file; +void detect_gpu(void) { + FILE *gpu_file; - gpu_file = popen("detectgpu 2>/dev/null", "r"); - fgets(gpu_str, MAX_STRLEN, gpu_file); - pclose(gpu_file); + gpu_file = popen("detectgpu 2>/dev/null", "r"); + fgets(gpu_str, MAX_STRLEN, gpu_file); + pclose(gpu_file); - return; + return; } /* detect_disk - detects the computer's total disk capacity and usage + detects the computer's total disk capacity and usage */ -void detect_disk(void) -{ - struct statvfs disk_info; - unsigned long disk_total = 0, disk_used = 0, disk_percentage = 0; - - if (!(statvfs(getenv("HOME"), &disk_info))) - { - disk_total = ((disk_info.f_blocks * disk_info.f_bsize) / GB); - disk_used = (((disk_info.f_blocks - disk_info.f_bfree) - * disk_info.f_bsize) / GB); - disk_percentage = (((float) disk_used / disk_total) * 100); - snprintf(disk_str, MAX_STRLEN, "%ldG / %ldG (%ld%%)", disk_used, disk_total, - disk_percentage); - } - else if (error) - { - ERR_REPORT("Could not stat $HOME for filesystem statistics."); - } - - return; +void detect_disk(void) { + struct statvfs disk_info; + unsigned long disk_total = 0, disk_used = 0, disk_percentage = 0; + + if (!(statvfs(getenv("HOME"), &disk_info))) { + disk_total = ((disk_info.f_blocks * disk_info.f_bsize) / GB); + disk_used = (((disk_info.f_blocks - disk_info.f_bfree) * disk_info.f_bsize) / GB); + disk_percentage = (((float)disk_used / disk_total) * 100); + snprintf(disk_str, MAX_STRLEN, "%ldG / %ldG (%ld%%)", disk_used, disk_total, disk_percentage); + } else if (error) { + ERR_REPORT("Could not stat $HOME for filesystem statistics."); + } + + return; } /* detect_mem - detects the computer's total and used RAM + detects the computer's total and used RAM */ -void detect_mem(void) -{ - FILE *mem_file; - long long total_mem = 0; +void detect_mem(void) { + FILE *mem_file; + long long total_mem = 0; - mem_file = popen("sysctl -n hw.physmem", "r"); - fscanf(mem_file, "%lld", &total_mem); - pclose(mem_file); + mem_file = popen("sysctl -n hw.physmem", "r"); + fscanf(mem_file, "%lld", &total_mem); + pclose(mem_file); - total_mem /= (long) MB; + total_mem /= (long)MB; - snprintf(mem_str, MAX_STRLEN, "%lld%s", total_mem, "MB"); + snprintf(mem_str, MAX_STRLEN, "%lld%s", total_mem, "MB"); - return; + return; } /* detect_shell - detects the shell currently running on the computer - -- - CAVEAT: shell version detection relies on the standard versioning format for - each shell. If any shell's older (or newer versions) suddenly begin to use a new - scheme, the version may be displayed incorrectly. - -- + detects the shell currently running on the computer + -- + CAVEAT: shell version detection relies on the standard versioning format for + each shell. If any shell's older (or newer versions) suddenly begin to use a new + scheme, the version may be displayed incorrectly. + -- */ -void detect_shell(void) -{ - FILE *shell_file; - char *shell_name; - char vers_str[MAX_STRLEN]; - - shell_name = getenv("SHELL"); - - if (shell_name == NULL) - { - if (error) - ERR_REPORT("Could not detect a shell."); - - return; - } - - if (STREQ(shell_name, "/bin/sh")) - { - safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); - } - else if (strstr(shell_name, "bash")) - { - shell_file = popen("bash --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); - pclose(shell_file); - } - else if (strstr(shell_name, "zsh")) - { - shell_file = popen("zsh --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); - pclose(shell_file); - } - else if (strstr(shell_name, "csh")) - { - shell_file = popen("csh --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); - pclose(shell_file); - } - else if (strstr(shell_name, "fish")) - { - shell_file = popen("fish --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); - pclose(shell_file); - } - else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") - || strstr(shell_name, "ksh")) - { - /* i don't have a version detection system for these, yet */ - safe_strncpy(shell_str, shell_name, MAX_STRLEN); - } - - return; +void detect_shell(void) { + FILE *shell_file; + char *shell_name; + char vers_str[MAX_STRLEN]; + + shell_name = getenv("SHELL"); + + if (shell_name == NULL) { + if (error) + ERR_REPORT("Could not detect a shell."); + + return; + } + + if (STREQ(shell_name, "/bin/sh")) { + safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); + } else if (strstr(shell_name, "bash")) { + shell_file = popen("bash --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); + pclose(shell_file); + } else if (strstr(shell_name, "zsh")) { + shell_file = popen("zsh --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); + pclose(shell_file); + } else if (strstr(shell_name, "csh")) { + shell_file = popen("csh --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); + pclose(shell_file); + } else if (strstr(shell_name, "fish")) { + shell_file = popen("fish --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); + pclose(shell_file); + } else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") || strstr(shell_name, "ksh")) { + /* i don't have a version detection system for these, yet */ + safe_strncpy(shell_str, shell_name, MAX_STRLEN); + } + + return; } /* detect_res - detects the combined resolution of all monitors attached to the computer + detects the combined resolution of all monitors attached to the computer */ -void detect_res(void) -{ - FILE *res_file; +void detect_res(void) { + FILE *res_file; - res_file = popen("xdpyinfo 2> /dev/null | sed -n 's/.*dim.* " - "\\([0-9]*x[0-9]*\\) .*/\\1/pg' | tr '\\n' ' '", "r"); - fgets(res_str, MAX_STRLEN, res_file); - pclose(res_file); + res_file = popen("xdpyinfo 2> /dev/null | sed -n 's/.*dim.* " + "\\([0-9]*x[0-9]*\\) .*/\\1/pg' | tr '\\n' ' '", + "r"); + fgets(res_str, MAX_STRLEN, res_file); + pclose(res_file); - if (STREQ(res_str, "Unknown")) - { - safe_strncpy(res_str, "No X Server", MAX_STRLEN); - } + if (STREQ(res_str, "Unknown")) { + safe_strncpy(res_str, "No X Server", MAX_STRLEN); + } - return; + return; } /* detect_de - detects the desktop environment currently running on top of the OS - -- - CAVEAT: This function relies on the presence of 'detectde', a shell script. - If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' - -- + detects the desktop environment currently running on top of the OS + -- + CAVEAT: This function relies on the presence of 'detectde', a shell script. + If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' + -- */ -void detect_de(void) -{ - char *curr_de; - - if ((curr_de = getenv("XDG_CURRENT_DESKTOP"))) - { - safe_strncpy(de_str, curr_de, MAX_STRLEN); - } - else - { - if (getenv("GNOME_DESKTOP_SESSION_ID")) - { - safe_strncpy(de_str, "Gnome", MAX_STRLEN); - } - else if (getenv("MATE_DESKTOP_SESSION_ID")) - { - safe_strncpy(de_str, "MATE", MAX_STRLEN); - } - else if (getenv("KDE_FULL_SESSION")) - { - /* KDE_SESSION_VERSION only exists on KDE4+, so - getenv will return NULL on KDE <= 3. - */ - snprintf(de_str, MAX_STRLEN, "KDE%s", getenv("KDE_SESSION_VERSION")); - } - else if (error) - { - ERR_REPORT("No desktop environment found."); - } - } - - return; +void detect_de(void) { + char *curr_de; + + if ((curr_de = getenv("XDG_CURRENT_DESKTOP"))) { + safe_strncpy(de_str, curr_de, MAX_STRLEN); + } else { + if (getenv("GNOME_DESKTOP_SESSION_ID")) { + safe_strncpy(de_str, "Gnome", MAX_STRLEN); + } else if (getenv("MATE_DESKTOP_SESSION_ID")) { + safe_strncpy(de_str, "MATE", MAX_STRLEN); + } else if (getenv("KDE_FULL_SESSION")) { + /* KDE_SESSION_VERSION only exists on KDE4+, so + getenv will return NULL on KDE <= 3. + */ + snprintf(de_str, MAX_STRLEN, "KDE%s", getenv("KDE_SESSION_VERSION")); + } else if (error) { + ERR_REPORT("No desktop environment found."); + } + } + + return; } /* detect_wm - detects the window manager currently running on top of the OS - -- - CAVEAT: This function relies on the presence of 'detectwm', a shell script. - If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' - -- + detects the window manager currently running on top of the OS + -- + CAVEAT: This function relies on the presence of 'detectwm', a shell script. + If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' + -- */ -void detect_wm(void) -{ - FILE *wm_file; +void detect_wm(void) { + FILE *wm_file; - wm_file = popen("detectwm 2> /dev/null", "r"); - fgets(wm_str, MAX_STRLEN, wm_file); - pclose(wm_file); + wm_file = popen("detectwm 2> /dev/null", "r"); + fgets(wm_str, MAX_STRLEN, wm_file); + pclose(wm_file); - return; + return; } /* detect_wm_theme - detects the theme associated with the WM detected in detect_wm() - -- - CAVEAT: This function relies on the presence of 'detectwmtheme', a shell script. - If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' - -- + detects the theme associated with the WM detected in detect_wm() + -- + CAVEAT: This function relies on the presence of 'detectwmtheme', a shell script. + If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' + -- */ -void detect_wm_theme(void) -{ - char exec_str[MAX_STRLEN]; - FILE *wm_theme_file; +void detect_wm_theme(void) { + char exec_str[MAX_STRLEN]; + FILE *wm_theme_file; - snprintf(exec_str, MAX_STRLEN, "detectwmtheme %s 2> /dev/null", wm_str); + snprintf(exec_str, MAX_STRLEN, "detectwmtheme %s 2> /dev/null", wm_str); - wm_theme_file = popen(exec_str, "r"); - fgets(wm_theme_str, MAX_STRLEN, wm_theme_file); - pclose(wm_theme_file); + wm_theme_file = popen(exec_str, "r"); + fgets(wm_theme_str, MAX_STRLEN, wm_theme_file); + pclose(wm_theme_file); - return; + return; } /* detect_gtk - detects the theme, icon(s), and font(s) associated with a GTK DE (if present) - -- - CAVEAT: This function relies on the presence of 'detectgtk', a shell script. - If it isn't present somewhere in the PATH, the GTK will be set as 'Unknown' - -- + detects the theme, icon(s), and font(s) associated with a GTK DE (if present) + -- + CAVEAT: This function relies on the presence of 'detectgtk', a shell script. + If it isn't present somewhere in the PATH, the GTK will be set as 'Unknown' + -- */ -void detect_gtk(void) -{ - FILE *gtk_file; - char gtk2_str[MAX_STRLEN] = "Unknown"; - char gtk3_str[MAX_STRLEN] = "Unknown"; - char gtk_icons_str[MAX_STRLEN] = "Unknown"; - char gtk_font_str[MAX_STRLEN] = "Unknown"; - - gtk_file = popen("detectgtk 2> /dev/null", "r"); - fscanf(gtk_file, "%s%s%s%s", gtk2_str, gtk3_str, gtk_icons_str, gtk_font_str); - pclose(gtk_file); - - if (STREQ(gtk2_str, gtk3_str)) - { - if (STREQ(gtk2_str, "Unknown")) - safe_strncpy(gtk_str, gtk2_str, MAX_STRLEN); - else - snprintf(gtk_str, MAX_STRLEN, "%s (GTK2/3)", gtk2_str); - } - else if (STREQ(gtk2_str, "Unknown") && !STREQ(gtk3_str, "Unknown")) - snprintf(gtk_str, MAX_STRLEN, "%s (GTK3)", gtk3_str); - else if (STREQ(gtk3_str, "Unknown") && !STREQ(gtk2_str, "Unknown")) - snprintf(gtk_str, MAX_STRLEN, "%s (GTK2)", gtk2_str); - else - snprintf(gtk_str, MAX_STRLEN, "%s (GTK2), %s (GTK3)", gtk2_str, gtk3_str); - - snprintf(icon_str, MAX_STRLEN, "%s", gtk_icons_str); - - snprintf(font_str, MAX_STRLEN, "%s", gtk_font_str); - - return; +void detect_gtk(void) { + FILE *gtk_file; + char gtk2_str[MAX_STRLEN] = "Unknown"; + char gtk3_str[MAX_STRLEN] = "Unknown"; + char gtk_icons_str[MAX_STRLEN] = "Unknown"; + char gtk_font_str[MAX_STRLEN] = "Unknown"; + + gtk_file = popen("detectgtk 2> /dev/null", "r"); + fscanf(gtk_file, "%s%s%s%s", gtk2_str, gtk3_str, gtk_icons_str, gtk_font_str); + pclose(gtk_file); + + if (STREQ(gtk2_str, gtk3_str)) { + if (STREQ(gtk2_str, "Unknown")) + safe_strncpy(gtk_str, gtk2_str, MAX_STRLEN); + else + snprintf(gtk_str, MAX_STRLEN, "%s (GTK2/3)", gtk2_str); + } else if (STREQ(gtk2_str, "Unknown") && !STREQ(gtk3_str, "Unknown")) + snprintf(gtk_str, MAX_STRLEN, "%s (GTK3)", gtk3_str); + else if (STREQ(gtk3_str, "Unknown") && !STREQ(gtk2_str, "Unknown")) + snprintf(gtk_str, MAX_STRLEN, "%s (GTK2)", gtk2_str); + else + snprintf(gtk_str, MAX_STRLEN, "%s (GTK2), %s (GTK3)", gtk2_str, gtk3_str); + + snprintf(icon_str, MAX_STRLEN, "%s", gtk_icons_str); + + snprintf(font_str, MAX_STRLEN, "%s", gtk_font_str); + + return; } diff --git a/src/plat/darwin/detect.c b/src/plat/darwin/detect.c index ea0236a..e01fa47 100644 --- a/src/plat/darwin/detect.c +++ b/src/plat/darwin/detect.c @@ -41,360 +41,324 @@ #include "../../error_flag.h" /* detect_distro - detects the computer's distribution (OS X release) + detects the computer's distribution (OS X release) */ -void detect_distro(void) -{ - char *codenames[] = {"Cheetah", "Puma", "Jaguar", "Panther", "Tiger", "Leopard", "Snow Leopard", "Lion", "Mountain Lion", "Mavericks", "Yosemite", "El Capitan", "Sierra", "High Sierra", "Mojave"}; - CFArrayRef split = CFStringCreateArrayBySeparatingStrings( - NULL, - CFPreferencesCopyAppValue( - CFSTR("ProductVersion"), - CFSTR("/System/Library/CoreServices/SystemVersion") - ), - CFSTR(".") - ); - unsigned maj = CFStringGetIntValue(CFArrayGetValueAtIndex(split, 0)); - unsigned min = CFStringGetIntValue(CFArrayGetValueAtIndex(split, 1)); - unsigned fix = 0; - if (CFArrayGetCount(split) == 3){ - fix = CFStringGetIntValue(CFArrayGetValueAtIndex(split, 2)); - } - - char build_ver[16]; - CFStringGetCString( - CFPreferencesCopyAppValue( - CFSTR("ProductBuildVersion"), - CFSTR("/System/Library/CoreServices/SystemVersion") - ), - build_ver, - 16, - kCFStringEncodingUTF8 - ); - - char *codename = "Unknown"; - if (min < sizeof(codenames) / sizeof(*codenames)){ - codename = codenames[min]; - } - - snprintf(distro_str, MAX_STRLEN, "Mac OS X %d.%d.%d (%s) \"%s\"", maj, min, fix, build_ver, codename); - - safe_strncpy(host_color, TLBL, MAX_STRLEN); - - return; +void detect_distro(void) { + char *codenames[] = {"Cheetah", "Puma", "Jaguar", "Panther", "Tiger", + "Leopard", "Snow Leopard", "Lion", "Mountain Lion", "Mavericks", + "Yosemite", "El Capitan", "Sierra", "High Sierra", "Mojave"}; + CFArrayRef split = CFStringCreateArrayBySeparatingStrings( + NULL, + CFPreferencesCopyAppValue(CFSTR("ProductVersion"), + CFSTR("/System/Library/CoreServices/SystemVersion")), + CFSTR(".")); + unsigned maj = CFStringGetIntValue(CFArrayGetValueAtIndex(split, 0)); + unsigned min = CFStringGetIntValue(CFArrayGetValueAtIndex(split, 1)); + unsigned fix = 0; + if (CFArrayGetCount(split) == 3) { + fix = CFStringGetIntValue(CFArrayGetValueAtIndex(split, 2)); + } + + char build_ver[16]; + CFStringGetCString(CFPreferencesCopyAppValue(CFSTR("ProductBuildVersion"), + CFSTR("/System/Library/CoreServices/SystemVersion")), + build_ver, 16, kCFStringEncodingUTF8); + + char *codename = "Unknown"; + if (min < sizeof(codenames) / sizeof(*codenames)) { + codename = codenames[min]; + } + + snprintf(distro_str, MAX_STRLEN, "Mac OS X %d.%d.%d (%s) \"%s\"", maj, min, fix, build_ver, + codename); + + safe_strncpy(host_color, TLBL, MAX_STRLEN); + + return; } /* detect_host - detects the computer's hostname and active user and formats them + detects the computer's hostname and active user and formats them */ -void detect_host(void) -{ - char *given_user = "Unknown"; - char given_host[MAX_STRLEN] = "Unknown"; - struct utsname host_info; +void detect_host(void) { + char *given_user = "Unknown"; + char given_host[MAX_STRLEN] = "Unknown"; + struct utsname host_info; - given_user = getlogin(); - uname(&host_info); - safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); + given_user = getlogin(); + uname(&host_info); + safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); - snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", - host_color, given_user, TNRM, TWHT, TNRM, host_color, given_host, TNRM); + snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", host_color, given_user, TNRM, TWHT, TNRM, + host_color, given_host, TNRM); - return; + return; } /* detect_kernel - detects the computer's kernel + detects the computer's kernel */ -void detect_kernel(void) -{ - struct utsname kern_info; +void detect_kernel(void) { + struct utsname kern_info; - uname(&kern_info); - snprintf(kernel_str, MAX_STRLEN, "%s %s %s", kern_info.sysname, - kern_info.release, kern_info.machine); + uname(&kern_info); + snprintf(kernel_str, MAX_STRLEN, "%s %s %s", kern_info.sysname, kern_info.release, + kern_info.machine); - return; + return; } /* detect_uptime - detects the computer's uptime + detects the computer's uptime */ -void detect_uptime(void) -{ - long long uptime = 0; - unsigned int secs = 0; - unsigned int mins = 0; - unsigned int hrs = 0; - unsigned int days = 0; - - /* three cheers for undocumented functions and structs */ - static mach_timebase_info_data_t timebase_info; - - if (timebase_info.denom == 0) - { - (void) mach_timebase_info(&timebase_info); - } - - uptime = (long long)((mach_absolute_time() * timebase_info.numer) / - (1000* 1000 * timebase_info.denom)); - uptime /= 1000; - - split_uptime(uptime, &secs, &mins, &hrs, &days); - - if (days > 0) - snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); - else - snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); - - return; +void detect_uptime(void) { + long long uptime = 0; + unsigned int secs = 0; + unsigned int mins = 0; + unsigned int hrs = 0; + unsigned int days = 0; + + /* three cheers for undocumented functions and structs */ + static mach_timebase_info_data_t timebase_info; + + if (timebase_info.denom == 0) { + (void)mach_timebase_info(&timebase_info); + } + + uptime = (long long)((mach_absolute_time() * timebase_info.numer) / + (1000 * 1000 * timebase_info.denom)); + uptime /= 1000; + + split_uptime(uptime, &secs, &mins, &hrs, &days); + + if (days > 0) + snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); + else + snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); + + return; } /* detect_pkgs - detects the number of packages installed on the computer + detects the number of packages installed on the computer */ -void detect_pkgs(void) -{ - int packages = 0; - glob_t gl; +void detect_pkgs(void) { + int packages = 0; + glob_t gl; - if (glob("/usr/local/Cellar/*", GLOB_NOSORT, NULL, &gl) == 0) - { - packages = gl.gl_pathc; - } - else if (error) - { - ERR_REPORT("Failure while globbing packages."); - } + if (glob("/usr/local/Cellar/*", GLOB_NOSORT, NULL, &gl) == 0) { + packages = gl.gl_pathc; + } else if (error) { + ERR_REPORT("Failure while globbing packages."); + } - globfree(&gl); + globfree(&gl); - snprintf(pkgs_str, MAX_STRLEN, "%d", packages); + snprintf(pkgs_str, MAX_STRLEN, "%d", packages); - return; + return; } /* detect_cpu - detects the computer's CPU brand/name-string + detects the computer's CPU brand/name-string */ -void detect_cpu(void) -{ - size_t size = MAX_STRLEN; - sysctlbyname("machdep.cpu.brand_string", cpu_str, &size, NULL, 0); - return; +void detect_cpu(void) { + size_t size = MAX_STRLEN; + sysctlbyname("machdep.cpu.brand_string", cpu_str, &size, NULL, 0); + return; } /* detect_gpu - detects the computer's GPU brand/name-string + detects the computer's GPU brand/name-string */ -void detect_gpu(void) -{ - CFMutableDictionaryRef matchDict = IOServiceMatching("IOPCIDevice"); - io_iterator_t iterator; - if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchDict, &iterator) == kIOReturnSuccess){ - io_registry_entry_t regEntry; - while ((regEntry = IOIteratorNext(iterator))) { - CFMutableDictionaryRef serviceDictionary; - if (IORegistryEntryCreateCFProperties(regEntry, &serviceDictionary, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess){ - IOObjectRelease(regEntry); - continue; - } - const void *GPUModel = CFDictionaryGetValue(serviceDictionary, CFSTR("model")); - if (GPUModel && CFGetTypeID(GPUModel) == CFDataGetTypeID()) - safe_strncpy(gpu_str, (char *)CFDataGetBytePtr((CFDataRef) GPUModel), MAX_STRLEN); - CFRelease(serviceDictionary); - IOObjectRelease(regEntry); - } - IOObjectRelease(iterator); - } - - return; +void detect_gpu(void) { + CFMutableDictionaryRef matchDict = IOServiceMatching("IOPCIDevice"); + io_iterator_t iterator; + if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchDict, &iterator) == + kIOReturnSuccess) { + io_registry_entry_t regEntry; + while ((regEntry = IOIteratorNext(iterator))) { + CFMutableDictionaryRef serviceDictionary; + if (IORegistryEntryCreateCFProperties(regEntry, &serviceDictionary, kCFAllocatorDefault, + kNilOptions) != kIOReturnSuccess) { + IOObjectRelease(regEntry); + continue; + } + const void *GPUModel = CFDictionaryGetValue(serviceDictionary, CFSTR("model")); + if (GPUModel && CFGetTypeID(GPUModel) == CFDataGetTypeID()) + safe_strncpy(gpu_str, (char *)CFDataGetBytePtr((CFDataRef)GPUModel), MAX_STRLEN); + CFRelease(serviceDictionary); + IOObjectRelease(regEntry); + } + IOObjectRelease(iterator); + } + + return; } /* detect_disk - detects the computer's total disk capacity and usage + detects the computer's total disk capacity and usage */ -void detect_disk(void) -{ - struct statfs disk_info; - long disk_total = 0, disk_used = 0, disk_percentage = 0; - - if (!(statfs(getenv("HOME"), &disk_info))) - { - disk_total = ((disk_info.f_blocks * disk_info.f_bsize) / GB); - disk_used = (((disk_info.f_blocks - disk_info.f_bfree) - * disk_info.f_bsize) / GB); - disk_percentage = (((float) disk_used / disk_total) * 100); - snprintf(disk_str, MAX_STRLEN, "%ldG / %ldG (%ld%%)", disk_used, disk_total, - disk_percentage); - } - else if (error) - { - ERR_REPORT("Could not stat $HOME for filesystem statistics."); - } - - return; +void detect_disk(void) { + struct statfs disk_info; + long disk_total = 0, disk_used = 0, disk_percentage = 0; + + if (!(statfs(getenv("HOME"), &disk_info))) { + disk_total = ((disk_info.f_blocks * disk_info.f_bsize) / GB); + disk_used = (((disk_info.f_blocks - disk_info.f_bfree) * disk_info.f_bsize) / GB); + disk_percentage = (((float)disk_used / disk_total) * 100); + snprintf(disk_str, MAX_STRLEN, "%ldG / %ldG (%ld%%)", disk_used, disk_total, disk_percentage); + } else if (error) { + ERR_REPORT("Could not stat $HOME for filesystem statistics."); + } + + return; } /* detect_mem - detects the computer's total and used RAM + detects the computer's total and used RAM */ -void detect_mem(void) -{ - int64_t used_mem = 0, total_mem = 0; - vm_size_t page_size; - mach_port_t mach_port; - mach_msg_type_number_t count; - vm_statistics64_data_t vm_stats; - mach_port = mach_host_self(); - count = sizeof(vm_stats) / sizeof(natural_t); - if (KERN_SUCCESS == host_page_size(mach_port, &page_size) && - KERN_SUCCESS == host_statistics64(mach_port, HOST_VM_INFO, (host_info64_t)&vm_stats, &count)){ - used_mem = ((int64_t)vm_stats.active_count + (int64_t)vm_stats.wire_count) * (int64_t)page_size; - } - - size_t len = sizeof(total_mem); - sysctlbyname("hw.memsize", &total_mem, &len, NULL, 0); - - snprintf(mem_str, MAX_STRLEN, "%lld%s / %lld%s", used_mem / MB, "MB", total_mem / MB, "MB"); - - return; +void detect_mem(void) { + int64_t used_mem = 0, total_mem = 0; + vm_size_t page_size; + mach_port_t mach_port; + mach_msg_type_number_t count; + vm_statistics64_data_t vm_stats; + mach_port = mach_host_self(); + count = sizeof(vm_stats) / sizeof(natural_t); + if (KERN_SUCCESS == host_page_size(mach_port, &page_size) && + KERN_SUCCESS == + host_statistics64(mach_port, HOST_VM_INFO, (host_info64_t)&vm_stats, &count)) { + used_mem = ((int64_t)vm_stats.active_count + (int64_t)vm_stats.wire_count) * (int64_t)page_size; + } + + size_t len = sizeof(total_mem); + sysctlbyname("hw.memsize", &total_mem, &len, NULL, 0); + + snprintf(mem_str, MAX_STRLEN, "%lld%s / %lld%s", used_mem / MB, "MB", total_mem / MB, "MB"); + + return; } /* detect_shell - detects the shell currently running on the computer - -- - CAVEAT: shell version detection relies on the standard versioning format for - each shell. If any shell's older (or newer versions) suddenly begin to use a - new scheme, the version may be displayed incorrectly. - -- + detects the shell currently running on the computer + -- + CAVEAT: shell version detection relies on the standard versioning format for + each shell. If any shell's older (or newer versions) suddenly begin to use a + new scheme, the version may be displayed incorrectly. + -- */ -void detect_shell(void) -{ - FILE *shell_file; - char *shell_name; - char vers_str[MAX_STRLEN]; - - shell_name = getenv("SHELL"); - - if (shell_name == NULL) - { - if (error) - ERR_REPORT("Could not detect a shell."); - - return; - } - - if (STREQ(shell_name, "/bin/sh")) - { - safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); - } - else if (strstr(shell_name, "bash")) - { - shell_file = popen("bash --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); - pclose(shell_file); - } - else if (strstr(shell_name, "zsh")) - { - shell_file = popen("zsh --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); - pclose(shell_file); - } - else if (strstr(shell_name, "csh")) - { - shell_file = popen("csh --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); - pclose(shell_file); - } - else if (strstr(shell_name, "fish")) - { - shell_file = popen("fish --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); - pclose(shell_file); - } - else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") - || strstr(shell_name, "ksh")) - { - /* i don't have a version detection system for these, yet */ - safe_strncpy(shell_str, shell_name, MAX_STRLEN); - } - - return; +void detect_shell(void) { + FILE *shell_file; + char *shell_name; + char vers_str[MAX_STRLEN]; + + shell_name = getenv("SHELL"); + + if (shell_name == NULL) { + if (error) + ERR_REPORT("Could not detect a shell."); + + return; + } + + if (STREQ(shell_name, "/bin/sh")) { + safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); + } else if (strstr(shell_name, "bash")) { + shell_file = popen("bash --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); + pclose(shell_file); + } else if (strstr(shell_name, "zsh")) { + shell_file = popen("zsh --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); + pclose(shell_file); + } else if (strstr(shell_name, "csh")) { + shell_file = popen("csh --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); + pclose(shell_file); + } else if (strstr(shell_name, "fish")) { + shell_file = popen("fish --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); + pclose(shell_file); + } else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") || strstr(shell_name, "ksh")) { + /* i don't have a version detection system for these, yet */ + safe_strncpy(shell_str, shell_name, MAX_STRLEN); + } + + return; } /* detect_res - detects the combined resolution of all monitors attached to the computer + detects the combined resolution of all monitors attached to the computer */ -void detect_res(void) -{ - uint32_t count = 0, chars = 0; - CGGetOnlineDisplayList(UINT32_MAX, NULL, &count); - CGDirectDisplayID displays[count]; - CGGetOnlineDisplayList(count, displays, &count); - chars += snprintf(res_str, MAX_STRLEN, "%zu x %zu", CGDisplayPixelsWide(*displays), CGDisplayPixelsHigh(*displays)); - for (int i = 1; i < count; ++i){ - chars += snprintf(res_str + chars, MAX_STRLEN, ", %zu x %zu", CGDisplayPixelsWide(displays[i]), CGDisplayPixelsHigh(displays[i])); - } - return; +void detect_res(void) { + uint32_t count = 0, chars = 0; + CGGetOnlineDisplayList(UINT32_MAX, NULL, &count); + CGDirectDisplayID displays[count]; + CGGetOnlineDisplayList(count, displays, &count); + chars += snprintf(res_str, MAX_STRLEN, "%zu x %zu", CGDisplayPixelsWide(*displays), + CGDisplayPixelsHigh(*displays)); + for (int i = 1; i < count; ++i) { + chars += snprintf(res_str + chars, MAX_STRLEN, ", %zu x %zu", CGDisplayPixelsWide(displays[i]), + CGDisplayPixelsHigh(displays[i])); + } + return; } /* detect_de - detects the desktop environment currently running on top of the OS. - On OS X, this will always be Aqua. + detects the desktop environment currently running on top of the OS. + On OS X, this will always be Aqua. */ -void detect_de(void) -{ - safe_strncpy(de_str, "Aqua", MAX_STRLEN); +void detect_de(void) { + safe_strncpy(de_str, "Aqua", MAX_STRLEN); - return; + return; } /* detect_wm - detects the window manager currently running on top of the OS. - On OS X, this will always be the Quartz Compositor. + detects the window manager currently running on top of the OS. + On OS X, this will always be the Quartz Compositor. */ -void detect_wm(void) -{ - safe_strncpy(wm_str, "Quartz Compositor", MAX_STRLEN); +void detect_wm(void) { + safe_strncpy(wm_str, "Quartz Compositor", MAX_STRLEN); - return; + return; } /* detect_wm_theme - detects the theme associated with the WM detected in detect_wm(). - On OS X, there are dark and light theme, and various accent colours. + detects the theme associated with the WM detected in detect_wm(). + On OS X, there are dark and light theme, and various accent colours. */ -void detect_wm_theme(void) -{ - char *accents[] = {"Graphite", "Red", "Orange", "Yellow", "Green", "", "Purple", "Pink", "Blue"}; - char *color; - Boolean accentExists; - CFStringRef def = CFSTR(".GlobalPreferences"); - CFIndex accentColor = CFPreferencesGetAppIntegerValue(CFSTR("AppleAccentColor"), def, &accentExists); - CFIndex aquaColorVariant = CFPreferencesGetAppIntegerValue(CFSTR("AppleAquaColorVariant"), def, NULL); - CFPropertyListRef style = CFPreferencesCopyAppValue(CFSTR("AppleInterfaceStyle"), def); - if (accentExists){ - color = accents[accentColor + 1]; - } else if (aquaColorVariant == 6){ - color = "Graphite"; - } else{ - color = "Blue"; - } - snprintf(wm_theme_str, MAX_STRLEN, "%s %s", style?"Dark":"Light", color); - return; +void detect_wm_theme(void) { + char *accents[] = {"Graphite", "Red", "Orange", "Yellow", "Green", "", "Purple", "Pink", "Blue"}; + char *color; + Boolean accentExists; + CFStringRef def = CFSTR(".GlobalPreferences"); + CFIndex accentColor = + CFPreferencesGetAppIntegerValue(CFSTR("AppleAccentColor"), def, &accentExists); + CFIndex aquaColorVariant = + CFPreferencesGetAppIntegerValue(CFSTR("AppleAquaColorVariant"), def, NULL); + CFPropertyListRef style = CFPreferencesCopyAppValue(CFSTR("AppleInterfaceStyle"), def); + if (accentExists) { + color = accents[accentColor + 1]; + } else if (aquaColorVariant == 6) { + color = "Graphite"; + } else { + color = "Blue"; + } + snprintf(wm_theme_str, MAX_STRLEN, "%s %s", style ? "Dark" : "Light", color); + return; } /* detect_gtk - OS X doesn't use GTK, so this function fills str with "Not Applicable" + OS X doesn't use GTK, so this function fills str with "Not Applicable" */ -void detect_gtk(void) -{ - safe_strncpy(gtk_str, "Not Applicable", MAX_STRLEN); +void detect_gtk(void) { + safe_strncpy(gtk_str, "Not Applicable", MAX_STRLEN); - return; + return; } diff --git a/src/plat/linux/detect.c b/src/plat/linux/detect.c index 6768591..7a5e403 100644 --- a/src/plat/linux/detect.c +++ b/src/plat/linux/detect.c @@ -37,1049 +37,791 @@ #include "../../error_flag.h" /* remove preceding and trailing single quote character, - remove trailing newline + remove trailing newline */ -static void unquote(char *s) -{ - int len = strlen(s); - - if (s[len-1] == '\n') - { - s[len-1] = '\0'; - len--; - } - if (s[len-1] == '\'') - { - s[len-1] = '\0'; - len--; - } - if (s[0] == '\'') - { - memmove(s, s+1, len); - } +static void unquote(char *s) { + int len = strlen(s); + + if (s[len - 1] == '\n') { + s[len - 1] = '\0'; + len--; + } + if (s[len - 1] == '\'') { + s[len - 1] = '\0'; + len--; + } + if (s[0] == '\'') { + memmove(s, s + 1, len); + } } /* detect_distro - detects the computer's distribution (really only relevant on Linux) + detects the computer's distribution (really only relevant on Linux) */ -void detect_distro(void) -{ - /* if distro_str was NOT set by the -D flag */ - if (STREQ(distro_str, "Unknown")) - { - FILE *distro_file; - - char distro_name_str[MAX_STRLEN]; - - if (FILE_EXISTS("/system/bin/getprop")) - { - safe_strncpy(distro_str, "Android", MAX_STRLEN); - safe_strncpy(host_color, TLGN, MAX_STRLEN); - } - else - { - bool detected = false; - - /* Bad solution, as /etc/issue contains junk on some distros */ - distro_file = fopen("/etc/issue", "r"); - - if (distro_file != NULL) - { - /* get the first 4 chars, that's all we need */ - fscanf(distro_file, "%4s", distro_name_str); - fclose(distro_file); - - if (STREQ(distro_name_str, "Kali")) - { - safe_strncpy(distro_str, "Kali Linux", MAX_STRLEN); - detected = true; - safe_strncpy(host_color, TLBL, MAX_STRLEN); - } - else if (STREQ(distro_name_str, "Back")) - { - safe_strncpy(distro_str, "Backtrack Linux", MAX_STRLEN); - detected = true; - safe_strncpy(host_color, TLRD, MAX_STRLEN); - } - else if (STREQ(distro_name_str, "Crun")) - { - safe_strncpy(distro_str, "CrunchBang", MAX_STRLEN); - detected = true; - safe_strncpy(host_color, TDGY, MAX_STRLEN); - } - else if (STREQ(distro_name_str, "LMDE")) - { - safe_strncpy(distro_str, "LMDE", MAX_STRLEN); - detected = true; - safe_strncpy(host_color, TLGN, MAX_STRLEN); - } - else if (STREQ(distro_name_str, "Debi") - || STREQ(distro_name_str, "Rasp")) - { - safe_strncpy(distro_str, "Debian", MAX_STRLEN); - detected = true; - safe_strncpy(host_color, TLRD, MAX_STRLEN); - } - } - - if (!detected) - { - if (FILE_EXISTS("/etc/redhat-release")) - { - safe_strncpy(distro_str, "Red Hat Linux", MAX_STRLEN); - safe_strncpy(host_color, TLRD, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/fedora-release")) - { - safe_strncpy(distro_str, "Fedora", MAX_STRLEN); - safe_strncpy(host_color, TLBL, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/SuSE-release")) - { - safe_strncpy(distro_str, "OpenSUSE", MAX_STRLEN); - safe_strncpy(host_color, TLGN, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/arch-release")) - { - safe_strncpy(distro_str, "Arch Linux", MAX_STRLEN); - safe_strncpy(host_color, TLCY, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/gentoo-release")) - { - safe_strncpy(distro_str, "Gentoo", MAX_STRLEN); - safe_strncpy(host_color, TLPR, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/angstrom-version")) - { - safe_strncpy(distro_str, "Angstrom", MAX_STRLEN); - safe_strncpy(host_color, TNRM, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/manjaro-release")) - { - safe_strncpy(distro_str, "Manjaro", MAX_STRLEN); - safe_strncpy(host_color, TLGN, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/slackware-release")) - { - safe_strncpy(distro_str, "Slackware", MAX_STRLEN); - safe_strncpy(host_color, TLBL, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/lsb-release")) - { - distro_file = fopen("/etc/lsb-release", "r"); - fscanf(distro_file, "%s ", distro_name_str); - fclose(distro_file); - - snprintf(distro_str, MAX_STRLEN, "%s", distro_name_str + 11); - safe_strncpy(host_color, TLRD, MAX_STRLEN); - } - else if (FILE_EXISTS("/etc/os-release")) - { - /* - TODO: Parse NAME or PRETTY_NAME from os-release - Until then, spit out an error message. - */ - if (error) - ERR_REPORT("Failed to detect a Linux distro (1)."); - } - else - { - safe_strncpy(distro_str, "Linux", MAX_STRLEN); - safe_strncpy(host_color, TLGY, MAX_STRLEN); - - if (error) - { - ERR_REPORT("Failed to detect a Linux distro (2)."); - } - } - } - } - } - - return; +void detect_distro(void) { + /* if distro_str was NOT set by the -D flag */ + if (STREQ(distro_str, "Unknown")) { + FILE *distro_file; + + char distro_name_str[MAX_STRLEN]; + + if (FILE_EXISTS("/system/bin/getprop")) { + safe_strncpy(distro_str, "Android", MAX_STRLEN); + safe_strncpy(host_color, TLGN, MAX_STRLEN); + } else { + bool detected = false; + + /* Bad solution, as /etc/issue contains junk on some distros */ + distro_file = fopen("/etc/issue", "r"); + + if (distro_file != NULL) { + /* get the first 4 chars, that's all we need */ + fscanf(distro_file, "%4s", distro_name_str); + fclose(distro_file); + + if (STREQ(distro_name_str, "Kali")) { + safe_strncpy(distro_str, "Kali Linux", MAX_STRLEN); + detected = true; + safe_strncpy(host_color, TLBL, MAX_STRLEN); + } else if (STREQ(distro_name_str, "Back")) { + safe_strncpy(distro_str, "Backtrack Linux", MAX_STRLEN); + detected = true; + safe_strncpy(host_color, TLRD, MAX_STRLEN); + } else if (STREQ(distro_name_str, "Crun")) { + safe_strncpy(distro_str, "CrunchBang", MAX_STRLEN); + detected = true; + safe_strncpy(host_color, TDGY, MAX_STRLEN); + } else if (STREQ(distro_name_str, "LMDE")) { + safe_strncpy(distro_str, "LMDE", MAX_STRLEN); + detected = true; + safe_strncpy(host_color, TLGN, MAX_STRLEN); + } else if (STREQ(distro_name_str, "Debi") || STREQ(distro_name_str, "Rasp")) { + safe_strncpy(distro_str, "Debian", MAX_STRLEN); + detected = true; + safe_strncpy(host_color, TLRD, MAX_STRLEN); + } + } + + if (!detected) { + if (FILE_EXISTS("/etc/redhat-release")) { + safe_strncpy(distro_str, "Red Hat Linux", MAX_STRLEN); + safe_strncpy(host_color, TLRD, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/fedora-release")) { + safe_strncpy(distro_str, "Fedora", MAX_STRLEN); + safe_strncpy(host_color, TLBL, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/SuSE-release")) { + safe_strncpy(distro_str, "OpenSUSE", MAX_STRLEN); + safe_strncpy(host_color, TLGN, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/arch-release")) { + safe_strncpy(distro_str, "Arch Linux", MAX_STRLEN); + safe_strncpy(host_color, TLCY, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/gentoo-release")) { + safe_strncpy(distro_str, "Gentoo", MAX_STRLEN); + safe_strncpy(host_color, TLPR, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/angstrom-version")) { + safe_strncpy(distro_str, "Angstrom", MAX_STRLEN); + safe_strncpy(host_color, TNRM, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/manjaro-release")) { + safe_strncpy(distro_str, "Manjaro", MAX_STRLEN); + safe_strncpy(host_color, TLGN, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/slackware-release")) { + safe_strncpy(distro_str, "Slackware", MAX_STRLEN); + safe_strncpy(host_color, TLBL, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/lsb-release")) { + distro_file = fopen("/etc/lsb-release", "r"); + fscanf(distro_file, "%s ", distro_name_str); + fclose(distro_file); + + snprintf(distro_str, MAX_STRLEN, "%s", distro_name_str + 11); + safe_strncpy(host_color, TLRD, MAX_STRLEN); + } else if (FILE_EXISTS("/etc/os-release")) { + /* + TODO: Parse NAME or PRETTY_NAME from os-release + Until then, spit out an error message. + */ + if (error) + ERR_REPORT("Failed to detect a Linux distro (1)."); + } else { + safe_strncpy(distro_str, "Linux", MAX_STRLEN); + safe_strncpy(host_color, TLGY, MAX_STRLEN); + + if (error) { + ERR_REPORT("Failed to detect a Linux distro (2)."); + } + } + } + } + } + + return; } /* detect_host - detects the computer's hostname and active user and formats them + detects the computer's hostname and active user and formats them */ -void detect_host(void) -{ - char given_user[MAX_STRLEN] = "Unknown"; - char given_host[MAX_STRLEN] = "Unknown"; - struct passwd *user_info; - struct utsname host_info; - - if ((user_info = getpwuid(geteuid()))) - { - safe_strncpy(given_user, user_info->pw_name, MAX_STRLEN); - } - else if (error) - { - ERR_REPORT("Could not detect username."); - } - - if (!(uname(&host_info))) - { - safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); - } - else if (error) - { - ERR_REPORT("Could not detect hostname."); - } - - snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", - host_color, given_user, TNRM, TWHT, TNRM, host_color, given_host, TNRM); - - return; +void detect_host(void) { + char given_user[MAX_STRLEN] = "Unknown"; + char given_host[MAX_STRLEN] = "Unknown"; + struct passwd *user_info; + struct utsname host_info; + + if ((user_info = getpwuid(geteuid()))) { + safe_strncpy(given_user, user_info->pw_name, MAX_STRLEN); + } else if (error) { + ERR_REPORT("Could not detect username."); + } + + if (!(uname(&host_info))) { + safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); + } else if (error) { + ERR_REPORT("Could not detect hostname."); + } + + snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", host_color, given_user, TNRM, TWHT, TNRM, + host_color, given_host, TNRM); + + return; } /* detect_kernel - detects the computer's kernel + detects the computer's kernel */ -void detect_kernel(void) -{ - struct utsname kern_info; - - if (!(uname(&kern_info))) - { - snprintf(kernel_str, MAX_STRLEN, "%s %s %s", kern_info.sysname, - kern_info.release, kern_info.machine); - } - else if (error) - { - ERR_REPORT("Could not detect kernel information."); - safe_strncpy(kernel_str, "Linux", MAX_STRLEN); - } - - return; +void detect_kernel(void) { + struct utsname kern_info; + + if (!(uname(&kern_info))) { + snprintf(kernel_str, MAX_STRLEN, "%s %s %s", kern_info.sysname, kern_info.release, + kern_info.machine); + } else if (error) { + ERR_REPORT("Could not detect kernel information."); + safe_strncpy(kernel_str, "Linux", MAX_STRLEN); + } + + return; } /* detect_uptime - detects the computer's uptime + detects the computer's uptime */ -void detect_uptime(void) -{ - unsigned int secs = 0; - unsigned int mins = 0; - unsigned int hrs = 0; - unsigned int days = 0; - struct sysinfo si_upt; - - if (!(sysinfo(&si_upt))) - { - split_uptime(si_upt.uptime, &secs, &mins, &hrs, &days); - - if (days > 0) - snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); - else - snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); - } - else - { - ERR_REPORT("Could not detect system uptime."); - } - - return; +void detect_uptime(void) { + unsigned int secs = 0; + unsigned int mins = 0; + unsigned int hrs = 0; + unsigned int days = 0; + struct sysinfo si_upt; + + if (!(sysinfo(&si_upt))) { + split_uptime(si_upt.uptime, &secs, &mins, &hrs, &days); + + if (days > 0) + snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); + else + snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); + } else { + ERR_REPORT("Could not detect system uptime."); + } + + return; } /* detect_pkgs - detects the number of packages installed on the computer + detects the number of packages installed on the computer */ -void detect_pkgs(void) -{ - FILE *pkgs_file; - int packages = 0; - glob_t gl; - - if (STREQ(distro_str, "Arch Linux") - || STREQ(distro_str, "ParabolaGNU/Linux-libre") - || STREQ(distro_str, "Chakra") || STREQ(distro_str, "Manjaro")) - { - if (!(glob("/var/lib/pacman/local/*", GLOB_NOSORT, NULL, &gl))) - { - packages = gl.gl_pathc; - } - else if (error) - { - ERR_REPORT("Failure while globbing packages."); - } - - globfree(&gl); - } - else if (STREQ(distro_str, "Frugalware")) - { - pkgs_file = popen("pacman-g2 -Q 2> /dev/null | wc -l", "r"); - fscanf(pkgs_file, "%d", &packages); - pclose(pkgs_file); - } - else if (STREQ(distro_str, "Ubuntu") || STREQ(distro_str, "Lubuntu") - || STREQ(distro_str, "Xubuntu") || STREQ(distro_str, "LinuxMint") - || STREQ(distro_str, "SolusOS") || STREQ(distro_str, "Debian") - || STREQ(distro_str, "LMDE") || STREQ(distro_str, "CrunchBang") - || STREQ(distro_str, "Peppermint") - || STREQ(distro_str, "LinuxDeepin") || STREQ(distro_str, "Trisquel") - || STREQ(distro_str, "elementary OS") - || STREQ(distro_str, "Backtrack Linux") - || STREQ(distro_str, "Kali Linux")) - { - if (!(glob("/var/lib/dpkg/info/*.list", GLOB_NOSORT, NULL, &gl))) - { - packages = gl.gl_pathc; - } - else if (error) - { - ERR_REPORT("Failure while globbing packages."); - } - - globfree(&gl); - } - else if (STREQ(distro_str, "Slackware")) - { - if (!(glob("/var/log/packages/*", GLOB_NOSORT, NULL, &gl))) - { - packages = gl.gl_pathc; - } - else if (error) - { - ERR_REPORT("Failure while globbing packages."); - } - - globfree(&gl); - } - else if (STREQ(distro_str, "Gentoo") || STREQ(distro_str, "Sabayon") - || STREQ(distro_str, "Funtoo")) - { - if (!(glob("/var/db/pkg/*/*", GLOB_NOSORT, NULL, &gl))) - { - packages = gl.gl_pathc; - } - else if (error) - { - ERR_REPORT("Failure while globbing packages."); - } - - globfree(&gl); - } - else if (STREQ(distro_str, "Fuduntu") || STREQ(distro_str, "Fedora") - || STREQ(distro_str, "OpenSUSE") - || STREQ(distro_str, "Red Hat Linux") - || STREQ(distro_str, "Mandriva") || STREQ(distro_str, "Mandrake") - || STREQ(distro_str, "Mageia") || STREQ(distro_str, "Viperr")) - { - /* RPM uses Berkeley DBs internally, so this won't change soon */ - pkgs_file = popen("rpm -qa 2> /dev/null | wc -l", "r"); - fscanf(pkgs_file, "%d", &packages); - pclose(pkgs_file); - } - else if (STREQ(distro_str, "Angstrom")) - { - pkgs_file = popen("opkg list-installed 2> /dev/null | wc -l", "r"); - fscanf(pkgs_file, "%d", &packages); - pclose(pkgs_file); - } - else if (STREQ(distro_str, "Linux")) /* if linux disto detection failed */ - { - safe_strncpy(pkgs_str, "Not Found", MAX_STRLEN); - - if (error) - ERR_REPORT("Packages cannot be detected on an unknown " - "Linux distro."); - } - - snprintf(pkgs_str, MAX_STRLEN, "%d", packages); - - return; +void detect_pkgs(void) { + FILE *pkgs_file; + int packages = 0; + glob_t gl; + + if (STREQ(distro_str, "Arch Linux") || STREQ(distro_str, "ParabolaGNU/Linux-libre") || + STREQ(distro_str, "Chakra") || STREQ(distro_str, "Manjaro")) { + if (!(glob("/var/lib/pacman/local/*", GLOB_NOSORT, NULL, &gl))) { + packages = gl.gl_pathc; + } else if (error) { + ERR_REPORT("Failure while globbing packages."); + } + + globfree(&gl); + } else if (STREQ(distro_str, "Frugalware")) { + pkgs_file = popen("pacman-g2 -Q 2> /dev/null | wc -l", "r"); + fscanf(pkgs_file, "%d", &packages); + pclose(pkgs_file); + } else if (STREQ(distro_str, "Ubuntu") || STREQ(distro_str, "Lubuntu") || + STREQ(distro_str, "Xubuntu") || STREQ(distro_str, "LinuxMint") || + STREQ(distro_str, "SolusOS") || STREQ(distro_str, "Debian") || + STREQ(distro_str, "LMDE") || STREQ(distro_str, "CrunchBang") || + STREQ(distro_str, "Peppermint") || STREQ(distro_str, "LinuxDeepin") || + STREQ(distro_str, "Trisquel") || STREQ(distro_str, "elementary OS") || + STREQ(distro_str, "Backtrack Linux") || STREQ(distro_str, "Kali Linux")) { + if (!(glob("/var/lib/dpkg/info/*.list", GLOB_NOSORT, NULL, &gl))) { + packages = gl.gl_pathc; + } else if (error) { + ERR_REPORT("Failure while globbing packages."); + } + + globfree(&gl); + } else if (STREQ(distro_str, "Slackware")) { + if (!(glob("/var/log/packages/*", GLOB_NOSORT, NULL, &gl))) { + packages = gl.gl_pathc; + } else if (error) { + ERR_REPORT("Failure while globbing packages."); + } + + globfree(&gl); + } else if (STREQ(distro_str, "Gentoo") || STREQ(distro_str, "Sabayon") || + STREQ(distro_str, "Funtoo")) { + if (!(glob("/var/db/pkg/*/*", GLOB_NOSORT, NULL, &gl))) { + packages = gl.gl_pathc; + } else if (error) { + ERR_REPORT("Failure while globbing packages."); + } + + globfree(&gl); + } else if (STREQ(distro_str, "Fuduntu") || STREQ(distro_str, "Fedora") || + STREQ(distro_str, "OpenSUSE") || STREQ(distro_str, "Red Hat Linux") || + STREQ(distro_str, "Mandriva") || STREQ(distro_str, "Mandrake") || + STREQ(distro_str, "Mageia") || STREQ(distro_str, "Viperr")) { + /* RPM uses Berkeley DBs internally, so this won't change soon */ + pkgs_file = popen("rpm -qa 2> /dev/null | wc -l", "r"); + fscanf(pkgs_file, "%d", &packages); + pclose(pkgs_file); + } else if (STREQ(distro_str, "Angstrom")) { + pkgs_file = popen("opkg list-installed 2> /dev/null | wc -l", "r"); + fscanf(pkgs_file, "%d", &packages); + pclose(pkgs_file); + } else if (STREQ(distro_str, "Linux")) /* if linux disto detection failed */ + { + safe_strncpy(pkgs_str, "Not Found", MAX_STRLEN); + + if (error) + ERR_REPORT("Packages cannot be detected on an unknown " + "Linux distro."); + } + + snprintf(pkgs_str, MAX_STRLEN, "%d", packages); + + return; } /* detect_cpu - detects the computer's CPU brand/name-string + detects the computer's CPU brand/name-string */ -void detect_cpu(void) -{ - FILE *cpu_file; - char cpuinfo_buf[MAX_STRLEN]; - char *cpuinfo_line; - int end; - - if ((cpu_file = fopen("/proc/cpuinfo", "r"))) - { - /* read past the first 4 lines (#5 is model name) */ - for (int i = 0; i < 5; i++) - { - if (!(fgets(cpuinfo_buf, MAX_STRLEN, cpu_file))) - { - ERR_REPORT("Fatal error while reading /proc/cpuinfo"); - return; - } - } - - /* fail to match a colon. this should never happen, but check anyways */ - if (!(cpuinfo_line = strchr(cpuinfo_buf, ':'))) - { - ERR_REPORT("Fatal error matching in /proc/cpuinfo"); - return; - } - - cpuinfo_line += 2; - end = strlen(cpuinfo_line); - - if (cpuinfo_line[end - 1] == '\n') - cpuinfo_line[end - 1] = '\0'; - - if (STREQ(cpuinfo_line, "ARMv6-compatible processor rev 7 (v6l)")) - { - safe_strncpy(cpu_str, "BCM2708 (Raspberry Pi)", MAX_STRLEN); - } - else - { - safe_strncpy(cpu_str, cpuinfo_line, MAX_STRLEN); - } - } - else if (error) - { - ERR_REPORT("Failed to open /proc/cpuinfo. Ancient Linux kernel?"); - } - - return; +void detect_cpu(void) { + FILE *cpu_file; + char cpuinfo_buf[MAX_STRLEN]; + char *cpuinfo_line; + int end; + + if ((cpu_file = fopen("/proc/cpuinfo", "r"))) { + /* read past the first 4 lines (#5 is model name) */ + for (int i = 0; i < 5; i++) { + if (!(fgets(cpuinfo_buf, MAX_STRLEN, cpu_file))) { + ERR_REPORT("Fatal error while reading /proc/cpuinfo"); + return; + } + } + + /* fail to match a colon. this should never happen, but check anyways */ + if (!(cpuinfo_line = strchr(cpuinfo_buf, ':'))) { + ERR_REPORT("Fatal error matching in /proc/cpuinfo"); + return; + } + + cpuinfo_line += 2; + end = strlen(cpuinfo_line); + + if (cpuinfo_line[end - 1] == '\n') + cpuinfo_line[end - 1] = '\0'; + + if (STREQ(cpuinfo_line, "ARMv6-compatible processor rev 7 (v6l)")) { + safe_strncpy(cpu_str, "BCM2708 (Raspberry Pi)", MAX_STRLEN); + } else { + safe_strncpy(cpu_str, cpuinfo_line, MAX_STRLEN); + } + } else if (error) { + ERR_REPORT("Failed to open /proc/cpuinfo. Ancient Linux kernel?"); + } + + return; } /* detect_gpu - detects the computer's GPU brand/name-string + detects the computer's GPU brand/name-string */ -void detect_gpu(void) -{ - Display *disp = NULL; - Window wind; - GLint attr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None }; - XVisualInfo *visual_info = NULL; - GLXContext context = NULL; - - if ((disp = XOpenDisplay(NULL))) - { - wind = DefaultRootWindow(disp); - - if ((visual_info = glXChooseVisual(disp, 0, attr))) - { - if ((context = glXCreateContext(disp, visual_info, NULL, GL_TRUE))) - { - glXMakeCurrent(disp, wind, context); - safe_strncpy(gpu_str, (const char *) glGetString(GL_RENDERER), - MAX_STRLEN); - - glXDestroyContext(disp, context); - } - else if (error) - { - ERR_REPORT("Failed to create OpenGL context."); - } - - XFree(visual_info); - } - else if (error) - { - ERR_REPORT("Failed to select a proper X visual."); - } - - XCloseDisplay(disp); - } - else if (error) - { - safe_strncpy(gpu_str, "No X Server", MAX_STRLEN); - ERR_REPORT("Could not open an X display (detect_gpu)."); - } - - return; +void detect_gpu(void) { + Display *disp = NULL; + Window wind; + GLint attr[] = {GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None}; + XVisualInfo *visual_info = NULL; + GLXContext context = NULL; + + if ((disp = XOpenDisplay(NULL))) { + wind = DefaultRootWindow(disp); + + if ((visual_info = glXChooseVisual(disp, 0, attr))) { + if ((context = glXCreateContext(disp, visual_info, NULL, GL_TRUE))) { + glXMakeCurrent(disp, wind, context); + safe_strncpy(gpu_str, (const char *)glGetString(GL_RENDERER), MAX_STRLEN); + + glXDestroyContext(disp, context); + } else if (error) { + ERR_REPORT("Failed to create OpenGL context."); + } + + XFree(visual_info); + } else if (error) { + ERR_REPORT("Failed to select a proper X visual."); + } + + XCloseDisplay(disp); + } else if (error) { + safe_strncpy(gpu_str, "No X Server", MAX_STRLEN); + ERR_REPORT("Could not open an X display (detect_gpu)."); + } + + return; } /* detect_disk - detects the computer's total disk capacity and usage + detects the computer's total disk capacity and usage */ -void detect_disk(void) -{ - FILE *mnt_file; - struct mntent *ent; - struct statvfs fs; - unsigned long long disk_total = 0, disk_used = 0, disk_pct = 0; - - if ((mnt_file = setmntent("/etc/mtab", "r"))) - { - while ((ent = getmntent(mnt_file))) - { - /* we only want to get the size of "real" disks (starting with /) */ - if (ent->mnt_dir && ent->mnt_fsname && ent->mnt_fsname[0] == '/') - { - if (!statvfs(ent->mnt_dir, &fs)) - { - disk_total += (fs.f_blocks * fs.f_bsize); - disk_used += ((fs.f_blocks - fs.f_bfree) * fs.f_bsize); - } - else - { - ERR_REPORT("Could not stat filesystem for statistics (detect_disk)."); - } - } - } - - disk_total /= GB; - disk_used /= GB; - disk_pct = disk_total > 0 ? (disk_used * 100 / disk_total) : 0; - - snprintf(disk_str, MAX_STRLEN, "%llu%s / %llu%s (%llu%%)", disk_used, - "GiB", disk_total, "GiB", disk_pct); - - endmntent(mnt_file); - } - else if (error) - { - ERR_REPORT("Could not open /etc/mtab (detect_disk)."); - } - - return; +void detect_disk(void) { + FILE *mnt_file; + struct mntent *ent; + struct statvfs fs; + unsigned long long disk_total = 0, disk_used = 0, disk_pct = 0; + + if ((mnt_file = setmntent("/etc/mtab", "r"))) { + while ((ent = getmntent(mnt_file))) { + /* we only want to get the size of "real" disks (starting with /) */ + if (ent->mnt_dir && ent->mnt_fsname && ent->mnt_fsname[0] == '/') { + if (!statvfs(ent->mnt_dir, &fs)) { + disk_total += (fs.f_blocks * fs.f_bsize); + disk_used += ((fs.f_blocks - fs.f_bfree) * fs.f_bsize); + } else { + ERR_REPORT("Could not stat filesystem for statistics (detect_disk)."); + } + } + } + + disk_total /= GB; + disk_used /= GB; + disk_pct = disk_total > 0 ? (disk_used * 100 / disk_total) : 0; + + snprintf(disk_str, MAX_STRLEN, "%llu%s / %llu%s (%llu%%)", disk_used, "GiB", disk_total, "GiB", + disk_pct); + + endmntent(mnt_file); + } else if (error) { + ERR_REPORT("Could not open /etc/mtab (detect_disk)."); + } + + return; } /* detect_mem - detects the computer's total and used RAM + detects the computer's total and used RAM */ -void detect_mem(void) -{ - long long memtotal = 0, shmem = 0, memavailable = 0, sunreclaim = 0; - long long total_mem, used_mem, mem_pct; - FILE *fp; - char line[64]; - - if ((fp = fopen("/proc/meminfo", "r"))) - { - while (fgets(line, 64, fp)) - { - if (strncmp(line, "MemTotal:", 9) == 0) - { - sscanf(line+9, "%lld", &memtotal); - } - else if (strncmp(line, "Shmem:", 6) == 0) - { - sscanf(line+6, "%lld", &shmem); - } - else if (strncmp(line, "MemAvailable:", 13) == 0) - { - sscanf(line+13, "%lld", &memavailable); - } - else if (strncmp(line, "SUnreclaim:", 11) == 0) - { - sscanf(line+11, "%lld", &sunreclaim); - } - } - fclose(fp); - } - else - { - ERR_REPORT("Failed to open /proc/meminfo. Ancient Linux kernel?"); - } - - total_mem = (memtotal + shmem) * 1000; - used_mem = total_mem - ((memavailable + sunreclaim) * 1000); - total_mem /= MB; - used_mem /= MB; - mem_pct = total_mem > 0 ? (used_mem * 100 / total_mem) : 0; - - snprintf(mem_str, MAX_STRLEN, "%lld%s / %lld%s (%lld%%)", used_mem, "MiB", - total_mem, "MiB", mem_pct); - - return; +void detect_mem(void) { + long long memtotal = 0, shmem = 0, memavailable = 0, sunreclaim = 0; + long long total_mem, used_mem, mem_pct; + FILE *fp; + char line[64]; + + if ((fp = fopen("/proc/meminfo", "r"))) { + while (fgets(line, 64, fp)) { + if (strncmp(line, "MemTotal:", 9) == 0) { + sscanf(line + 9, "%lld", &memtotal); + } else if (strncmp(line, "Shmem:", 6) == 0) { + sscanf(line + 6, "%lld", &shmem); + } else if (strncmp(line, "MemAvailable:", 13) == 0) { + sscanf(line + 13, "%lld", &memavailable); + } else if (strncmp(line, "SUnreclaim:", 11) == 0) { + sscanf(line + 11, "%lld", &sunreclaim); + } + } + fclose(fp); + } else { + ERR_REPORT("Failed to open /proc/meminfo. Ancient Linux kernel?"); + } + + total_mem = (memtotal + shmem) * 1000; + used_mem = total_mem - ((memavailable + sunreclaim) * 1000); + total_mem /= MB; + used_mem /= MB; + mem_pct = total_mem > 0 ? (used_mem * 100 / total_mem) : 0; + + snprintf(mem_str, MAX_STRLEN, "%lld%s / %lld%s (%lld%%)", used_mem, "MiB", total_mem, "MiB", + mem_pct); + + return; } /* detect_shell - detects the shell currently running on the computer - -- - CAVEAT: shell version detection relies on the standard versioning format for - each shell. If any shell's older (or newer versions) suddenly begin to use a new - scheme, the version may be displayed incorrectly. - -- + detects the shell currently running on the computer + -- + CAVEAT: shell version detection relies on the standard versioning format for + each shell. If any shell's older (or newer versions) suddenly begin to use a new + scheme, the version may be displayed incorrectly. + -- */ -void detect_shell(void) -{ - FILE *shell_file; - char *shell_name; - char vers_str[MAX_STRLEN]; - - if (!(shell_name = getenv("SHELL"))) - { - if (error) - ERR_REPORT("Could not detect a shell - $SHELL not defined."); - - return; - } - - if (STREQ(shell_name, "/bin/sh")) - { - safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); - } - else if (strstr(shell_name, "bash")) - { - shell_file = popen("bash --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); - pclose(shell_file); - } - else if (strstr(shell_name, "zsh")) - { - shell_file = popen("zsh --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); - pclose(shell_file); - } - else if (strstr(shell_name, "csh")) - { - shell_file = popen("csh --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); - pclose(shell_file); - } - else if (strstr(shell_name, "fish")) - { - shell_file = popen("fish --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); - pclose(shell_file); - } - else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") - || strstr(shell_name, "ksh")) - { - /* i don't have a version detection system for these, yet */ - safe_strncpy(shell_str, shell_name, MAX_STRLEN); - } - - return; +void detect_shell(void) { + FILE *shell_file; + char *shell_name; + char vers_str[MAX_STRLEN]; + + if (!(shell_name = getenv("SHELL"))) { + if (error) + ERR_REPORT("Could not detect a shell - $SHELL not defined."); + + return; + } + + if (STREQ(shell_name, "/bin/sh")) { + safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); + } else if (strstr(shell_name, "bash")) { + shell_file = popen("bash --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); + pclose(shell_file); + } else if (strstr(shell_name, "zsh")) { + shell_file = popen("zsh --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); + pclose(shell_file); + } else if (strstr(shell_name, "csh")) { + shell_file = popen("csh --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); + pclose(shell_file); + } else if (strstr(shell_name, "fish")) { + shell_file = popen("fish --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); + pclose(shell_file); + } else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") || strstr(shell_name, "ksh")) { + /* i don't have a version detection system for these, yet */ + safe_strncpy(shell_str, shell_name, MAX_STRLEN); + } + + return; } /* detect_res - detects the combined resolution of all monitors attached to the computer + detects the combined resolution of all monitors attached to the computer */ -void detect_res(void) -{ - int width = 0, height = 0; - Display *disp; - Screen *screen; - - if ((disp = XOpenDisplay(NULL))) - { - screen = XDefaultScreenOfDisplay(disp); - width = WidthOfScreen(screen); - height = HeightOfScreen(screen); - - snprintf(res_str, MAX_STRLEN, "%dx%d", width, height); - - XCloseDisplay(disp); - } - else - { - safe_strncpy(res_str, "No X Server", MAX_STRLEN); - - if (error) - ERR_REPORT("Could not open an X display (detect_res)"); - } - - return; +void detect_res(void) { + int width = 0, height = 0; + Display *disp; + Screen *screen; + + if ((disp = XOpenDisplay(NULL))) { + screen = XDefaultScreenOfDisplay(disp); + width = WidthOfScreen(screen); + height = HeightOfScreen(screen); + + snprintf(res_str, MAX_STRLEN, "%dx%d", width, height); + + XCloseDisplay(disp); + } else { + safe_strncpy(res_str, "No X Server", MAX_STRLEN); + + if (error) + ERR_REPORT("Could not open an X display (detect_res)"); + } + + return; } /* detect_de - detects the desktop environment currently running on top of the OS + detects the desktop environment currently running on top of the OS */ -void detect_de(void) -{ - char *curr_de; - - if ((curr_de = getenv("XDG_CURRENT_DESKTOP"))) - { - safe_strncpy(de_str, curr_de, MAX_STRLEN); - } - else - { - if (getenv("GNOME_DESKTOP_SESSION_ID")) - { - safe_strncpy(de_str, "Gnome", MAX_STRLEN); - } - else if (getenv("MATE_DESKTOP_SESSION_ID")) - { - safe_strncpy(de_str, "MATE", MAX_STRLEN); - } - else if (getenv("KDE_FULL_SESSION")) - { - /* KDE_SESSION_VERSION only exists on KDE4+, so - getenv will return NULL on KDE <= 3. - */ - snprintf(de_str, MAX_STRLEN, "KDE%s", getenv("KDE_SESSION_VERSION")); - } - else if (error) - { - ERR_REPORT("No desktop environment found."); - } - } - - return; +void detect_de(void) { + char *curr_de; + + if ((curr_de = getenv("XDG_CURRENT_DESKTOP"))) { + safe_strncpy(de_str, curr_de, MAX_STRLEN); + } else { + if (getenv("GNOME_DESKTOP_SESSION_ID")) { + safe_strncpy(de_str, "Gnome", MAX_STRLEN); + } else if (getenv("MATE_DESKTOP_SESSION_ID")) { + safe_strncpy(de_str, "MATE", MAX_STRLEN); + } else if (getenv("KDE_FULL_SESSION")) { + /* KDE_SESSION_VERSION only exists on KDE4+, so + getenv will return NULL on KDE <= 3. + */ + snprintf(de_str, MAX_STRLEN, "KDE%s", getenv("KDE_SESSION_VERSION")); + } else if (error) { + ERR_REPORT("No desktop environment found."); + } + } + + return; } /* detect_wm - detects the window manager currently running on top of the OS + detects the window manager currently running on top of the OS */ -void detect_wm(void) -{ - Display *disp; - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes; - char *wm_name = '\0'; - Window *wm_check_window; - - if ((disp = XOpenDisplay(NULL))) - { - if (!(XGetWindowProperty(disp, DefaultRootWindow(disp), - XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", true), - 0, KB, false, XA_WINDOW, &actual_type, &actual_format, &nitems, - &bytes, (unsigned char **) &wm_check_window))) - { - if (wm_check_window && !(XGetWindowProperty(disp, *wm_check_window, - XInternAtom(disp, "_NET_WM_NAME", true), 0, KB, false, - XInternAtom(disp, "UTF8_STRING", true), &actual_type, - &actual_format, &nitems, &bytes, (unsigned char **) &wm_name))) - { - safe_strncpy(wm_str, wm_name, MAX_STRLEN); - XFree(wm_name); - } - else if (error) - { - ERR_REPORT("No _NET_WM_NAME property found."); - } - - XFree(wm_check_window); - } - else if (error) - { - ERR_REPORT("No WM detected (non-EWMH compliant?)"); - } - - XCloseDisplay(disp); - } - else if (error) - { - ERR_REPORT("Could not open an X display. (detect_wm)"); - } - - return; +void detect_wm(void) { + Display *disp; + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes; + char *wm_name = '\0'; + Window *wm_check_window; + + if ((disp = XOpenDisplay(NULL))) { + if (!(XGetWindowProperty(disp, DefaultRootWindow(disp), + XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", true), 0, KB, false, + XA_WINDOW, &actual_type, &actual_format, &nitems, &bytes, + (unsigned char **)&wm_check_window))) { + if (wm_check_window && + !(XGetWindowProperty(disp, *wm_check_window, XInternAtom(disp, "_NET_WM_NAME", true), 0, + KB, false, XInternAtom(disp, "UTF8_STRING", true), &actual_type, + &actual_format, &nitems, &bytes, (unsigned char **)&wm_name))) { + safe_strncpy(wm_str, wm_name, MAX_STRLEN); + XFree(wm_name); + } else if (error) { + ERR_REPORT("No _NET_WM_NAME property found."); + } + + XFree(wm_check_window); + } else if (error) { + ERR_REPORT("No WM detected (non-EWMH compliant?)"); + } + + XCloseDisplay(disp); + } else if (error) { + ERR_REPORT("Could not open an X display. (detect_wm)"); + } + + return; } /* detect_wm_theme - detects the theme associated with the WM detected in detect_wm() - -- - CAVEAT: This function relies on the presence of 'detectwmtheme', a shell script. - If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' - -- + detects the theme associated with the WM detected in detect_wm() + -- + CAVEAT: This function relies on the presence of 'detectwmtheme', a shell script. + If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' + -- */ -void detect_wm_theme(void) -{ - char exec_str[MAX_STRLEN] = "false"; - char config_file[MAX_STRLEN]; - char *home; - FILE *wm_theme_file; - - snprintf(wm_theme_str, MAX_STRLEN, "Unknown"); - home = getenv("HOME"); - - if (!home) - { - ERR_REPORT("Environment variable HOME not set."); - } - else - { - if (STREQ("Awesome", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.config/awesome/rc.lua", home); - snprintf(exec_str, MAX_STRLEN, - "grep -e '^[^-].*\\(theme\\|beautiful\\).*lua' '%s' | grep '[a-zA-Z0-9]\\+/[a-zA-Z0-9]\\+.lua' -o | head -n1 | cut -d'/' -f1", - config_file); - } - else if (STRCASEEQ("BlackBox", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.blackboxrc", home); - if (FILE_EXISTS(config_file)) - { - snprintf(exec_str, MAX_STRLEN, - "awk -F\"/\" '/styleFile/ {print $NF}' '%s'", - config_file); - } - } - else if (STREQ("Cinnamon", wm_str)) - { - safe_strncpy(exec_str, - "gsettings get org.cinnamon.theme name", - MAX_STRLEN); - } - else if (STREQ("Compiz", wm_str) || BEGINS_WITH(wm_str, "Mutter") || - STREQ("GNOME Shell", wm_str)) - { - if (command_in_path("gsettings")) - { - safe_strncpy(exec_str, - "gsettings get org.gnome.desktop.wm.preferences theme", - MAX_STRLEN); - } - else if (command_in_path("gconftool-2")) - { - safe_strncpy(exec_str, - "gconftool-2 -g /apps/metacity/general/theme", - MAX_STRLEN); - } - } - else if (STREQ("E16", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.e16/e_config--0.0.cfg", home); - if (FILE_EXISTS(config_file)) - { - snprintf(exec_str, MAX_STRLEN, - "awk -F\"= \" '/theme.name/ {print $2}' '%s'", - config_file); - } - } - else if (STREQ("E17", wm_str) || STREQ("Enlightenment", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.e/e/config/standard/e.cfg", home); - if (FILE_EXISTS(config_file) && command_in_path("eet")) - { - snprintf(exec_str, MAX_STRLEN, - "cfg=\"$(eet -d '%s' config | awk '/value \"file\" string.*.edj/{ print $4 }')\"; " - "cfg=\"${cfg##*/}\"; " - "echo \"${cfg%%.*}\"", - config_file); - } - else - { - char *tmp = getenv("E_CONF_PROFILE"); - if (tmp) - { - safe_strncpy(wm_theme_str, tmp, MAX_STRLEN); - } - } - } - else if (STREQ("Emerald", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.emerald/theme/theme.ini", home); - if (FILE_EXISTS(config_file)) - { - snprintf(exec_str, MAX_STRLEN, - "for a in /usr/share/emerald/themes/* \"%s/.emerald/themes\"/*; do" - " cmp \"%s\" \"$a/theme.ini\" &>/dev/null && basename \"$a\"; " - "done", - home, config_file); - } - } - else if (STRCASEEQ("FluxBox", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.fluxbox/init", home); - if (FILE_EXISTS(config_file)) - { - snprintf(exec_str, MAX_STRLEN, - "awk -F\"/\" '/styleFile/ {print $NF}' '%s'", - config_file); - } - } - else if (STREQ("IceWM", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.icewm/theme", home); - if (FILE_EXISTS(config_file)) - { - snprintf(exec_str, MAX_STRLEN, - "awk -F\"[\\\",/]\" '!/#/ {print $2}' '%s'", - config_file); - } - } - else if (BEGINS_WITH(wm_str, "KWin")) - { - FILE *f = NULL; - char kde_config_dir[MAX_STRLEN] = "Unknown"; - char kde_theme[MAX_STRLEN] = "Unknown"; - char *env; - const char *kde_config_cmd = NULL; - - env = getenv("KDE_CONFIG_DIR"); - if (env) - { - safe_strncpy(kde_config_dir, env, MAX_STRLEN); - } - else - { - if (command_in_path("kde5-config")) - { - kde_config_cmd = "kde5-config --localprefix"; - } - else if (command_in_path("kde4-config")) - { - kde_config_cmd = "kde4-config --localprefix"; - } - if (command_in_path("kde-config")) - { - kde_config_cmd = "kde-config --localprefix"; - } - - if (kde_config_cmd) - { - f = popen(kde_config_cmd, "r"); - fgets(kde_config_dir, MAX_STRLEN, f); - pclose(f); - } - } - - if (!STREQ("Unknown", kde_config_dir)) - { - snprintf(exec_str, MAX_STRLEN, - "awk '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,\"\",$0); print $0; exit}' '%s/share/config/kwinrc'", - kde_config_dir); - f = popen(exec_str, "r"); - fgets(kde_theme, MAX_STRLEN, f); - pclose(f); - - if (STREQ("", kde_theme) || STREQ("\n", kde_theme)) - { - snprintf(config_file, MAX_STRLEN, "%s/share/config/kdebugrc", kde_config_dir); - if (FILE_EXISTS(config_file)) - { - snprintf(exec_str, MAX_STRLEN, - "awk '/(decoration)/ {gsub(/\\[/,\"\",$1); print $1; exit}' '%s'", - config_file); - f = popen(exec_str, "r"); - fgets(kde_theme, MAX_STRLEN, f); - pclose(f); - - if (STREQ("", kde_theme) || STREQ("\n", kde_theme)) - { - safe_strncpy(kde_theme, "Unknown", MAX_STRLEN); - } - } - } - } - - safe_strncpy(exec_str, "false", MAX_STRLEN); - safe_strncpy(wm_theme_str, kde_theme, MAX_STRLEN); - } - else if (STREQ("Marco", wm_str) || STREQ("Metacity (Marco)", wm_str)) - { - safe_strncpy(exec_str, - "gsettings get org.mate.Marco.general theme", - MAX_STRLEN); - } - else if (STREQ("Metacity", wm_str)) - { - safe_strncpy(exec_str, "gconftool-2 -g /apps/metacity/general/theme 2>/dev/null", MAX_STRLEN); - } - else if (STRCASEEQ("OpenBox", wm_str)) - { - snprintf(config_file, MAX_STRLEN, "%s/.config/openbox/lxde-rc.xml", home); - if (!(FILE_EXISTS(config_file) && STREQ(de_str, "LXDE"))) - { - config_file[0] = '\0'; - } - - if (config_file[0] == '\0') - { - snprintf(config_file, MAX_STRLEN, "%s/.config/openbox/rc.xml", home); - if (!FILE_EXISTS(config_file)) - { - config_file[0] = '\0'; - } - } - - if (config_file[0] != '\0') - { - snprintf(exec_str, MAX_STRLEN, - "awk -F\"[<,>]\" '//dev/null && basename \"$a\"; " + "done", + home, config_file); + } + } else if (STRCASEEQ("FluxBox", wm_str)) { + snprintf(config_file, MAX_STRLEN, "%s/.fluxbox/init", home); + if (FILE_EXISTS(config_file)) { + snprintf(exec_str, MAX_STRLEN, "awk -F\"/\" '/styleFile/ {print $NF}' '%s'", config_file); + } + } else if (STREQ("IceWM", wm_str)) { + snprintf(config_file, MAX_STRLEN, "%s/.icewm/theme", home); + if (FILE_EXISTS(config_file)) { + snprintf(exec_str, MAX_STRLEN, "awk -F\"[\\\",/]\" '!/#/ {print $2}' '%s'", config_file); + } + } else if (BEGINS_WITH(wm_str, "KWin")) { + FILE *f = NULL; + char kde_config_dir[MAX_STRLEN] = "Unknown"; + char kde_theme[MAX_STRLEN] = "Unknown"; + char *env; + const char *kde_config_cmd = NULL; + + env = getenv("KDE_CONFIG_DIR"); + if (env) { + safe_strncpy(kde_config_dir, env, MAX_STRLEN); + } else { + if (command_in_path("kde5-config")) { + kde_config_cmd = "kde5-config --localprefix"; + } else if (command_in_path("kde4-config")) { + kde_config_cmd = "kde4-config --localprefix"; + } + if (command_in_path("kde-config")) { + kde_config_cmd = "kde-config --localprefix"; + } + + if (kde_config_cmd) { + f = popen(kde_config_cmd, "r"); + fgets(kde_config_dir, MAX_STRLEN, f); + pclose(f); + } + } + + if (!STREQ("Unknown", kde_config_dir)) { + snprintf(exec_str, MAX_STRLEN, + "awk '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,\"\",$0); print $0; exit}' " + "'%s/share/config/kwinrc'", + kde_config_dir); + f = popen(exec_str, "r"); + fgets(kde_theme, MAX_STRLEN, f); + pclose(f); + + if (STREQ("", kde_theme) || STREQ("\n", kde_theme)) { + snprintf(config_file, MAX_STRLEN, "%s/share/config/kdebugrc", kde_config_dir); + if (FILE_EXISTS(config_file)) { + snprintf(exec_str, MAX_STRLEN, + "awk '/(decoration)/ {gsub(/\\[/,\"\",$1); print $1; exit}' '%s'", + config_file); + f = popen(exec_str, "r"); + fgets(kde_theme, MAX_STRLEN, f); + pclose(f); + + if (STREQ("", kde_theme) || STREQ("\n", kde_theme)) { + safe_strncpy(kde_theme, "Unknown", MAX_STRLEN); + } + } + } + } + + safe_strncpy(exec_str, "false", MAX_STRLEN); + safe_strncpy(wm_theme_str, kde_theme, MAX_STRLEN); + } else if (STREQ("Marco", wm_str) || STREQ("Metacity (Marco)", wm_str)) { + safe_strncpy(exec_str, "gsettings get org.mate.Marco.general theme", MAX_STRLEN); + } else if (STREQ("Metacity", wm_str)) { + safe_strncpy(exec_str, "gconftool-2 -g /apps/metacity/general/theme 2>/dev/null", MAX_STRLEN); + } else if (STRCASEEQ("OpenBox", wm_str)) { + snprintf(config_file, MAX_STRLEN, "%s/.config/openbox/lxde-rc.xml", home); + if (!(FILE_EXISTS(config_file) && STREQ(de_str, "LXDE"))) { + config_file[0] = '\0'; + } + + if (config_file[0] == '\0') { + snprintf(config_file, MAX_STRLEN, "%s/.config/openbox/rc.xml", home); + if (!FILE_EXISTS(config_file)) { + config_file[0] = '\0'; + } + } + + if (config_file[0] != '\0') { + snprintf(exec_str, MAX_STRLEN, "awk -F\"[<,>]\" '/ /dev/null", de_str); - gtk_file = popen(exec_str, "r"); - fscanf(gtk_file, "%s%s%s%s", gtk2_str, gtk3_str, gtk_icons_str, gtk_font_str); - pclose(gtk_file); - - unquote(gtk2_str); - unquote(gtk3_str); - unquote(gtk_icons_str); - unquote(gtk_font_str); - - if (STREQ(gtk3_str, "Unknown")) - snprintf(gtk_str, MAX_STRLEN, "%s (GTK2), %s (Icons)", gtk2_str, - gtk_icons_str); - else if (STREQ(gtk2_str, "Unknown")) - snprintf(gtk_str, MAX_STRLEN, "%s (GTK3), %s (Icons)", gtk3_str, - gtk_icons_str); - else - snprintf(gtk_str, MAX_STRLEN, "%s (GTK2), %s (GTK3)", gtk2_str, gtk3_str); - - snprintf(icon_str, MAX_STRLEN, "%s", gtk_icons_str); - - snprintf(font_str, MAX_STRLEN, "%s", gtk_font_str); - - return; +void detect_gtk(void) { + FILE *gtk_file; + char exec_str[MAX_STRLEN]; + char gtk2_str[MAX_STRLEN] = "Unknown"; + char gtk3_str[MAX_STRLEN] = "Unknown"; + char gtk_icons_str[MAX_STRLEN] = "Unknown"; + char gtk_font_str[MAX_STRLEN] = "Unknown"; + + snprintf(exec_str, MAX_STRLEN, "detectgtk '%s' 2> /dev/null", de_str); + gtk_file = popen(exec_str, "r"); + fscanf(gtk_file, "%s%s%s%s", gtk2_str, gtk3_str, gtk_icons_str, gtk_font_str); + pclose(gtk_file); + + unquote(gtk2_str); + unquote(gtk3_str); + unquote(gtk_icons_str); + unquote(gtk_font_str); + + if (STREQ(gtk3_str, "Unknown")) + snprintf(gtk_str, MAX_STRLEN, "%s (GTK2), %s (Icons)", gtk2_str, gtk_icons_str); + else if (STREQ(gtk2_str, "Unknown")) + snprintf(gtk_str, MAX_STRLEN, "%s (GTK3), %s (Icons)", gtk3_str, gtk_icons_str); + else + snprintf(gtk_str, MAX_STRLEN, "%s (GTK2), %s (GTK3)", gtk2_str, gtk3_str); + + snprintf(icon_str, MAX_STRLEN, "%s", gtk_icons_str); + + snprintf(font_str, MAX_STRLEN, "%s", gtk_font_str); + + return; } diff --git a/src/plat/sun/detect.c b/src/plat/sun/detect.c index fb7e652..bbb6b9e 100644 --- a/src/plat/sun/detect.c +++ b/src/plat/sun/detect.c @@ -33,386 +33,329 @@ #include "../../error_flag.h" /* detect_distro - detects the computer's distribution + detects the computer's distribution */ -void detect_distro(void) -{ - struct utsname distro_info; +void detect_distro(void) { + struct utsname distro_info; - uname(&distro_info); - snprintf(distro_str, MAX_STRLEN, "%s", distro_info.sysname); + uname(&distro_info); + snprintf(distro_str, MAX_STRLEN, "%s", distro_info.sysname); - return; + return; } /* detect_host - detects the computer's hostname and active user and formats them + detects the computer's hostname and active user and formats them */ -void detect_host(void) -{ - char *given_user = "Unknown"; - char given_host[MAX_STRLEN] = "Unknown"; - struct utsname host_info; +void detect_host(void) { + char *given_user = "Unknown"; + char given_host[MAX_STRLEN] = "Unknown"; + struct utsname host_info; - given_user = getlogin(); - uname(&host_info); - safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); + given_user = getlogin(); + uname(&host_info); + safe_strncpy(given_host, host_info.nodename, MAX_STRLEN); - snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", - host_color, given_user, TNRM, TWHT, TNRM, host_color, given_host, TNRM); + snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", host_color, given_user, TNRM, TWHT, TNRM, + host_color, given_host, TNRM); - return; + return; } /* detect_kernel - detects the computer's kernel + detects the computer's kernel */ -void detect_kernel(void) -{ - struct utsname kern_info; +void detect_kernel(void) { + struct utsname kern_info; - uname(&kern_info); - snprintf(kernel_str, MAX_STRLEN, "%s", kern_info.release); + uname(&kern_info); + snprintf(kernel_str, MAX_STRLEN, "%s", kern_info.release); - return; + return; } /* detect_uptime - detects the computer's uptime + detects the computer's uptime */ -void detect_uptime(void) -{ - long uptime = 0, currtime = 0, boottime = 0; - unsigned int secs = 0; - unsigned int mins = 0; - unsigned int hrs = 0; - unsigned int days = 0; - struct utmpx *ent; - - currtime = time(NULL); - - while ((ent = getutxent())) - { - if (STREQ("system boot", ent->ut_line)) - { - boottime = ent->ut_tv.tv_sec; - } - } - - uptime = currtime - boottime; - - split_uptime(uptime, &secs, &mins, &hrs, &days); - - if (days > 0) - snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); - else - snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); - - return; +void detect_uptime(void) { + long uptime = 0, currtime = 0, boottime = 0; + unsigned int secs = 0; + unsigned int mins = 0; + unsigned int hrs = 0; + unsigned int days = 0; + struct utmpx *ent; + + currtime = time(NULL); + + while ((ent = getutxent())) { + if (STREQ("system boot", ent->ut_line)) { + boottime = ent->ut_tv.tv_sec; + } + } + + uptime = currtime - boottime; + + split_uptime(uptime, &secs, &mins, &hrs, &days); + + if (days > 0) + snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); + else + snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); + + return; } /* detect_pkgs - detects the number of packages installed on the computer + detects the number of packages installed on the computer */ -void detect_pkgs(void) -{ - FILE *pkgs_file; - int packages = 0; +void detect_pkgs(void) { + FILE *pkgs_file; + int packages = 0; - pkgs_file = popen("pkg list | wc -l", "r"); - fscanf(pkgs_file, "%d", &packages); - pclose(pkgs_file); + pkgs_file = popen("pkg list | wc -l", "r"); + fscanf(pkgs_file, "%d", &packages); + pclose(pkgs_file); - snprintf(pkgs_str, MAX_STRLEN, "%d", packages); + snprintf(pkgs_str, MAX_STRLEN, "%d", packages); - return; + return; } /* detect_cpu - detects the computer's CPU brand/name-string + detects the computer's CPU brand/name-string */ -void detect_cpu(void) -{ - FILE *cpu_file; +void detect_cpu(void) { + FILE *cpu_file; - cpu_file = popen("psrinfo -pv | tail -1 | tr -d '\\t\\n'", "r"); - fgets(cpu_str, MAX_STRLEN, cpu_file); - pclose(cpu_file); + cpu_file = popen("psrinfo -pv | tail -1 | tr -d '\\t\\n'", "r"); + fgets(cpu_str, MAX_STRLEN, cpu_file); + pclose(cpu_file); - return; + return; } /* detect_gpu - detects the computer's GPU brand/name-string + detects the computer's GPU brand/name-string */ -void detect_gpu(void) -{ - FILE *gpu_file; +void detect_gpu(void) { + FILE *gpu_file; - gpu_file = popen("detectgpu 2>/dev/null", "r"); - fgets(gpu_str, MAX_STRLEN, gpu_file); - pclose(gpu_file); + gpu_file = popen("detectgpu 2>/dev/null", "r"); + fgets(gpu_str, MAX_STRLEN, gpu_file); + pclose(gpu_file); - return; + return; } /* detect_disk - detects the computer's total disk capacity and usage + detects the computer's total disk capacity and usage */ -void detect_disk(void) -{ - struct statvfs disk_info; - unsigned long disk_total = 0, disk_used = 0, disk_percentage = 0; - - if (!(statvfs(getenv("HOME"), &disk_info))) - { - disk_total = ((disk_info.f_blocks * disk_info.f_bsize) / GB); - disk_used = (((disk_info.f_blocks - disk_info.f_bfree) * disk_info.f_bsize) / GB); - disk_percentage = (((float) disk_used / disk_total) * 100); - snprintf(disk_str, MAX_STRLEN, "%ldG / %ldG (%ld%%)", disk_used, disk_total, disk_percentage); - } - else if (error) - { - ERR_REPORT("Could not stat $HOME for filesystem statistics."); - } - - return; +void detect_disk(void) { + struct statvfs disk_info; + unsigned long disk_total = 0, disk_used = 0, disk_percentage = 0; + + if (!(statvfs(getenv("HOME"), &disk_info))) { + disk_total = ((disk_info.f_blocks * disk_info.f_bsize) / GB); + disk_used = (((disk_info.f_blocks - disk_info.f_bfree) * disk_info.f_bsize) / GB); + disk_percentage = (((float)disk_used / disk_total) * 100); + snprintf(disk_str, MAX_STRLEN, "%ldG / %ldG (%ld%%)", disk_used, disk_total, disk_percentage); + } else if (error) { + ERR_REPORT("Could not stat $HOME for filesystem statistics."); + } + + return; } /* detect_mem - detects the computer's total and used RAM + detects the computer's total and used RAM */ -void detect_mem(void) -{ - long long total_mem = 0; +void detect_mem(void) { + long long total_mem = 0; - total_mem = (long long)sysconf(_SC_PHYS_PAGES) * (long long)sysconf(_SC_PAGE_SIZE); - total_mem /= MB; + total_mem = (long long)sysconf(_SC_PHYS_PAGES) * (long long)sysconf(_SC_PAGE_SIZE); + total_mem /= MB; - /* sar -r 1 to get free pages? */ + /* sar -r 1 to get free pages? */ - snprintf(mem_str, MAX_STRLEN, "%lld%s", total_mem, "MB"); + snprintf(mem_str, MAX_STRLEN, "%lld%s", total_mem, "MB"); - return; + return; } /* detect_shell - detects the shell currently running on the computer - -- - CAVEAT: shell version detection relies on the standard versioning format for - each shell. If any shell's older (or newer versions) suddenly begin to use a new - scheme, the version may be displayed incorrectly. - -- + detects the shell currently running on the computer + -- + CAVEAT: shell version detection relies on the standard versioning format for + each shell. If any shell's older (or newer versions) suddenly begin to use a new + scheme, the version may be displayed incorrectly. + -- */ -void detect_shell(void) -{ - FILE *shell_file; - char *shell_name; - char vers_str[MAX_STRLEN]; - - shell_name = getenv("SHELL"); - - if (shell_name == NULL) - { - if (error) - ERR_REPORT("Could not detect a shell."); - - return; - } - - if (STREQ(shell_name, "/bin/sh")) - { - safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); - } - else if (strstr(shell_name, "bash")) - { - shell_file = popen("bash --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); - pclose(shell_file); - } - else if (strstr(shell_name, "zsh")) - { - shell_file = popen("zsh --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); - pclose(shell_file); - } - else if (strstr(shell_name, "csh")) - { - shell_file = popen("csh --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); - pclose(shell_file); - } - else if (strstr(shell_name, "fish")) - { - shell_file = popen("fish --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); - pclose(shell_file); - } - else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") - || strstr(shell_name, "ksh")) - { - /* i don't have a version detection system for these, yet */ - safe_strncpy(shell_str, shell_name, MAX_STRLEN); - } - - return; +void detect_shell(void) { + FILE *shell_file; + char *shell_name; + char vers_str[MAX_STRLEN]; + + shell_name = getenv("SHELL"); + + if (shell_name == NULL) { + if (error) + ERR_REPORT("Could not detect a shell."); + + return; + } + + if (STREQ(shell_name, "/bin/sh")) { + safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); + } else if (strstr(shell_name, "bash")) { + shell_file = popen("bash --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); + pclose(shell_file); + } else if (strstr(shell_name, "zsh")) { + shell_file = popen("zsh --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); + pclose(shell_file); + } else if (strstr(shell_name, "csh")) { + shell_file = popen("csh --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); + pclose(shell_file); + } else if (strstr(shell_name, "fish")) { + shell_file = popen("fish --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); + pclose(shell_file); + } else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") || strstr(shell_name, "ksh")) { + /* i don't have a version detection system for these, yet */ + safe_strncpy(shell_str, shell_name, MAX_STRLEN); + } + + return; } /* detect_res - detects the combined resolution of all monitors attached to the computer + detects the combined resolution of all monitors attached to the computer */ -void detect_res(void) -{ - int width = 0; - int height = 0; - Display *disp; - Screen *screen; - - if ((disp = XOpenDisplay(NULL))) - { - screen = XDefaultScreenOfDisplay(disp); - width = WidthOfScreen(screen); - height = HeightOfScreen(screen); - snprintf(res_str, MAX_STRLEN, "%dx%d", width, height); - XCloseDisplay(disp); - } - else - { - safe_strncpy(res_str, "No X Server", MAX_STRLEN); - if (error) - ERR_REPORT("Problem detecting X display resolution."); - } - - - return; +void detect_res(void) { + int width = 0; + int height = 0; + Display *disp; + Screen *screen; + + if ((disp = XOpenDisplay(NULL))) { + screen = XDefaultScreenOfDisplay(disp); + width = WidthOfScreen(screen); + height = HeightOfScreen(screen); + snprintf(res_str, MAX_STRLEN, "%dx%d", width, height); + XCloseDisplay(disp); + } else { + safe_strncpy(res_str, "No X Server", MAX_STRLEN); + if (error) + ERR_REPORT("Problem detecting X display resolution."); + } + + return; } /* detect_de - detects the desktop environment currently running on top of the OS + detects the desktop environment currently running on top of the OS */ -void detect_de(void) -{ - char *curr_de; - - if ((curr_de = getenv("XDG_CURRENT_DESKTOP"))) - { - safe_strncpy(de_str, curr_de, MAX_STRLEN); - } - else - { - if (getenv("GNOME_DESKTOP_SESSION_ID")) - { - safe_strncpy(de_str, "Gnome", MAX_STRLEN); - } - else if (getenv("MATE_DESKTOP_SESSION_ID")) - { - safe_strncpy(de_str, "MATE", MAX_STRLEN); - } - else if (getenv("KDE_FULL_SESSION")) - { - /* KDE_SESSION_VERSION only exists on KDE4+, so - getenv will return NULL on KDE <= 3. - */ - snprintf(de_str, MAX_STRLEN, "KDE%s", getenv("KDE_SESSION_VERSION")); - } - else if (error) - { - ERR_REPORT("No desktop environment found."); - } - } - - return; +void detect_de(void) { + char *curr_de; + + if ((curr_de = getenv("XDG_CURRENT_DESKTOP"))) { + safe_strncpy(de_str, curr_de, MAX_STRLEN); + } else { + if (getenv("GNOME_DESKTOP_SESSION_ID")) { + safe_strncpy(de_str, "Gnome", MAX_STRLEN); + } else if (getenv("MATE_DESKTOP_SESSION_ID")) { + safe_strncpy(de_str, "MATE", MAX_STRLEN); + } else if (getenv("KDE_FULL_SESSION")) { + /* KDE_SESSION_VERSION only exists on KDE4+, so + getenv will return NULL on KDE <= 3. + */ + snprintf(de_str, MAX_STRLEN, "KDE%s", getenv("KDE_SESSION_VERSION")); + } else if (error) { + ERR_REPORT("No desktop environment found."); + } + } + + return; } /* detect_wm - detects the window manager currently running on top of the OS - -- - CAVEAT: This function relies on the presence of 'detectwm', a shell script. - If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' - -- + detects the window manager currently running on top of the OS + -- + CAVEAT: This function relies on the presence of 'detectwm', a shell script. + If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' + -- */ -void detect_wm(void) -{ - Display *disp; - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes; - char *wm_name = '\0'; - Window *wm_check_window; - - if ((disp = XOpenDisplay(NULL))) - { - if (!(XGetWindowProperty(disp, DefaultRootWindow(disp), - XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", true), - 0, KB, false, XA_WINDOW, &actual_type, &actual_format, &nitems, - &bytes, (unsigned char **) &wm_check_window))) - { - if (!(XGetWindowProperty(disp, *wm_check_window, - XInternAtom(disp, "_NET_WM_NAME", true), 0, KB, false, - XInternAtom(disp, "UTF8_STRING", true), &actual_type, - &actual_format, &nitems, &bytes, (unsigned char **) &wm_name))) - { - safe_strncpy(wm_str, wm_name, MAX_STRLEN); - XFree(wm_name); - } - else if (error) - { - ERR_REPORT("No _NET_WM_NAME property found."); - } - - XFree(wm_check_window); - } - else if (error) - { - ERR_REPORT("WM cannot be detected without EWMH compliance."); - } - - XCloseDisplay(disp); - } - else if (error) - { - ERR_REPORT("Could not open an X display."); - } - - return; +void detect_wm(void) { + Display *disp; + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes; + char *wm_name = '\0'; + Window *wm_check_window; + + if ((disp = XOpenDisplay(NULL))) { + if (!(XGetWindowProperty(disp, DefaultRootWindow(disp), + XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", true), 0, KB, false, + XA_WINDOW, &actual_type, &actual_format, &nitems, &bytes, + (unsigned char **)&wm_check_window))) { + if (!(XGetWindowProperty(disp, *wm_check_window, XInternAtom(disp, "_NET_WM_NAME", true), 0, + KB, false, XInternAtom(disp, "UTF8_STRING", true), &actual_type, + &actual_format, &nitems, &bytes, (unsigned char **)&wm_name))) { + safe_strncpy(wm_str, wm_name, MAX_STRLEN); + XFree(wm_name); + } else if (error) { + ERR_REPORT("No _NET_WM_NAME property found."); + } + + XFree(wm_check_window); + } else if (error) { + ERR_REPORT("WM cannot be detected without EWMH compliance."); + } + + XCloseDisplay(disp); + } else if (error) { + ERR_REPORT("Could not open an X display."); + } + + return; } /* detect_wm_theme - detects the theme associated with the WM detected in detect_wm() - -- - CAVEAT: This function relies on the presence of 'detectwmtheme', a shell script. - If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' - -- + detects the theme associated with the WM detected in detect_wm() + -- + CAVEAT: This function relies on the presence of 'detectwmtheme', a shell script. + If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' + -- */ -void detect_wm_theme(void) -{ - char exec_str[MAX_STRLEN]; - FILE *wm_theme_file; +void detect_wm_theme(void) { + char exec_str[MAX_STRLEN]; + FILE *wm_theme_file; - snprintf(exec_str, MAX_STRLEN, "detectwmtheme %s 2> /dev/null", wm_str); + snprintf(exec_str, MAX_STRLEN, "detectwmtheme %s 2> /dev/null", wm_str); - wm_theme_file = popen(exec_str, "r"); - fgets(wm_theme_str, MAX_STRLEN, wm_theme_file); - pclose(wm_theme_file); + wm_theme_file = popen(exec_str, "r"); + fgets(wm_theme_str, MAX_STRLEN, wm_theme_file); + pclose(wm_theme_file); - return; + return; } /* detect_gtk - detects the theme, icon(s), and font(s) associated with a GTK DE (if present) - -- - CAVEAT: This function relies on the presence of 'detectgtk', a shell script. - If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' - -- + detects the theme, icon(s), and font(s) associated with a GTK DE (if present) + -- + CAVEAT: This function relies on the presence of 'detectgtk', a shell script. + If it isn't present somewhere in the PATH, the WM Theme will be set as 'Unknown' + -- */ -void detect_gtk(void) -{ - safe_strncpy(gtk_str, "Not implemented", MAX_STRLEN); +void detect_gtk(void) { + safe_strncpy(gtk_str, "Not implemented", MAX_STRLEN); - return; + return; } diff --git a/src/plat/win32/bitmap.c b/src/plat/win32/bitmap.c index 5e5734b..ea2a350 100644 --- a/src/plat/win32/bitmap.c +++ b/src/plat/win32/bitmap.c @@ -8,88 +8,77 @@ #include -int createBitmapFile(LPCTSTR lpszFileName, HBITMAP hBitmap, HDC hdc) -{ - BITMAP bitmap; - BITMAPFILEHEADER bitmapFileHeader; - - if (!GetObject(hBitmap, sizeof(BITMAP), &bitmap)) - { - return -1; - } - - int infoHeaderSize = sizeof(BITMAPINFOHEADER); - int rgbQuadSize = sizeof(RGBQUAD); - int bits = bitmap.bmPlanes * bitmap.bmBitsPixel; - int infoHeaderSizeImage = ((bitmap.bmWidth * bits + 31) &~31) / 8 * - bitmap.bmHeight; - - PBITMAPINFO pBitmapInfo = (PBITMAPINFO) LocalAlloc(LPTR, - infoHeaderSize + rgbQuadSize * (1 << bits)); - - pBitmapInfo->bmiHeader.biSize = infoHeaderSize; - pBitmapInfo->bmiHeader.biBitCount = bitmap.bmBitsPixel; - pBitmapInfo->bmiHeader.biClrImportant = 0; - pBitmapInfo->bmiHeader.biClrUsed = 0; - pBitmapInfo->bmiHeader.biCompression = BI_RGB; - pBitmapInfo->bmiHeader.biHeight = bitmap.bmHeight; - pBitmapInfo->bmiHeader.biWidth = bitmap.bmWidth; - pBitmapInfo->bmiHeader.biPlanes = bitmap.bmPlanes; - pBitmapInfo->bmiHeader.biSizeImage = infoHeaderSizeImage; - - PBITMAPINFOHEADER pBitmapInfoHeader = (PBITMAPINFOHEADER) pBitmapInfo; - LPBYTE mem = GlobalAlloc(GMEM_FIXED, pBitmapInfoHeader->biSizeImage); - - if (!mem) - { - return -1; - } - - if (!GetDIBits(hdc, hBitmap, 0, pBitmapInfoHeader->biHeight, mem, pBitmapInfo, - DIB_RGB_COLORS)) - { - return -1; - } - - int fileHeaderSize = sizeof(BITMAPFILEHEADER); - int fileAndInfoHeaderSize = fileHeaderSize + infoHeaderSize + - pBitmapInfoHeader->biClrUsed * rgbQuadSize; - - bitmapFileHeader.bfType = 'B' + ('M' << 8); - bitmapFileHeader.bfOffBits = fileAndInfoHeaderSize; - bitmapFileHeader.bfSize = fileAndInfoHeaderSize + pBitmapInfoHeader->biSizeImage; - bitmapFileHeader.bfReserved1 = 0; - bitmapFileHeader.bfReserved2 = 0; - - HANDLE handleFile = CreateFile(lpszFileName, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - - if (handleFile == INVALID_HANDLE_VALUE) - { - return -1; - } - - if (!WriteFile(handleFile, &bitmapFileHeader, fileHeaderSize, NULL, NULL)) - { - return -1; - } - - if (!WriteFile(handleFile, pBitmapInfoHeader, - infoHeaderSize + pBitmapInfoHeader->biClrUsed * rgbQuadSize, NULL, NULL)) - { - return -1; - } - - if (!WriteFile(handleFile, mem, pBitmapInfoHeader->biSizeImage, NULL, NULL)) - { - return -1; - } - - if (!CloseHandle(handleFile)) - { - return -1; - } - - GlobalFree(mem); - return 0; +int createBitmapFile(LPCTSTR lpszFileName, HBITMAP hBitmap, HDC hdc) { + BITMAP bitmap; + BITMAPFILEHEADER bitmapFileHeader; + + if (!GetObject(hBitmap, sizeof(BITMAP), &bitmap)) { + return -1; + } + + int infoHeaderSize = sizeof(BITMAPINFOHEADER); + int rgbQuadSize = sizeof(RGBQUAD); + int bits = bitmap.bmPlanes * bitmap.bmBitsPixel; + int infoHeaderSizeImage = ((bitmap.bmWidth * bits + 31) & ~31) / 8 * bitmap.bmHeight; + + PBITMAPINFO pBitmapInfo = + (PBITMAPINFO)LocalAlloc(LPTR, infoHeaderSize + rgbQuadSize * (1 << bits)); + + pBitmapInfo->bmiHeader.biSize = infoHeaderSize; + pBitmapInfo->bmiHeader.biBitCount = bitmap.bmBitsPixel; + pBitmapInfo->bmiHeader.biClrImportant = 0; + pBitmapInfo->bmiHeader.biClrUsed = 0; + pBitmapInfo->bmiHeader.biCompression = BI_RGB; + pBitmapInfo->bmiHeader.biHeight = bitmap.bmHeight; + pBitmapInfo->bmiHeader.biWidth = bitmap.bmWidth; + pBitmapInfo->bmiHeader.biPlanes = bitmap.bmPlanes; + pBitmapInfo->bmiHeader.biSizeImage = infoHeaderSizeImage; + + PBITMAPINFOHEADER pBitmapInfoHeader = (PBITMAPINFOHEADER)pBitmapInfo; + LPBYTE mem = GlobalAlloc(GMEM_FIXED, pBitmapInfoHeader->biSizeImage); + + if (!mem) { + return -1; + } + + if (!GetDIBits(hdc, hBitmap, 0, pBitmapInfoHeader->biHeight, mem, pBitmapInfo, DIB_RGB_COLORS)) { + return -1; + } + + int fileHeaderSize = sizeof(BITMAPFILEHEADER); + int fileAndInfoHeaderSize = + fileHeaderSize + infoHeaderSize + pBitmapInfoHeader->biClrUsed * rgbQuadSize; + + bitmapFileHeader.bfType = 'B' + ('M' << 8); + bitmapFileHeader.bfOffBits = fileAndInfoHeaderSize; + bitmapFileHeader.bfSize = fileAndInfoHeaderSize + pBitmapInfoHeader->biSizeImage; + bitmapFileHeader.bfReserved1 = 0; + bitmapFileHeader.bfReserved2 = 0; + + HANDLE handleFile = + CreateFile(lpszFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + if (handleFile == INVALID_HANDLE_VALUE) { + return -1; + } + + if (!WriteFile(handleFile, &bitmapFileHeader, fileHeaderSize, NULL, NULL)) { + return -1; + } + + if (!WriteFile(handleFile, pBitmapInfoHeader, + infoHeaderSize + pBitmapInfoHeader->biClrUsed * rgbQuadSize, NULL, NULL)) { + return -1; + } + + if (!WriteFile(handleFile, mem, pBitmapInfoHeader->biSizeImage, NULL, NULL)) { + return -1; + } + + if (!CloseHandle(handleFile)) { + return -1; + } + + GlobalFree(mem); + return 0; } diff --git a/src/plat/win32/detect.c b/src/plat/win32/detect.c index 9e75069..4da1b2c 100644 --- a/src/plat/win32/detect.c +++ b/src/plat/win32/detect.c @@ -15,7 +15,7 @@ #include #include #ifndef __MINGW32__ -# include +#include #endif /* Windows-specific includes */ @@ -36,532 +36,449 @@ extern int pclose(FILE *stream); #include "../../error_flag.h" /* detect_distro - detects the computer's distribution (Windows version) + detects the computer's distribution (Windows version) */ -void detect_distro(void) -{ - OSVERSIONINFO vers_info; - int major, minor; - - vers_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&vers_info); - major = vers_info.dwMajorVersion; - minor = vers_info.dwMinorVersion; - - /* if distro_str was NOT set by the -D flag */ - if (STREQ(distro_str, "Unknown")) - { - switch (major) - { - case 10: - safe_strncpy(distro_str, "Microsoft Windows 10", MAX_STRLEN); - break; - case 6: - switch (minor) - { - case 3: - safe_strncpy(distro_str, "Microsoft Windows 8.1", MAX_STRLEN); - break; - case 2: - safe_strncpy(distro_str, "Microsoft Windows 8", MAX_STRLEN); - break; - case 1: - safe_strncpy(distro_str, "Microsoft Windows 7", MAX_STRLEN); - break; - case 0: - safe_strncpy(distro_str, "Microsoft Windows Vista", MAX_STRLEN); - break; - } - break; - case 5: - switch (minor) - { - case 1: - safe_strncpy(distro_str, "Microsoft Windows XP", MAX_STRLEN); - break; - case 0: - safe_strncpy(distro_str, "Microsoft Windows 2000", MAX_STRLEN); - break; - } - break; - default: - safe_strncpy(distro_str, "Microsoft Windows", MAX_STRLEN); - break; - } - } - - // TODO: This should really go somewhere else. - if (major == 10 || (major == 6 && (minor == 3 || minor == 2))) - { - safe_strncpy(host_color, TLBL, MAX_STRLEN); - } - else - { - safe_strncpy(host_color, TRED, MAX_STRLEN); - } - - return; +void detect_distro(void) { + OSVERSIONINFO vers_info; + int major, minor; + + vers_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&vers_info); + major = vers_info.dwMajorVersion; + minor = vers_info.dwMinorVersion; + + /* if distro_str was NOT set by the -D flag */ + if (STREQ(distro_str, "Unknown")) { + switch (major) { + case 10: + safe_strncpy(distro_str, "Microsoft Windows 10", MAX_STRLEN); + break; + case 6: + switch (minor) { + case 3: + safe_strncpy(distro_str, "Microsoft Windows 8.1", MAX_STRLEN); + break; + case 2: + safe_strncpy(distro_str, "Microsoft Windows 8", MAX_STRLEN); + break; + case 1: + safe_strncpy(distro_str, "Microsoft Windows 7", MAX_STRLEN); + break; + case 0: + safe_strncpy(distro_str, "Microsoft Windows Vista", MAX_STRLEN); + break; + } + break; + case 5: + switch (minor) { + case 1: + safe_strncpy(distro_str, "Microsoft Windows XP", MAX_STRLEN); + break; + case 0: + safe_strncpy(distro_str, "Microsoft Windows 2000", MAX_STRLEN); + break; + } + break; + default: + safe_strncpy(distro_str, "Microsoft Windows", MAX_STRLEN); + break; + } + } + + // TODO: This should really go somewhere else. + if (major == 10 || (major == 6 && (minor == 3 || minor == 2))) { + safe_strncpy(host_color, TLBL, MAX_STRLEN); + } else { + safe_strncpy(host_color, TRED, MAX_STRLEN); + } + + return; } /* detect_host - detects the computer's hostname and active user and formats them + detects the computer's hostname and active user and formats them */ -void detect_host(void) -{ - char *given_user = "Unknown"; - char given_host[MAX_STRLEN] = "Unknown"; - - given_user = malloc(sizeof(char) * MAX_STRLEN); - if (!given_user) - { - ERR_REPORT("Memory allocation failed in detect_host."); - exit(1); - } - - DWORD username_len = MAX_STRLEN; - GetUserName(given_user, &username_len); +void detect_host(void) { + char *given_user = "Unknown"; + char given_host[MAX_STRLEN] = "Unknown"; + + given_user = malloc(sizeof(char) * MAX_STRLEN); + if (!given_user) { + ERR_REPORT("Memory allocation failed in detect_host."); + exit(1); + } + + DWORD username_len = MAX_STRLEN; + GetUserName(given_user, &username_len); #ifdef __MINGW32__ - DWORD hostname_len = MAX_STRLEN; - GetComputerNameEx(ComputerNameDnsHostname, given_host, &hostname_len); + DWORD hostname_len = MAX_STRLEN; + GetComputerNameEx(ComputerNameDnsHostname, given_host, &hostname_len); #else - gethostname(given_host, MAX_STRLEN); + gethostname(given_host, MAX_STRLEN); #endif - snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", - host_color, given_user, TNRM, TWHT, TNRM, host_color, given_host, TNRM); + snprintf(host_str, MAX_STRLEN, "%s%s%s%s@%s%s%s%s", host_color, given_user, TNRM, TWHT, TNRM, + host_color, given_host, TNRM); - free(given_user); + free(given_user); - return; + return; } /* detect_kernel - detects the computer's kernel + detects the computer's kernel */ -void detect_kernel(void) -{ - OSVERSIONINFO kern_info; - SYSTEM_INFO arch_info; - char arch_str[MAX_STRLEN]; - - ZeroMemory(&kern_info, sizeof(OSVERSIONINFO)); - kern_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&kern_info); - - GetNativeSystemInfo(&arch_info); - - if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - { - safe_strncpy(arch_str, "AMD64", MAX_STRLEN); - } - else if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM) - { - safe_strncpy(arch_str, "ARM", MAX_STRLEN); - } - else if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) - { - safe_strncpy(arch_str, "IA64", MAX_STRLEN); - } - else if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) - { - safe_strncpy(arch_str, "x86", MAX_STRLEN); - } - else - { - safe_strncpy(arch_str, "Unknown", MAX_STRLEN); - } - - snprintf(kernel_str, MAX_STRLEN, "Windows NT %d.%d build %d (%s)", - (int) kern_info.dwMajorVersion, (int) kern_info.dwMinorVersion, - (int) kern_info.dwBuildNumber, arch_str); - - return; +void detect_kernel(void) { + OSVERSIONINFO kern_info; + SYSTEM_INFO arch_info; + char arch_str[MAX_STRLEN]; + + ZeroMemory(&kern_info, sizeof(OSVERSIONINFO)); + kern_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&kern_info); + + GetNativeSystemInfo(&arch_info); + + if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + safe_strncpy(arch_str, "AMD64", MAX_STRLEN); + } else if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM) { + safe_strncpy(arch_str, "ARM", MAX_STRLEN); + } else if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) { + safe_strncpy(arch_str, "IA64", MAX_STRLEN); + } else if (arch_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { + safe_strncpy(arch_str, "x86", MAX_STRLEN); + } else { + safe_strncpy(arch_str, "Unknown", MAX_STRLEN); + } + + snprintf(kernel_str, MAX_STRLEN, "Windows NT %d.%d build %d (%s)", (int)kern_info.dwMajorVersion, + (int)kern_info.dwMinorVersion, (int)kern_info.dwBuildNumber, arch_str); + + return; } - /* detect_uptime - detects the computer's uptime + detects the computer's uptime */ -void detect_uptime(void) -{ - long uptime = 0; - unsigned int secs = 0; - unsigned int mins = 0; - unsigned int hrs = 0; - unsigned int days = 0; +void detect_uptime(void) { + long uptime = 0; + unsigned int secs = 0; + unsigned int mins = 0; + unsigned int hrs = 0; + unsigned int days = 0; - uptime = GetTickCount(); /* known problem: will rollover after 49.7 days */ - uptime /= 1000; + uptime = GetTickCount(); /* known problem: will rollover after 49.7 days */ + uptime /= 1000; - split_uptime(uptime, &secs, &mins, &hrs, &days); + split_uptime(uptime, &secs, &mins, &hrs, &days); - if (days > 0) - snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); - else - snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); + if (days > 0) + snprintf(uptime_str, MAX_STRLEN, "%dd %dh %dm %ds", days, hrs, mins, secs); + else + snprintf(uptime_str, MAX_STRLEN, "%dh %dm %ds", hrs, mins, secs); - return; + return; } /* detect_pkgs - detects the number of packages installed on the computer + detects the number of packages installed on the computer */ -void detect_pkgs(void) -{ -#ifndef __MINGW32__ /* maybe count Chocolatey packages? */ - const char *pattern; - glob_t globbuf; +void detect_pkgs(void) { +#ifndef __MINGW32__ /* maybe count Chocolatey packages? */ + const char *pattern; + glob_t globbuf; #if defined(__MSYS__) - /* MSYS2 */ - /* ignores: ALPM_DB_VERSION */ - pattern = "/var/lib/pacman/local/*-*"; + /* MSYS2 */ + /* ignores: ALPM_DB_VERSION */ + pattern = "/var/lib/pacman/local/*-*"; #else - /* Cygwin */ - /* ignores: installed.db setup.rc timestamp */ - pattern = "/etc/setup/*.lst.*"; + /* Cygwin */ + /* ignores: installed.db setup.rc timestamp */ + pattern = "/etc/setup/*.lst.*"; #endif - globbuf.gl_offs = 1; - glob(pattern, GLOB_DOOFFS, NULL, &globbuf); - snprintf(pkgs_str, MAX_STRLEN, "%d", (int) globbuf.gl_pathc); - globfree(&globbuf); -#endif /* !__MINGW32__ */ + globbuf.gl_offs = 1; + glob(pattern, GLOB_DOOFFS, NULL, &globbuf); + snprintf(pkgs_str, MAX_STRLEN, "%d", (int)globbuf.gl_pathc); + globfree(&globbuf); +#endif /* !__MINGW32__ */ - return; + return; } /* detect_cpu - detects the computer's CPU brand/name-string + detects the computer's CPU brand/name-string */ -void detect_cpu(void) -{ - HKEY hkey; - DWORD str_size = MAX_STRLEN; +void detect_cpu(void) { + HKEY hkey; + DWORD str_size = MAX_STRLEN; - RegOpenKey(HKEY_LOCAL_MACHINE, - "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &hkey); - RegQueryValueEx(hkey, "ProcessorNameString", 0, NULL, (BYTE *) cpu_str, - &str_size); + RegOpenKey(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &hkey); + RegQueryValueEx(hkey, "ProcessorNameString", 0, NULL, (BYTE *)cpu_str, &str_size); - return; + return; } /* detect_gpu - detects the computer's GPU brand/name-string + detects the computer's GPU brand/name-string */ -void detect_gpu(void) -{ - HKEY hkey; - DWORD str_size = MAX_STRLEN; - - RegOpenKey(HKEY_LOCAL_MACHINE, - "SYSTEM\\ControlSet001\\Control\\Class\\" - "{4D36E968-E325-11CE-BFC1-08002BE10318}\\0000\\Settings", &hkey); - RegQueryValueEx(hkey, "Device Description", 0, NULL, (BYTE *) gpu_str, - &str_size); - - return; +void detect_gpu(void) { + HKEY hkey; + DWORD str_size = MAX_STRLEN; + + RegOpenKey(HKEY_LOCAL_MACHINE, + "SYSTEM\\ControlSet001\\Control\\Class\\" + "{4D36E968-E325-11CE-BFC1-08002BE10318}\\0000\\Settings", + &hkey); + RegQueryValueEx(hkey, "Device Description", 0, NULL, (BYTE *)gpu_str, &str_size); + + return; } /* detect_disk - detects the computer's total disk capacity and usage + detects the computer's total disk capacity and usage */ -void detect_disk(void) -{ - char *disk_unit; - long long totalBytes, freeBytes, usedBytes, disk_used, disk_total, - disk_percentage; +void detect_disk(void) { + char *disk_unit; + long long totalBytes, freeBytes, usedBytes, disk_used, disk_total, disk_percentage; - char drive[MAX_STRLEN]; + char drive[MAX_STRLEN]; #ifdef __MINGW32__ - char buf[MAX_STRLEN]; - - if (GetSystemDirectory(buf, MAX_STRLEN)) - { - snprintf(drive, MAX_STRLEN, "%c:\\", buf[0]); - } - else - { - if (GetEnvironmentVariable("SystemDrive", buf, MAX_STRLEN)) - { - snprintf(drive, MAX_STRLEN, "%c:\\", buf[0]); - } - else - { - snprintf(drive, MAX_STRLEN, "C:\\"); - } - } + char buf[MAX_STRLEN]; + + if (GetSystemDirectory(buf, MAX_STRLEN)) { + snprintf(drive, MAX_STRLEN, "%c:\\", buf[0]); + } else { + if (GetEnvironmentVariable("SystemDrive", buf, MAX_STRLEN)) { + snprintf(drive, MAX_STRLEN, "%c:\\", buf[0]); + } else { + snprintf(drive, MAX_STRLEN, "C:\\"); + } + } #else - FILE *disk_file; + FILE *disk_file; - disk_file = popen("cygpath -w / | head -c3", "r"); - fscanf(disk_file, "%s", (char *)drive); - pclose(disk_file); + disk_file = popen("cygpath -w / | head -c3", "r"); + fscanf(disk_file, "%s", (char *)drive); + pclose(disk_file); #endif - if (GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER) &totalBytes, - (PULARGE_INTEGER) &freeBytes)) - { - usedBytes = totalBytes - freeBytes; - - if (usedBytes >= GB) - { - disk_used = usedBytes / GB; - disk_unit = "G"; - } - else - { - disk_used = usedBytes / MB; - disk_unit = "M"; - } - - disk_total = totalBytes / GB; - disk_percentage = (usedBytes * 100) / totalBytes; - - snprintf(disk_str, MAX_STRLEN, "%lld%s / %lldG (%lld%%) [%s]", disk_used, - disk_unit, disk_total, disk_percentage, drive); - } - - return; + if (GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&totalBytes, (PULARGE_INTEGER)&freeBytes)) { + usedBytes = totalBytes - freeBytes; + + if (usedBytes >= GB) { + disk_used = usedBytes / GB; + disk_unit = "G"; + } else { + disk_used = usedBytes / MB; + disk_unit = "M"; + } + + disk_total = totalBytes / GB; + disk_percentage = (usedBytes * 100) / totalBytes; + + snprintf(disk_str, MAX_STRLEN, "%lld%s / %lldG (%lld%%) [%s]", disk_used, disk_unit, disk_total, + disk_percentage, drive); + } + + return; } /* detect_mem - detects the computer's total and used RAM + detects the computer's total and used RAM */ -void detect_mem(void) -{ - long long total_mem = 0; - long long used_mem = 0; - MEMORYSTATUSEX mem_stat; +void detect_mem(void) { + long long total_mem = 0; + long long used_mem = 0; + MEMORYSTATUSEX mem_stat; - mem_stat.dwLength = sizeof(mem_stat); - GlobalMemoryStatusEx(&mem_stat); + mem_stat.dwLength = sizeof(mem_stat); + GlobalMemoryStatusEx(&mem_stat); - total_mem = (long long) mem_stat.ullTotalPhys / MB; - used_mem = total_mem - ((long long) mem_stat.ullAvailPhys / MB); + total_mem = (long long)mem_stat.ullTotalPhys / MB; + used_mem = total_mem - ((long long)mem_stat.ullAvailPhys / MB); - snprintf(mem_str, MAX_STRLEN, "%lld%s / %lld%s", used_mem, "MB", total_mem, "MB"); + snprintf(mem_str, MAX_STRLEN, "%lld%s / %lld%s", used_mem, "MB", total_mem, "MB"); - return; + return; } /* detect_shell - detects the shell currently running on the computer - -- - CAVEAT: shell version detection relies on the standard versioning format for - each shell. If any shell's older (or newer versions) suddenly begin to use a new - scheme, the version may be displayed incorrectly. - -- + detects the shell currently running on the computer + -- + CAVEAT: shell version detection relies on the standard versioning format for + each shell. If any shell's older (or newer versions) suddenly begin to use a new + scheme, the version may be displayed incorrectly. + -- */ -void detect_shell(void) -{ - char *shell_name; +void detect_shell(void) { + char *shell_name; #ifndef __MINGW32__ - FILE *shell_file; - char vers_str[MAX_STRLEN]; + FILE *shell_file; + char vers_str[MAX_STRLEN]; #endif - shell_name = getenv("SHELL"); + shell_name = getenv("SHELL"); - if (shell_name == NULL) - { - if (error) - ERR_REPORT("Could not detect a shell."); + if (shell_name == NULL) { + if (error) + ERR_REPORT("Could not detect a shell."); - return; - } + return; + } #ifndef __MINGW32__ - if (STREQ(shell_name, "/bin/sh")) - { - safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); - } - else if (strstr(shell_name, "bash")) - { - shell_file = popen("bash --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); - pclose(shell_file); - } - else if (strstr(shell_name, "zsh")) - { - shell_file = popen("zsh --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); - pclose(shell_file); - } - else if (strstr(shell_name, "csh")) - { - shell_file = popen("csh --version | head -1", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); - pclose(shell_file); - } - else if (strstr(shell_name, "fish")) - { - shell_file = popen("fish --version", "r"); - fgets(vers_str, MAX_STRLEN, shell_file); - snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); - pclose(shell_file); - } - else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") - || strstr(shell_name, "ksh")) - { - /* i don't have a version detection system for these, yet */ - safe_strncpy(shell_str, shell_name, MAX_STRLEN); - } -#else /* __MINGW32__ */ - /* limited shell detection when running in Cygwin or MSYS2 */ - if (strstr(shell_name, "cmd.exe")) - { - safe_strncpy(shell_str, "Command Prompt (cmd.exe)", MAX_STRLEN); - } - else if (strstr(shell_name, "PowerShell")) - { - safe_strncpy(shell_str, "Windows PowerShell", MAX_STRLEN); - } - else if (strstr(shell_name, "/bin/sh")) - { - safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); - } - else if (strstr(shell_name, "bash")) - { - snprintf(shell_str, MAX_STRLEN, "bash"); - } - else if (strstr(shell_name, "zsh")) - { - snprintf(shell_str, MAX_STRLEN, "zsh"); - } - else if (strstr(shell_name, "csh")) - { - snprintf(shell_str, MAX_STRLEN, "csh"); - } - else if (strstr(shell_name, "fish")) - { - snprintf(shell_str, MAX_STRLEN, "fish"); - } - else if (strstr(shell_name, "dash")) - { - snprintf(shell_str, MAX_STRLEN, "dash"); - } - else if (strstr(shell_name, "ash")) - { - snprintf(shell_str, MAX_STRLEN, "ash"); - } - else if (strstr(shell_name, "ksh")) - { - snprintf(shell_str, MAX_STRLEN, "ksh"); - } + if (STREQ(shell_name, "/bin/sh")) { + safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); + } else if (strstr(shell_name, "bash")) { + shell_file = popen("bash --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "bash %.*s", 17, vers_str + 10); + pclose(shell_file); + } else if (strstr(shell_name, "zsh")) { + shell_file = popen("zsh --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "zsh %.*s", 5, vers_str + 4); + pclose(shell_file); + } else if (strstr(shell_name, "csh")) { + shell_file = popen("csh --version | head -1", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "csh %.*s", 7, vers_str + 5); + pclose(shell_file); + } else if (strstr(shell_name, "fish")) { + shell_file = popen("fish --version", "r"); + fgets(vers_str, MAX_STRLEN, shell_file); + snprintf(shell_str, MAX_STRLEN, "fish %.*s", 13, vers_str + 6); + pclose(shell_file); + } else if (strstr(shell_name, "dash") || strstr(shell_name, "ash") || strstr(shell_name, "ksh")) { + /* i don't have a version detection system for these, yet */ + safe_strncpy(shell_str, shell_name, MAX_STRLEN); + } +#else /* __MINGW32__ */ + /* limited shell detection when running in Cygwin or MSYS2 */ + if (strstr(shell_name, "cmd.exe")) { + safe_strncpy(shell_str, "Command Prompt (cmd.exe)", MAX_STRLEN); + } else if (strstr(shell_name, "PowerShell")) { + safe_strncpy(shell_str, "Windows PowerShell", MAX_STRLEN); + } else if (strstr(shell_name, "/bin/sh")) { + safe_strncpy(shell_str, "POSIX sh", MAX_STRLEN); + } else if (strstr(shell_name, "bash")) { + snprintf(shell_str, MAX_STRLEN, "bash"); + } else if (strstr(shell_name, "zsh")) { + snprintf(shell_str, MAX_STRLEN, "zsh"); + } else if (strstr(shell_name, "csh")) { + snprintf(shell_str, MAX_STRLEN, "csh"); + } else if (strstr(shell_name, "fish")) { + snprintf(shell_str, MAX_STRLEN, "fish"); + } else if (strstr(shell_name, "dash")) { + snprintf(shell_str, MAX_STRLEN, "dash"); + } else if (strstr(shell_name, "ash")) { + snprintf(shell_str, MAX_STRLEN, "ash"); + } else if (strstr(shell_name, "ksh")) { + snprintf(shell_str, MAX_STRLEN, "ksh"); + } #endif - return; + return; } /* detect_res - detects the combined resolution of all monitors attached to the computer + detects the combined resolution of all monitors attached to the computer */ -void detect_res(void) -{ - int width = 0; - int height = 0; +void detect_res(void) { + int width = 0; + int height = 0; - width = GetSystemMetrics(SM_CXVIRTUALSCREEN); - height = GetSystemMetrics(SM_CYVIRTUALSCREEN); + width = GetSystemMetrics(SM_CXVIRTUALSCREEN); + height = GetSystemMetrics(SM_CYVIRTUALSCREEN); - snprintf(res_str, MAX_STRLEN, "%dx%d", width, height); + snprintf(res_str, MAX_STRLEN, "%dx%d", width, height); - return; + return; } /* detect_de - detects the desktop environment currently running on top of the OS. - On Windows, this will always be either Luna, Aero, or Metro. + detects the desktop environment currently running on top of the OS. + On Windows, this will always be either Luna, Aero, or Metro. */ -void detect_de(void) -{ - OSVERSIONINFO vers_info; - int major, minor; - - vers_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&vers_info); - major = vers_info.dwMajorVersion; - minor = vers_info.dwMinorVersion; - - if (major == 10) - safe_strncpy(de_str, "Modern UI/Metro", MAX_STRLEN); - else if (major == 6 && minor >= 2) - safe_strncpy(de_str, "Metro", MAX_STRLEN); - else if (major == 6 && minor <= 1) - safe_strncpy(de_str, "Aero", MAX_STRLEN); - else if (major == 5) - safe_strncpy(de_str, "Luna", MAX_STRLEN); - - return; +void detect_de(void) { + OSVERSIONINFO vers_info; + int major, minor; + + vers_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&vers_info); + major = vers_info.dwMajorVersion; + minor = vers_info.dwMinorVersion; + + if (major == 10) + safe_strncpy(de_str, "Modern UI/Metro", MAX_STRLEN); + else if (major == 6 && minor >= 2) + safe_strncpy(de_str, "Metro", MAX_STRLEN); + else if (major == 6 && minor <= 1) + safe_strncpy(de_str, "Aero", MAX_STRLEN); + else if (major == 5) + safe_strncpy(de_str, "Luna", MAX_STRLEN); + + return; } /* detect_wm - detects the window manager currently running on top of the OS. - On Windows, this will always be DWM/Explorer. + detects the window manager currently running on top of the OS. + On Windows, this will always be DWM/Explorer. */ -void detect_wm(void) -{ - safe_strncpy(wm_str, "DWM/Explorer", MAX_STRLEN); +void detect_wm(void) { + safe_strncpy(wm_str, "DWM/Explorer", MAX_STRLEN); - return; + return; } /* detect_wm_theme - On Windows, detects the current theme running on DWM. + On Windows, detects the current theme running on DWM. */ -void detect_wm_theme(void) -{ - char tmp_theme[MAX_STRLEN] = "Unknown"; - char *suffix; - HKEY hkey; - DWORD str_size = MAX_STRLEN; - - RegOpenKey(HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Themes", &hkey); - RegQueryValueEx(hkey, "CurrentTheme", 0, NULL, (BYTE *) tmp_theme, - &str_size); - - /* if we successfully retrieved a theme from the registry */ - if (!STREQ(tmp_theme, "Unknown")) - { - safe_strncpy(tmp_theme, basename(tmp_theme), MAX_STRLEN); - suffix = tmp_theme + strlen(tmp_theme) - 6; - - /* if our retrieved theme ends with .theme, truncate it */ - if (STREQ(suffix, ".theme")) - { - tmp_theme[strlen(tmp_theme) - 6] = '\0'; - } - } - - safe_strncpy(wm_theme_str, tmp_theme, MAX_STRLEN); - - return; +void detect_wm_theme(void) { + char tmp_theme[MAX_STRLEN] = "Unknown"; + char *suffix; + HKEY hkey; + DWORD str_size = MAX_STRLEN; + + RegOpenKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes", &hkey); + RegQueryValueEx(hkey, "CurrentTheme", 0, NULL, (BYTE *)tmp_theme, &str_size); + + /* if we successfully retrieved a theme from the registry */ + if (!STREQ(tmp_theme, "Unknown")) { + safe_strncpy(tmp_theme, basename(tmp_theme), MAX_STRLEN); + suffix = tmp_theme + strlen(tmp_theme) - 6; + + /* if our retrieved theme ends with .theme, truncate it */ + if (STREQ(suffix, ".theme")) { + tmp_theme[strlen(tmp_theme) - 6] = '\0'; + } + } + + safe_strncpy(wm_theme_str, tmp_theme, MAX_STRLEN); + + return; } /* detect_gtk - On Windows, detects the font associated with Cygwin's terminal (mintty) + On Windows, detects the font associated with Cygwin's terminal (mintty) */ -void detect_gtk(void) -{ +void detect_gtk(void) { #ifdef __MINGW32__ - snprintf(gtk_str, MAX_STRLEN, "none"); + snprintf(gtk_str, MAX_STRLEN, "none"); #else - FILE *gtk_file; - char font_str[MAX_STRLEN] = "Unknown"; + FILE *gtk_file; + char font_str[MAX_STRLEN] = "Unknown"; - gtk_file = popen("grep '^Font=.*' < $HOME/.minttyrc | " - "grep -o '[0-9A-z ]*$' | tr -d '\\r\\n'", "r"); - fgets(font_str, MAX_STRLEN, gtk_file); - pclose(gtk_file); + gtk_file = popen("grep '^Font=.*' < $HOME/.minttyrc | " + "grep -o '[0-9A-z ]*$' | tr -d '\\r\\n'", + "r"); + fgets(font_str, MAX_STRLEN, gtk_file); + pclose(gtk_file); - snprintf(gtk_str, MAX_STRLEN, "%s (Font)", font_str); + snprintf(gtk_str, MAX_STRLEN, "%s (Font)", font_str); #endif - return; + return; } diff --git a/src/tests/gltest.c b/src/tests/gltest.c index ec528e3..4e4a2ab 100644 --- a/src/tests/gltest.c +++ b/src/tests/gltest.c @@ -7,7 +7,6 @@ #include #include -int main(void) -{ - ; +int main(void) { + ; } diff --git a/src/tests/x11test.c b/src/tests/x11test.c index 4cc8df3..dcf9a28 100644 --- a/src/tests/x11test.c +++ b/src/tests/x11test.c @@ -6,7 +6,6 @@ #include -int main(void) -{ - ; +int main(void) { + ; } diff --git a/src/util.c b/src/util.c index 1790768..a2109d4 100644 --- a/src/util.c +++ b/src/util.c @@ -19,154 +19,140 @@ #include "error_flag.h" #if defined(__CYGWIN__) || defined(__MSYS__) || defined(__MINGW32__) - #include - #include "plat/win32/bitmap.h" +#include +#include "plat/win32/bitmap.h" #endif /* safe_strncpy - calls strncpy with the given params, then inserts a terminating NULL - returns a pointer to a string containing the copied data + calls strncpy with the given params, then inserts a terminating NULL + returns a pointer to a string containing the copied data */ -char *safe_strncpy(char *destination, const char *source, size_t num) -{ - char *ret = strncpy(destination, source, num); - ret[num - 1] = '\0'; - return ret; +char *safe_strncpy(char *destination, const char *source, size_t num) { + char *ret = strncpy(destination, source, num); + ret[num - 1] = '\0'; + return ret; } /* split_uptime - splits param uptime into individual time-units - argument long uptime: the uptime, in seconds, to be split - arguments int *secs..*days: pointers to ints for storing the uptime - -- - CAVEAT: uptime MUST be in seconds - -- + splits param uptime into individual time-units + argument long uptime: the uptime, in seconds, to be split + arguments int *secs..*days: pointers to ints for storing the uptime + -- + CAVEAT: uptime MUST be in seconds + -- */ -void split_uptime(long uptime, unsigned int *secs, unsigned int *mins, - unsigned int *hrs, unsigned int *days) -{ - *secs = (unsigned int) uptime % 60; - *mins = (unsigned int) (uptime / 60) % 60; - *hrs = (unsigned int) (uptime / 3600) % 24; - *days = (unsigned int) (uptime / 86400); - - return; +void split_uptime(long uptime, unsigned int *secs, unsigned int *mins, unsigned int *hrs, + unsigned int *days) { + *secs = (unsigned int)uptime % 60; + *mins = (unsigned int)(uptime / 60) % 60; + *hrs = (unsigned int)(uptime / 3600) % 24; + *days = (unsigned int)(uptime / 86400); + + return; } /* take_screenshot - takes a screenshot and saves it to $HOME/screenfetch_screenshot.png + takes a screenshot and saves it to $HOME/screenfetch_screenshot.png */ -void take_screenshot(bool verbose) -{ +void take_screenshot(bool verbose) { #if !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__MINGW32__) - int call_status = 1; - char file_loc[MAX_STRLEN]; + int call_status = 1; + char file_loc[MAX_STRLEN]; #endif - printf("%s", "Taking shot in 3.."); - fflush(stdout); - sleep(1); - printf("%s", "2.."); - fflush(stdout); - sleep(1); - printf("%s", "1.."); - fflush(stdout); - sleep(1); - printf("%s\n", "0"); + printf("%s", "Taking shot in 3.."); + fflush(stdout); + sleep(1); + printf("%s", "2.."); + fflush(stdout); + sleep(1); + printf("%s", "1.."); + fflush(stdout); + sleep(1); + printf("%s\n", "0"); #if defined(__CYGWIN__) || defined(__MSYS__) || defined(__MINGW32__) - HDC screen_dc = GetDC(NULL); - HDC mem_dc = CreateCompatibleDC(screen_dc); + HDC screen_dc = GetDC(NULL); + HDC mem_dc = CreateCompatibleDC(screen_dc); - int horiz = GetDeviceCaps(screen_dc, HORZRES); - int vert = GetDeviceCaps(screen_dc, VERTRES); + int horiz = GetDeviceCaps(screen_dc, HORZRES); + int vert = GetDeviceCaps(screen_dc, VERTRES); - HBITMAP bitmap = CreateCompatibleBitmap(screen_dc, horiz, vert); - HBITMAP old_bitmap = SelectObject(mem_dc, bitmap); + HBITMAP bitmap = CreateCompatibleBitmap(screen_dc, horiz, vert); + HBITMAP old_bitmap = SelectObject(mem_dc, bitmap); - BitBlt(mem_dc, 0, 0, horiz, vert, screen_dc, 0, 0, SRCCOPY); - bitmap = SelectObject(mem_dc, old_bitmap); + BitBlt(mem_dc, 0, 0, horiz, vert, screen_dc, 0, 0, SRCCOPY); + bitmap = SelectObject(mem_dc, old_bitmap); - if (createBitmapFile("screenfetch_screenshot.bmp", bitmap, mem_dc) == 0) - { - VERBOSE_OUT("Screenshot successfully saved.", ""); - } - else - { - ERR_REPORT("Problem saving screenshot."); - } + if (createBitmapFile("screenfetch_screenshot.bmp", bitmap, mem_dc) == 0) { + VERBOSE_OUT("Screenshot successfully saved.", ""); + } else { + ERR_REPORT("Problem saving screenshot."); + } - DeleteDC(screen_dc); - DeleteDC(mem_dc); + DeleteDC(screen_dc); + DeleteDC(mem_dc); #elif defined(__APPLE__) && defined(__MACH__) - call_status = system("screencapture -x ~/screenfetch_screenshot.png 2> /dev/null"); + call_status = system("screencapture -x ~/screenfetch_screenshot.png 2> /dev/null"); #else - call_status = system("scrot ~/screenfetch_screenshot.png 2> /dev/null"); + call_status = system("scrot ~/screenfetch_screenshot.png 2> /dev/null"); #endif #if !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__MINGW32__) - safe_strncpy(file_loc, getenv("HOME"), MAX_STRLEN); - strncat(file_loc, "/screenfetch_screenshot.png", MAX_STRLEN); - - if (FILE_EXISTS(file_loc) && verbose) - { - VERBOSE_OUT("Screenshot successfully saved.", ""); - } - else if (call_status && error) - { - ERR_REPORT("Problem saving screenshot."); - } + safe_strncpy(file_loc, getenv("HOME"), MAX_STRLEN); + strncat(file_loc, "/screenfetch_screenshot.png", MAX_STRLEN); + + if (FILE_EXISTS(file_loc) && verbose) { + VERBOSE_OUT("Screenshot successfully saved.", ""); + } else if (call_status && error) { + ERR_REPORT("Problem saving screenshot."); + } #endif - return; + return; } /* returns 1 if command is in PATH, otherwise 0 -*/ + */ #ifdef __linux -int command_in_path(const char *command) -{ - char *env, *env_copy, *str, *token; - char *file = NULL; - int j, len, rv = 0; - - env = getenv("PATH"); - - if (!command || !env) - { - return 0; - } - - env_copy = strdup(env); - - /* though not really needed, stop after 9999 iterations - to prevent any potential endless loop - */ - for (j = 0, str = env_copy; j < 9999; ++j, str = NULL) - { - len = strlen(command); - token = strtok(str, ":"); - - if (token == NULL || len == 0) - { - rv = 0; - break; - } - - file = malloc(strlen(token) + len + 2); - sprintf(file, "%s/%s", token, command); - - if (FILE_EXISTS(file)) - { - rv = 1; - free(file); - break; - } - free(file); - } - - free(env_copy); - return rv; +int command_in_path(const char *command) { + char *env, *env_copy, *str, *token; + char *file = NULL; + int j, len, rv = 0; + + env = getenv("PATH"); + + if (!command || !env) { + return 0; + } + + env_copy = strdup(env); + + /* though not really needed, stop after 9999 iterations + to prevent any potential endless loop + */ + for (j = 0, str = env_copy; j < 9999; ++j, str = NULL) { + len = strlen(command); + token = strtok(str, ":"); + + if (token == NULL || len == 0) { + rv = 0; + break; + } + + file = malloc(strlen(token) + len + 2); + sprintf(file, "%s/%s", token, command); + + if (FILE_EXISTS(file)) { + rv = 1; + free(file); + break; + } + free(file); + } + + free(env_copy); + return rv; } -#endif /* __linux */ +#endif /* __linux */ diff --git a/src/util.h b/src/util.h index d888824..3ba7e4f 100644 --- a/src/util.h +++ b/src/util.h @@ -10,11 +10,11 @@ #define SCREENFETCH_C_UTIL_H char *safe_strncpy(char *destination, const char *source, size_t num); -void split_uptime(long uptime, unsigned int *secs, unsigned int *mins, - unsigned int *hrs, unsigned int *days); +void split_uptime(long uptime, unsigned int *secs, unsigned int *mins, unsigned int *hrs, + unsigned int *days); void take_screenshot(bool verbose); #ifdef __linux int command_in_path(const char *command); -#endif /* __linux */ +#endif /* __linux */ #endif /* SCREENFETCH_C_UTIL_H */