bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some problems in bash-devel #2


From: Joachim Schmitz
Subject: Some problems in bash-devel #2
Date: Sat, 15 Sep 2012 17:38:11 +0200

Hi Chet

Here's my 2nd batch of fixes to the devel branch, it is mainly about // comments vs. /* */ ones

diff --git a/lib/readline/colors.c b/lib/readline/colors.c
index 7a271f2..ebf9e42 100644
--- a/lib/readline/colors.c
+++ b/lib/readline/colors.c
@@ -34,17 +34,17 @@

#include <stdio.h>

-#include "posixstat.h" // stat related macros (S_ISREG, ...)
-#include <fcntl.h> // S_ISUID
+#include "posixstat.h" /* stat related macros (S_ISREG, ...) */
+#include <fcntl.h> /* S_ISUID */

-// strlen()
+/* strlen() */
#if defined (HAVE_STRING_H)
#  include <string.h>
#else /* !HAVE_STRING_H */
#  include <strings.h>
#endif /* !HAVE_STRING_H */

-// abort()
+/* abort() */
#if defined (HAVE_STDLIB_H)
#  include <stdlib.h>
#else
@@ -123,6 +123,7 @@ _rl_print_color_indicator (char *f)
      name = filename;
    }

+  {
#if defined (HAVE_LSTAT)
  int stat_ok = lstat(name, &astat);
#else
@@ -130,7 +131,7 @@ _rl_print_color_indicator (char *f)
#endif
  if( stat_ok == 0 ) {
    mode = astat.st_mode;
-    linkok = 1; //f->linkok;
+    linkok = 1; /*f->linkok;*/
  }
  else
    linkok = -1;
@@ -142,7 +143,7 @@ _rl_print_color_indicator (char *f)
  else if(stat_ok != 0)
    {
      static enum indicator_no filetype_indicator[] = FILETYPE_INDICATORS;
-      colored_filetype = filetype_indicator[normal]; //f->filetype];
+      colored_filetype = filetype_indicator[normal]; /*f->filetype];*/
    }
  else
    {
@@ -154,7 +155,7 @@ _rl_print_color_indicator (char *f)
            colored_filetype = C_SETUID;
          else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
            colored_filetype = C_SETGID;
-          else if (is_colored (C_CAP) && 0) //f->has_capability)
+          else if (is_colored (C_CAP) && 0) /*f->has_capability)*/
            colored_filetype = C_CAP;
          else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
            colored_filetype = C_EXEC;
@@ -192,6 +193,7 @@ _rl_print_color_indicator (char *f)
          colored_filetype = C_ORPHAN;
        }
    }
+  }

  /* Check the file's suffix only if still classified as C_FILE.  */
  ext = NULL;
diff --git a/lib/readline/parse-colors.c b/lib/readline/parse-colors.c
index 06eb25a..3080aea 100644
--- a/lib/readline/parse-colors.c
+++ b/lib/readline/parse-colors.c
@@ -32,21 +32,21 @@

#include <stdio.h>

-// strdup() / strcpy()
+/* strdup() / strcpy() */
#if defined (HAVE_STRING_H)
#  include <string.h>
#else /* !HAVE_STRING_H */
#  include <strings.h>
#endif /* !HAVE_STRING_H */

-// abort()
+/* abort() */
#if defined (HAVE_STDLIB_H)
#  include <stdlib.h>
#else
#  include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */

-#include "rldefs.h" // STREQ, savestring
+#include "rldefs.h" /* STREQ, savestring */
#include "readline.h"
#include "rlprivate.h"
#include "rlshell.h"
@@ -61,30 +61,30 @@ static bool get_funky_string (char **dest, const char **src, bool equals_end, si

struct bin_str _rl_color_indicator[] =
  {
-    { LEN_STR_PAIR ("\033[") },         //  lc: Left of color sequence
-    { LEN_STR_PAIR ("m") },             //  rc: Right of color sequence
- { 0, NULL }, // ec: End color (replaces lc+no+rc)
-    { LEN_STR_PAIR ("0") },             //  rs: Reset to ordinary colors
-    { 0, NULL },                        //  no: Normal
-    { 0, NULL },                        //  fi: File: default
-    { LEN_STR_PAIR ("01;34") },         //  di: Directory: bright blue
-    { LEN_STR_PAIR ("01;36") },         //  ln: Symlink: bright cyan
-    { LEN_STR_PAIR ("33") },            //  pi: Pipe: yellow/brown
-    { LEN_STR_PAIR ("01;35") },         //  so: Socket: bright magenta
-    { LEN_STR_PAIR ("01;33") },         //  bd: Block device: bright yellow
-    { LEN_STR_PAIR ("01;33") },         //  cd: Char device: bright yellow
-    { 0, NULL },                        //  mi: Missing file: undefined
-    { 0, NULL },                        //  or: Orphaned symlink: undefined
-    { LEN_STR_PAIR ("01;32") },         //  ex: Executable: bright green
-    { LEN_STR_PAIR ("01;35") },         //  do: Door: bright magenta
-    { LEN_STR_PAIR ("37;41") },         //  su: setuid: white on red
-    { LEN_STR_PAIR ("30;43") },         //  sg: setgid: black on yellow
-    { LEN_STR_PAIR ("37;44") },         //  st: sticky: black on blue
- { LEN_STR_PAIR ("34;42") }, // ow: other-writable: blue on green - { LEN_STR_PAIR ("30;42") }, // tw: ow w/ sticky: black on green
-    { LEN_STR_PAIR ("30;41") },         //  ca: black on red
-    { 0, NULL },                        //  mh: disabled by default
-    { LEN_STR_PAIR ("\033[K") },        //  cl: clear to end of line
+    { LEN_STR_PAIR ("\033[") },         /*  lc: Left of color sequence */
+    { LEN_STR_PAIR ("m") },             /*  rc: Right of color sequence */
+ { 0, NULL }, /* ec: End color (replaces lc+no+rc) */
+    { LEN_STR_PAIR ("0") },             /*  rs: Reset to ordinary colors */
+    { 0, NULL },                        /*  no: Normal */
+    { 0, NULL },                        /*  fi: File: default */
+    { LEN_STR_PAIR ("01;34") },         /*  di: Directory: bright blue */
+    { LEN_STR_PAIR ("01;36") },         /*  ln: Symlink: bright cyan */
+    { LEN_STR_PAIR ("33") },            /*  pi: Pipe: yellow/brown */
+    { LEN_STR_PAIR ("01;35") },         /*  so: Socket: bright magenta */
+ { LEN_STR_PAIR ("01;33") }, /* bd: Block device: bright yellow */ + { LEN_STR_PAIR ("01;33") }, /* cd: Char device: bright yellow */
+    { 0, NULL },                        /*  mi: Missing file: undefined */
+ { 0, NULL }, /* or: Orphaned symlink: undefined */
+    { LEN_STR_PAIR ("01;32") },         /*  ex: Executable: bright green */
+    { LEN_STR_PAIR ("01;35") },         /*  do: Door: bright magenta */
+    { LEN_STR_PAIR ("37;41") },         /*  su: setuid: white on red */
+    { LEN_STR_PAIR ("30;43") },         /*  sg: setgid: black on yellow */
+    { LEN_STR_PAIR ("37;44") },         /*  st: sticky: black on blue */
+ { LEN_STR_PAIR ("34;42") }, /* ow: other-writable: blue on green */ + { LEN_STR_PAIR ("30;42") }, /* tw: ow w/ sticky: black on green */
+    { LEN_STR_PAIR ("30;41") },         /*  ca: black on red */
+    { 0, NULL },                        /*  mh: disabled by default */
+    { LEN_STR_PAIR ("\033[K") },        /*  cl: clear to end of line */
  };

/* Parse a string as part of the LS_COLORS variable; this may involve


Another problem is your use of stdbool.h, which at least here on HP NonSopt only works in C99 mode, not in C89 mode. And the former is not availeble on older version or our O/S, but these are still in user so would be excluded from using bash, just for a few files (3, if I counted correctls, all in lib/readline/) that use bool (from stdbool.h)

I've fixed it with a

#if defined(__TANDEM) && defined(HAVE_STDBOOL_H) && (__STDC_VERSION__ < 199901L)
typedef int _Bool;
#endif

at the end of config-bot.h.

In the due course of that 2nd batch I also found that .gitignore I proposed in the first batch needs to get extended:

doc/bashref.aux
doc/bashref.bt
doc/bashref.bts
doc/bashref.cp
doc/bashref.cps
doc/bashref.fn
doc/bashref.fns
doc/bashref.ky
doc/bashref.log
doc/bashref.pg
doc/bashref.rw
doc/bashref.rws
doc/bashref.toc
doc/bashref.tp
doc/bashref.vr
doc/bashref.vrs
lib/readline/doc/history.aux
lib/readline/doc/history.cp
lib/readline/doc/history.cps
lib/readline/doc/history.fn
lib/readline/doc/history.ky
lib/readline/doc/history.log
lib/readline/doc/history.pg
lib/readline/doc/history.toc
lib/readline/doc/history.tp
lib/readline/doc/history.vr
lib/readline/doc/history.vrs
lib/readline/doc/rlman.aux
lib/readline/doc/rlman.cp
lib/readline/doc/rlman.cps
lib/readline/doc/rlman.fn
lib/readline/doc/rlman.fns
lib/readline/doc/rlman.ky
lib/readline/doc/rlman.log
lib/readline/doc/rlman.pg
lib/readline/doc/rlman.toc
lib/readline/doc/rlman.tp
lib/readline/doc/rlman.vr
lib/readline/doc/rluserman.aux
lib/readline/doc/rluserman.cp
lib/readline/doc/rluserman.cps
lib/readline/doc/rluserman.fn
lib/readline/doc/rluserman.fns
lib/readline/doc/rluserman.ky
lib/readline/doc/rluserman.log
lib/readline/doc/rluserman.pg
lib/readline/doc/rluserman.toc
lib/readline/doc/rluserman.tp
lib/readline/doc/rluserman.vr
lib/readline/doc/rluserman.vrs
po/foo.new.po

All these may need to get removed from git, seems that 'make clean' deletes them? Some more get deleted by 'make distclean', guess those should be remved from git and added to .gitignore too?

Bye, Jojo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]