diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-04-25 15:54:52 -0400 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-04-25 16:09:04 -0400 |
commit | e0aa299f91fc0afc516cc107eed847ce28b3ebe1 (patch) | |
tree | af032a270a82e516538a8c1094a248ce90345e0a | |
parent | 5cd70ab92f72621b6c3e2b4d6c017aac47194ab9 (diff) | |
download | opendircolors-e0aa299f91fc0afc516cc107eed847ce28b3ebe1.tar.gz opendircolors-e0aa299f91fc0afc516cc107eed847ce28b3ebe1.tar.zst opendircolors-e0aa299f91fc0afc516cc107eed847ce28b3ebe1.zip |
Fix SIGILL when -O is greater than 0, fix make install
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | convert.c (renamed from lscolors.c) | 6 |
2 files changed, 7 insertions, 4 deletions
@@ -1,7 +1,10 @@ PROG= opendircolors -SRCS= lscolors.c +SRCS= convert.c MAN= +BINDIR=/usr/local/bin +LINKS= ${BINDIR}/opendircolors ${BINDIR}/dircolors + MAKEOBJDIR=obj .include <bsd.prog.mk> @@ -60,7 +60,7 @@ main(int argc, char **argv) int tolscolors(char *dircolor) { - char *color, *ent, *buf, *val, *val2; + char *ent, *buf, *val, *val2; char out[22] = "xxxxxxxxxxxxxxxxxxxxxx"; bool bold = false; @@ -103,8 +103,7 @@ numtocol(char c, bool bold) int tols_colors(char *lscolors) { - char *ls_out; - strcpy(ls_out, ""); + char *ls_out = strdup(""); for (int i = 0; i < 11; i++) { if (lscolors[2 * i] == 'x' && lscolors[2 * i + 1] == 'x') @@ -123,6 +122,7 @@ tols_colors(char *lscolors) sprintf(ls_out + strlen(ls_out), ":"); } printf("%s\n", ls_out); + free(ls_out); return 0; } |