diff options
author | louie <lshprung@yahoo.com> | 2020-06-26 16:32:51 -0700 |
---|---|---|
committer | louie <lshprung@yahoo.com> | 2020-06-26 16:32:51 -0700 |
commit | f41dcb2b06bb379ff47a9f66cf509426706567f9 (patch) | |
tree | c5c7623bb36b11da6d1fc3a7149e2e5d00e5b4ca /draw.c | |
parent | cb03ecee3ad48a33ff72a2b86412846251ebee3e (diff) |
Fixed trimming issue
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -182,21 +182,14 @@ void fill_entries(ENTRY **entry_arr, int count){ return; } -//FIXME issue trimming entries with path title char *trim_name(char *name, char *path, int max_len){ - char *tok; //for use in finding relative path name - char *tok_ahead; - char *delims = "/\t\n"; + char *relative; //group name and path are equivalent: special procedure if(!(strcmp(name, path))){ //find relative path name - tok_ahead = strtok(name, delims); - while(tok_ahead != NULL){ - tok = tok_ahead; - tok_ahead = strtok(NULL, delims); - } - name = tok; + relative = strrchr(name, '/'); + name = relative+1; if(strlen(name) <= max_len) return name; } |