]> git.cameronkatri.com Git - opendircolors.git/commitdiff
Fix SIGILL when -O is greater than 0, fix make install
authorCameron Katri <me@cameronkatri.com>
Sun, 25 Apr 2021 19:54:52 +0000 (15:54 -0400)
committerCameron Katri <me@cameronkatri.com>
Sun, 25 Apr 2021 20:09:04 +0000 (16:09 -0400)
Makefile
convert.c [moved from lscolors.c with 97% similarity]

index e047301d28075e060a1e290cb98ce230675158e0..2cf3c76fc844b2deca8bfa70333b47786f861582 100644 (file)
--- 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>
similarity index 97%
rename from lscolors.c
rename to convert.c
index ff735f423120086dcf06ad4878519fa840a2df99..004e8c48cbcb63132d075923f8179720282acf52 100644 (file)
+++ 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;
 }