aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-28 22:13:51 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-28 22:13:51 -0800
commit2aa5f544a7a03c1ad59c70ed149911aa3ece0898 (patch)
tree0273c184d85863da1b17bebd286a8b7002ec4ffb /bb.c
parent657330ddd6d7a67e16c198b4e9ad2aac239d4799 (diff)
Reorganized header files
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/bb.c b/bb.c
index 76bf659..960fbe7 100644
--- a/bb.c
+++ b/bb.c
@@ -6,6 +6,7 @@
* This file contains the main source code of `bb`.
*/
+#include <ctype.h>
#include <fcntl.h>
#include <glob.h>
#include <limits.h>
@@ -20,14 +21,19 @@
#include <termios.h>
#include <unistd.h>
-#include "bb.h"
#include "draw.h"
#include "terminal.h"
+#include "types.h"
+#include "utils.h"
#ifndef BB_NAME
#define BB_NAME "bb"
#endif
+#define BB_VERSION "0.27.0"
+#define MAX_BINDINGS 1024
+#define SCROLLOFF MIN(5, (winsize.ws_row-4)/2)
+
// Functions
void bb_browse(bb_t *bb, const char *initial_path);
static void check_cmdfile(bb_t *bb);
@@ -208,7 +214,7 @@ static int compare_files(const void *v1, const void *v2, void *v)
*/
const char *n1 = e1->name, *n2 = e2->name;
while (*n1 && *n2) {
- char c1 = LOWERCASE(*n1), c2 = LOWERCASE(*n2);
+ char c1 = tolower(*n1), c2 = tolower(*n2);
if ('0' <= c1 && c1 <= '9' && '0' <= c2 && c2 <= '9') {
long i1 = strtol(n1, (char**)&n1, 10);
long i2 = strtol(n2, (char**)&n2, 10);
@@ -224,7 +230,7 @@ static int compare_files(const void *v1, const void *v2, void *v)
++n1; ++n2;
}
}
- COMPARE(LOWERCASE(*n2), LOWERCASE(*n1));
+ COMPARE(tolower(*n2), tolower(*n1));
break;
}
case COL_PERM: COMPARE((e1->info.st_mode & 0x3FF), (e2->info.st_mode & 0x3FF)); break;