:)
This commit is contained in:
parent
7f7ca8c507
commit
22c4e8cdb0
5 changed files with 47 additions and 19 deletions
20
src/fetch.c
20
src/fetch.c
|
@ -201,3 +201,23 @@ int GetMem(const char *title, const FETCH fetch) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetModel(const char *title, const FETCH fetch) {
|
||||
FILE *fp = NULL;
|
||||
for (size_t i = 0; i < sizeof(MODELS) / sizeof(char *); i++) {
|
||||
fp = fopen(MODELS[i], "r");
|
||||
if (fp != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (fp == NULL)
|
||||
return 1;
|
||||
|
||||
char model_buffer[MODEL_BUFF_SIZE + 1];
|
||||
char *ptr = fgets(model_buffer, sizeof(model_buffer), fp);
|
||||
if (ptr != NULL)
|
||||
printf("%s%s%s%s", fetch.color, title, fetch.font_color, model_buffer);
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue