commit - 8fcd80b10a857ec4371865d45c8fbdbd96b9cd7f
commit + eef51ac5f1740f16e00d1af34df4b8b4ce7fb44f
blob - 2c91a6725a2d4530a6fbdb59478164f4f50206fe
blob + bc1f866077af422d7c6f8bc9ea315fa85e63bbd2
--- rover.c
+++ rover.c
char *name;
off_t size;
int marked;
-} row_t;
+} Row;
/* Dynamic array of marked entries. */
typedef struct {
int bulk;
int nentries;
char **entries;
-} marks_t;
+} Marks;
/* Global state. Some basic info is allocated for ten tabs. */
-static struct rover_t {
+static struct Rover {
int tab;
int nfiles;
int scroll[10];
int esel[10];
uint8_t flags[10];
- row_t *rows;
+ Row *rows;
WINDOW *window;
char cwd[10][FILENAME_MAX];
- marks_t marks;
+ Marks marks;
} rover;
/* Macros for accessing global state. */
#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_t;
+typedef enum {DEFAULT, RED, GREEN, YELLOW, BLUE, CYAN, MAGENTA, WHITE} Color;
typedef int (*PROCESS)(const char *path);
static void
-init_marks(marks_t *marks)
+init_marks(Marks *marks)
{
strcpy(marks->dirpath, "");
marks->bulk = BULK_INIT;
/* Unmark all entries. */
static void
-mark_none(marks_t *marks)
+mark_none(Marks *marks)
{
int i;
}
static void
-add_mark(marks_t *marks, char *dirpath, char *entry)
+add_mark(Marks *marks, char *dirpath, char *entry)
{
int i;
}
static void
-del_mark(marks_t *marks, char *entry)
+del_mark(Marks *marks, char *entry)
{
int i;
}
static void
-free_marks(marks_t *marks)
+free_marks(Marks *marks)
{
int i;
free(marks->entries);
}
-static void message(const char *msg, color_t color);
+static void message(const char *msg, Color color);
static void clear_message();
static void handle_segv(int sig);
rowcmp(const void *a, const void *b)
{
int isdir1, isdir2, cmpdir;
- const row_t *r1 = a;
- const row_t *r2 = b;
+ const Row *r1 = a;
+ const Row *r2 = b;
isdir1 = ISDIR(r1->name);
isdir2 = ISDIR(r2->name);
cmpdir = isdir2 - isdir1;
/* Get all entries for a given path (usually cwd). */
static int
-ls(char *path, row_t **rowsp, uint8_t flags)
+ls(char *path, Row **rowsp, uint8_t flags)
{
DIR *dp;
struct dirent *ep;
struct stat statbuf;
- row_t *rows;
+ Row *rows;
int i, n;
if(!(dp = opendir(path))) return -1;
}
static void
-free_rows(row_t **rowsp, int nfiles)
+free_rows(Row **rowsp, int nfiles)
{
int i;
/* Update line input on the screen. */
static void
-update_input(char *prompt, color_t color)
+update_input(char *prompt, Color color)
{
int plen, ilen;
/* Show a message on the status bar. */
static void
-message(const char *msg, color_t color)
+message(const char *msg, Color color)
{
int len, pos;
update_input(prompt, DEFAULT);
while (igetstr(INPUT, INPUTSZ)) {
int sel;
- color_t color = RED;
+ Color color = RED;
length = strlen(INPUT);
if (length) {
for (sel = 0; sel < rover.nfiles; sel++)