#include "aardvark.h"
+#include <stdint.h>
#include <ncurses.h>
typedef struct {
- char a, b, c;
+ uint8_t a, b, c;
} Triplet_T;
static Triplet_T aadata[77] = {
void aardvark_draw(void) {
int row, col;
- getmaxyx(stdscr, row, col);
int i;
int trips=sizeof(aadata)/sizeof(Triplet_T);
char* aardvark="############################################################";
+ getmaxyx(stdscr, row, col);
for(i=0; i<trips; i++)
mvaddnstr(((row-28)/2)+aadata[i].a, (col-70)/2+aadata[i].b, aardvark, aadata[i].c);
refresh();
#include <sys/stat.h>
#include <unistd.h>
-#include <vec.h>
-#include <mem.h>
-
+#include "vec.h"
+#include "mem.h"
#include "state.h"
#include "workdir.h"
int index = state_get_focused_frame();
//do nothing if at the end of the file list
if(Windows[index].idx < vec_size(Windows[index].vfiles)-1){
- Windows[index].idx += 1;
int rows,cols;
+ Windows[index].idx += 1;
getmaxyx(stdscr, rows,cols);
(void) cols;
if((TopBuffer+Windows[index].idx+BotBuffer) > rows)
void workdir_ls(void) {
int windex = state_get_focused_frame();
- get_files(windex);
int i = Windows[windex].top_index;
int rows, cols;
+ get_files(windex);
getmaxyx(stdscr, rows, cols);
attron(A_UNDERLINE);
mvaddnstr(1, 1, Windows[windex].cwd, cols-2);
static void get_files(int windex){
int i=0;
- if(Windows[windex].vfiles) mem_release(Windows[windex].vfiles);
char* dotdot = mem_allocate(sizeof(char)*3, NULL);
- strcpy(dotdot, "..");
- Windows[windex].vfiles = vec_new(1, dotdot); /* TODO: check if cwd = / */
char cmd[1028] = "ls ";
- strcpy(&cmd[3], Windows[windex].cwd);
- FILE* ls = popen(cmd, "r");
size_t len = 0; //unused. reflects sized allocated for buffer (filename) by getline
ssize_t read;
char* filename=0;
+ FILE* ls;
+ if(Windows[windex].vfiles) mem_release(Windows[windex].vfiles);
+ strcpy(dotdot, "..");
+ Windows[windex].vfiles = vec_new(1, dotdot); /* TODO: check if cwd = / */
+ strcpy(&cmd[3], Windows[windex].cwd);
+ ls = popen(cmd, "r");
i = 1;
while ((read = getline(&filename, &len, ls)) != -1){
filename[read-1]=0; //remove ending newline