aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-03-26 21:36:37 +0200
committerArnold D. Robbins <arnold@skeeve.com>2012-03-26 21:36:37 +0200
commit15635ff21b6f1a0951f0ff5de6ddaf0edab8edd7 (patch)
treeef4d017b04e45f934ca2130e622262aa952e62a3
parent2e14bf32d257e86fb4db379211c1f86af2b23165 (diff)
downloadegawk-15635ff21b6f1a0951f0ff5de6ddaf0edab8edd7.tar.gz
egawk-15635ff21b6f1a0951f0ff5de6ddaf0edab8edd7.tar.bz2
egawk-15635ff21b6f1a0951f0ff5de6ddaf0edab8edd7.zip
Some minor style edits in code and doc.
-rw-r--r--ChangeLog10
-rw-r--r--awkgram.y10
-rw-r--r--doc/ChangeLog4
-rw-r--r--doc/gawk.texi11
-rw-r--r--io.c2
-rw-r--r--main.c6
6 files changed, 32 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index d5be293f..2b17e4f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-03-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ Some cleanups.
+
+ * awkgram.y (add_srcfile): Use whole messages, better for
+ translations.
+ * io.c (init_awkpath): Small style tweak.
+ * main.c (path_environ): Straighten out initial comment, fix
+ compiler warning by making `val' const char *.
+
2012-03-25 Andrew J. Schorr <aschorr@telemetry-investments.com>
* configure.ac (AC_DISABLE_STATIC): Add this to avoid building useless
diff --git a/awkgram.y b/awkgram.y
index 0b47568b..18e758f9 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1845,7 +1845,7 @@ static const struct token tokentab[] = {
{"int", Op_builtin, LEX_BUILTIN, A(1), do_int},
{"isarray", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_isarray},
{"length", Op_builtin, LEX_LENGTH, A(0)|A(1), do_length},
-{"load", Op_symbol, LEX_LOAD, GAWKX, 0},
+{"load", Op_symbol, LEX_LOAD, GAWKX, 0},
{"log", Op_builtin, LEX_BUILTIN, A(1), do_log},
{"lshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift},
{"match", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_match},
@@ -2288,8 +2288,12 @@ add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int
*errcode = errno_val;
return NULL;
}
- fatal(_("can't open %s `%s' for reading (%s)"),
- ((stype == SRC_EXTLIB) ? "shared library" : "source file"), src, errno_val ? strerror(errno_val) : _("reason unknown"));
+ /* use full messages to ease translation */
+ fatal(stype == SRC_EXTLIB
+ ? _("can't open source file `%s' for reading (%s)")
+ : _("can't open shared library `%s' for reading (%s)"),
+ src,
+ errno_val ? strerror(errno_val) : _("reason unknown"));
}
for (s = srcfiles->next; s != srcfiles; s = s->next) {
diff --git a/doc/ChangeLog b/doc/ChangeLog
index f8f83fca..815644ca 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk.texi: Minor style edits.
+
2012-03-21 Andrew J. Schorr <aschorr@telemetry-investments.com>
* gawk.texi, gawk.1: Document new @load keyword.
diff --git a/doc/gawk.texi b/doc/gawk.texi
index c3375ce8..eaad54d2 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -3883,19 +3883,20 @@ suffix to the filename. For example, on GNU/Linux systems, the suffix
@samp{.so} is used.
@example
-$ @kbd{awk '@@load "ordchr"; BEGIN @{print chr(65)@}'}
-A
+$ @kbd{gawk '@@load "ordchr"; BEGIN @{print chr(65)@}'}
+@print{} A
@end example
@noindent
This is equivalent to the following example:
@example
-$ @kbd{awk -lordchr 'BEGIN @{print chr(65)@}'}
-A
+$ @kbd{gawk -lordchr 'BEGIN @{print chr(65)@}'}
+@print{} A
@end example
-@noindent For command-line usage, the @option{-l} option is more convenient,
+@noindent
+For command-line usage, the @option{-l} option is more convenient,
but @samp{@@load} is useful for embedding inside an @command{awk} source file
that requires access to a shared library.
diff --git a/io.c b/io.c
index 79bc8682..e3327f17 100644
--- a/io.c
+++ b/io.c
@@ -2345,7 +2345,7 @@ init_awkpath(path_info *pi)
pi->max_pathlen = 0;
if ((path = getenv(pi->envname)) == NULL || *path == '\0')
- path = *(pi->dfltp);
+ path = pi->dfltp[0];
max_path = INC_PATH;
emalloc(pi->awkpath, char **, (max_path + 1) * sizeof(char *), "init_awkpath");
diff --git a/main.c b/main.c
index dafa15cf..9df5869f 100644
--- a/main.c
+++ b/main.c
@@ -971,12 +971,12 @@ init_vars()
register_deferred_variable("ENVIRON", load_environ);
}
-/* load_environ --- populate the ENVIRON array */
+/* path_environ --- put path variable into environment if not already there */
static void
path_environ(const char *pname, const char *dflt)
{
- char *val;
+ const char *val;
NODE **aptr;
NODE *tmp;
@@ -996,6 +996,8 @@ path_environ(const char *pname, const char *dflt)
unref(tmp);
}
+/* load_environ --- populate the ENVIRON array */
+
static NODE *
load_environ()
{