texinfo-commits
[Top][All Lists]
Advanced

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

[6028] pass Invocation_name=$0 from shell wrapper to awk script


From: karl
Subject: [6028] pass Invocation_name=$0 from shell wrapper to awk script
Date: Fri, 09 Jan 2015 00:09:09 +0000

Revision: 6028
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6028
Author:   karl
Date:     2015-01-09 00:09:08 +0000 (Fri, 09 Jan 2015)
Log Message:
-----------
pass Invocation_name=$0 from shell wrapper to awk script

Modified Paths:
--------------
    trunk/texindex/ChangeLog
    trunk/texindex/Makefile.am
    trunk/texindex/README
    trunk/texindex/texindex.in
    trunk/texindex/ti.twjr

Modified: trunk/texindex/ChangeLog
===================================================================
--- trunk/texindex/ChangeLog    2015-01-08 09:58:34 UTC (rev 6027)
+++ trunk/texindex/ChangeLog    2015-01-09 00:09:08 UTC (rev 6028)
@@ -1,3 +1,11 @@
+2015-01-08  Karl Berry  <address@hidden>
+
+       * ti.twjr (Invocation_name): new global, renamed from Prgname.
+       (usage): use it, a la coreutils.
+       * texindex.in: pass it (value $0), with -v.
+       
+       * Makefile.am (EXTRA_DIST): dek_idx.png rename.
+
 2015-01-06  Karl Berry  <address@hidden>
 
        first merge into automake:

Modified: trunk/texindex/Makefile.am
===================================================================
--- trunk/texindex/Makefile.am  2015-01-08 09:58:34 UTC (rev 6027)
+++ trunk/texindex/Makefile.am  2015-01-09 00:09:08 UTC (rev 6028)
@@ -66,4 +66,4 @@
        $(AWK) -f $(srcdir)/jrweave $(srcdir)/ti.twjr >ti.texi || rm -f $@
 
 # just a fun cartoon used in the literate document.
-EXTRA_DIST += donald_knuth.png
+EXTRA_DIST += dek_idx.png

Modified: trunk/texindex/README
===================================================================
--- trunk/texindex/README       2015-01-08 09:58:34 UTC (rev 6027)
+++ trunk/texindex/README       2015-01-09 00:09:08 UTC (rev 6028)
@@ -6,7 +6,7 @@
 ChangeLog              -- What it looks like
 Makefile.am            -- What it looks like
 README                 -- What it looks like
-donald_knuth.png       -- A cute cartoon
+dek_idx.png            -- A cute cartoon
 jrtangle               -- TexiWeb Jr tangle program
 jrweave                        -- TexiWeb Jr weave program
 texindex.in            -- texindex shell script wrapper, for automake

Modified: trunk/texindex/texindex.in
===================================================================
--- trunk/texindex/texindex.in  2015-01-08 09:58:34 UTC (rev 6027)
+++ trunk/texindex/texindex.in  2015-01-09 00:09:08 UTC (rev 6028)
@@ -70,4 +70,4 @@
   exit 1
 fi
 
-exec $awk_binary -f $ti_script -- "$@"
+exec $awk_binary -v Invocation_name="$0" -f "$ti_script" -- "$@"

Modified: trunk/texindex/ti.twjr
===================================================================
--- trunk/texindex/ti.twjr      2015-01-08 09:58:34 UTC (rev 6027)
+++ trunk/texindex/ti.twjr      2015-01-09 00:09:08 UTC (rev 6028)
@@ -285,7 +285,8 @@
 
 Per GNU standards, we sometimes hardwire the string @samp{texindex} as
 the name of the program, and sometimes use the name by which the program
-was invoked.  We'll call the latter @code{Prgname}.
+was invoked.  We'll call the latter @code{Invocation_name}; it's
+supposed to be passed in from the shell wrapper.
 
 The last line below sets up @code{Can_split_null}, which tells us if the
 built-in @code{split()} function will split apart a string into its
@@ -295,7 +296,8 @@
 @cindex @code{FALSE} constant
 @cindex @code{EXIT_SUCCESS} constant
 @cindex @code{EXIT_FAILURE} constant
address@hidden @code{Texindex_Version} variable
address@hidden @code{Texindex_version} variable
address@hidden @code{Invocation_name} variable
 @cindex @code{Can_split_null} variable
 @cindex @code{check_split_null()} function
 @<Initial setup@>=
@@ -304,8 +306,11 @@
 EXIT_SUCCESS = 0
 EXIT_FAILURE = 1
 
-Prgname = "texindex"  # ARGV[0] is "awk"
-Texindex_Version = "5.2+dev"
+Texindex_version = "5.2+dev"
+if (! Invocation_name) {
+  # provide fallback in case it's not passed in.
+  Invocation_name = "texindex"
+}
 
 Can_split_null = check_split_null()
 @
@@ -344,7 +349,7 @@
   } else if (ARGV[i] ~ /^--?.+/) {
     fatal(_"%s: unrecognized option `%s'\n" \
           "Try `%s --help' for more information.\n",
-          Prgname, ARGV[i], Prgname)
+          Invocation_name, ARGV[i], Invocation_name)
     exit EXIT_FAILURE
   } else {
     break
@@ -1219,7 +1224,7 @@
 information and then exit.  The strings that can and should be
 translated are prefixed with an underscore.
 
address@hidden @code{Texindex_Version} variable
address@hidden @code{Texindex_version} variable
 @cindex @code{usage()} function
 @cindex @code{version()} function
 @tex
@@ -1230,7 +1235,7 @@
 @<Helper functions@>=
 function usage(exit_val)
 {
-  printf(_"Usage: %s [OPTION]... FILE...\n", Prgname)
+  printf(_"Usage: %s [OPTION]... FILE...\n", Invocation_name)
   print _"Generate a sorted index for each TeX output FILE."
   print _"Usually FILE... is specified as `foo.??' for a document `foo.texi'."
   print ""
@@ -1248,7 +1253,7 @@
 
 function version()
 {
-  print "texindex (GNU texinfo)", Texindex_Version
+  print "texindex (GNU texinfo)", Texindex_version
   print ""
   print _"Copyright (C) 2015 Free Software Foundation, Inc."
   print _"License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>"




reply via email to

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