if (S_ISREG(sb->st_mode)) {
/* Show file(1) output */
strcpy(buf, "file -b \"");
- xstrlcpy(buf + strlen(buf), fpath, strlen(fpath) + 1);
+ xstrlcpy(buf + strlen(buf), fpath, sizeof(buf) - strlen(buf));
strcat(buf, "\" 2>&1");
- p = get_output(buf, PATH_MAX + 16);
+ p = get_output(buf, sizeof(buf));
if (p) {
dprintf(fd, "\n\n ");
while (*p) {
if (get_output(buf, MAX_CMD_LEN) == NULL)
return -1;
- strcpy(buf, "mediainfo \"");
- xstrlcpy(buf + strlen(buf), fpath, strlen(fpath) + 1);
+ strcpy(buf, "mediainfo \'");
+ xstrlcpy(buf + strlen(buf), fpath, sizeof(buf) - strlen(buf));
if (full)
- strcat(buf, "\" -f ");
+ strcat(buf, "\' -f ");
else
- strcat(buf, "\" ");
+ strcat(buf, "\' ");
sprintf(buf + strlen(buf), "2>&1 | %s", xgetenv("PAGER", "less"));
return system(buf);
/* If NNN_OPENER is set, use it */
if (opener) {
- sprintf(cmd, "%s \"", opener);
- xstrlcpy(cmd + strlen(cmd), newpath, strlen(newpath) + 1);
- strcat(cmd, "\" > /dev/null 2>&1");
+ sprintf(cmd, "%s \'", opener);
+ xstrlcpy(cmd + strlen(cmd), newpath, sizeof(cmd) - strlen(cmd));
+ strcat(cmd, "\' > /dev/null 2>&1");
r = system(cmd);
continue;
}
/* Play with nlay if identified */
mime = getmime(dents[cur].name);
if (mime) {
- strcpy(cmd, "nlay \"");
- xstrlcpy(cmd + strlen(cmd), newpath, strlen(newpath) + 1);
- sprintf(cmd + strlen(cmd), "\" %s", mime);
+ strcpy(cmd, "nlay \'");
+ xstrlcpy(cmd + strlen(cmd), newpath, sizeof(cmd) - strlen(cmd));
+ sprintf(cmd + strlen(cmd), "\' %s", mime);
exitcurses();
r = system(cmd);
initcurses();
/* If nlay doesn't handle it, open plain text
files with vi, then try NNN_FALLBACK_OPENER */
- strcpy(cmd, "file -bi \"");
- xstrlcpy(cmd + strlen(cmd), newpath, strlen(newpath) + 1);
- strcat(cmd, "\"");
+ strcpy(cmd, "file -bi \'");
+ xstrlcpy(cmd + strlen(cmd), newpath, sizeof(cmd) - strlen(cmd));
+ strcat(cmd, "\'");
if (get_output(cmd, MAX_CMD_LEN) == NULL)
continue;
initcurses();
continue;
} else if (fb_opener) {
- sprintf(cmd, "%s \"", fb_opener);
- xstrlcpy(cmd + strlen(cmd), newpath, strlen(newpath) + 1);
- strcat(cmd, "\" > /dev/null 2>&1");
+ sprintf(cmd, "%s \'", fb_opener);
+ xstrlcpy(cmd + strlen(cmd), newpath, sizeof(cmd) - strlen(cmd));
+ strcat(cmd, "\' > /dev/null 2>&1");
r = system(cmd);
continue;
}