]> git.cameronkatri.com Git - opendircolors.git/blobdiff - opendircolors.c
dirconvert(1): Clarify stdin reading in manpage
[opendircolors.git] / opendircolors.c
index 6f91f0d970e1a5fe2aa9e06c3f53e87887dfd473..bda00dcfd3fa3e7fa2ac8cd79f53956abbb10bea 100644 (file)
  * SUCH DAMAGE.
  */
 
+#include <err.h>
+#include <errno.h>
 #include <getopt.h>
+#include <libgen.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sysexits.h>
-#include <errno.h>
-#include <libgen.h>
-#include <err.h>
 
 #include "common.h"
 
-void usage(const char*);
+void usage(const char *);
 
 #define MAXKEYLEN 21
 
@@ -46,6 +46,7 @@ static const struct option long_options[] = {     /* no clang-format */
        { "bourne-shell", no_argument, NULL, 'b' }, /**/
        { "sh", no_argument, NULL, 'b' },           /**/
        { "csh", no_argument, NULL, 'c' },          /**/
+       { "c-shell", no_argument, NULL, 'c' },      /**/
        { NULL, no_argument, NULL, 0 }
 };
 
@@ -67,18 +68,18 @@ main(int argc, char **argv)
        int ch;
        FILE *fd;
        char *prefix = "LS_COLORS='";
-       char *suffix = "';\nexport LS_COLORS";
+       char *suffix = "';\nexport LS_COLORS;";
        char *lsprefix = "LSCOLORS='";
-       char *lssuffix = "';\nexport LSCOLORS";
+       char *lssuffix = "';\nexport LSCOLORS;";
 
        while (
            (ch = getopt_long(argc, argv, "hbc", long_options, NULL)) != -1) {
                switch (ch) {
                case 'b':
                        prefix = "LS_COLORS='";
-                       suffix = "';\nexport LS_COLORS";
+                       suffix = "';\nexport LS_COLORS;";
                        lsprefix = "LSCOLORS='";
-                       lssuffix = "';\nexport LSCOLORS";
+                       lssuffix = "';\nexport LSCOLORS;";
                        break;
                case 'c':
                        prefix = "setenv LS_COLORS '";
@@ -103,7 +104,7 @@ main(int argc, char **argv)
                fd = stdin;
        else if ((fd = fopen(path, "r")) == NULL) {
                warnx("%s: %s\n", path, strerror(errno));
-               return(errno);
+               return (errno);
        }
 
        char *line = NULL;