mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Line length size limit is now 139
This commit is contained in:
parent
081cb3a3e8
commit
5404cee9ee
181
nnn.c
181
nnn.c
|
@ -6,8 +6,7 @@
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
|
||||||
|| defined(__APPLE__)
|
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#include <sys/event.h>
|
#include <sys/event.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -496,6 +495,7 @@ initcurses(void)
|
||||||
fprintf(stderr, "initscr() failed\n");
|
fprintf(stderr, "initscr() failed\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cbreak();
|
cbreak();
|
||||||
noecho();
|
noecho();
|
||||||
nonl();
|
nonl();
|
||||||
|
@ -530,8 +530,7 @@ spawn(char *file, char *arg1, char *arg2, char *dir, uchar flag)
|
||||||
/* Show a marker (to indicate nnn spawned shell) */
|
/* Show a marker (to indicate nnn spawned shell) */
|
||||||
if (flag & F_MARKER) {
|
if (flag & F_MARKER) {
|
||||||
printf("\n +-++-++-+\n | n n n |\n +-++-++-+\n\n");
|
printf("\n +-++-++-+\n | n n n |\n +-++-++-+\n\n");
|
||||||
printf("Spawned shell level: %d\n",
|
printf("Spawned shell level: %d\n", atoi(getenv("SHLVL")) + 1);
|
||||||
atoi(getenv("SHLVL")) + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Suppress stdout and stderr */
|
/* Suppress stdout and stderr */
|
||||||
|
@ -669,8 +668,7 @@ getmime(char *file)
|
||||||
static uint len = LEN(assocs);
|
static uint len = LEN(assocs);
|
||||||
|
|
||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
if (regcomp(®ex, assocs[i].regex,
|
if (regcomp(®ex, assocs[i].regex, REG_NOSUB | REG_EXTENDED | REG_ICASE) != 0)
|
||||||
REG_NOSUB | REG_EXTENDED | REG_ICASE) != 0)
|
|
||||||
continue;
|
continue;
|
||||||
if (regexec(®ex, file, 0, NULL, 0) == 0)
|
if (regexec(®ex, file, 0, NULL, 0) == 0)
|
||||||
return assocs[i].mime;
|
return assocs[i].mime;
|
||||||
|
@ -1097,23 +1095,17 @@ printent(struct entry *ent, int sel)
|
||||||
ncols = COLS;
|
ncols = COLS;
|
||||||
|
|
||||||
if (S_ISDIR(ent->mode))
|
if (S_ISDIR(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%s/", CURSYM(sel),
|
snprintf(g_buf, ncols, "%s%s/", CURSYM(sel), unescape(ent->name));
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISLNK(ent->mode))
|
else if (S_ISLNK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%s@", CURSYM(sel),
|
snprintf(g_buf, ncols, "%s%s@", CURSYM(sel), unescape(ent->name));
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISSOCK(ent->mode))
|
else if (S_ISSOCK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%s=", CURSYM(sel),
|
snprintf(g_buf, ncols, "%s%s=", CURSYM(sel), unescape(ent->name));
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISFIFO(ent->mode))
|
else if (S_ISFIFO(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%s|", CURSYM(sel),
|
snprintf(g_buf, ncols, "%s%s|", CURSYM(sel), unescape(ent->name));
|
||||||
unescape(ent->name));
|
|
||||||
else if (ent->mode & 0100)
|
else if (ent->mode & 0100)
|
||||||
snprintf(g_buf, ncols, "%s%s*", CURSYM(sel),
|
snprintf(g_buf, ncols, "%s%s*", CURSYM(sel), unescape(ent->name));
|
||||||
unescape(ent->name));
|
|
||||||
else
|
else
|
||||||
snprintf(g_buf, ncols, "%s%s", CURSYM(sel),
|
snprintf(g_buf, ncols, "%s%s", CURSYM(sel), unescape(ent->name));
|
||||||
unescape(ent->name));
|
|
||||||
|
|
||||||
/* Dirs are always shown on top */
|
/* Dirs are always shown on top */
|
||||||
if (cfg.dircolor && !S_ISDIR(ent->mode)) {
|
if (cfg.dircolor && !S_ISDIR(ent->mode)) {
|
||||||
|
@ -1165,64 +1157,38 @@ printent_long(struct entry *ent, int sel)
|
||||||
|
|
||||||
if (!cfg.blkorder) {
|
if (!cfg.blkorder) {
|
||||||
if (S_ISDIR(ent->mode))
|
if (S_ISDIR(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s / %s/",
|
snprintf(g_buf, ncols, "%s%-16.16s / %s/", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf, unescape(ent->name));
|
|
||||||
else if (S_ISLNK(ent->mode))
|
else if (S_ISLNK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s @ %s@",
|
snprintf(g_buf, ncols, "%s%-16.16s @ %s@", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf, unescape(ent->name));
|
|
||||||
else if (S_ISSOCK(ent->mode))
|
else if (S_ISSOCK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s = %s=",
|
snprintf(g_buf, ncols, "%s%-16.16s = %s=", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf, unescape(ent->name));
|
|
||||||
else if (S_ISFIFO(ent->mode))
|
else if (S_ISFIFO(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s | %s|",
|
snprintf(g_buf, ncols, "%s%-16.16s | %s|", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf, unescape(ent->name));
|
|
||||||
else if (S_ISBLK(ent->mode))
|
else if (S_ISBLK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s b %s",
|
snprintf(g_buf, ncols, "%s%-16.16s b %s", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf, unescape(ent->name));
|
|
||||||
else if (S_ISCHR(ent->mode))
|
else if (S_ISCHR(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s c %s",
|
snprintf(g_buf, ncols, "%s%-16.16s c %s", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf, unescape(ent->name));
|
|
||||||
else if (ent->mode & 0100)
|
else if (ent->mode & 0100)
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s* %s*",
|
snprintf(g_buf, ncols, "%s%-16.16s %8.8s* %s*", CURSYM(sel), buf, coolsize(ent->size), unescape(ent->name));
|
||||||
CURSYM(sel), buf, coolsize(ent->size),
|
|
||||||
unescape(ent->name));
|
|
||||||
else
|
else
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s %s",
|
snprintf(g_buf, ncols, "%s%-16.16s %8.8s %s", CURSYM(sel), buf, coolsize(ent->size), unescape(ent->name));
|
||||||
CURSYM(sel), buf, coolsize(ent->size),
|
|
||||||
unescape(ent->name));
|
|
||||||
} else {
|
} else {
|
||||||
if (S_ISDIR(ent->mode))
|
if (S_ISDIR(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s/ %s/",
|
snprintf(g_buf, ncols, "%s%-16.16s %8.8s/ %s/", CURSYM(sel), buf, coolsize(ent->blocks << 9), unescape(ent->name));
|
||||||
CURSYM(sel), buf, coolsize(ent->blocks << 9),
|
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISLNK(ent->mode))
|
else if (S_ISLNK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s @ %s@",
|
snprintf(g_buf, ncols, "%s%-16.16s @ %s@", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf,
|
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISSOCK(ent->mode))
|
else if (S_ISSOCK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s = %s=",
|
snprintf(g_buf, ncols, "%s%-16.16s = %s=", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf,
|
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISFIFO(ent->mode))
|
else if (S_ISFIFO(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s | %s|",
|
snprintf(g_buf, ncols, "%s%-16.16s | %s|", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf,
|
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISBLK(ent->mode))
|
else if (S_ISBLK(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s b %s",
|
snprintf(g_buf, ncols, "%s%-16.16s b %s", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf,
|
|
||||||
unescape(ent->name));
|
|
||||||
else if (S_ISCHR(ent->mode))
|
else if (S_ISCHR(ent->mode))
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s c %s",
|
snprintf(g_buf, ncols, "%s%-16.16s c %s", CURSYM(sel), buf, unescape(ent->name));
|
||||||
CURSYM(sel), buf,
|
|
||||||
unescape(ent->name));
|
|
||||||
else if (ent->mode & 0100)
|
else if (ent->mode & 0100)
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s* %s*",
|
snprintf(g_buf, ncols, "%s%-16.16s %8.8s* %s*", CURSYM(sel), buf, coolsize(ent->blocks << 9), unescape(ent->name));
|
||||||
CURSYM(sel), buf, coolsize(ent->blocks << 9),
|
|
||||||
unescape(ent->name));
|
|
||||||
else
|
else
|
||||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s %s",
|
snprintf(g_buf, ncols, "%s%-16.16s %8.8s %s", CURSYM(sel), buf, coolsize(ent->blocks << 9), unescape(ent->name));
|
||||||
CURSYM(sel), buf, coolsize(ent->blocks << 9),
|
|
||||||
unescape(ent->name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dirs are always shown on top */
|
/* Dirs are always shown on top */
|
||||||
|
@ -1292,8 +1258,7 @@ get_fileind(mode_t mode, char *desc)
|
||||||
static char *
|
static char *
|
||||||
get_lsperms(mode_t mode, char *desc)
|
get_lsperms(mode_t mode, char *desc)
|
||||||
{
|
{
|
||||||
static const char * const rwx[] = {"---", "--x", "-w-", "-wx",
|
static const char * const rwx[] = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"};
|
||||||
"r--", "r-x", "rw-", "rwx"};
|
|
||||||
static char bits[11];
|
static char bits[11];
|
||||||
|
|
||||||
bits[0] = get_fileind(mode, desc);
|
bits[0] = get_fileind(mode, desc);
|
||||||
|
@ -1432,15 +1397,11 @@ show_stats(char *fpath, char *fname, struct stat *sb)
|
||||||
|
|
||||||
/* Show major, minor number for block or char device */
|
/* Show major, minor number for block or char device */
|
||||||
if (perms[0] == 'b' || perms[0] == 'c')
|
if (perms[0] == 'b' || perms[0] == 'c')
|
||||||
dprintf(fd, " Device type: %x,%x",
|
dprintf(fd, " Device type: %x,%x", major(sb->st_rdev), minor(sb->st_rdev));
|
||||||
major(sb->st_rdev), minor(sb->st_rdev));
|
|
||||||
|
|
||||||
/* Show permissions, owner, group */
|
/* Show permissions, owner, group */
|
||||||
dprintf(fd, "\n Access: 0%d%d%d/%s Uid: (%u/%s) Gid: (%u/%s)",
|
dprintf(fd, "\n Access: 0%d%d%d/%s Uid: (%u/%s) Gid: (%u/%s)", (sb->st_mode >> 6) & 7, (sb->st_mode >> 3) & 7,
|
||||||
(sb->st_mode >> 6) & 7, (sb->st_mode >> 3) & 7, sb->st_mode & 7,
|
sb->st_mode & 7, perms, sb->st_uid, (getpwuid(sb->st_uid))->pw_name, sb->st_gid, (getgrgid(sb->st_gid))->gr_name);
|
||||||
perms,
|
|
||||||
sb->st_uid, (getpwuid(sb->st_uid))->pw_name,
|
|
||||||
sb->st_gid, (getgrgid(sb->st_gid))->gr_name);
|
|
||||||
|
|
||||||
/* Show last access time */
|
/* Show last access time */
|
||||||
strftime(g_buf, 40, "%a %d-%b-%Y %T %z,%Z", localtime(&sb->st_atime));
|
strftime(g_buf, 40, "%a %d-%b-%Y %T %z,%Z", localtime(&sb->st_atime));
|
||||||
|
@ -1698,8 +1659,7 @@ dentfill(char *path, struct entry **dents,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Skip self and parent */
|
/* Skip self and parent */
|
||||||
if ((namep[0] == '.' && (namep[1] == '\0' ||
|
if ((namep[0] == '.' && (namep[1] == '\0' || (namep[1] == '.' && namep[2] == '\0'))))
|
||||||
(namep[1] == '.' && namep[2] == '\0'))))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW)
|
if (fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW)
|
||||||
|
@ -1711,8 +1671,7 @@ dentfill(char *path, struct entry **dents,
|
||||||
ent_blocks = 0;
|
ent_blocks = 0;
|
||||||
mkpath(path, namep, g_buf, PATH_MAX);
|
mkpath(path, namep, g_buf, PATH_MAX);
|
||||||
|
|
||||||
if (nftw(g_buf, sum_bsizes, open_max,
|
if (nftw(g_buf, sum_bsizes, open_max, FTW_MOUNT | FTW_PHYS) == -1) {
|
||||||
FTW_MOUNT | FTW_PHYS) == -1) {
|
|
||||||
printmsg(STR_NFTWFAIL);
|
printmsg(STR_NFTWFAIL);
|
||||||
dir_blocks += sb.st_blocks;
|
dir_blocks += sb.st_blocks;
|
||||||
} else
|
} else
|
||||||
|
@ -1759,8 +1718,7 @@ dentfill(char *path, struct entry **dents,
|
||||||
num_saved = num_files + 1;
|
num_saved = num_files + 1;
|
||||||
mkpath(path, namep, g_buf, PATH_MAX);
|
mkpath(path, namep, g_buf, PATH_MAX);
|
||||||
|
|
||||||
if (nftw(g_buf, sum_bsizes, open_max,
|
if (nftw(g_buf, sum_bsizes, open_max, FTW_MOUNT | FTW_PHYS) == -1) {
|
||||||
FTW_MOUNT | FTW_PHYS) == -1) {
|
|
||||||
printmsg(STR_NFTWFAIL);
|
printmsg(STR_NFTWFAIL);
|
||||||
dentp->blocks = sb.st_blocks;
|
dentp->blocks = sb.st_blocks;
|
||||||
} else
|
} else
|
||||||
|
@ -1933,15 +1891,10 @@ redraw(char *path)
|
||||||
* be truncated in directory listing
|
* be truncated in directory listing
|
||||||
*/
|
*/
|
||||||
if (!cfg.blkorder)
|
if (!cfg.blkorder)
|
||||||
sprintf(g_buf, "total %d %s[%s%s]", ndents,
|
sprintf(g_buf, "total %d %s[%s%s]", ndents, sort, unescape(dents[cur].name), ind);
|
||||||
sort, unescape(dents[cur].name), ind);
|
|
||||||
else {
|
else {
|
||||||
i = sprintf(g_buf, "du: %s (%lu files) ",
|
i = sprintf(g_buf, "du: %s (%lu files) ", coolsize(dir_blocks << 9), num_files);
|
||||||
coolsize(dir_blocks << 9),
|
sprintf(g_buf + i, "vol: %s free [%s%s]", coolsize(fs_free), unescape(dents[cur].name), ind);
|
||||||
num_files);
|
|
||||||
sprintf(g_buf + i, "vol: %s free [%s%s]",
|
|
||||||
coolsize(fs_free),
|
|
||||||
unescape(dents[cur].name), ind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printmsg(g_buf);
|
printmsg(g_buf);
|
||||||
|
@ -2092,22 +2045,18 @@ nochange:
|
||||||
*/
|
*/
|
||||||
if (editor) {
|
if (editor) {
|
||||||
if (getmime(dents[cur].name)) {
|
if (getmime(dents[cur].name)) {
|
||||||
spawn(editor, newpath, NULL,
|
spawn(editor, newpath, NULL, NULL, F_NORMAL);
|
||||||
NULL, F_NORMAL);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recognize and open plain
|
/* Recognize and open plain
|
||||||
* text files with vi
|
* text files with vi
|
||||||
*/
|
*/
|
||||||
if (get_output(g_buf, MAX_CMD_LEN,
|
if (get_output(g_buf, MAX_CMD_LEN, "file", "-bi", newpath, 0) == NULL)
|
||||||
"file", "-bi",
|
|
||||||
newpath, 0) == NULL)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strstr(g_buf, "text/") == g_buf) {
|
if (strstr(g_buf, "text/") == g_buf) {
|
||||||
spawn(editor, newpath, NULL,
|
spawn(editor, newpath, NULL, NULL, F_NORMAL);
|
||||||
NULL, F_NORMAL);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2126,8 +2075,7 @@ nochange:
|
||||||
DPRINTF_S(fltr);
|
DPRINTF_S(fltr);
|
||||||
/* Save current */
|
/* Save current */
|
||||||
if (ndents > 0)
|
if (ndents > 0)
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
goto nochange;
|
goto nochange;
|
||||||
case SEL_MFLTR:
|
case SEL_MFLTR:
|
||||||
cfg.filtermode ^= 1;
|
cfg.filtermode ^= 1;
|
||||||
|
@ -2213,8 +2161,7 @@ nochange:
|
||||||
char *home = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
|
|
||||||
if (home)
|
if (home)
|
||||||
snprintf(newpath, PATH_MAX, "%s%s",
|
snprintf(newpath, PATH_MAX, "%s%s", home, tmp + 1);
|
||||||
home, tmp + 1);
|
|
||||||
else {
|
else {
|
||||||
free(input);
|
free(input);
|
||||||
printmsg(STR_NOHOME);
|
printmsg(STR_NOHOME);
|
||||||
|
@ -2386,12 +2333,7 @@ nochange:
|
||||||
char *home = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
|
|
||||||
if (home)
|
if (home)
|
||||||
snprintf(newpath,
|
snprintf(newpath, PATH_MAX, "%s%s", home, bookmark[r].loc + 1);
|
||||||
PATH_MAX,
|
|
||||||
"%s%s",
|
|
||||||
home,
|
|
||||||
bookmark[r].loc
|
|
||||||
+ 1);
|
|
||||||
else {
|
else {
|
||||||
printmsg(STR_NOHOME);
|
printmsg(STR_NOHOME);
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
@ -2441,20 +2383,17 @@ nochange:
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_DETAIL:
|
case SEL_DETAIL:
|
||||||
cfg.showdetail ^= 1;
|
cfg.showdetail ^= 1;
|
||||||
cfg.showdetail ? (printptr = &printent_long)
|
cfg.showdetail ? (printptr = &printent_long) : (printptr = &printent);
|
||||||
: (printptr = &printent);
|
|
||||||
/* Save current */
|
/* Save current */
|
||||||
if (ndents > 0)
|
if (ndents > 0)
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_STATS:
|
case SEL_STATS:
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (ndents > 0) {
|
if (ndents > 0) {
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
|
|
||||||
r = lstat(oldpath, &sb);
|
r = lstat(oldpath, &sb);
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
|
@ -2462,8 +2401,7 @@ nochange:
|
||||||
dentfree(dents);
|
dentfree(dents);
|
||||||
printerr(1, "lstat");
|
printerr(1, "lstat");
|
||||||
} else {
|
} else {
|
||||||
r = show_stats(oldpath, dents[cur].name,
|
r = show_stats(oldpath, dents[cur].name, &sb);
|
||||||
&sb);
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
printmsg(strerror(errno));
|
printmsg(strerror(errno));
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
@ -2476,8 +2414,7 @@ nochange:
|
||||||
case SEL_MEDIA: // fallthrough
|
case SEL_MEDIA: // fallthrough
|
||||||
case SEL_FMEDIA:
|
case SEL_FMEDIA:
|
||||||
if (ndents > 0) {
|
if (ndents > 0) {
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
|
|
||||||
if (show_mediainfo(oldpath, run) == -1) {
|
if (show_mediainfo(oldpath, run) == -1) {
|
||||||
sprintf(g_buf, "%s missing", metaviewer);
|
sprintf(g_buf, "%s missing", metaviewer);
|
||||||
|
@ -2492,8 +2429,7 @@ nochange:
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
|
|
||||||
spawn(desktop_manager, path, NULL, path,
|
spawn(desktop_manager, path, NULL, path, F_NOTRACE | F_NOWAIT);
|
||||||
F_NOTRACE | F_NOWAIT);
|
|
||||||
break;
|
break;
|
||||||
case SEL_FSIZE:
|
case SEL_FSIZE:
|
||||||
cfg.sizeorder ^= 1;
|
cfg.sizeorder ^= 1;
|
||||||
|
@ -2501,8 +2437,7 @@ nochange:
|
||||||
cfg.blkorder = 0;
|
cfg.blkorder = 0;
|
||||||
/* Save current */
|
/* Save current */
|
||||||
if (ndents > 0)
|
if (ndents > 0)
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_BSIZE:
|
case SEL_BSIZE:
|
||||||
cfg.blkorder ^= 1;
|
cfg.blkorder ^= 1;
|
||||||
|
@ -2514,8 +2449,7 @@ nochange:
|
||||||
cfg.sizeorder = 0;
|
cfg.sizeorder = 0;
|
||||||
/* Save current */
|
/* Save current */
|
||||||
if (ndents > 0)
|
if (ndents > 0)
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_MTIME:
|
case SEL_MTIME:
|
||||||
cfg.mtimeorder ^= 1;
|
cfg.mtimeorder ^= 1;
|
||||||
|
@ -2523,23 +2457,19 @@ nochange:
|
||||||
cfg.blkorder = 0;
|
cfg.blkorder = 0;
|
||||||
/* Save current */
|
/* Save current */
|
||||||
if (ndents > 0)
|
if (ndents > 0)
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_REDRAW:
|
case SEL_REDRAW:
|
||||||
/* Save current */
|
/* Save current */
|
||||||
if (ndents > 0)
|
if (ndents > 0)
|
||||||
mkpath(path, dents[cur].name, oldpath,
|
mkpath(path, dents[cur].name, oldpath, PATH_MAX);
|
||||||
PATH_MAX);
|
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_COPY:
|
case SEL_COPY:
|
||||||
if (copier && ndents) {
|
if (copier && ndents) {
|
||||||
if (istopdir(path))
|
if (istopdir(path))
|
||||||
snprintf(newpath, PATH_MAX, "/%s",
|
snprintf(newpath, PATH_MAX, "/%s", dents[cur].name);
|
||||||
dents[cur].name);
|
|
||||||
else
|
else
|
||||||
snprintf(newpath, PATH_MAX, "%s/%s",
|
snprintf(newpath, PATH_MAX, "%s/%s", path, dents[cur].name);
|
||||||
path, dents[cur].name);
|
|
||||||
spawn(copier, newpath, NULL, NULL, F_NONE);
|
spawn(copier, newpath, NULL, NULL, F_NONE);
|
||||||
printmsg(newpath);
|
printmsg(newpath);
|
||||||
} else if (!copier)
|
} else if (!copier)
|
||||||
|
@ -2561,8 +2491,7 @@ nochange:
|
||||||
/* Screensaver */
|
/* Screensaver */
|
||||||
if (idletimeout != 0 && idle == idletimeout) {
|
if (idletimeout != 0 && idle == idletimeout) {
|
||||||
idle = 0;
|
idle = 0;
|
||||||
spawn(player, "", "screensaver", NULL,
|
spawn(player, "", "screensaver", NULL, F_NORMAL | F_SIGINT);
|
||||||
F_NORMAL | F_SIGINT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue