diff options
-rw-r--r-- | draw.c | 4 | ||||
-rw-r--r-- | entry.c | 12 | ||||
-rw-r--r-- | entry.h | 4 | ||||
-rw-r--r-- | entry.o | bin | 3336 -> 3672 bytes | |||
-rw-r--r-- | read_cfg.c | 18 | ||||
-rw-r--r-- | read_cfg.o | bin | 10072 -> 10136 bytes |
6 files changed, 25 insertions, 13 deletions
@@ -359,6 +359,7 @@ char *get_launch(){ char *program = get_gprog(g[g_hover]); char *flags = get_gflags(g[g_hover]); char *path = get_epath(e[e_hover]); + bool force = get_eforce(e[e_hover]); int mode = get_compmode(); char *full_command = malloc(sizeof(char) * BUF_LEN); bool quote_flag_p = (program[0] == '"' ? false : true); @@ -376,7 +377,8 @@ char *get_launch(){ } else{ - if(mode != 0) path = compat_convert(path, mode); + //if the entry is not forced and compatability mode is on, run it through the converter function + if(mode != 0 && !force) path = compat_convert(path, mode); if(quote_flag_p) strcat(full_command, "\""); strcat(full_command, program); if(quote_flag_p) strcat(full_command, "\""); @@ -1,5 +1,6 @@ #include <assert.h> #include <dirent.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -11,22 +12,24 @@ typedef struct entry{ char name[BUF_LEN]; char path[BUF_LEN]; + bool path_force; struct entry *next; } ENTRY; -ENTRY *create_entry(char *new_name, char *new_path); +ENTRY *create_entry(char *new_name, char *new_path, bool force); 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_name, char *new_path){ +ENTRY *create_entry(char *new_name, char *new_path, bool force){ ENTRY *new; new = malloc(sizeof(ENTRY)); strcpy(new->name, new_name); strcpy(new->path, new_path); + new->path_force = force; new->next = NULL; return new; @@ -66,6 +69,11 @@ char *get_epath(ENTRY *e){ return e->path; } +bool get_eforce(ENTRY *e){ + assert(e != NULL); + return e->path_force; +} + void entry_debug(ENTRY *trav){ while(trav != NULL){ @@ -3,7 +3,7 @@ typedef struct entry ENTRY; -ENTRY *create_entry(char *new_name, char *new_path); +ENTRY *create_entry(char *new_name, char *new_path, bool force); ENTRY *entry_add_last(ENTRY *tail, ENTRY *add); @@ -13,6 +13,8 @@ char *get_ename(ENTRY *e); char *get_epath(ENTRY *e); +bool get_eforce(ENTRY *e); + void entry_debug(ENTRY *trav); #endif Binary files differ@@ -202,12 +202,12 @@ void handle_fname(char *path, char *group, bool recurs, bool force, char *name){ //don't check that the path arg is valid if(force){ - if(name != NULL) new = create_entry(name, full_path_cpy); + if(name != NULL) new = create_entry(name, full_path_cpy, force); else if(hr){ strcpy(auto_name, autoAlias(full_path_cpy)); - new = create_entry(auto_name, full_path_cpy); + new = create_entry(auto_name, full_path_cpy, force); } - else new = create_entry(full_path_cpy, full_path_cpy); + else new = create_entry(full_path_cpy, full_path_cpy, force); if(new != NULL) group_add(group, new); } @@ -237,13 +237,13 @@ void handle_fname(char *path, char *group, bool recurs, bool force, char *name){ if(fname->d_type == DT_REG && !(wild_cmp(&arg_cpy[i+1], fname->d_name))){ //check if a name was given as argument - if(name != NULL) new = create_entry(name, relative_path_cpy); + if(name != NULL) new = create_entry(name, relative_path_cpy, force); //check if autoAlias is on. If it is, go to the autoAlias function else if(hr){ strcpy(auto_name, autoAlias(relative_path_cpy)); - new = create_entry(auto_name, relative_path_cpy); + new = create_entry(auto_name, relative_path_cpy, force); } - else new = create_entry(relative_path_cpy, relative_path_cpy); + else new = create_entry(relative_path_cpy, relative_path_cpy, force); if(new != NULL) group_add(group, new); } } @@ -262,12 +262,12 @@ void handle_fname(char *path, char *group, bool recurs, bool force, char *name){ //file name is okay //FIXME does not take into account whether the argument is a file (could be a directory, symlink, etc.) else{ - if(name != NULL) new = create_entry(name, full_path_cpy); + if(name != NULL) new = create_entry(name, full_path_cpy, force); else if(hr){ strcpy(auto_name, autoAlias(full_path_cpy)); - new = create_entry(auto_name, full_path_cpy); + new = create_entry(auto_name, full_path_cpy, force); } - else new = create_entry(full_path_cpy, full_path_cpy); + else new = create_entry(full_path_cpy, full_path_cpy, force); if(new != NULL){ group_add(group, new); } Binary files differ |