CPU string fix try + some formatting

This commit is contained in:
TheDarkBug 2021-10-03 23:48:10 +02:00
parent 07b2c4a4d8
commit d6d9962b93

View file

@ -175,7 +175,7 @@ int main(int argc, char *argv[])
{
uwu_hw(gpu_model[i]);
}
uwu_hw(cpu_model);
// uwu_hw("cpu");
uwu_hw(host_model);
print_info();
@ -188,7 +188,8 @@ void parse_config()
// opening and reading the config file
FILE *config;
if (config_directory == NULL) {
if (config_directory == NULL)
{
if (homedir != NULL)
config = fopen(strcat(homedir, "/.config/uwufetch/config"), "r");
}
@ -711,7 +712,8 @@ void replace(char *original, char *search, char *replacer)
{
char *ch;
char buffer[1024];
while (ch = strstr(original, search)) {
while (ch = strstr(original, search))
{
strncpy(buffer, original, ch - original);
buffer[ch - original] = 0;
sprintf(buffer + (ch - original), "%s%s", replacer, ch + strlen(search));
@ -725,7 +727,8 @@ void replace_ignorecase(char *original, char *search, char *replacer)
{
char *ch;
char buffer[1024];
while (ch = strcasestr(original, search)) {
while (ch = strcasestr(original, search))
{
strncpy(buffer, original, ch - original);
buffer[ch - original] = 0;
sprintf(buffer + (ch - original), "%s%s", replacer, ch + strlen(search));
@ -1151,9 +1154,9 @@ void uwu_hw(char *hwname)
{
#define HW_TO_UWU(original, uwuified) \
replace_ignorecase(hwname, original, uwuified);
replace(hwname, "CPU", "CPUwU");
replace(hwname, "cpu", "CPUwU");
HW_TO_UWU("lenovo", "LenOwO")
HW_TO_UWU("cpu", "CPUwU")
HW_TO_UWU("gpu", "GPUwU")
HW_TO_UWU("graphics", "Gwaphics")
HW_TO_UWU("corporation", "COwOpowation")