added #define E_NAME etc, to enable faster customisation (eg renaming editor for a different project).

This commit is contained in:
Hugh Barney 2017-03-26 17:59:15 +01:00
parent 16aaf4d44b
commit e1b7e7d467

10
zep.c
View File

@ -14,6 +14,10 @@
#include <unistd.h> #include <unistd.h>
#include <termios.h> #include <termios.h>
#define E_NAME "zep"
#define E_VERSION "v1.2"
#define E_LABEL "Zep:"
#define B_MODIFIED 0x01 /* modified buffer */ #define B_MODIFIED 0x01 /* modified buffer */
#define MSGLINE (LINES-1) #define MSGLINE (LINES-1)
#define CHUNK 8096L #define CHUNK 8096L
@ -97,7 +101,7 @@ void fatal(char *msg)
refresh(); refresh();
endwin(); endwin();
noraw(); noraw();
printf("\nzep v1.1: %s\n", msg); printf("\n" E_NAME " " E_VERSION ": %s\n", msg);
exit(1); exit(1);
} }
@ -374,7 +378,7 @@ void modeline(buffer_t *bp)
standout(); standout();
move(bp->w_top + bp->w_rows, 0); move(bp->w_top + bp->w_rows, 0);
mch = ((bp->b_flags & B_MODIFIED) ? '*' : '='); mch = ((bp->b_flags & B_MODIFIED) ? '*' : '=');
sprintf(temp, "=%c Zep: == %s ", mch, bp->b_fname); sprintf(temp, "=%c " E_LABEL " == %s ", mch, bp->b_fname);
addstr(temp); addstr(temp);
for (i = strlen(temp) + 1; i <= COLS; i++) for (i = strlen(temp) + 1; i <= COLS; i++)
@ -715,7 +719,7 @@ keymap_t keymap[] = {
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
if (argc != 2) fatal("usage: zep filename\n"); if (argc != 2) fatal("usage: " E_NAME " filename\n");
initscr(); initscr();
raw(); raw();