mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Touchbase buffer manipulation
This commit is contained in:
parent
9fb728170a
commit
a279f58b91
24
nnn.c
24
nnn.c
|
@ -1114,9 +1114,7 @@ show_stats(char* fpath, char* fname, struct stat *sb)
|
||||||
|
|
||||||
if (S_ISREG(sb->st_mode)) {
|
if (S_ISREG(sb->st_mode)) {
|
||||||
/* Show file(1) output */
|
/* Show file(1) output */
|
||||||
strcpy(buf, "file -b \"");
|
sprintf(buf, "file -b \'%s\' 2>&1", fpath);
|
||||||
xstrlcpy(buf + strlen(buf), fpath, sizeof(buf) - strlen(buf));
|
|
||||||
strcat(buf, "\" 2>&1");
|
|
||||||
p = get_output(buf, sizeof(buf));
|
p = get_output(buf, sizeof(buf));
|
||||||
if (p) {
|
if (p) {
|
||||||
dprintf(fd, "\n\n ");
|
dprintf(fd, "\n\n ");
|
||||||
|
@ -1136,7 +1134,7 @@ show_stats(char* fpath, char* fname, struct stat *sb)
|
||||||
dprintf(fd, "\n\n");
|
dprintf(fd, "\n\n");
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
sprintf(buf, "cat %s | %s", tmp, xgetenv("PAGER", "less"));
|
sprintf(buf, "cat %s | less", tmp);
|
||||||
fd = system(buf);
|
fd = system(buf);
|
||||||
|
|
||||||
unlink(tmp);
|
unlink(tmp);
|
||||||
|
@ -1152,13 +1150,11 @@ show_mediainfo(const char* fpath, int full)
|
||||||
if (get_output(buf, MAX_CMD_LEN) == NULL)
|
if (get_output(buf, MAX_CMD_LEN) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
strcpy(buf, "mediainfo \'");
|
sprintf(buf, "mediainfo \'%s\' ", fpath);
|
||||||
xstrlcpy(buf + strlen(buf), fpath, sizeof(buf) - strlen(buf));
|
|
||||||
if (full)
|
if (full)
|
||||||
strcat(buf, "\' -f ");
|
strcat(buf, "-f 2>&1 | less");
|
||||||
else
|
else
|
||||||
strcat(buf, "\' ");
|
strcat(buf, "2>&1 | less");
|
||||||
sprintf(buf + strlen(buf), "2>&1 | %s", xgetenv("PAGER", "less"));
|
|
||||||
|
|
||||||
return system(buf);
|
return system(buf);
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1162,7 @@ show_mediainfo(const char* fpath, int full)
|
||||||
static int
|
static int
|
||||||
show_help(void)
|
show_help(void)
|
||||||
{
|
{
|
||||||
char helpstr[2048] = ("echo \"\
|
char helpstr[] = ("echo \"\
|
||||||
Key | Function\n\
|
Key | Function\n\
|
||||||
-+-\n\
|
-+-\n\
|
||||||
Up, k, ^P | Previous entry\n\
|
Up, k, ^P | Previous entry\n\
|
||||||
|
@ -1199,9 +1195,9 @@ show_help(void)
|
||||||
^L | Force a redraw\n\
|
^L | Force a redraw\n\
|
||||||
? | Toggle help screen\n\
|
? | Toggle help screen\n\
|
||||||
q | Quit\n\
|
q | Quit\n\
|
||||||
Q | Quit and change directory\n\n\" | ");
|
Q | Quit and change directory\n\n\" | less");
|
||||||
|
|
||||||
return system(strcat(helpstr, xgetenv("PAGER", "less")));
|
return system(helpstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1600,9 +1596,7 @@ nochange:
|
||||||
|
|
||||||
/* If nlay doesn't handle it, open plain text
|
/* If nlay doesn't handle it, open plain text
|
||||||
files with vi, then try NNN_FALLBACK_OPENER */
|
files with vi, then try NNN_FALLBACK_OPENER */
|
||||||
strcpy(cmd, "file -bi \'");
|
sprintf(cmd, "file -bi \'%s\'", newpath);
|
||||||
xstrlcpy(cmd + strlen(cmd), newpath, MAX_CMD_LEN - strlen(cmd));
|
|
||||||
strcat(cmd, "\'");
|
|
||||||
if (get_output(cmd, MAX_CMD_LEN) == NULL)
|
if (get_output(cmd, MAX_CMD_LEN) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue