diff -rc2P source-highlight-1.2/ChangeLog source-highlight-1.2.1/ChangeLog *** source-highlight-1.2/ChangeLog Mon Dec 3 23:01:38 2001 --- source-highlight-1.2.1/ChangeLog Tue Dec 25 19:20:41 2001 *************** *** 1,2 **** --- 1,21 ---- + 2001-12-20 Lorenzo Bettini + + * NEWS: Version 1.2.1 released + + * src/getopt.c: much more modern version taken from GNU C library + + * src/getopt1.c: much more modern version taken from GNU C library + + * src/getopt.h: much more modern version taken from GNU C library + + * src/lib/alloca.c: removed, no longer needed + + * configure.in: removed check for alloca + + * src/lib/my_sstream.h: use using std::ostringstream + if the compiler supports it + + * src/lib/my_set.h: use using std::set if the compiler supports it + 2001-12-03 Lorenzo Bettini diff -rc2P source-highlight-1.2/NEWS source-highlight-1.2.1/NEWS *** source-highlight-1.2/NEWS Mon Dec 3 22:29:06 2001 --- source-highlight-1.2.1/NEWS Thu Dec 20 23:00:50 2001 *************** *** 6,9 **** --- 6,17 ---- Please send source-highlight bug reports to bug-source-highlight@gnu.org + Version 1.2.1 + + * Fixed a problem of compilation for gcc 3.0 (thanks to Alexios Zavras + and Bruno Schweizer ) + * much more recent versions of getopt.h, getopt.c, getopt1.c are provided + (the previous ones were very very old!), that do not rely on alloca + anymore. + Version 1.2 diff -rc2P source-highlight-1.2/README source-highlight-1.2.1/README *** source-highlight-1.2/README Mon Dec 3 23:00:54 2001 --- source-highlight-1.2.1/README Thu Dec 20 22:59:57 2001 *************** *** 1,5 **** ! GNU Source-highlight 1.2 ! December 3rd, 2001 by Lorenzo Bettini --- 1,5 ---- ! GNU Source-highlight 1.2.1 ! December 21st, 2001 by Lorenzo Bettini *************** *** 41,44 **** --- 41,52 ---- Changes in this release + * Fixed a problem of compilation for gcc 3.0 (thanks to Alexios Zavras + and Bruno Schweizer ) + * much more recent versions of getopt.h, getopt.c, getopt1.c are provided + (the previous ones were very very old!), that do not rely on alloca + anymore. + + Changes in version 1.2 + * Added normal text decoration (specify "normal" in tags.j2h) (suggested by Bernie Boudet ). *************** *** 233,237 **** And here's the output of `cpp2html --help` ! GNU cpp2html 1.6 (GNU source-highlight 1.2) source-highlight 1.0 --- 241,245 ---- And here's the output of `cpp2html --help` ! GNU cpp2html 1.6 (GNU source-highlight 1.2.1) source-highlight 1.0 *************** *** 339,344 **** * Bernie Boudet suggested customization of normal text ! * Christian Paulsen notfied the error for multiple input files See also THANKS :-) --- 347,355 ---- * Bernie Boudet suggested customization of normal text ! * Christian Paulsen notified the error for multiple input files + * Alexios Zavras and Bruno Schweizer + for notifying the problem in + compilation with gcc 3.0. See also THANKS :-) diff -rc2P source-highlight-1.2/THANKS source-highlight-1.2.1/THANKS *** source-highlight-1.2/THANKS Sun Nov 25 13:36:57 2001 --- source-highlight-1.2.1/THANKS Thu Dec 20 22:32:07 2001 *************** *** 34,39 **** --- 34,41 ---- Xavier Outhier xouthier@yahoo.fr Christian Paulsen christian.paulsen@sdrc.com + Bruno Schweizer bruno@smda.medizin.uni-ulm.de Arto Viitanen av@cs.uta.fi Geurt Vos geurt@xosl.org Robert Wetzel rw8@mail.inf.tu-dresden.de Curtis Weyant dylan38@angelfire.com + Alexios Zavras zvr@pobox.com diff -rc2P source-highlight-1.2/config.h.in source-highlight-1.2.1/config.h.in *** source-highlight-1.2/config.h.in Wed Nov 28 21:58:36 2001 --- source-highlight-1.2.1/config.h.in Thu Dec 20 22:53:28 2001 *************** *** 1,31 **** /* config.h.in. Generated automatically from configure.in by autoheader. */ - /* Define if using alloca.c. */ - #undef C_ALLOCA - /* Define to empty if the keyword does not work. */ #undef const - /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ - #undef CRAY_STACKSEG_END - - /* Define if you have alloca, as a function or macro. */ - #undef HAVE_ALLOCA - - /* Define if you have and it should be used (not on Ultrix). */ - #undef HAVE_ALLOCA_H - /* Define to `unsigned' if doesn't define. */ #undef size_t - - /* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ - #undef STACK_DIRECTION /* Define if you have the ANSI C header files. */ --- 1,9 ---- diff -rc2P source-highlight-1.2/configure source-highlight-1.2.1/configure *** source-highlight-1.2/configure Mon Dec 3 21:27:57 2001 --- source-highlight-1.2.1/configure Thu Dec 20 22:53:25 2001 *************** *** 700,704 **** PACKAGE=source-highlight ! VERSION=1.2 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then --- 700,704 ---- PACKAGE=source-highlight ! VERSION=1.2.1 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then *************** *** 2574,2818 **** - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works - # for constant arguments. Useless! - echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 - echo "configure:2580: checking for working alloca.h" >&5 - if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 - else - cat > conftest.$ac_ext < - int main() { - char *p = alloca(2 * sizeof(int)); - ; return 0; } - EOF - if { (eval echo configure:2592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes - else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no - fi - rm -f conftest* - fi - - echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 - if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF - #define HAVE_ALLOCA_H 1 - EOF - - fi - - echo $ac_n "checking for alloca""... $ac_c" 1>&6 - echo "configure:2613: checking for alloca" >&5 - if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 - else - cat > conftest.$ac_ext < - # define alloca _alloca - # else - # if HAVE_ALLOCA_H - # include - # else - # ifdef _AIX - #pragma alloca - # else - # ifndef alloca /* predefined by HP cc +Olibcalls */ - char *alloca (); - # endif - # endif - # endif - # endif - #endif - - int main() { - char *p = (char *) alloca(1); - ; return 0; } - EOF - if { (eval echo configure:2646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_func_alloca_works=yes - else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no - fi - rm -f conftest* - fi - - echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 - if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF - #define HAVE_ALLOCA 1 - EOF - - fi - - if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF - #define C_ALLOCA 1 - EOF - - - echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 - echo "configure:2678: checking whether alloca needs Cray hooks" >&5 - if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 - else - cat > conftest.$ac_ext <&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_os_cray=yes - else - rm -rf conftest* - ac_cv_os_cray=no - fi - rm -f conftest* - - fi - - echo "$ac_t""$ac_cv_os_cray" 1>&6 - if test $ac_cv_os_cray = yes; then - for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 - echo "configure:2708: checking for $ac_func" >&5 - if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 - else - cat > conftest.$ac_ext < - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ - char $ac_func(); - - int main() { - - /* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ - #if defined (__stub_$ac_func) || defined (__stub___$ac_func) - choke me - #else - $ac_func(); - #endif - - ; return 0; } - EOF - if { (eval echo configure:2739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" - else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" - fi - rm -f conftest* - fi - - if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&6 - fi - - done - fi - - echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 - echo "configure:2766: checking stack direction for C alloca" >&5 - if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 - else - if test "$cross_compiling" = yes; then - ac_cv_c_stack_direction=0 - else - cat > conftest.$ac_ext < addr) ? 1 : -1; - } - main () - { - exit (find_stack_direction() < 0); - } - EOF - if { (eval echo configure:2796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null - then - ac_cv_c_stack_direction=1 - else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 - fi - rm -fr conftest* - fi - - fi - - echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 - cat >> confdefs.h <&6 ! echo "configure:2823: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GENGETOPT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 --- 2579,2583 ---- set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:2582: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GENGETOPT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 2868,2872 **** echo $ac_n "checking checking if it's flex ""... $ac_c" 1>&6 ! echo "configure:2871: checking checking if it's flex " >&5 if test "$ac_cv_prog_LEX" = "flex"; then LFLAGS="$LFLAGS -l -L" --- 2627,2631 ---- echo $ac_n "checking checking if it's flex ""... $ac_c" 1>&6 ! echo "configure:2630: checking checking if it's flex " >&5 if test "$ac_cv_prog_LEX" = "flex"; then LFLAGS="$LFLAGS -l -L" *************** *** 2879,2883 **** YFLAGS="$YFLAGS -d" echo $ac_n "checking checking if it's bison ""... $ac_c" 1>&6 ! echo "configure:2882: checking checking if it's bison " >&5 if test "$ac_cv_prog_YACC" = "bison -y"; then YFLAGS="$YFLAGS -o y.tab.c -l" --- 2638,2642 ---- YFLAGS="$YFLAGS -d" echo $ac_n "checking checking if it's bison ""... $ac_c" 1>&6 ! echo "configure:2641: checking checking if it's bison " >&5 if test "$ac_cv_prog_YACC" = "bison -y"; then YFLAGS="$YFLAGS -o y.tab.c -l" *************** *** 2895,2899 **** set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:2898: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 --- 2654,2658 ---- set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:2657: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 3097,3101 **** s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g s%@LIBOBJS@%$LIBOBJS%g - s%@ALLOCA@%$ALLOCA%g s%@GENGETOPT@%$GENGETOPT%g s%@NO_GENGETOPT_TRUE@%$NO_GENGETOPT_TRUE%g --- 2856,2859 ---- diff -rc2P source-highlight-1.2/configure.in source-highlight-1.2.1/configure.in *** source-highlight-1.2/configure.in Mon Dec 3 21:27:39 2001 --- source-highlight-1.2.1/configure.in Thu Dec 20 22:50:38 2001 *************** *** 14,18 **** dnl for automake AM_CONFIG_HEADER(config.h) ! AM_INIT_AUTOMAKE(source-highlight,1.2) AC_SUBST(source_highlightdatadir) --- 14,18 ---- dnl for automake AM_CONFIG_HEADER(config.h) ! AM_INIT_AUTOMAKE(source-highlight,1.2.1) AC_SUBST(source_highlightdatadir) *************** *** 100,106 **** dnl check for getopt in standard library AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] ) - - dnl check for alloca - AC_FUNC_ALLOCA() dnl this is only for developers who change src/cmdline.ggo file --- 100,103 ---- diff -rc2P source-highlight-1.2/doc/source-highlight.html.in source-highlight-1.2.1/doc/source-highlight.html.in *** source-highlight-1.2/doc/source-highlight.html.in Mon Dec 3 23:00:27 2001 --- source-highlight-1.2.1/doc/source-highlight.html.in Tue Dec 25 19:19:45 2001 *************** *** 11,15 ****

GNU Source-highlight @VERSION@

! December 3rd, 2001

by Lorenzo Bettini

This package is a collection of programs that given a source file, --- 11,15 ----

GNU Source-highlight @VERSION@

! December 21st, 2001

by Lorenzo Bettini

This package is a collection of programs that given a source file, *************** *** 46,49 **** --- 46,63 ----

  • + Fixed a problem of compilation for gcc 3.0 (thanks to Alexios Zavras <zvr@pobox.com> + and Bruno Schweizer <bruno@smda.medizin.uni-ulm.de>)
  • + +
  • + much more recent versions of getopt.h, getopt.c, getopt1.c + are provided (the previous ones were very very old!), that do not rely + on alloca anymore.
  • +
+ +

+ Changes in version 1.2

+ +
    +
  • Added normal text decoration (specify "normal" in tags.j2h) (suggested by Bernie Boudet <bboudet@bigfoot.com>).
  • *************** *** 415,419 ****
  • Christian Paulsen <christian.paulsen@sdrc.com> ! notfied the error for multiple input files
See also THANKS  :-) --- 429,438 ----
  • Christian Paulsen <christian.paulsen@sdrc.com> ! notified the error for multiple input files
  • ! !
  • ! Alexios Zavras <zvr@pobox.com> and ! Bruno Schweizer <bruno@smda.medizin.uni-ulm.de> ! notified the problem in compilation with gcc 3.0.
  • See also THANKS  :-) diff -rc2P source-highlight-1.2/src/Makefile.in source-highlight-1.2.1/src/Makefile.in *** source-highlight-1.2/src/Makefile.in Mon Dec 3 23:01:56 2001 --- source-highlight-1.2.1/src/Makefile.in Tue Dec 25 19:24:30 2001 *************** *** 357,365 **** genhtml/startapp4html.h cpp_scanner.o: cpp_scanner.cc lib/getopt.h lib/tags.h lib/colors.h \ ! lib/tokens.h lib/genfun.h java2html.o: java2html.cc java2html.h ../config.h cxxconfig.h \ genhtml/startapp4html.h java_scanner.o: java_scanner.cc lib/getopt.h lib/tags.h lib/colors.h \ ! lib/tokens.h lib/genfun.h info-am: --- 357,365 ---- genhtml/startapp4html.h cpp_scanner.o: cpp_scanner.cc lib/getopt.h lib/tags.h lib/colors.h \ ! lib/my_set.h ../config.h cxxconfig.h lib/tokens.h lib/genfun.h java2html.o: java2html.cc java2html.h ../config.h cxxconfig.h \ genhtml/startapp4html.h java_scanner.o: java_scanner.cc lib/getopt.h lib/tags.h lib/colors.h \ ! lib/my_set.h ../config.h cxxconfig.h lib/tokens.h lib/genfun.h info-am: diff -rc2P source-highlight-1.2/src/lib/Makefile.am source-highlight-1.2.1/src/lib/Makefile.am *** source-highlight-1.2/src/lib/Makefile.am Wed Nov 28 22:39:27 2001 --- source-highlight-1.2.1/src/lib/Makefile.am Thu Dec 20 22:50:50 2001 *************** *** 44,48 **** optparser.stamp optscanner.stamp ! libcommon_a_LIBADD = @LIBOBJS@ @ALLOCA@ INCLUDES = -I@top_srcdir@/src --- 44,48 ---- optparser.stamp optscanner.stamp ! libcommon_a_LIBADD = @LIBOBJS@ INCLUDES = -I@top_srcdir@/src *************** *** 52,56 **** tokens.h messages.h genfun.h fileutil.h \ cmdline.h envmapper.h startapp.h \ ! chartranslator.h \ getopt.h \ cmdline.ggo \ --- 52,56 ---- tokens.h messages.h genfun.h fileutil.h \ cmdline.h envmapper.h startapp.h \ ! chartranslator.h my_set.h my_sstream.h \ getopt.h \ cmdline.ggo \ diff -rc2P source-highlight-1.2/src/lib/Makefile.in source-highlight-1.2.1/src/lib/Makefile.in *** source-highlight-1.2/src/lib/Makefile.in Mon Dec 3 23:01:57 2001 --- source-highlight-1.2.1/src/lib/Makefile.in Tue Dec 25 19:24:31 2001 *************** *** 96,104 **** ! libcommon_a_LIBADD = @LIBOBJS@ @ALLOCA@ INCLUDES = -I@top_srcdir@/src ! EXTRA_DIST = colors.h decorators.h generators.h keys.h optparser.h tags.h textgen.h tokens.h messages.h genfun.h fileutil.h cmdline.h envmapper.h startapp.h chartranslator.h getopt.h cmdline.ggo copyright.h reportbugs.h options_defs.sed --- 96,104 ---- ! libcommon_a_LIBADD = @LIBOBJS@ INCLUDES = -I@top_srcdir@/src ! EXTRA_DIST = colors.h decorators.h generators.h keys.h optparser.h tags.h textgen.h tokens.h messages.h genfun.h fileutil.h cmdline.h envmapper.h startapp.h chartranslator.h my_set.h my_sstream.h getopt.h cmdline.ggo copyright.h reportbugs.h options_defs.sed *************** *** 116,120 **** LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ ! libcommon_a_DEPENDENCIES = @LIBOBJS@ @ALLOCA@ libcommon_a_OBJECTS = copyright.o reportbugs.o cmdline.o generators.o \ tags.o messages.o genfun.o fileutil.o envmapper.o chartranslator.o \ --- 116,120 ---- LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ ! libcommon_a_DEPENDENCIES = @LIBOBJS@ libcommon_a_OBJECTS = copyright.o reportbugs.o cmdline.o generators.o \ tags.o messages.o genfun.o fileutil.o envmapper.o chartranslator.o \ *************** *** 131,136 **** CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ ! DIST_COMMON = Makefile.am Makefile.in alloca.c getopt.c getopt1.c \ ! optparser.cc optscanner.cc yywrap.c --- 131,136 ---- CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ ! DIST_COMMON = Makefile.am Makefile.in getopt.c getopt1.c optparser.cc \ ! optscanner.cc yywrap.c *************** *** 243,263 **** cmdline.o: cmdline.c ../../config.h ../../src/cxxconfig.h getopt.h \ cmdline.h ! decorators.o: decorators.cc decorators.h textgen.h tags.h colors.h envmapper.o: envmapper.c envmapper.h fileutil.o: fileutil.cc fileutil.h generators.o: generators.cc textgen.h decorators.h tags.h colors.h \ ! keys.h genfun.o: genfun.cc genfun.h messages.h generators.h tags.h colors.h \ ! keys.h textgen.h decorators.h ../../config.h \ ! ../../src/cxxconfig.h messages.o: messages.cc messages.h ! optparser.o: optparser.cc ../../config.h ../../src/cxxconfig.h tags.h \ ! colors.h keys.h messages.h ! optscanner.o: optscanner.cc getopt.h tags.h colors.h optparser.h startapp.o: startapp.cc ../../config.h ../../src/cxxconfig.h colors.h \ cmdline.h genfun.h fileutil.h messages.h generators.h \ envmapper.h chartranslator.h startapp.h copyright.h \ reportbugs.h ! tags.o: tags.cc tags.h colors.h keys.h textgen.o: textgen.cc textgen.h chartranslator.h --- 243,267 ---- cmdline.o: cmdline.c ../../config.h ../../src/cxxconfig.h getopt.h \ cmdline.h ! decorators.o: decorators.cc decorators.h textgen.h tags.h colors.h \ ! my_set.h ../../config.h ../../src/cxxconfig.h envmapper.o: envmapper.c envmapper.h fileutil.o: fileutil.cc fileutil.h generators.o: generators.cc textgen.h decorators.h tags.h colors.h \ ! my_set.h ../../config.h ../../src/cxxconfig.h keys.h genfun.o: genfun.cc genfun.h messages.h generators.h tags.h colors.h \ ! my_set.h ../../config.h ../../src/cxxconfig.h keys.h textgen.h \ ! decorators.h messages.o: messages.cc messages.h ! optparser.o: optparser.cc my_sstream.h ../../config.h \ ! ../../src/cxxconfig.h tags.h colors.h my_set.h keys.h \ ! messages.h ! optscanner.o: optscanner.cc getopt.h tags.h colors.h my_set.h \ ! ../../config.h ../../src/cxxconfig.h optparser.h startapp.o: startapp.cc ../../config.h ../../src/cxxconfig.h colors.h \ cmdline.h genfun.h fileutil.h messages.h generators.h \ envmapper.h chartranslator.h startapp.h copyright.h \ reportbugs.h ! tags.o: tags.cc tags.h colors.h my_set.h ../../config.h \ ! ../../src/cxxconfig.h keys.h textgen.o: textgen.cc textgen.h chartranslator.h Only in source-highlight-1.2/src/lib: alloca.c diff -rc2P source-highlight-1.2/src/lib/getopt.c source-highlight-1.2.1/src/lib/getopt.c *** source-highlight-1.2/src/lib/getopt.c Sun Apr 15 18:45:37 2001 --- source-highlight-1.2.1/src/lib/getopt.c Thu Dec 20 22:49:44 2001 *************** *** 1,53 **** /* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what ! "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! ! ! Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 Free Software Foundation, Inc. ! This program is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2, or (at your option) any ! later version. ! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ! /* NOTE!!! AIX requires this to be the first thing in the file. ! Do not put ANYTHING before it! */ ! #if !defined (__GNUC__) && defined (_AIX) ! #pragma alloca #endif #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif ! ! #ifdef __GNUC__ ! #define alloca __builtin_alloca ! #else /* not __GNUC__ */ ! #if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__)))) ! #include ! #else ! #ifndef _AIX ! char *alloca (); #endif - #endif /* alloca.h */ - #endif /* not __GNUC__ */ ! #if !__STDC__ && !defined(const) && IN_GCC ! #define const ! #endif ! ! /* This tells Alpha OSF/1 not to define a getopt prototype in . */ ! #ifndef _NO_PROTO ! #define _NO_PROTO #endif --- 1,41 ---- /* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what ! "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! ! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. ! The GNU C Library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Lesser General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public ! License along with the GNU C Library; if not, write to the Free ! Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ! 02111-1307 USA. */ ! /* This tells Alpha OSF/1 not to define a getopt prototype in . ! Ditto for AIX 3.2 and . */ ! #ifndef _NO_PROTO ! # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H ! # include #endif ! #if !defined __STDC__ || !__STDC__ ! /* This is a separate conditional since some stdc systems ! reject `defined (const)'. */ ! # ifndef const ! # define const ! # endif #endif *************** *** 62,66 **** it is simpler to just do this in the source for each such file. */ ! #if defined (_LIBC) || !defined (__GNU_LIBRARY__) --- 50,62 ---- it is simpler to just do this in the source for each such file. */ ! #define GETOPT_INTERFACE_VERSION 2 ! #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 ! # include ! # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION ! # define ELIDE_CODE ! # endif ! #endif ! ! #ifndef ELIDE_CODE *************** *** 68,83 **** to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ - #undef alloca /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ ! #include ! #else /* Not GNU C library. */ ! #define __alloca alloca #endif /* GNU C library. */ ! /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a ! long-named option. Because this is not POSIX.2 compliant, it is ! being phased out. */ ! /* #define GETOPT_COMPAT */ /* This version of `getopt' appears to the caller like standard Unix `getopt' --- 64,91 ---- to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ ! # include ! # include #endif /* GNU C library. */ ! #ifdef VMS ! # include ! # if HAVE_STRING_H - 0 ! # include ! # endif ! #endif ! ! #ifndef _ ! /* This is for other GNU distributions with internationalized messages. */ ! # if defined HAVE_LIBINTL_H || defined _LIBC ! # include ! # ifndef _ ! # define _(msgid) gettext (msgid) ! # endif ! # else ! # define _(msgid) (msgid) ! # endif ! #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' *************** *** 103,107 **** each non-option ARGV-element is returned here. */ ! char *optarg = 0; /* Index in ARGV of the next element to be scanned. --- 111,115 ---- each non-option ARGV-element is returned here. */ ! char *optarg; /* Index in ARGV of the next element to be scanned. *************** *** 111,115 **** On entry to `getopt', zero means this is the first call; initialize. ! When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. --- 119,123 ---- On entry to `getopt', zero means this is the first call; initialize. ! When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. *************** *** 117,122 **** how much of ARGV has been scanned so far. */ ! /* XXX 1003.2 says this must be 1 before any call. */ ! int optind = 0; /* The next char to be scanned in the option-element --- 125,136 ---- how much of ARGV has been scanned so far. */ ! /* 1003.2 says this must be 1 before any call. */ ! int optind = 1; ! ! /* Formerly, initialization of getopt depended on optind==0, which ! causes problems with re-calling getopt as programs generally don't ! know that. */ ! ! int __getopt_initialized; /* The next char to be scanned in the option-element *************** *** 167,171 **** The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only ! `--' can cause `getopt' to return EOF with `optind' != ARGC. */ static enum --- 181,185 ---- The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only ! `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum *************** *** 173,176 **** --- 187,193 ---- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; + + /* Value of POSIXLY_CORRECT environment variable. */ + static char *posixly_correct; #ifdef __GNU_LIBRARY__ *************** *** 179,191 **** On some systems, it contains special magic macros that don't work in GCC. */ ! #include ! #define my_index strchr ! #define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) #else /* Avoid depending on library functions or files whose names are inconsistent. */ ! char *getenv (); static char * --- 196,215 ---- On some systems, it contains special magic macros that don't work in GCC. */ ! # include ! # define my_index strchr #else + # if HAVE_STRING_H + # include + # else + # include + # endif + /* Avoid depending on library functions or files whose names are inconsistent. */ ! #ifndef getenv ! extern char *getenv (); ! #endif static char * *************** *** 203,217 **** } ! static void ! my_bcopy (from, to, size) ! const char *from; ! char *to; ! int size; ! { ! int i; ! for (i = 0; i < size; i++) ! to[i] = from[i]; ! } ! #endif /* GNU C library. */ /* Handle permutation of arguments. */ --- 227,243 ---- } ! /* If using GCC, we can safely declare strlen this way. ! If not using GCC, it is ok not to declare it. */ ! #ifdef __GNUC__ ! /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. ! That was relevant to code that was here before. */ ! # if (!defined __STDC__ || !__STDC__) && !defined strlen ! /* gcc with -traditional declares the built-in strlen to return int, ! and has done so at least since version 2.4.5. -- rms. */ ! extern int strlen (const char *); ! # endif /* not __STDC__ */ ! #endif /* __GNUC__ */ ! ! #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ *************** *** 224,227 **** --- 250,286 ---- static int last_nonopt; + #ifdef _LIBC + /* Stored original parameters. + XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + extern int __libc_argc; + extern char **__libc_argv; + + /* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + + # ifdef USE_NONOPTION_FLAGS + /* Defined in getopt_init.c */ + extern char *__getopt_nonoption_flags; + + static int nonoption_flags_max_len; + static int nonoption_flags_len; + # endif + + # ifdef USE_NONOPTION_FLAGS + # define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } + # else + # define SWAP_FLAGS(ch1, ch2) + # endif + #else /* !_LIBC */ + # define SWAP_FLAGS(ch1, ch2) + #endif /* _LIBC */ + /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) *************** *** 233,251 **** the new indices of the non-options in ARGV after they are moved. */ static void exchange (argv) char **argv; { ! int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); ! char **temp = (char **) __alloca (nonopts_size); ! /* Interchange the two blocks of data in ARGV. */ ! my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size); ! my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], ! (optind - last_nonopt) * sizeof (char *)); ! my_bcopy ((char *) temp, ! (char *) &argv[first_nonopt + optind - last_nonopt], ! nonopts_size); /* Update records for the slots the non-options now occupy. */ --- 292,372 ---- the new indices of the non-options in ARGV after they are moved. */ + #if defined __STDC__ && __STDC__ + static void exchange (char **); + #endif + static void exchange (argv) char **argv; { ! int bottom = first_nonopt; ! int middle = last_nonopt; ! int top = optind; ! char *tem; ! ! /* Exchange the shorter segment with the far end of the longer segment. ! That puts the shorter segment into the right place. ! It leaves the longer segment in the right place overall, ! but it consists of two parts that need to be swapped next. */ ! ! #if defined _LIBC && defined USE_NONOPTION_FLAGS ! /* First make sure the handling of the `__getopt_nonoption_flags' ! string can work normally. Our top argument must be in the range ! of the string. */ ! if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) ! { ! /* We must extend the array. The user plays games with us and ! presents new arguments. */ ! char *new_str = malloc (top + 1); ! if (new_str == NULL) ! nonoption_flags_len = nonoption_flags_max_len = 0; ! else ! { ! memset (__mempcpy (new_str, __getopt_nonoption_flags, ! nonoption_flags_max_len), ! '\0', top + 1 - nonoption_flags_max_len); ! nonoption_flags_max_len = top + 1; ! __getopt_nonoption_flags = new_str; ! } ! } ! #endif ! ! while (top > middle && middle > bottom) ! { ! if (top - middle > middle - bottom) ! { ! /* Bottom segment is the short one. */ ! int len = middle - bottom; ! register int i; ! /* Swap it with the top part of the top segment. */ ! for (i = 0; i < len; i++) ! { ! tem = argv[bottom + i]; ! argv[bottom + i] = argv[top - (middle - bottom) + i]; ! argv[top - (middle - bottom) + i] = tem; ! SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); ! } ! /* Exclude the moved bottom segment from further swapping. */ ! top -= len; ! } ! else ! { ! /* Top segment is the short one. */ ! int len = top - middle; ! register int i; ! /* Swap it with the bottom part of the bottom segment. */ ! for (i = 0; i < len; i++) ! { ! tem = argv[bottom + i]; ! argv[bottom + i] = argv[middle + i]; ! argv[middle + i] = tem; ! SWAP_FLAGS (bottom + i, middle + i); ! } ! /* Exclude the moved top segment from further swapping. */ ! bottom += len; ! } ! } /* Update records for the slots the non-options now occupy. */ *************** *** 254,257 **** --- 375,449 ---- last_nonopt = optind; } + + /* Initialize the internal data when the first call is made. */ + + #if defined __STDC__ && __STDC__ + static const char *_getopt_initialize (int, char *const *, const char *); + #endif + static const char * + _getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; + { + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + + #if defined _LIBC && defined USE_NONOPTION_FLAGS + if (posixly_correct == NULL + && argc == __libc_argc && argv == __libc_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', nonoption_flags_max_len - len); + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; + #endif + + return optstring; + } /* Scan elements of ARGV (whose length is ARGC) for option characters *************** *** 268,272 **** resume the scan with the following option character or ARGV-element. ! If there are no more option characters, `getopt' returns `EOF'. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted --- 460,464 ---- resume the scan with the following option character or ARGV-element. ! If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted *************** *** 320,358 **** int long_only; { ! int option_index; ! optarg = 0; ! /* Initialize the internal data when the first call is made. ! Start processing options with ARGV-element 1 (since ARGV-element 0 ! is the program name); the sequence of previously skipped ! non-option ARGV-elements is empty. */ ! if (optind == 0) { ! first_nonopt = last_nonopt = optind = 1; ! ! nextchar = NULL; ! ! /* Determine how to handle the ordering of options and nonoptions. */ ! ! if (optstring[0] == '-') ! { ! ordering = RETURN_IN_ORDER; ! ++optstring; ! } ! else if (optstring[0] == '+') ! { ! ordering = REQUIRE_ORDER; ! ++optstring; ! } ! else if (getenv ("POSIXLY_CORRECT") != NULL) ! ordering = REQUIRE_ORDER; ! else ! ordering = PERMUTE; } if (nextchar == NULL || *nextchar == '\0') { if (ordering == PERMUTE) { --- 512,555 ---- int long_only; { ! int print_errors = opterr; ! if (optstring[0] == ':') ! print_errors = 0; ! if (argc < 1) ! return -1; ! optarg = NULL; ! if (optind == 0 || !__getopt_initialized) { ! if (optind == 0) ! optind = 1; /* Don't scan ARGV[0], the program name. */ ! optstring = _getopt_initialize (argc, argv, optstring); ! __getopt_initialized = 1; } + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ + #if defined _LIBC && defined USE_NONOPTION_FLAGS + # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) + #else + # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') + #endif + if (nextchar == NULL || *nextchar == '\0') { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + if (ordering == PERMUTE) { *************** *** 365,383 **** first_nonopt = optind; ! /* Now skip any additional non-options and extend the range of non-options previously skipped. */ ! while (optind < argc ! && (argv[optind][0] != '-' || argv[optind][1] == '\0') ! #ifdef GETOPT_COMPAT ! && (longopts == NULL ! || argv[optind][0] != '+' || argv[optind][1] == '\0') ! #endif /* GETOPT_COMPAT */ ! ) optind++; last_nonopt = optind; } ! /* Special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, --- 562,574 ---- first_nonopt = optind; ! /* Skip any additional non-options and extend the range of non-options previously skipped. */ ! while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } ! /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, *************** *** 406,410 **** if (first_nonopt != last_nonopt) optind = first_nonopt; ! return EOF; } --- 597,601 ---- if (first_nonopt != last_nonopt) optind = first_nonopt; ! return -1; } *************** *** 412,424 **** either stop the scan or describe it to the caller and pass it by. */ ! if ((argv[optind][0] != '-' || argv[optind][1] == '\0') ! #ifdef GETOPT_COMPAT ! && (longopts == NULL ! || argv[optind][0] != '+' || argv[optind][1] == '\0') ! #endif /* GETOPT_COMPAT */ ! ) { if (ordering == REQUIRE_ORDER) ! return EOF; optarg = argv[optind++]; return 1; --- 603,610 ---- either stop the scan or describe it to the caller and pass it by. */ ! if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) ! return -1; optarg = argv[optind++]; return 1; *************** *** 426,430 **** /* We have found another option-ARGV-element. ! Start decoding its characters. */ nextchar = (argv[optind] + 1 --- 612,616 ---- /* We have found another option-ARGV-element. ! Skip the initial punctuation. */ nextchar = (argv[optind] + 1 *************** *** 432,459 **** } if (longopts != NULL ! && ((argv[optind][0] == '-' ! && (argv[optind][1] == '-' || long_only)) ! #ifdef GETOPT_COMPAT ! || argv[optind][0] == '+' ! #endif /* GETOPT_COMPAT */ ! )) { const struct option *p; ! char *s = nextchar; int exact = 0; int ambig = 0; ! const struct option *pfound = NULL; ! int indfound; ! while (*s && *s != '=') ! s++; ! /* Test all options for either exact match or abbreviated matches. */ ! for (p = longopts, option_index = 0; p->name; ! p++, option_index++) ! if (!strncmp (p->name, nextchar, s - nextchar)) { ! if (s - nextchar == strlen (p->name)) { /* Exact match found. */ --- 618,658 ---- } + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + if (longopts != NULL ! && (argv[optind][1] == '-' ! || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { + char *nameend; const struct option *p; ! const struct option *pfound = NULL; int exact = 0; int ambig = 0; ! int indfound = -1; ! int option_index; ! for (nameend = nextchar; *nameend && *nameend != '='; nameend++) ! /* Do nothing. */ ; ! /* Test all long options for either exact match ! or abbreviated matches. */ ! for (p = longopts, option_index = 0; p->name; p++, option_index++) ! if (!strncmp (p->name, nextchar, nameend - nextchar)) { ! if ((unsigned int) (nameend - nextchar) ! == (unsigned int) strlen (p->name)) { /* Exact match found. */ *************** *** 469,474 **** indfound = option_index; } ! else ! /* Second nonexact match found. */ ambig = 1; } --- 668,676 ---- indfound = option_index; } ! else if (long_only ! || pfound->has_arg != p->has_arg ! || pfound->flag != p->flag ! || pfound->val != p->val) ! /* Second or later nonexact match found. */ ambig = 1; } *************** *** 476,484 **** if (ambig && !exact) { ! if (opterr) ! fprintf (stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } --- 678,687 ---- if (ambig && !exact) { ! if (print_errors) ! fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; + optopt = 0; return '?'; } *************** *** 488,513 **** option_index = indfound; optind++; ! if (*s) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) ! optarg = s + 1; else { ! if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, ! "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, ! "%s: option `%c%s' doesn't allow an argument\n", ! argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); return '?'; } --- 691,719 ---- option_index = indfound; optind++; ! if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) ! optarg = nameend + 1; else { ! if (print_errors) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, ! _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, ! _("%s: option `%c%s' doesn't allow an argument\n"), ! argv[0], argv[optind - 1][0], pfound->name); } + nextchar += strlen (nextchar); + + optopt = pfound->val; return '?'; } *************** *** 519,526 **** else { ! if (opterr) ! fprintf (stderr, "%s: option `%s' requires an argument\n", ! argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } --- 725,734 ---- else { ! if (print_errors) ! fprintf (stderr, ! _("%s: option `%s' requires an argument\n"), ! argv[0], argv[optind - 1]); nextchar += strlen (nextchar); + optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } *************** *** 536,539 **** --- 744,748 ---- return pfound->val; } + /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short *************** *** 541,567 **** Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' - #ifdef GETOPT_COMPAT - || argv[optind][0] == '+' - #endif /* GETOPT_COMPAT */ || my_index (optstring, *nextchar) == NULL) { ! if (opterr) { if (argv[optind][1] == '-') /* --option */ ! fprintf (stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar); else /* +option or -option */ ! fprintf (stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; return '?'; } } ! /* Look at and handle the next option-character. */ { --- 750,774 ---- Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { ! if (print_errors) { if (argv[optind][1] == '-') /* --option */ ! fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ ! fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; + optopt = 0; return '?'; } } ! /* Look at and handle the next short option-character. */ { *************** *** 575,594 **** if (temp == NULL || c == ':') { ! if (opterr) { ! #if 0 ! if (c < 040 || c >= 0177) ! fprintf (stderr, "%s: unrecognized option, character code 0%o\n", argv[0], c); else ! fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); ! #else ! /* 1003.2 specifies the format of this message. */ ! fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); ! #endif } optopt = c; return '?'; } if (temp[1] == ':') { --- 782,922 ---- if (temp == NULL || c == ':') { ! if (print_errors) { ! if (posixly_correct) ! /* 1003.2 specifies the format of this message. */ ! fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else ! fprintf (stderr, _("%s: invalid option -- %c\n"), ! argv[0], c); } optopt = c; return '?'; } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (print_errors) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (print_errors) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (print_errors) + fprintf (stderr, _("\ + %s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (print_errors) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } if (temp[1] == ':') { *************** *** 602,606 **** } else ! optarg = 0; nextchar = NULL; } --- 930,934 ---- } else ! optarg = NULL; nextchar = NULL; } *************** *** 617,630 **** else if (optind == argc) { ! if (opterr) { - #if 0 - fprintf (stderr, "%s: option `-%c' requires an argument\n", - argv[0], c); - #else /* 1003.2 specifies the format of this message. */ ! fprintf (stderr, "%s: option requires an argument -- %c\n", argv[0], c); - #endif } optopt = c; --- 945,954 ---- else if (optind == argc) { ! if (print_errors) { /* 1003.2 specifies the format of this message. */ ! fprintf (stderr, ! _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; *************** *** 657,661 **** } ! #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST --- 981,985 ---- } ! #endif /* Not ELIDE_CODE. */ #ifdef TEST *************** *** 677,681 **** c = getopt (argc, argv, "abc:d:0123456789"); ! if (c == EOF) break; --- 1001,1005 ---- c = getopt (argc, argv, "abc:d:0123456789"); ! if (c == -1) break; diff -rc2P source-highlight-1.2/src/lib/getopt.h source-highlight-1.2.1/src/lib/getopt.h *** source-highlight-1.2/src/lib/getopt.h Sun Apr 15 18:45:37 2001 --- source-highlight-1.2.1/src/lib/getopt.h Thu Dec 20 22:49:40 2001 *************** *** 1,21 **** /* Declarations for getopt. ! Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. ! This program is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2, or (at your option) any ! later version. ! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GETOPT_H ! #define _GETOPT_H 1 #ifdef __cplusplus --- 1,37 ---- /* Declarations for getopt. ! Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! The GNU C Library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Lesser General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public ! License along with the GNU C Library; if not, write to the Free ! Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ! 02111-1307 USA. */ #ifndef _GETOPT_H ! ! #ifndef __need_getopt ! # define _GETOPT_H 1 ! #endif ! ! /* If __GNU_LIBRARY__ is not already defined, either we are being used ! standalone, or this is the first header included in the source file. ! If we are being used with glibc, we need to include , but ! that does not exist if we are standalone. So: if __GNU_LIBRARY__ is ! not defined, include , which will pull in for us ! if it's from glibc. (Why ctype.h? It's guaranteed to exist and it ! doesn't flood the namespace with stuff the way some other headers do.) */ ! #if !defined __GNU_LIBRARY__ ! # include ! #endif #ifdef __cplusplus *************** *** 37,41 **** On entry to `getopt', zero means this is the first call; initialize. ! When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. --- 53,57 ---- On entry to `getopt', zero means this is the first call; initialize. ! When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. *************** *** 54,57 **** --- 70,74 ---- extern int optopt; + #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector *************** *** 77,85 **** struct option { ! #if __STDC__ const char *name; ! #else char *name; ! #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ --- 94,102 ---- struct option { ! # if (defined __STDC__ && __STDC__) || defined __cplusplus const char *name; ! # else char *name; ! # endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ *************** *** 91,125 **** /* Names for the values of the `has_arg' field of `struct option'. */ ! #define no_argument 0 ! #define required_argument 1 ! #define optional_argument 2 ! #if __STDC__ ! #if defined(__GNU_LIBRARY__) /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ ! extern int getopt (int argc, char *const *argv, const char *shortopts); ! #else /* not __GNU_LIBRARY__ */ extern int getopt (); ! #endif /* not __GNU_LIBRARY__ */ ! extern int getopt_long (int argc, char *const *argv, const char *shortopts, ! const struct option *longopts, int *longind); ! extern int getopt_long_only (int argc, char *const *argv, ! const char *shortopts, ! const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ ! extern int _getopt_internal (int argc, char *const *argv, ! const char *shortopts, ! const struct option *longopts, int *longind, ! int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); ! #endif /* not __STDC__ */ #ifdef __cplusplus --- 108,173 ---- /* Names for the values of the `has_arg' field of `struct option'. */ ! # define no_argument 0 ! # define required_argument 1 ! # define optional_argument 2 ! #endif /* need getopt */ ! ! ! /* Get definitions and prototypes for functions to process the ! arguments in ARGV (ARGC of them, minus the program name) for ! options given in OPTS. ! ! Return the option character from OPTS just read. Return -1 when ! there are no more options. For unrecognized options, or options ! missing arguments, `optopt' is set to the option letter, and '?' is ! returned. ! ! The OPTS string is a list of characters which are recognized option ! letters, optionally followed by colons, specifying that that letter ! takes an argument, to be placed in `optarg'. ! ! If a letter in OPTS is followed by two colons, its argument is ! optional. This behavior is specific to the GNU `getopt'. ! ! The argument `--' causes premature termination of argument ! scanning, explicitly telling `getopt' that there are no more ! options. ! ! If OPTS begins with `--', then non-option arguments are treated as ! arguments to the option '\0'. This behavior is specific to the GNU ! `getopt'. */ ! #if (defined __STDC__ && __STDC__) || defined __cplusplus ! # ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ ! extern int getopt (int __argc, char *const *__argv, const char *__shortopts); ! # else /* not __GNU_LIBRARY__ */ extern int getopt (); ! # endif /* __GNU_LIBRARY__ */ ! ! # ifndef __need_getopt ! extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, ! const struct option *__longopts, int *__longind); ! extern int getopt_long_only (int __argc, char *const *__argv, ! const char *__shortopts, ! const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ ! extern int _getopt_internal (int __argc, char *const *__argv, ! const char *__shortopts, ! const struct option *__longopts, int *__longind, ! int __long_only); ! # endif #else /* not __STDC__ */ extern int getopt (); + # ifndef __need_getopt extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); ! # endif ! #endif /* __STDC__ */ #ifdef __cplusplus *************** *** 127,129 **** #endif ! #endif /* _GETOPT_H */ --- 175,180 ---- #endif ! /* Make sure we later can get all the definitions and declarations. */ ! #undef __need_getopt ! ! #endif /* getopt.h */ diff -rc2P source-highlight-1.2/src/lib/getopt1.c source-highlight-1.2.1/src/lib/getopt1.c *** source-highlight-1.2/src/lib/getopt1.c Sun Apr 15 18:45:37 2001 --- source-highlight-1.2.1/src/lib/getopt1.c Thu Dec 20 22:49:49 2001 *************** *** 1,29 **** /* getopt_long and getopt_long_only entry points for GNU getopt. ! Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 ! Free Software Foundation, Inc. ! This program is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2, or (at your option) any ! later version. ! ! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H ! #include "config.h" #endif #include "getopt.h" ! #if !__STDC__ && !defined(const) && IN_GCC #define const #endif #include --- 1,35 ---- /* getopt_long and getopt_long_only entry points for GNU getopt. ! Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 ! Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! ! The GNU C Library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Lesser General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public ! License along with the GNU C Library; if not, write to the Free ! Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ! 02111-1307 USA. */ #ifdef HAVE_CONFIG_H ! #include #endif #include "getopt.h" ! #if !defined __STDC__ || !__STDC__ ! /* This is a separate conditional since some stdc systems ! reject `defined (const)'. */ ! #ifndef const #define const #endif + #endif #include *************** *** 37,41 **** it is simpler to just do this in the source for each such file. */ ! #if defined (_LIBC) || !defined (__GNU_LIBRARY__) --- 43,55 ---- it is simpler to just do this in the source for each such file. */ ! #define GETOPT_INTERFACE_VERSION 2 ! #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 ! #include ! #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION ! #define ELIDE_CODE ! #endif ! #endif ! ! #ifndef ELIDE_CODE *************** *** 44,49 **** #ifdef __GNU_LIBRARY__ #include - #else - char *getenv (); #endif --- 58,61 ---- *************** *** 80,84 **** ! #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST --- 92,96 ---- ! #endif /* Not ELIDE_CODE. */ #ifdef TEST *************** *** 111,115 **** c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); ! if (c == EOF) break; --- 123,127 ---- c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); ! if (c == -1) break; diff -rc2P source-highlight-1.2/src/lib/my_set.h source-highlight-1.2.1/src/lib/my_set.h *** source-highlight-1.2/src/lib/my_set.h Thu Jan 1 01:00:00 1970 --- source-highlight-1.2.1/src/lib/my_set.h Thu Dec 20 22:07:15 2001 *************** *** 0 **** --- 1,16 ---- + // deal with namespace problems + + #ifndef _MY_SET_H + #define _MY_SET_H + + #include + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #ifdef HAVE_NAMESPACES + using std::set; + #endif + + #endif // _MY_SET_H diff -rc2P source-highlight-1.2/src/lib/my_sstream.h source-highlight-1.2.1/src/lib/my_sstream.h *** source-highlight-1.2/src/lib/my_sstream.h Thu Jan 1 01:00:00 1970 --- source-highlight-1.2.1/src/lib/my_sstream.h Thu Dec 20 22:09:19 2001 *************** *** 0 **** --- 1,15 ---- + // deal with namespace problems + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif // HAVE_CONFIG_H + + #ifdef HAVE_SSTREAM + #include + #else + #include "includes/sstream" + #endif + + #ifdef HAVE_NAMESPACES + using std::ostringstream; + #endif diff -rc2P source-highlight-1.2/src/lib/optparser.cc source-highlight-1.2.1/src/lib/optparser.cc *** source-highlight-1.2/src/lib/optparser.cc Wed Nov 28 21:52:20 2001 --- source-highlight-1.2.1/src/lib/optparser.cc Thu Dec 20 22:11:01 2001 *************** *** 35,48 **** #include ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! ! #ifdef HAVE_SSTREAM ! #include ! #else ! #include "includes/sstream" ! #endif ! ! #endif // HAVE_CONFIG_H #include "tags.h" --- 35,39 ---- #include ! #include "my_sstream.h" #include "tags.h" *************** *** 133,138 **** #if YYDEBUG != 0 static const short yyrline[] = { 0, ! 72, 74, 75, 78, 83, 90, 91, 94, 95, 96, ! 97 }; #endif --- 124,129 ---- #if YYDEBUG != 0 static const short yyrline[] = { 0, ! 63, 65, 66, 69, 74, 81, 82, 85, 86, 87, ! 88 }; #endif diff -rc2P source-highlight-1.2/src/lib/optparser.yy source-highlight-1.2.1/src/lib/optparser.yy *** source-highlight-1.2/src/lib/optparser.yy Wed Nov 28 21:52:17 2001 --- source-highlight-1.2.1/src/lib/optparser.yy Thu Dec 20 22:08:16 2001 *************** *** 23,36 **** #include ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! ! #ifdef HAVE_SSTREAM ! #include ! #else ! #include "includes/sstream" ! #endif ! ! #endif // HAVE_CONFIG_H #include "tags.h" --- 23,27 ---- #include ! #include "my_sstream.h" #include "tags.h" diff -rc2P source-highlight-1.2/src/lib/tags.h source-highlight-1.2.1/src/lib/tags.h *** source-highlight-1.2/src/lib/tags.h Wed Nov 28 22:33:19 2001 --- source-highlight-1.2.1/src/lib/tags.h Thu Dec 20 22:04:39 2001 *************** *** 24,28 **** #include #include ! #include class Tag --- 24,29 ---- #include #include ! ! #include "my_set.h" class Tag