mirror of
https://gitlab.com/klmp200/fish.git
synced 2025-07-11 12:19:23 +00:00
Victime boloss
This commit is contained in:
@ -28,7 +28,9 @@ Settings *getSettings() {
|
||||
filename = strcat(filename, (char*) FISH_RC_FILE);
|
||||
s->passwd = user;
|
||||
s->PS1 = extractVariable(filename, (char*) "PS1");
|
||||
if (s->PS1 == NULL) s->PS1 = strdup("->");
|
||||
s->PS2 = extractVariable(filename, (char*) "PS2");
|
||||
if (s->PS2 == NULL) s->PS2 = strdup("->");
|
||||
|
||||
free(filename);
|
||||
return s;
|
||||
@ -36,6 +38,8 @@ Settings *getSettings() {
|
||||
|
||||
void freeSettings(Settings *settings){
|
||||
if (settings != NULL){
|
||||
settings->PS1[0] = '\0';
|
||||
settings->PS2[0] = '\0';
|
||||
free(settings->PS1);
|
||||
free(settings->PS2);
|
||||
free(settings);
|
||||
@ -73,7 +77,7 @@ char* extractVariable(char* filename, char* var){
|
||||
else {
|
||||
perror ( filename ); /* why didn't the file open? */
|
||||
}
|
||||
return NULL;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,4 +10,5 @@ Settings * getSettings(); //TESTEDssssss
|
||||
void freeSettings(Settings *settings); //TESTED
|
||||
char* extractVariable(char* filename, char* var);//TESTED
|
||||
|
||||
#endif //FISH_FISH_SETTINGS_H
|
||||
#endif //FISH_FISH_SETTINGS_H
|
||||
|
||||
|
Reference in New Issue
Block a user