mirror of
https://github.com/tat3r/tdfiglet.git
synced 2024-12-22 06:36:40 +00:00
bugchasing
This commit is contained in:
parent
99997d2762
commit
09fbef581e
10
Makefile
10
Makefile
@ -4,7 +4,7 @@ PREFIX ?= /usr/local
|
||||
FONTS := fonts/*
|
||||
FONTDIR := $(PREFIX)/share/$(PROG)/fonts
|
||||
CC ?= cc
|
||||
CFLAGS += -DFONT_DIR=\"$(FONTDIR)\" -std=c99 -Wall
|
||||
CFLAGS += -DFONT_DIR=\"$(FONTDIR)\" -std=c99 -Wall -g
|
||||
|
||||
UNAME := $(shell sh -c 'uname -s 2>/dev/null')
|
||||
|
||||
@ -19,10 +19,10 @@ default: $(SRC)
|
||||
.PHONY: debug clean install
|
||||
|
||||
install:
|
||||
install -m 0755 -d $(PREFIX)/bin
|
||||
install -m 0755 -d $(FONTDIR)
|
||||
install -m 0755 $(PROG) $(PREFIX)/bin/$(PROG)
|
||||
for i in $(FONTS) ; do install -m 0644 $$i $(FONTDIR) ; done
|
||||
test -d $(FONTDIR) || mkdir -p $(PREFIX)/bin
|
||||
cp $(PROG) $(PREFIX)/bin
|
||||
test -d $(FONTDIR) || mkdir -p $(FONTDIR)
|
||||
for i in $(FONTS) ; do cp -v $$i $(FONTDIR) ; done
|
||||
|
||||
debug: $(SRC)
|
||||
$(CC) -DDEBUG -g $(CFLAGS) $(LDFLAGS) $(SRC) -o $(PROG)
|
||||
|
18
tdfiglet.c
18
tdfiglet.c
@ -143,10 +143,6 @@ main(int argc, char *argv[])
|
||||
opt.encoding = ENC_UNICODE;
|
||||
char *fontfile = NULL;
|
||||
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
}
|
||||
|
||||
while((o = getopt(argc, argv, "f:w:j:c:e:i")) != -1) {
|
||||
switch (o) {
|
||||
case 'f':
|
||||
@ -207,6 +203,10 @@ main(int argc, char *argv[])
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc < 1) {
|
||||
usage();
|
||||
}
|
||||
|
||||
if (!fontfile) {
|
||||
fontfile = DEFAULT_FONT;
|
||||
}
|
||||
@ -247,7 +247,7 @@ font_t
|
||||
sprintf(fn, "%s/%s", FONT_DIR, fn_arg);
|
||||
} else {
|
||||
fn = malloc(strlen(FONT_DIR) + strlen(fn_arg) + \
|
||||
strlen(FONT_EXT) + 1);
|
||||
strlen(FONT_EXT) + 2);
|
||||
sprintf(fn, "%s/%s.%s", FONT_DIR, fn_arg, FONT_EXT);
|
||||
}
|
||||
} else {
|
||||
@ -273,7 +273,7 @@ font_t
|
||||
|
||||
font = malloc(sizeof(font_t));
|
||||
|
||||
if (stat(fn, &st)) {
|
||||
if (fstat(fd, &st)) {
|
||||
perror(NULL);
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
@ -468,8 +468,8 @@ printcolor(uint8_t color)
|
||||
uint8_t fg = color & 0x0f;
|
||||
uint8_t bg = (color & 0xf0) >> 4;
|
||||
|
||||
/* thedraw colors DRK BRT BRT BRT RED BRT */
|
||||
/* thedraw colors BLK BLU GRN CYN RED MAG BRN GRY GRY BLU GRN CYN RED PNK YLW WHT */
|
||||
/* thedraw colors BRT BRT BRT BRT BRT BRT BRT BRT */
|
||||
/* thedraw colors BLK BLU GRN CYN RED MAG BRN GRY BLK BLU GRN CYN RED PNK YLW WHT */
|
||||
uint8_t fgacolors[] = {30, 34, 32, 36, 31, 35, 33, 37, 90, 94, 92, 96, 91, 95, 93, 97};
|
||||
uint8_t bgacolors[] = {40, 44, 42, 46, 41, 45, 43, 47};
|
||||
uint8_t fgmcolors[] = { 1, 2, 3, 10, 5, 6, 7, 15, 14, 12, 9, 11, 4, 13, 8, 0};
|
||||
@ -495,7 +495,7 @@ printrow(const glyph_t *glyph, int row)
|
||||
uint8_t lastcolor;
|
||||
|
||||
for (i = 0; i < glyph->width; i++) {
|
||||
utfchar = glyph->cell[glyph->width * row + i].utfchar;
|
||||
utfchar = glyph->cell[glyph->width * row + i].utfchar;
|
||||
color = glyph->cell[glyph->width * row + i].color;
|
||||
|
||||
if (i == 0 || color != lastcolor) {
|
||||
|
Loading…
Reference in New Issue
Block a user