From 43eeda3d0982160d7863dd2268d989f79c24f03f Mon Sep 17 00:00:00 2001 From: louie Date: Mon, 22 Jun 2020 21:08:10 -0700 Subject: Altered Group Structure and cfg --- entry.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'entry.c') diff --git a/entry.c b/entry.c index d5f1425..6b5e9ce 100644 --- a/entry.c +++ b/entry.c @@ -14,29 +14,25 @@ typedef struct entry{ struct entry *next; } ENTRY; -ENTRY *create_entry(char *new_path, char *new_group); +ENTRY *create_entry(char *new_name, char *new_path); ENTRY *entry_add_last(ENTRY *tail, ENTRY *add); ENTRY **get_entries(ENTRY *head, int count); char *get_ename(ENTRY *e); char *get_epath(ENTRY *e); -ENTRY *create_entry(char *new_path, char *new_group){ +ENTRY *create_entry(char *new_name, char *new_path){ ENTRY *new; - char full_path[BUF_LEN] = ""; - - if(new_group != NULL) strcat(full_path, new_group); - strcat(full_path, new_path); //check if file exists - if(access(full_path, F_OK) == -1){ - printf("Error: Invalid File Name \"%s\"\n", full_path); + if(access(new_path, F_OK) == -1){ + printf("Error: Invalid File Name \"%s\"\n", new_path); return NULL; } new = malloc(sizeof(ENTRY)); - strcpy(new->name, new_path); - strcpy(new->path, full_path); + strcpy(new->name, new_name); + strcpy(new->path, new_path); new->next = NULL; return new; -- cgit