diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2019-01-16 18:58:39 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2019-01-16 18:58:39 +0000 |
commit | f8c4f57df57c19c548d40d4a5a907b7577d72bac (patch) | |
tree | 88590c2b86a5c311a8fd6c402c933b3309e20bb9 /Build/source | |
parent | 2e7f1c95f5b3db3e7972009f3b8b32eb90faa9c3 (diff) |
Corrections in comm-w2c.ch.
Initial experiments with 'HAVE_GETTEXT' show that 'kpse_var_expand'
returns the expansion of '$SELFAUTOLOC' correctly, but returns the yet
to be defined '$TEXMFLOCALEFILES' AS IS (and not, as advertised in
'texk/kpathsea/variable.h', the empty string, nor the originally assumed
NULL pointer). 'strcmp'aring the string returned from 'kpse_var_expand'
to the configuration variable works as expected.
Secondly, the numeric part after flag '-d/+d' is skipped and not
interpreted as flags, i.e., we do not set numeric flags '2' and '3' from
command line option '+d32'.
git-svn-id: svn://tug.org/texlive/trunk@49726 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/web2c/cwebboot.cin | 80 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-w2c.ch | 26 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/po/cweb-tl.pot | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po | 6 |
5 files changed, 62 insertions, 61 deletions
diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index 3f897fb5237..bce9b6de131 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -17,14 +17,14 @@ #include <stdlib.h> /*:22*//*81:*/ -#line 1121 "cwebdir/comm-w2c.ch" +#line 1123 "cwebdir/comm-w2c.ch" #include <string.h> #line 1417 "cwebdir/common.w" -#line 1128 "cwebdir/comm-w2c.ch" +#line 1130 "cwebdir/comm-w2c.ch" /*:81*//*85:*/ -#line 1167 "cwebdir/comm-w2c.ch" +#line 1169 "cwebdir/comm-w2c.ch" #include <stdbool.h> #include <stddef.h> @@ -48,7 +48,7 @@ #endif /*:88*//*90:*/ -#line 1278 "cwebdir/comm-w2c.ch" +#line 1276 "cwebdir/comm-w2c.ch" typedef bool boolean; #define HAVE_BOOLEAN @@ -171,8 +171,7 @@ err_print(_("! Include file name too long") ) ;goto restart;} \ #define C_printf(c,a) fprintf(C_file,c,a) #define C_putc(c) putc(c,C_file) \ -#define max_banner 50 -#define max_path_length (BUFSIZ-2) \ +#define max_banner 50 \ #define PATH_SEPARATOR separators[0] #define DIR_SEPARATOR separators[1] @@ -180,6 +179,8 @@ err_print(_("! Include file name too long") ) ;goto restart;} \ #define _(STRING) gettext(STRING) \ +#define TEXMF_LOCALE "$TEXMFLOCALEFILES" \ + #define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) \ #define show_kpathsea_debug flags['d'] \ @@ -309,15 +310,15 @@ const char*use_language= ""; FILE*C_file; FILE*tex_file; FILE*idx_file; -#line 1054 "cwebdir/comm-w2c.ch" +#line 1056 "cwebdir/comm-w2c.ch" FILE*scn_file; FILE*check_file; -#line 1061 "cwebdir/comm-w2c.ch" +#line 1063 "cwebdir/comm-w2c.ch" FILE*active_file; char*found_filename; #line 1376 "cwebdir/common.w" -#line 1078 "cwebdir/comm-w2c.ch" +#line 1080 "cwebdir/comm-w2c.ch" /*:77*/ #line 61 "cwebdir/common.w" @@ -332,10 +333,9 @@ char change_buffer[buf_size]; char*change_limit; /*:11*//*86:*/ -#line 1184 "cwebdir/comm-w2c.ch" +#line 1185 "cwebdir/comm-w2c.ch" char cb_banner[max_banner]; -char locale_path[max_path_length]= "/usr/share/locale/"; string texmf_locale; #ifndef SEPARATORS #define SEPARATORS "://" @@ -405,7 +405,7 @@ static void scan_args(void); #line 1253 "cwebdir/common.w" /*:69*//*83:*/ -#line 1143 "cwebdir/comm-w2c.ch" +#line 1145 "cwebdir/comm-w2c.ch" boolean get_line(void); name_pointer id_lookup(const char*,const char*,char); @@ -418,7 +418,7 @@ void reset_input(void); void sprint_section_name(char*,name_pointer); /*:83*//*84:*/ -#line 1156 "cwebdir/comm-w2c.ch" +#line 1158 "cwebdir/comm-w2c.ch" static boolean input_ln(FILE*); static int web_strcmp(char*,int,char*,int); @@ -428,7 +428,7 @@ static void check_change(void); static void prime_the_change_buffer(void); /*:84*//*95:*/ -#line 1334 "cwebdir/comm-w2c.ch" +#line 1332 "cwebdir/comm-w2c.ch" void cb_show_banner(void); static void cb_usage(const_string str); @@ -468,7 +468,7 @@ root= NULL; #line 72 "cwebdir/comm-w2c.ch" /*91:*/ -#line 1299 "cwebdir/comm-w2c.ch" +#line 1297 "cwebdir/comm-w2c.ch" kpse_set_program_name(argv[0],"cweb"); @@ -476,20 +476,16 @@ kpse_set_program_name(argv[0],"cweb"); #line 73 "cwebdir/comm-w2c.ch" /*89:*/ -#line 1242 "cwebdir/comm-w2c.ch" +#line 1244 "cwebdir/comm-w2c.ch" setlocale(LC_MESSAGES,setlocale(LC_CTYPE,"")); -texmf_locale= kpse_var_expand("$TEXMFLOCALEFILES"); -if(texmf_locale){ -if(strlen(texmf_locale)<max_path_length) -sprintf(locale_path,"%s",texmf_locale); -else err_print("! Include path too long"); - +texmf_locale= kpse_var_expand(TEXMF_LOCALE); +bindtextdomain("cweb", +bindtextdomain("cweb-tl", +bindtextdomain("web2c-help", +strcmp(texmf_locale,TEXMF_LOCALE)? +texmf_locale:"/usr/share/locale"))); free(texmf_locale); -} -bindtextdomain("cweb",locale_path); -bindtextdomain("cweb-tl",locale_path); -bindtextdomain("web2c-help",locale_path); textdomain("cweb"); @@ -505,7 +501,7 @@ textdomain("cweb"); #line 75 "cwebdir/comm-w2c.ch" /*78:*/ -#line 1078 "cwebdir/comm-w2c.ch" +#line 1080 "cwebdir/comm-w2c.ch" scan_args(); if(program==ctangle){ @@ -1436,7 +1432,7 @@ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/ if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0) /*94:*/ -#line 1327 "cwebdir/comm-w2c.ch" +#line 1325 "cwebdir/comm-w2c.ch" cb_usagehelp(program==ctangle?CTANGLEHELP: program==cweave?CWEAVEHELP:CTWILLHELP,NULL); @@ -1448,7 +1444,7 @@ program==cweave?CWEAVEHELP:CTWILLHELP,NULL); if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0) /*97:*/ -#line 1384 "cwebdir/comm-w2c.ch" +#line 1382 "cwebdir/comm-w2c.ch" printversionandexit(cb_banner, program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth", @@ -1472,24 +1468,26 @@ if(*dot_pos=='q'){ show_banner= show_progress= show_happiness= 0; }else if(*dot_pos=='d'){ -if(sscanf(*argv+2,"%u",&kpathsea_debug)!=1)/*75:*/ +if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*75:*/ #line 1352 "cwebdir/common.w" -#line 1041 "cwebdir/comm-w2c.ch" +#line 1043 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); #line 1363 "cwebdir/common.w" -#line 1048 "cwebdir/comm-w2c.ch" +#line 1050 "cwebdir/comm-w2c.ch" /*:75*/ #line 1015 "cwebdir/comm-w2c.ch" +while(isdigit(*dot_pos))dot_pos++; +dot_pos--; }else if(*dot_pos=='l'){ use_language= ++dot_pos; break; }else -#line 1026 "cwebdir/comm-w2c.ch" +#line 1028 "cwebdir/comm-w2c.ch" flags[(eight_bits)*dot_pos]= flag_change; #line 1350 "cwebdir/common.w" } @@ -1514,7 +1512,7 @@ if(!found_web)/*71:*/ { if(s-*argv> max_file_name_length-5) /*76:*/ -#line 1048 "cwebdir/comm-w2c.ch" +#line 1050 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); #line 1365 "cwebdir/common.w" @@ -1548,7 +1546,7 @@ if(strcmp(*argv,"-")!=0){ #line 1314 "cwebdir/common.w" if(s-*argv> max_file_name_length-4) /*76:*/ -#line 1048 "cwebdir/comm-w2c.ch" +#line 1050 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); #line 1365 "cwebdir/common.w" @@ -1574,7 +1572,7 @@ else if(!found_out)/*73:*/ { if(s-*argv> max_file_name_length-5) /*76:*/ -#line 1048 "cwebdir/comm-w2c.ch" +#line 1050 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); #line 1365 "cwebdir/common.w" @@ -1608,12 +1606,12 @@ found_out= 1; else/*75:*/ #line 1352 "cwebdir/common.w" -#line 1041 "cwebdir/comm-w2c.ch" +#line 1043 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); #line 1363 "cwebdir/common.w" -#line 1048 "cwebdir/comm-w2c.ch" +#line 1050 "cwebdir/comm-w2c.ch" /*:75*/ #line 1278 "cwebdir/common.w" ; @@ -1622,12 +1620,12 @@ else/*75:*/ if(!found_web)/*75:*/ #line 1352 "cwebdir/common.w" -#line 1041 "cwebdir/comm-w2c.ch" +#line 1043 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); #line 1363 "cwebdir/common.w" -#line 1048 "cwebdir/comm-w2c.ch" +#line 1050 "cwebdir/comm-w2c.ch" /*:75*/ #line 1281 "cwebdir/common.w" ; @@ -1636,7 +1634,7 @@ cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); #line 953 "cwebdir/comm-w2c.ch" /*:70*//*96:*/ -#line 1341 "cwebdir/comm-w2c.ch" +#line 1339 "cwebdir/comm-w2c.ch" void cb_show_banner(void) { diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 5ea40f3a729..f1c7fc207ca 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,8 @@ +2019-01-16 Andreas Scherer <https://ascherer.github.io> + + * comm-w2c.ch: Correct usage of 'kpse_var_expand'; + skip numeric argument of '-d' flag. + 2019-01-15 Andreas Scherer <https://ascherer.github.io> * comm-w2c.ch: Provisional 'bindtextdomain' lookup in TDS. diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 9c1dc4c65db..2c195b66ac5 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -1012,7 +1012,9 @@ the other arrays for the argument. show_banner=show_progress=show_happiness=0; } else if (*dot_pos=='d') { - if (sscanf(*argv+2,"%u",&kpathsea_debug)!=1) @<Print usage error...@>@; + if (sscanf(++dot_pos,"%u",&kpathsea_debug)!=1) @<Print usage error...@>@; + while (isdigit(*dot_pos)) dot_pos++; /* skip numeric part */ + dot_pos--; /* reset to final digit */ } else if(*dot_pos=='l') { use_language=++dot_pos; @@ -1175,7 +1177,6 @@ argument string need a few extra variables. @s string int @d max_banner 50 -@d max_path_length (BUFSIZ-2) @d PATH_SEPARATOR separators[0] @d DIR_SEPARATOR separators[1] @@ -1183,7 +1184,6 @@ argument string need a few extra variables. @<Other...@>= char cb_banner[max_banner];@/ -char locale_path[max_path_length]="/usr/share/locale/";@/ string texmf_locale;@/ #ifndef SEPARATORS #define SEPARATORS "://" @@ -1239,19 +1239,17 @@ system by checking out the sources and translating the strings in files \.{cweb.pot}, \.{cweb-tl.pot}, and \.{web2c-help.pot}, and submitting the resulting \.{*.po} files to the maintainers at \.{tex-k@@tug.org}. +@d TEXMF_LOCALE "$TEXMFLOCALEFILES" + @<Set locale...@>= setlocale(LC_MESSAGES, setlocale(LC_CTYPE, "")); -texmf_locale = kpse_var_expand ("$TEXMFLOCALEFILES"); -if (texmf_locale) { - if (strlen(texmf_locale) < max_path_length) - sprintf(locale_path,"%s",texmf_locale); - else err_print("! Include path too long"); -@.Include path too long@> - free(texmf_locale); -} -bindtextdomain("cweb", locale_path); -bindtextdomain("cweb-tl", locale_path); -bindtextdomain("web2c-help", locale_path); +texmf_locale = kpse_var_expand (TEXMF_LOCALE); +bindtextdomain("cweb", + bindtextdomain("cweb-tl", + bindtextdomain("web2c-help", + strcmp(texmf_locale, TEXMF_LOCALE) ? + texmf_locale : "/usr/share/locale"))); +free(texmf_locale); textdomain("cweb"); /* the majority of |"strings"| come from ``plain \.{CWEB}'' */ @.cweb.mo@> diff --git a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot index b2003abf984..00408e394ab 100644 --- a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot +++ b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot @@ -17,17 +17,17 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: comm-texlive.ch:496 +#: comm-texlive.ch:494 #, c-format msgid "%s: Need one to three file arguments.\n" msgstr "" -#: comm-texlive.ch:497 +#: comm-texlive.ch:495 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "" -#: comm-texlive.ch:516 +#: comm-texlive.ch:514 #, c-format msgid "" "\n" diff --git a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po index 03165a02f2a..61fbaacf10a 100644 --- a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po +++ b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po @@ -17,17 +17,17 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: comm-texlive.ch:496 +#: comm-texlive.ch:494 #, c-format msgid "%s: Need one to three file arguments.\n" msgstr "%s: Benötige ein bis drei Dateiargumente.\n" -#: comm-texlive.ch:497 +#: comm-texlive.ch:495 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "Versuche `%s --help' für weitere Informationen.\n" -#: comm-texlive.ch:516 +#: comm-texlive.ch:514 #, c-format msgid "" "\n" |