commit - 496dd2b0d22a9e1f88d1e553c659fc6bc87a4bb2
commit + 8f853fb5f771e6b061dddb1d778178c160361453
blob - 0e1ea92883d9f25f10262dd7c5a618ce85f671e9
blob + 3f04ea537a06e47f3deefc5eb28bf0b268a08976
--- rover.c
+++ rover.c
#define BULK_THRESH 256
/* Information associated to each entry in listing. */
-typedef struct {
+typedef struct Row {
char *name;
off_t size;
int marked;
} Row;
/* Dynamic array of marked entries. */
-typedef struct {
+typedef struct Marks {
char dirpath[FILENAME_MAX];
int bulk;
int nentries;
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define ISDIR(E) (strchr((E), '/') != NULL)
-typedef enum {DEFAULT, RED, GREEN, YELLOW, BLUE, CYAN, MAGENTA, WHITE} Color;
+typedef enum Color {DEFAULT, RED, GREEN, YELLOW, BLUE, CYAN, MAGENTA, WHITE} Color;
typedef int (*PROCESS)(const char *path);
static void
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
curs_set(FALSE); /* Hide blinking cursor. */
- memset(&sa, 0, sizeof (struct sigaction));
- /* Setup SIGSEGV handler. */
- sa.sa_handler = handle_segv;
- sigaction(SIGSEGV, &sa, NULL);
- /* Setup SIGWINCH handler. */
- sa.sa_handler = handle_winch;
- sigaction(SIGWINCH, &sa, NULL);
if (has_colors()) {
short bg;
start_color();
init_pair(WHITE, COLOR_WHITE, bg);
}
atexit((void (*)(void)) endwin);
+ memset(&sa, 0, sizeof (struct sigaction));
+ /* Setup SIGSEGV handler. */
+ sa.sa_handler = handle_segv;
+ sigaction(SIGSEGV, &sa, NULL);
+ /* Setup SIGWINCH handler. */
+ sa.sa_handler = handle_winch;
+ sigaction(SIGWINCH, &sa, NULL);
}
/* Update the listing view. */
continue;
if (!(flags & SHOW_HIDDEN) && ep->d_name[0] == '.')
continue;
- /* FIXME: ANSI C doesn't have lstat(). How do we handle symlinks? */
+ /* FIXME: POSIX < 200112L doesn't have lstat(). How do we handle symlinks? */
stat(ep->d_name, &statbuf);
if (S_ISDIR(statbuf.st_mode)) {
if (flags & SHOW_DIRS) {
*rowsp = NULL;
}
-/* Change working directory. */
-/* NOTE: The caller needs to write the new path to CWD
- *before* calling this function. */
+/* Change working directory to the path in CWD. */
static void
cd(int reset)
{