aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-04-25 15:54:52 -0400
committerCameron Katri <me@cameronkatri.com>2021-04-25 16:09:04 -0400
commite0aa299f91fc0afc516cc107eed847ce28b3ebe1 (patch)
treeaf032a270a82e516538a8c1094a248ce90345e0a
parent5cd70ab92f72621b6c3e2b4d6c017aac47194ab9 (diff)
downloadopendircolors-e0aa299f91fc0afc516cc107eed847ce28b3ebe1.tar.gz
opendircolors-e0aa299f91fc0afc516cc107eed847ce28b3ebe1.tar.zst
opendircolors-e0aa299f91fc0afc516cc107eed847ce28b3ebe1.zip
Fix SIGILL when -O is greater than 0, fix make install
-rw-r--r--Makefile5
-rw-r--r--convert.c (renamed from lscolors.c)6
2 files changed, 7 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index e047301..2cf3c76 100644
--- a/Makefile
+++ b/Makefile
@@ -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>
diff --git a/lscolors.c b/convert.c
index ff735f4..004e8c4 100644
--- a/lscolors.c
+++ b/convert.c
@@ -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;
}