aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2020-01-06 00:01:46 -0700
committerArnold D. Robbins <arnold@skeeve.com>2020-01-06 00:01:46 -0700
commit944989bf683d30f306d8f29a3eb8c68c7c603fb4 (patch)
tree065c2aede377272723a419e6f28d051c95ce98f8
parentc7eeb57210cc7104df233a243295c36ffe6a2117 (diff)
downloadone-true-awk-944989bf683d30f306d8f29a3eb8c68c7c603fb4.tar.gz
Minor fixes.
-rw-r--r--ChangeLog7
-rw-r--r--b.c2
-rw-r--r--lex.c2
-rw-r--r--tran.c6
4 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 77271dc..1afd9de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-06 Arnold D. Robbins <arnold@skeeve.com>
+
+ Minor fixes.
+ * b.c (replace_repeat): Turn init_q back into an int.
+ * lex.c (string): Use \a instead of \007.
+ * tran.c (catstr): Use snprintf instead of sprintf.
+
2020-01-01 Arnold D. Robbins <arnold@skeeve.com>
* tran.c (syminit, arginit, envinit): Free sval member before
diff --git a/b.c b/b.c
index c400363..5671796 100644
--- a/b.c
+++ b/b.c
@@ -909,7 +909,7 @@ replace_repeat(const uschar *reptok, int reptoklen, const uschar *atom,
int i, j;
uschar *buf = 0;
int ret = 1;
- bool init_q = (firstnum == 0); /* first added char will be ? */
+ int init_q = (firstnum == 0); /* first added char will be ? */
int n_q_reps = secondnum-firstnum; /* m>n, so reduce until {1,m-n} left */
int prefix_length = reptok - basestr; /* prefix includes first rep */
int suffix_length = strlen((const char *) reptok) - reptoklen; /* string after rep specifier */
diff --git a/lex.c b/lex.c
index 1c6a0b7..d729516 100644
--- a/lex.c
+++ b/lex.c
@@ -390,7 +390,7 @@ int string(void)
case 'r': *bp++ = '\r'; break;
case 'b': *bp++ = '\b'; break;
case 'v': *bp++ = '\v'; break;
- case 'a': *bp++ = '\007'; break;
+ case 'a': *bp++ = '\a'; break;
case '\\': *bp++ = '\\'; break;
case '0': case '1': case '2': /* octal: \d \dd \ddd */
diff --git a/tran.c b/tran.c
index 1fca361..d659cfa 100644
--- a/tran.c
+++ b/tran.c
@@ -527,12 +527,14 @@ Cell *catstr(Cell *a, Cell *b) /* concatenate a and b */
if (p == NULL)
FATAL("out of space concatenating %s and %s", sa, sb);
snprintf(p, l, "%s%s", sa, sb);
- char *newbuf = malloc(strlen(p) + 2);
+
+ l++; // add room for ' '
+ char *newbuf = malloc(l);
if (newbuf == NULL)
FATAL("out of space concatenating %s and %s", sa, sb);
// See string() in lex.c; a string "xx" is stored in the symbol
// table as "xx ".
- sprintf(newbuf, "%s ", p);
+ snprintf(newbuf, l, "%s ", p);
c = setsymtab(newbuf, p, 0.0, CON|STR|DONTFREE, symtab);
free(p);
free(newbuf);