fix
This commit is contained in:
parent
69ddc38152
commit
7ab3e8ef0c
1
config.h
1
config.h
@ -23,6 +23,7 @@ PARAMETR CONFIG[] = {
|
||||
{" pkg ", GetPkg},
|
||||
{" mem ", GetMem},
|
||||
{" mod ", GetModel},
|
||||
{" host ", GetHostname},
|
||||
{" ", Blank},
|
||||
{" ", PrintColors}
|
||||
};
|
||||
|
@ -45,5 +45,6 @@ int GetShell(const char *title, const FETCH fetch);
|
||||
int GetPkg(const char *title, const FETCH fetch);
|
||||
int GetMem(const char *title, const FETCH fetch);
|
||||
int GetModel(const char *title, const FETCH fetch);
|
||||
int GetHostname(const char *title, const FETCH fetch);
|
||||
|
||||
#endif
|
||||
|
10
src/fetch.c
10
src/fetch.c
@ -5,6 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <sys/utsname.h>
|
||||
#include "fetch.h"
|
||||
#include "config.h"
|
||||
@ -231,3 +232,12 @@ int GetModel(const char *title, const FETCH fetch) {
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetHostname(const char *title, const FETCH fetch) {
|
||||
char hostname[HOST_NAME_MAX + 1];
|
||||
if (gethostname(hostname, sizeof(hostname)) < 0)
|
||||
return 1;
|
||||
|
||||
printf("%s%s%s%s", fetch.color, title, fetch.font_color, hostname);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user