5 #include <sys/types.h> /* pid_t, ... */
6 #include <stdio.h> /* FILENAME_MAX */
7 #include <locale.h> /* setlocale(), LC_ALL */
8 #include <unistd.h> /* chdir(), getcwd(), read(), close(), ... */
9 #include <dirent.h> /* DIR, struct dirent, opendir(), ... */
11 #include <fcntl.h> /* open() */
12 #include <sys/wait.h> /* waitpid() */
13 #include <signal.h> /* struct sigaction, sigaction() */
20 static char ROW[ROWSZ];
22 static char STATUS[STATUSSZ];
24 static char INPUT[INPUTSZ];
26 /* Argument buffers for execvp(). */
28 static char *ARGS[MAXARGS];
30 /* Listing view parameters. */
31 #define HEIGHT (LINES-4)
32 #define STATUSPOS (COLS-16)
34 /* Listing view flags. */
35 #define SHOW_FILES 0x01u
36 #define SHOW_DIRS 0x02u
37 #define SHOW_HIDDEN 0x04u
39 /* Marks parameters. */
41 #define BULK_THRESH 256
43 /* Information associated to each entry in listing. */
50 /* Dynamic array of marked entries. */
52 char dirpath[FILENAME_MAX];
58 /* Global state. Some basic info is allocated for ten tabs. */
59 static struct rover_t {
67 char cwd[10][FILENAME_MAX];
71 /* Macros for accessing global state. */
72 #define ENAME(I) rover.rows[I].name
73 #define ESIZE(I) rover.rows[I].size
74 #define MARKED(I) rover.rows[I].marked
75 #define SCROLL rover.scroll[rover.tab]
76 #define ESEL rover.esel[rover.tab]
77 #define FLAGS rover.flags[rover.tab]
78 #define CWD rover.cwd[rover.tab]
81 #define MIN(A, B) ((A) < (B) ? (A) : (B))
82 #define MAX(A, B) ((A) > (B) ? (A) : (B))
83 #define ISDIR(E) (strchr((E), '/') != NULL)
85 typedef enum {DEFAULT, RED, GREEN, YELLOW, BLUE, CYAN, MAGENTA, WHITE} color_t;
86 typedef int (*PROCESS)(const char *path);
89 init_marks(marks_t *marks)
91 strcpy(marks->dirpath, "");
92 marks->bulk = BULK_INIT;
94 marks->entries = (char **) calloc(marks->bulk, sizeof(char *));
97 /* Unmark all entries. */
99 mark_none(marks_t *marks)
103 strcpy(marks->dirpath, "");
104 for (i = 0; i < marks->bulk && marks->nentries; i++)
105 if (marks->entries[i]) {
106 free(marks->entries[i]);
107 marks->entries[i] = NULL;
110 if (marks->bulk > BULK_THRESH) {
111 /* Reset bulk to free some memory. */
112 free(marks->entries);
113 marks->bulk = BULK_INIT;
114 marks->entries = (char **) calloc(marks->bulk, sizeof(char *));
119 add_mark(marks_t *marks, char *dirpath, char *entry)
123 if (!strcmp(marks->dirpath, dirpath)) {
124 /* Append mark to directory. */
125 if (marks->nentries == marks->bulk) {
126 /* Expand bulk to accomodate new entry. */
127 int extra = marks->bulk >> 1;
128 marks->bulk += extra; /* bulk *= 1.5; */
129 marks->entries = (char **) realloc(
130 marks->entries, marks->bulk * sizeof(char *)
132 memset(&marks->entries[marks->nentries], 0, extra * sizeof(char *));
136 /* Search for empty slot (there must be one). */
137 for (i = 0; i < marks->bulk; i++)
138 if (!marks->entries[i])
143 /* Directory changed. Discard old marks. */
145 strcpy(marks->dirpath, dirpath);
148 marks->entries[i] = (char *) malloc(strlen(entry) + 1);
149 strcpy(marks->entries[i], entry);
154 del_mark(marks_t *marks, char *entry)
158 if (marks->nentries > 1) {
159 for (i = 0; i < marks->bulk; i++)
160 if (marks->entries[i] && !strcmp(marks->entries[i], entry))
162 free(marks->entries[i]);
163 marks->entries[i] = NULL;
166 else mark_none(marks);
170 free_marks(marks_t *marks)
174 for (i = 0; i < marks->bulk && marks->nentries; i++)
175 if (marks->entries[i]) {
176 free(marks->entries[i]);
179 free(marks->entries);
182 static void message(const char *msg, color_t color);
184 static void handle_segv(int sig);
185 static void handle_winch(int sig);
193 setlocale(LC_ALL, "");
195 cbreak(); /* Get one character at a time. */
197 nonl(); /* No NL->CR/NL on output. */
198 intrflush(stdscr, FALSE);
199 keypad(stdscr, TRUE);
200 curs_set(FALSE); /* Hide blinking cursor. */
201 memset(&sa, 0, sizeof(struct sigaction));
202 /* Setup SIGSEGV handler. */
203 sa.sa_handler = handle_segv;
204 sigaction(SIGSEGV, &sa, NULL);
205 /* Setup SIGWINCH handler. */
206 sa.sa_handler = handle_winch;
207 sigaction(SIGWINCH, &sa, NULL);
210 init_pair(RED, COLOR_RED, COLOR_BLACK);
211 init_pair(GREEN, COLOR_GREEN, COLOR_BLACK);
212 init_pair(YELLOW, COLOR_YELLOW,COLOR_BLACK);
213 init_pair(BLUE, COLOR_BLUE, COLOR_BLACK);
214 init_pair(CYAN, COLOR_CYAN, COLOR_BLACK);
215 init_pair(MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
216 init_pair(WHITE, COLOR_WHITE, COLOR_BLACK);
218 atexit((void (*)(void)) endwin);
221 /* Update the listing view. */
229 mvhline(0, 0, ' ', COLS);
230 color_set(RVC_CWD, NULL);
231 mvaddnstr(0, 0, CWD, COLS);
232 color_set(DEFAULT, NULL);
233 attr_on(A_BOLD, NULL);
234 color_set(RVC_TABNUM, NULL);
235 mvaddch(0, COLS-4, rover.tab + '0');
236 color_set(DEFAULT, NULL);
237 attr_off(A_BOLD, NULL);
238 wclear(rover.window);
239 wcolor_set(rover.window, RVC_BORDER, NULL);
240 wborder(rover.window, 0, 0, 0, 0, 0, 0, 0, 0);
241 wcolor_set(rover.window, DEFAULT, NULL);
242 /* Selection might not be visible, due to cursor wrapping or window
243 shrinking. In that case, the scroll must be moved to make it visible. */
244 SCROLL = MAX(MIN(SCROLL, ESEL), ESEL - HEIGHT + 1);
245 marking = !strcmp(CWD, rover.marks.dirpath);
246 for (i = 0, j = SCROLL; i < HEIGHT && j < rover.nfiles; i++, j++) {
247 ishidden = ENAME(j)[0] == '.';
248 isdir = ISDIR(ENAME(j));
250 wattr_on(rover.window, A_REVERSE, NULL);
252 wcolor_set(rover.window, RVC_HIDDEN, NULL);
254 wcolor_set(rover.window, RVC_DIR, NULL);
256 wcolor_set(rover.window, RVC_FILE, NULL);
258 sprintf(ROW, "%s%*d", ENAME(j),
259 COLS - strlen(ENAME(j)) - 4, (int) ESIZE(j));
261 strcpy(ROW, ENAME(j));
262 mvwhline(rover.window, i + 1, 1, ' ', COLS - 2);
263 if (marking && MARKED(j))
264 mvwaddch(rover.window, i + 1, 1, RVS_MARK);
266 mvwaddch(rover.window, i + 1, 1, ' ');
267 mvwaddnstr(rover.window, i + 1, 3, ROW, COLS - 4);
268 wcolor_set(rover.window, DEFAULT, NULL);
270 wattr_off(rover.window, A_REVERSE, NULL);
272 if (rover.nfiles > HEIGHT) {
274 center = (SCROLL + (HEIGHT >> 1)) * HEIGHT / rover.nfiles;
275 height = (HEIGHT-1) * HEIGHT / rover.nfiles;
276 if (!height) height = 1;
277 wcolor_set(rover.window, RVC_BORDER, NULL);
278 wborder(rover.window, 0, 0, 0, 0, 0, 0, 0, 0);
279 wcolor_set(rover.window, RVC_SCROLLBAR, NULL);
280 mvwvline(rover.window, center-(height>>1)+1, COLS-1, RVS_SCROLLBAR, height);
281 wcolor_set(rover.window, DEFAULT, NULL);
283 wrefresh(rover.window);
284 STATUS[0] = FLAGS & SHOW_FILES ? 'F' : ' ';
285 STATUS[1] = FLAGS & SHOW_DIRS ? 'D' : ' ';
286 STATUS[2] = FLAGS & SHOW_HIDDEN ? 'H' : ' ';
290 sprintf(ROW, "%d/%d", ESEL + 1, rover.nfiles);
291 sprintf(STATUS+3, "%12s", ROW);
292 color_set(RVC_STATUS, NULL);
293 mvaddstr(LINES - 1, STATUSPOS, STATUS);
294 color_set(DEFAULT, NULL);
298 /* SIGSEGV handler: clean up curses before exiting. */
304 puts("Received SIGSEGV (segmentation fault).");
308 /* SIGWINCH handler: resize application according to new terminal settings. */
310 handle_winch(int sig)
313 delwin(rover.window);
317 rover.window = subwin(stdscr, LINES - 2, COLS, 1, 0);
321 /* Comparison used to sort listing entries. */
323 rowcmp(const void *a, const void *b)
325 int isdir1, isdir2, cmpdir;
328 isdir1 = ISDIR(r1->name);
329 isdir2 = ISDIR(r2->name);
330 cmpdir = isdir2 - isdir1;
331 return cmpdir ? cmpdir : strcoll(r1->name, r2->name);
334 /* Get all entries for a given path (usually cwd). */
336 ls(char *path, row_t **rowsp, uint8_t flags)
344 if(!(dp = opendir(path))) return -1;
345 n = -2; /* We don't want the entries "." and "..". */
346 while (readdir(dp)) n++;
348 rows = (row_t *) malloc(n * sizeof(row_t));
350 while ((ep = readdir(dp))) {
351 if (!strcmp(ep->d_name, ".") || !strcmp(ep->d_name, ".."))
353 if (!(flags & SHOW_HIDDEN) && ep->d_name[0] == '.')
355 /* FIXME: ANSI C doesn't have lstat(). How do we handle symlinks? */
356 stat(ep->d_name, &statbuf);
357 if (S_ISDIR(statbuf.st_mode)) {
358 if (flags & SHOW_DIRS) {
359 rows[i].name = (char *) malloc(strlen(ep->d_name) + 2);
360 strcpy(rows[i].name, ep->d_name);
361 strcat(rows[i].name, "/");
365 else if (flags & SHOW_FILES) {
366 rows[i].name = (char *) malloc(strlen(ep->d_name) + 1);
367 strcpy(rows[i].name, ep->d_name);
368 rows[i].size = statbuf.st_size;
372 n = i; /* Ignore unused space in array caused by filters. */
373 qsort(rows, n, sizeof(row_t), rowcmp);
380 free_rows(row_t **rowsp, int nfiles)
384 for (i = 0; i < nfiles; i++)
385 free((*rowsp)[i].name);
390 /* Change working directory. */
391 /* NOTE: The caller needs to write the new path to CWD
392 * *before* calling this function. */
398 if (reset) ESEL = SCROLL = 0;
401 free_rows(&rover.rows, rover.nfiles);
402 rover.nfiles = ls(CWD, &rover.rows, FLAGS);
403 if (!strcmp(CWD, rover.marks.dirpath)) {
404 for (i = 0; i < rover.nfiles; i++) {
405 for (j = 0; j < rover.marks.bulk; j++)
407 rover.marks.entries[j] &&
408 !strcmp(rover.marks.entries[j], ENAME(i))
411 MARKED(i) = j < rover.marks.bulk;
414 else for (i = 0; i < rover.nfiles; i++)
419 /* Recursively process a source directory using CWD as destination root.
420 * For each node (i.e. directory), do the following:
421 * 1. call pre(destination);
422 * 2. call proc() on every child leaf (i.e. files);
423 * 3. recurse into every child node;
424 * 4. call pos(source).
425 * E.g. to move directory /src/ (and all its contents) inside /dst/:
426 * strcpy(CWD, "/dst/");
427 * process_dir(adddir, movfile, deldir, "/src/");
430 process_dir(PROCESS pre, PROCESS proc, PROCESS pos, const char *path)
435 char subpath[FILENAME_MAX];
438 char dstpath[FILENAME_MAX];
439 strcpy(dstpath, CWD);
440 strcat(dstpath, path + strlen(rover.marks.dirpath));
443 if(!(dp = opendir(path))) return;
444 while ((ep = readdir(dp))) {
445 if (!strcmp(ep->d_name, ".") || !strcmp(ep->d_name, ".."))
447 sprintf(subpath, "%s%s", path, ep->d_name);
448 stat(subpath, &statbuf);
449 if (S_ISDIR(statbuf.st_mode)) {
450 strcat(subpath, "/");
451 process_dir(pre, proc, pos, subpath);
459 /* Process all marked entries using CWD as destination root.
460 * All marked entries that are directories will be recursively processed.
461 * See process_dir() for details on the parameters.
464 process_marked(PROCESS pre, PROCESS proc, PROCESS pos)
467 char path[FILENAME_MAX];
469 for (i = 0; i < rover.marks.bulk; i++)
470 if (rover.marks.entries[i]) {
471 sprintf(path, "%s%s", rover.marks.dirpath, rover.marks.entries[i]);
472 if (ISDIR(rover.marks.entries[i])) {
473 if (!strncmp(path, CWD, strlen(path)))
474 message("Cannot copy/move directory inside itself.", RED);
476 process_dir(pre, proc, pos, path);
480 mark_none(&rover.marks);
484 /* Wrappers for file operations. */
485 static PROCESS delfile = unlink;
486 static PROCESS deldir = rmdir;
487 static int addfile(const char *path) {
488 /* Using creat(2) because mknod(2) doesn't seem to be portable. */
491 ret = creat(path, 0644);
492 if (ret < 0) return ret;
495 static int cpyfile(const char *srcpath) {
500 char dstpath[FILENAME_MAX];
502 ret = src = open(srcpath, O_RDONLY);
503 if (ret < 0) return ret;
504 ret = fstat(src, &st);
505 if (ret < 0) return ret;
506 strcpy(dstpath, CWD);
507 strcat(dstpath, srcpath + strlen(rover.marks.dirpath));
508 ret = dst = creat(dstpath, st.st_mode);
509 if (ret < 0) return ret;
510 while ((size = read(src, buf, BUFSIZ)) > 0)
511 write(dst, buf, size);
516 static int adddir(const char *path) {
520 ret = stat(CWD, &st);
521 if (ret < 0) return ret;
522 return mkdir(path, st.st_mode);
524 static int movfile(const char *srcpath) {
525 char dstpath[FILENAME_MAX];
527 strcpy(dstpath, CWD);
528 strcat(dstpath, srcpath + strlen(rover.marks.dirpath));
529 return rename(srcpath, dstpath);
532 /* Do a fork-exec to external program (e.g. $EDITOR). */
541 /* fork() succeeded. */
543 waitpid(pid, &status, 0);
549 execvp(ARGS[0], ARGS);
553 /* Interactive getstr(). */
555 igetstr(char *buffer, int maxlen)
559 length = strlen(buffer);
562 if (ch == '\r' || ch == '\n' || ch == KEY_DOWN || ch == KEY_ENTER) {
566 else if (ch == erasechar() || ch == KEY_LEFT || ch == KEY_BACKSPACE) {
568 buffer[--length] = '\0';
570 else if (ch == killchar()) {
574 else if (length < maxlen - 1 && isprint(ch)) {
575 buffer[length++] = ch;
576 buffer[length] = '\0';
581 /* Update line input on the screen. */
583 update_input(char *prompt, color_t color)
587 plen = strlen(prompt);
588 ilen = strlen(INPUT);
589 color_set(RVC_PROMPT, NULL);
590 mvaddstr(LINES - 1, 0, prompt);
591 color_set(color, NULL);
592 mvaddstr(LINES - 1, plen, INPUT);
593 mvaddch(LINES - 1, ilen + plen, ' ');
594 move(LINES - 1, ilen + plen);
595 color_set(DEFAULT, NULL);
598 /* Show a message on the status bar. */
600 message(const char *msg, color_t color)
605 pos = (STATUSPOS - len) >> 1;
606 attr_on(A_BOLD, NULL);
607 color_set(color, NULL);
608 mvaddstr(LINES - 1, pos, msg);
609 color_set(DEFAULT, NULL);
610 attr_off(A_BOLD, NULL);
614 main(int argc, char *argv[])
622 for (i = 0; i < 10; i++) {
623 rover.esel[i] = rover.scroll[i] = 0;
624 rover.flags[i] = SHOW_FILES | SHOW_DIRS;
626 strcpy(rover.cwd[0], getenv("HOME"));
627 for (i = 1; i < argc && i < 10; i++) {
628 if ((d = opendir(argv[i]))) {
629 strcpy(rover.cwd[i], argv[i]);
632 else strcpy(rover.cwd[i], rover.cwd[0]);
634 getcwd(rover.cwd[i], FILENAME_MAX);
635 for (i++; i < 10; i++)
636 strcpy(rover.cwd[i], rover.cwd[i-1]);
637 for (i = 0; i < 10; i++)
638 if (rover.cwd[i][strlen(rover.cwd[i]) - 1] != '/')
639 strcat(rover.cwd[i], "/");
641 rover.window = subwin(stdscr, LINES - 2, COLS, 1, 0);
642 init_marks(&rover.marks);
647 mvhline(LINES - 1, 0, ' ', STATUSPOS); /* Clear message area. */
648 if (!strcmp(key, RVK_QUIT)) break;
649 else if (ch >= '0' && ch <= '9') {
650 rover.tab = ch - '0';
653 else if (!strcmp(key, RVK_DOWN)) {
654 if (!rover.nfiles) continue;
655 ESEL = (ESEL + 1) % rover.nfiles;
658 else if (!strcmp(key, RVK_UP)) {
659 if (!rover.nfiles) continue;
660 ESEL = ESEL ? ESEL - 1 : rover.nfiles - 1;
663 else if (!strcmp(key, RVK_JUMP_DOWN)) {
664 if (!rover.nfiles) continue;
665 ESEL = MIN(ESEL + RV_JUMP, rover.nfiles - 1);
666 if (rover.nfiles > HEIGHT)
667 SCROLL = MIN(SCROLL + RV_JUMP, rover.nfiles - HEIGHT);
670 else if (!strcmp(key, RVK_JUMP_UP)) {
671 if (!rover.nfiles) continue;
672 ESEL = MAX(ESEL - RV_JUMP, 0);
673 SCROLL = MAX(SCROLL - RV_JUMP, 0);
676 else if (!strcmp(key, RVK_CD_DOWN)) {
677 if (!rover.nfiles || !ISDIR(ENAME(ESEL))) continue;
678 strcat(CWD, ENAME(ESEL));
681 else if (!strcmp(key, RVK_CD_UP)) {
682 char *dirname, first;
683 if (strlen(CWD) == 1) continue;
684 CWD[strlen(CWD) - 1] = '\0';
685 dirname = strrchr(CWD, '/') + 1;
689 if ((FLAGS & SHOW_DIRS) &&
690 ((FLAGS & SHOW_HIDDEN) || (first != '.'))
693 dirname[strlen(dirname)] = '/';
694 while (strcmp(ENAME(ESEL), dirname))
696 if (rover.nfiles > HEIGHT) {
697 SCROLL = ESEL - (HEIGHT >> 1);
698 SCROLL = MIN(MAX(SCROLL, 0), rover.nfiles - HEIGHT);
704 else if (!strcmp(key, RVK_HOME)) {
705 strcpy(CWD, getenv("HOME"));
706 if (CWD[strlen(CWD) - 1] != '/')
710 else if (!strcmp(key, RVK_SHELL)) {
711 program = getenv("SHELL");
719 else if (!strcmp(key, RVK_VIEW)) {
720 if (!rover.nfiles || ISDIR(ENAME(ESEL))) continue;
721 program = getenv("PAGER");
724 ARGS[1] = ENAME(ESEL);
729 else if (!strcmp(key, RVK_EDIT)) {
730 if (!rover.nfiles || ISDIR(ENAME(ESEL))) continue;
731 program = getenv("EDITOR");
734 ARGS[1] = ENAME(ESEL);
740 else if (!strcmp(key, RVK_SEARCH)) {
741 int oldsel, oldscroll, length;
742 char *prompt = "search: ";
743 if (!rover.nfiles) continue;
747 update_input(prompt, DEFAULT);
748 while (igetstr(INPUT, INPUTSZ)) {
751 length = strlen(INPUT);
753 for (sel = 0; sel < rover.nfiles; sel++)
754 if (!strncmp(ENAME(sel), INPUT, length))
756 if (sel < rover.nfiles) {
759 if (rover.nfiles > HEIGHT) {
762 else if (sel - 3 > rover.nfiles - HEIGHT)
763 SCROLL = rover.nfiles - HEIGHT;
774 update_input(prompt, color);
776 mvhline(LINES - 1, 0, ' ', STATUSPOS);
779 else if (!strcmp(key, RVK_TG_FILES)) {
783 else if (!strcmp(key, RVK_TG_DIRS)) {
787 else if (!strcmp(key, RVK_TG_HIDDEN)) {
788 FLAGS ^= SHOW_HIDDEN;
791 else if (!strcmp(key, RVK_NEW_FILE)) {
793 char *prompt = "new file: ";
795 update_input(prompt, DEFAULT);
796 while (igetstr(INPUT, INPUTSZ)) {
797 int length = strlen(INPUT);
799 for (i = 0; i < rover.nfiles; i++) {
801 !strncmp(ENAME(i), INPUT, length) &&
802 (!strcmp(ENAME(i) + length, "") ||
803 !strcmp(ENAME(i) + length, "/"))
809 update_input(prompt, ok ? GREEN : RED);
811 mvhline(LINES - 1, 0, ' ', STATUSPOS);
813 if (ok) { addfile(INPUT); cd(1); }
814 else message("File already exists.", RED);
817 else if (!strcmp(key, RVK_NEW_DIR)) {
819 char *prompt = "new directory: ";
821 update_input(prompt, DEFAULT);
822 while (igetstr(INPUT, INPUTSZ)) {
823 int length = strlen(INPUT);
825 for (i = 0; i < rover.nfiles; i++) {
827 !strncmp(ENAME(i), INPUT, length) &&
828 (!strcmp(ENAME(i) + length, "") ||
829 !strcmp(ENAME(i) + length, "/"))
835 update_input(prompt, ok ? GREEN : RED);
837 mvhline(LINES - 1, 0, ' ', STATUSPOS);
839 if (ok) { adddir(INPUT); cd(1); }
840 else message("File already exists.", RED);
843 else if (!strcmp(key, RVK_RENAME)) {
845 char *prompt = "rename: ";
846 strcpy(INPUT, ENAME(ESEL));
847 update_input(prompt, RED);
848 while (igetstr(INPUT, INPUTSZ)) {
849 int length = strlen(INPUT);
851 for (i = 0; i < rover.nfiles; i++) {
853 !strncmp(ENAME(i), INPUT, length) &&
854 (!strcmp(ENAME(i) + length, "") ||
855 !strcmp(ENAME(i) + length, "/"))
861 update_input(prompt, ok ? GREEN : RED);
863 mvhline(LINES - 1, 0, ' ', STATUSPOS);
865 if (ok) { rename(ENAME(ESEL), INPUT); cd(1); }
866 else message("File already exists.", RED);
869 else if (!strcmp(key, RVK_TG_MARK)) {
871 del_mark(&rover.marks, ENAME(ESEL));
873 add_mark(&rover.marks, CWD, ENAME(ESEL));
874 MARKED(ESEL) = !MARKED(ESEL);
875 ESEL = (ESEL + 1) % rover.nfiles;
878 else if (!strcmp(key, RVK_INVMARK)) {
879 for (i = 0; i < rover.nfiles; i++) {
881 del_mark(&rover.marks, ENAME(i));
883 add_mark(&rover.marks, CWD, ENAME(i));
884 MARKED(i) = !MARKED(i);
888 else if (!strcmp(key, RVK_MARKALL)) {
889 for (i = 0; i < rover.nfiles; i++)
891 add_mark(&rover.marks, CWD, ENAME(i));
896 else if (!strcmp(key, RVK_DELETE)) {
897 if (rover.marks.nentries) {
898 message("Delete marked entries? (Y to confirm)", YELLOW);
900 process_marked(NULL, delfile, deldir);
901 mvhline(LINES - 1, 0, ' ', STATUSPOS); /* Clear message area. */
903 else message("No entries marked for deletion.", RED);
905 else if (!strcmp(key, RVK_COPY)) {
906 if (rover.marks.nentries)
907 process_marked(adddir, cpyfile, NULL);
908 else message("No entries marked for copying.", RED);
910 else if (!strcmp(key, RVK_MOVE)) {
911 if (rover.marks.nentries)
912 process_marked(adddir, movfile, deldir);
913 else message("No entries marked for moving.", RED);
917 free_rows(&rover.rows, rover.nfiles);
918 free_marks(&rover.marks);
919 delwin(rover.window);