diff options
author | Greg McGary <greg@mcgary.org> | 1999-04-08 09:53:10 +0000 |
---|---|---|
committer | Greg McGary <greg@mcgary.org> | 1999-04-08 09:53:10 +0000 |
commit | 797dd02870ed606e1503e0a24b2d1e4e4068244b (patch) | |
tree | 96e9422c8e681c9d6e734278febc2ce2d2ac690b | |
parent | 9e5bd0c4df77dff6f0a914375b82ff100bb55cab (diff) | |
download | idutils-797dd02870ed606e1503e0a24b2d1e4e4068244b.tar.gz idutils-797dd02870ed606e1503e0a24b2d1e4e4068244b.tar.bz2 idutils-797dd02870ed606e1503e0a24b2d1e4e4068244b.zip |
* src/lid.c (limits.h): Include earlier to avoid RE_DUP_MAX
conflict. [From Erick.Branderhorst@asml.nl]
(search_flinkv): Bash terminating newline. [From marc@snafu.org]
* lisp/elisp-comp: Import more recent version from automake.
* libidu/scanners.c (SCAN_CPP_DIRECTIVE): Tolerate
leading whitespace before first '#' [From rodneybrown@pmsc.com]
(get_token_asm, get_token_c): Move some common leading context
into SCAN_CPP_DIRECTIVE.
-rw-r--r-- | libidu/scanners.c | 29 | ||||
-rwxr-xr-x | lisp/elisp-comp | 27 | ||||
-rw-r--r-- | src/lid.c | 10 |
3 files changed, 39 insertions, 27 deletions
diff --git a/libidu/scanners.c b/libidu/scanners.c index 7786c52..0db6bcd 100644 --- a/libidu/scanners.c +++ b/libidu/scanners.c @@ -483,6 +483,17 @@ unsigned char *scanner_buffer; #define SCAN_CPP_DIRECTIVE \ do \ { \ + new_line = 0; \ + /* Cope with leading whitespace before CPP lines */ \ + while (c == ' ' || c == '\t') \ + c = getc (in_FILE); \ + if (c == '\n') \ + { \ + new_line = 1; \ + goto top; \ + } \ + else if (c != '#') \ + goto next; \ c = getc (in_FILE); \ while (ISBORING (c)) \ c = getc (in_FILE); \ @@ -506,7 +517,7 @@ unsigned char *scanner_buffer; if (c == '"') \ { \ c = getc (in_FILE); \ - while (c != '\n' && c != EOF && c != '"') \ + while (c != '\n' && c != '"' && c != EOF) \ { \ *id++ = c; \ c = getc (in_FILE); \ @@ -516,7 +527,7 @@ unsigned char *scanner_buffer; else if (c == '<') \ { \ c = getc (in_FILE); \ - while (c != '\n' && c != EOF && c != '>') \ + while (c != '\n' && c != '>' && c != EOF) \ { \ *id++ = c; \ c = getc (in_FILE); \ @@ -573,12 +584,7 @@ get_token_c (FILE *in_FILE, void const *args, int *flags) top: c = getc (in_FILE); if (new_line) - { - new_line = 0; - if (c != '#') - goto next; - SCAN_CPP_DIRECTIVE; - } + SCAN_CPP_DIRECTIVE; next: while (ISBORING (c)) @@ -890,12 +896,7 @@ get_token_asm (FILE *in_FILE, void const *args, int *flags) top: c = getc (in_FILE); if (ARGS->handle_cpp > 0 && new_line) - { - new_line = 0; - if (c != '#') - goto next; - SCAN_CPP_DIRECTIVE; - } + SCAN_CPP_DIRECTIVE; next: while (ISBORING (c)) diff --git a/lisp/elisp-comp b/lisp/elisp-comp index d9adbfe..96e4aa5 100755 --- a/lisp/elisp-comp +++ b/lisp/elisp-comp @@ -26,17 +26,24 @@ # they require or load-library one another. if test $# = 0; then - echo 1>&2 "No files given to $0" + echo 1>&2 "No files given to $0" + exit 1 else - tempdir=elc.$$ - mkdir $tempdir - cp $* $tempdir - cd $tempdir + if test -z "$EMACS" || test "$EMACS" = "t"; then + # Value of "t" means we are running in a shell under Emacs. + # Just assume Emacs is called "emacs". + EMACS=emacs + fi - echo "(setq load-path (cons nil load-path))" > script - emacs -batch -l script -f batch-byte-compile *.el - mv *.elc .. + tempdir=elc.$$ + mkdir $tempdir + cp $* $tempdir + cd $tempdir - cd .. - rm -fr $tempdir + echo "(setq load-path (cons nil load-path))" > script + $EMACS -q -batch -l script -f batch-byte-compile *.el + mv *.elc .. + + cd .. + rm -fr $tempdir fi @@ -26,6 +26,9 @@ #include <sys/wait.h> #include <assert.h> #include <getopt.h> +#if HAVE_LIMITS_H +# include <limits.h> +#endif #include <regex.h> #include "xstring.h" #include "xunistd.h" @@ -36,9 +39,6 @@ #include "error.h" #include "pathmax.h" #include "xalloca.h" -#if HAVE_LIMITS_H -# include <limits.h> -#endif typedef void (*report_func_t) __P((char const *name, struct file_link **flinkv)); typedef int (*query_func_t) __P((char const *arg, report_func_t)); @@ -758,9 +758,13 @@ search_flinkv (struct file_link **flinkv) char pattern[BUFSIZ]; unsigned int count; char *file_name = ALLOCA (char, PATH_MAX); + char *eol; if (fgets (pattern, sizeof (pattern), stdin) == 0) return -1; + eol = strchr(pattern, '\n'); + if (eol) + *eol = 0; for (count = 0; *flinkv; count++, flinkv++) { |