Загрузить файлы в «/»
This commit is contained in:
parent
f7f728c618
commit
b14ca9e430
18
funcs.h
18
funcs.h
@ -60,7 +60,7 @@ void Init(void) {
|
||||
void GetShell(void) {
|
||||
char *shell = getenv("SHELL");
|
||||
if (shell == NULL) {
|
||||
printf("%sSHELL \033[0;37mNothing\033[0m", Logo.color);
|
||||
printf("%sSHELL \033[0;37mnone\033[0m", Logo.color);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ void PrintOs(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%sOS \033[0;37m%s\033[0m", Logo.color, Os + strlen("PRETTY_NAME= "));
|
||||
printf("%sOS \033[0;37m%s\033[0m", Logo.color, Os + strlen("NAME= "));
|
||||
}
|
||||
|
||||
void GetUptime(void) {
|
||||
@ -102,7 +102,7 @@ void GetUptime(void) {
|
||||
|
||||
void GetUser(void) {
|
||||
struct passwd *pw = getpwuid(geteuid());
|
||||
printf("%sUSER \033[0;37m%s\033[0m", Logo.color, pw->pw_name);
|
||||
printf("%sUSER \033[0;37m%s\033[0m", Logo.color, (pw != 0) ? pw->pw_name : "none");
|
||||
}
|
||||
|
||||
void GetPkgs(void) {
|
||||
@ -158,19 +158,17 @@ void Blank(void) {
|
||||
|
||||
char *GetOs(void) {
|
||||
FILE *fp = fopen("/etc/os-release", "r");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
if (fp != NULL) {
|
||||
|
||||
else {
|
||||
size_t len = 1;
|
||||
char *line = malloc(sizeof(char) * len);
|
||||
size_t len = 0;
|
||||
char *line = NULL;
|
||||
|
||||
while (getline(&line, &len, fp) != EOF) {
|
||||
if (strstr(line, "PRETTY_NAME=") != NULL) {
|
||||
if (!strncmp(line, "NAME=", 5)) {
|
||||
line[strlen(line) - 2] = '\0';
|
||||
fclose(fp);
|
||||
|
||||
//Need free (in main())
|
||||
//free in main()
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user