diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-07-31 21:16:15 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-07-31 21:16:15 -0600 |
commit | 8167f58e118afa658590253f8696c816511c3708 (patch) | |
tree | b79d65ce860848c50449b69ae299898b71c3e322 /pico | |
parent | bba1f63e9be0b65c090d1707a6c9168443604ed6 (diff) | |
download | alpine-8167f58e118afa658590253f8696c816511c3708.tar.xz |
* Clear more warnings given by gcc-10. Work in progress.
Diffstat (limited to 'pico')
-rw-r--r-- | pico/browse.c | 27 | ||||
-rw-r--r-- | pico/osdep/color.c | 2 |
2 files changed, 19 insertions, 10 deletions
diff --git a/pico/browse.c b/pico/browse.c index 595185f1..f5fb1e79 100644 --- a/pico/browse.c +++ b/pico/browse.c @@ -721,6 +721,7 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen, case 'e': /* exit or edit */ case 'E': if(gmode&MDBRONLY){ /* run "pico" */ + char *t; snprintf(child, sizeof(child), "%.*s%c%.*s", NLINE, gmp->dname, C_FILESEP, NLINE, gmp->current->fname); /* make sure selected isn't a directory or executable */ @@ -729,17 +730,22 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen, break; } - if((envp = (char *) getenv("EDITOR")) != NULL) - snprintf(tmp, sizeof(tmp), "%s \'%s\'", envp, child); - else - snprintf(tmp, sizeof(tmp), "pico%s%s%s \'%s\'", + if((envp = (char *) getenv("EDITOR")) != NULL){ + t = fs_get(strlen(envp) + strlen(child) + 3 + 1); + sprintf(t, "%s \'%s\'", envp, child); + } + else{ + t = fs_get(strlen(child) + 16 + 1); + sprintf(t, "pico%s%s%s \'%s\'", (gmode & MDFKEY) ? " -f" : "", (gmode & MDSHOCUR) ? " -g" : "", (gmode & MDMOUSE) ? " -m" : "", child); + } - BrowserRunChild(tmp, gmp->dname); /* spawn pico */ + BrowserRunChild(t, gmp->dname); /* spawn pico */ PaintBrowser(gmp, 0, &crow, &ccol); /* redraw browser */ + if(t) fs_give((void **) &t); } else{ zotmaster(&gmp); @@ -1585,11 +1591,14 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen, NLINE, gmp->current->fname); if(LikelyASCII(child)){ - snprintf(tmp, sizeof(tmp), "%s \'%s\'", - (envp = (char *) getenv("PAGER")) - ? envp : BROWSER_PAGER, child); - BrowserRunChild(tmp, gmp->dname); + char *t; + envp = (char *) getenv("PAGER"); + t = fs_get((envp ? strlen(envp) : strlen(BROWSER_PAGER)) + + strlen(child) + 3 + 1); + sprintf(t, "%s \'%s\'", envp ? envp : BROWSER_PAGER, child); + BrowserRunChild(t, gmp->dname); PaintBrowser(gmp, 0, &crow, &ccol); + if(t) fs_give((void **) &t); } break; diff --git a/pico/osdep/color.c b/pico/osdep/color.c index 312348c1..4dcb5881 100644 --- a/pico/osdep/color.c +++ b/pico/osdep/color.c @@ -1680,7 +1680,7 @@ color_to_asciirgb(char *colorName) * but at least the embedded colors in filter.c will get properly * sucked up when they're encountered. */ - strncpy(c_to_a_buf[whichbuf], "xxxxxxxxxxx", RGBLEN); /* RGBLEN is 11 */ + strcpy(c_to_a_buf[whichbuf], "xxxxxxxxxxx"); l = strlen(colorName); strncpy(c_to_a_buf[whichbuf], colorName, (l < RGBLEN) ? l : RGBLEN); c_to_a_buf[whichbuf][RGBLEN] = '\0'; |