zap whitespace

This commit is contained in:
purplerain 2023-09-19 02:17:03 +00:00
parent d226ef1ecf
commit d8235ebda5
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
14 changed files with 33 additions and 33 deletions

View File

@ -26,13 +26,13 @@ This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August 1987. was sent to the printers in August 1987.
Sep 06, 2023: Sep 06, 2023:
Fix edge case where FS is changed on commandline. Thanks to Fix edge case where FS is changed on commandline. Thanks to
Gordon Shephard and Miguel Pineiro Jr. Gordon Shephard and Miguel Pineiro Jr.
Fix regular expression clobbering in the lexer, where lexer does Fix regular expression clobbering in the lexer, where lexer does
not make a copy of regexp literals. also makedfa memory leaks have not make a copy of regexp literals. also makedfa memory leaks have
been plugged. Thanks to Miguel Pineiro Jr. been plugged. Thanks to Miguel Pineiro Jr.
Dec 15, 2022: Dec 15, 2022:
Force hex escapes in strings to be no more than two characters, Force hex escapes in strings to be no more than two characters,
as they already are in regular expressions. This brings internal as they already are in regular expressions. This brings internal
@ -55,7 +55,7 @@ May 23, 2022:
Mar 14, 2022: Mar 14, 2022:
Historic bug: command-line "name=value" assignment had been Historic bug: command-line "name=value" assignment had been
truncating its entry in ARGV. (circa 1989) Thanks to truncating its entry in ARGV. (circa 1989) Thanks to
Miguel Pineiro Jr. <mpj@pineiro.cc>. Miguel Pineiro Jr. <mpj@pineiro.cc>.
Mar 3, 2022: Mar 3, 2022:

View File

@ -445,7 +445,7 @@ void fldbld(void) /* create fields from current record */
} }
if (*r++ == 0) if (*r++ == 0)
break; break;
} }
} }
*fr = 0; *fr = 0;

View File

@ -712,7 +712,7 @@ int u8_byte2char(const char *s, int bytenum)
{ {
int i, len, b; int i, len, b;
int charnum = 0; /* BUG: what origin? */ int charnum = 0; /* BUG: what origin? */
/* should be 0 to match start==0 which means no match */ /* should be 0 to match start==0 which means no match */
b = strlen(s); b = strlen(s);
if (bytenum > b) { if (bytenum > b) {
@ -757,13 +757,13 @@ enum
}; };
int runetochar(char *str, int c) int runetochar(char *str, int c)
{ {
/* one character sequence 00000-0007F => 00-7F */ /* one character sequence 00000-0007F => 00-7F */
if (c <= Rune1) { if (c <= Rune1) {
str[0] = c; str[0] = c;
return 1; return 1;
} }
/* two character sequence 00080-007FF => T2 Tx */ /* two character sequence 00080-007FF => T2 Tx */
if (c <= Rune2) { if (c <= Rune2) {
str[0] = T2 | (c >> 1*Bitx); str[0] = T2 | (c >> 1*Bitx);
@ -780,14 +780,14 @@ int runetochar(char *str, int c)
str[2] = Tx | (c & Maskx); str[2] = Tx | (c & Maskx);
return 3; return 3;
} }
/* four character sequence 010000-1FFFFF => T4 Tx Tx Tx */ /* four character sequence 010000-1FFFFF => T4 Tx Tx Tx */
str[0] = T4 | (c >> 3*Bitx); str[0] = T4 | (c >> 3*Bitx);
str[1] = Tx | ((c >> 2*Bitx) & Maskx); str[1] = Tx | ((c >> 2*Bitx) & Maskx);
str[2] = Tx | ((c >> 1*Bitx) & Maskx); str[2] = Tx | ((c >> 1*Bitx) & Maskx);
str[3] = Tx | (c & Maskx); str[3] = Tx | (c & Maskx);
return 4; return 4;
} }
/* ========== end of utf8 code =========== */ /* ========== end of utf8 code =========== */
@ -1247,7 +1247,7 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
prec = u8_strlen(t); prec = u8_strlen(t);
pad = wid>prec ? wid - prec : 0; // has to be >= 0 pad = wid>prec ? wid - prec : 0; // has to be >= 0
int i, k, n; int i, k, n;
if (ljust) { // print prec chars from t, then pad blanks if (ljust) { // print prec chars from t, then pad blanks
n = u8_char2byte(t, prec); n = u8_char2byte(t, prec);
for (k = 0; k < n; k++) { for (k = 0; k < n; k++) {

View File

@ -454,7 +454,7 @@ permitted. The names of arrays are permitted to
collide with the names of simple variables and function names. collide with the names of simple variables and function names.
Any fractional Any fractional
part of a subscript is discarded before use. part of a subscript is discarded before use.
Subscripts must be greater than or equal to zero and Subscripts must be greater than or equal to zero and
less than or equal to 2047. less than or equal to 2047.
.PP .PP
Subscripted variables may be freely used in expressions, in Subscripted variables may be freely used in expressions, in
@ -1053,7 +1053,7 @@ Storage classes
.PP .PP
There are only two storage classes in BC, global and automatic There are only two storage classes in BC, global and automatic
(local). (local).
Only identifiers that are to be local to a function need be Only identifiers that are to be local to a function need be
declared with the \fBauto\fP command. declared with the \fBauto\fP command.
The arguments to a function The arguments to a function
are local to the function. are local to the function.
@ -1061,7 +1061,7 @@ All other identifiers are assumed to be global
and available to all functions. and available to all functions.
All identifiers, global and local, have initial values All identifiers, global and local, have initial values
of zero. of zero.
Identifiers declared as \fBauto\fP are allocated on entry to the function Identifiers declared as \fBauto\fP are allocated on entry to the function
and released on returning from the function. and released on returning from the function.
They therefore do not retain values between function calls. They therefore do not retain values between function calls.
\fBauto\fP arrays are specified by the array name followed by empty square brackets. \fBauto\fP arrays are specified by the array name followed by empty square brackets.
@ -1069,7 +1069,7 @@ They therefore do not retain values between function calls.
Automatic variables in BC do not work in exactly the same way Automatic variables in BC do not work in exactly the same way
as in either C or PL/I. On entry to a function, the old values of as in either C or PL/I. On entry to a function, the old values of
the names that appear as parameters and as automatic the names that appear as parameters and as automatic
variables are pushed onto a stack. variables are pushed onto a stack.
Until return is made from the function, reference to these Until return is made from the function, reference to these
names refers only to the new values. names refers only to the new values.
.NH 1 .NH 1
@ -1203,14 +1203,14 @@ value is printed and assigned to the variable `last'.
No trailing newline is printed. No trailing newline is printed.
The expression may also be a string enclosed in double quotes. The expression may also be a string enclosed in double quotes.
Within these strings the following escape sequences may be used: Within these strings the following escape sequences may be used:
\ea \ea
for bell (alert), for bell (alert),
`\eb' `\eb'
for backspace, for backspace,
`\ef' `\ef'
for formfeed, for formfeed,
`\en' `\en'
for newline, for newline,
`\er' `\er'
for carriage return, for carriage return,
`\et' `\et'
@ -1229,7 +1229,7 @@ The \fBquit\fR statement stops execution of a BC program and returns
control to UNIX when it is first encountered. control to UNIX when it is first encountered.
Because it is not treated as an executable statement, Because it is not treated as an executable statement,
it cannot be used it cannot be used
in a function definition or in an in a function definition or in an
.ft B .ft B
if, for, if, for,
.ft .ft

View File

@ -10,13 +10,13 @@ that even if I was dumb enough to try. From this we can easily calculate
the day of week for any date. The algorithm for a zero based day of week: the day of week for any date. The algorithm for a zero based day of week:
calculate the number of days in all prior years (year-1)*365 calculate the number of days in all prior years (year-1)*365
add the number of leap years (days?) since year 1 add the number of leap years (days?) since year 1
(not including this year as that is covered later) (not including this year as that is covered later)
add the day number within the year add the day number within the year
this compensates for the non-inclusive leap year this compensates for the non-inclusive leap year
calculation calculation
if the day in question occurs before the gregorian reformation if the day in question occurs before the gregorian reformation
(3 sep 1752 for our purposes), then simply return (3 sep 1752 for our purposes), then simply return
(value so far - 1 + SATURDAY's value of 6) modulo 7. (value so far - 1 + SATURDAY's value of 6) modulo 7.
if the day in question occurs during the reformation (3 sep 1752 if the day in question occurs during the reformation (3 sep 1752
to 13 sep 1752 inclusive) return THURSDAY. This is my to 13 sep 1752 inclusive) return THURSDAY. This is my

View File

@ -502,7 +502,7 @@ exactly as described. The quantity returned is the remains of the
dividend at the end of the divide process. dividend at the end of the divide process.
Since division truncates toward zero, remainders have the same Since division truncates toward zero, remainders have the same
sign as the dividend. sign as the dividend.
The scale of the remainder is set to The scale of the remainder is set to
the maximum of the scale of the dividend and the maximum of the scale of the dividend and
the scale of the quotient plus the scale of the divisor. the scale of the quotient plus the scale of the divisor.
.SH .SH
@ -544,7 +544,7 @@ Input Conversion and Base
Numbers are converted to the internal representation as they are read Numbers are converted to the internal representation as they are read
in. in.
The scale stored with a number is simply the number of fractional digits input. The scale stored with a number is simply the number of fractional digits input.
Negative numbers are indicated by preceding the number with a \fB\_\fP (an Negative numbers are indicated by preceding the number with a \fB\_\fP (an
underscore). underscore).
The hexadecimal digits A\-F correspond to the numbers 10\-15 regardless of input base. The hexadecimal digits A\-F correspond to the numbers 10\-15 regardless of input base.
The \fBi\fP command can be used to change the base of the input numbers. The \fBi\fP command can be used to change the base of the input numbers.
@ -653,9 +653,9 @@ into the array \fIx\fP of the value to be loaded.
.SH .SH
Miscellaneous Commands Miscellaneous Commands
.PP .PP
The command \fB!\fP interprets the rest of the line as a The command \fB!\fP interprets the rest of the line as a
.UX .UX
command and passes it to command and passes it to
.UX .UX
to execute. to execute.
One other compiler command is \fBQ\fP. One other compiler command is \fBQ\fP.

View File

@ -32,7 +32,7 @@
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */ /* PURPOSE. */
#include "options.h" #include "options.h"
/* Be sure to synchronize these options with those defined in "options.h", /* Be sure to synchronize these options with those defined in "options.h",

View File

@ -32,7 +32,7 @@
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */ /* PURPOSE. */
#include "flexdef.h" #include "flexdef.h"
#include "scanopt.h" #include "scanopt.h"

View File

@ -127,7 +127,7 @@ sub link
my @libobjects = values %$libs; my @libobjects = values %$libs;
tsay {"libs:\n", join("\n", (keys %$libs))}; tsay {"libs:\n", join("\n", (keys %$libs))};
tsay {"libfiles:\n", tsay {"libfiles:\n",
join("\n", map { $_->{fullpath}//'UNDEF' } @libobjects) }; join("\n", map { $_->{fullpath}//'UNDEF' } @libobjects) };
$linker->create_symlinks($symlinkdir, $libs); $linker->create_symlinks($symlinkdir, $libs);

View File

@ -293,7 +293,7 @@ keep(char *ptr)
else else
kept_capacity = 50; kept_capacity = 50;
kept = xreallocarray(kept, kept_capacity, kept = xreallocarray(kept, kept_capacity,
sizeof(char *), "Out of memory while saving %d strings\n", sizeof(char *), "Out of memory while saving %d strings\n",
kept_capacity); kept_capacity);
} }
kept[kept_size++] = ptr; kept[kept_size++] = ptr;

View File

@ -488,7 +488,7 @@ add_targets_to_make(Lst todo)
if (gn->children_left != 0) { if (gn->children_left != 0) {
if (DEBUG(MAKE)) if (DEBUG(MAKE))
printf("%s: not queuing (%d child%s left to build)\n", printf("%s: not queuing (%d child%s left to build)\n",
gn->name, gn->children_left, gn->name, gn->children_left,
gn->children_left > 1 ? "ren" : ""); gn->children_left > 1 ? "ren" : "");
Lst_ForEach(&gn->children, MakeAddChild, Lst_ForEach(&gn->children, MakeAddChild,
&examine); &examine);

View File

@ -523,7 +523,7 @@ rmchk(opt_t opts)
} }
(void) snprintf(ptarget, (void) snprintf(ptarget,
sizeof(target) - (ptarget - target), sizeof(target) - (ptarget - target),
"%s%s", "%s%s",
(ptarget[-1] == '/' ? "" : "/"), (ptarget[-1] == '/' ? "" : "/"),
targ); targ);
debugmsg(DM_MISC, "check %s\n", target); debugmsg(DM_MISC, "check %s\n", target);

View File

@ -270,7 +270,7 @@ sendcmdmsg(int cmd, char *msg, size_t msgsize)
} }
debugmsg(DM_PROTO, ">>> Cmd = %c (\\%3.3o) Msg = \"%.*s\"", debugmsg(DM_PROTO, ">>> Cmd = %c (\\%3.3o) Msg = \"%.*s\"",
cmd, cmd, cmd, cmd,
(cmd == C_NONE) ? len-1 : len-2, (cmd == C_NONE) ? len-1 : len-2,
(cmd == C_NONE) ? msg : msg + 1); (cmd == C_NONE) ? msg : msg + 1);

View File

@ -123,7 +123,7 @@ print_header(void)
"%s (%u-%u of %u) %s", uloadbuf, start, end, num_disp, "%s (%u-%u of %u) %s", uloadbuf, start, end, num_disp,
paused ? "PAUSED" : ""); paused ? "PAUSED" : "");
else else
snprintf(tmpbuf, sizeof(tmpbuf), snprintf(tmpbuf, sizeof(tmpbuf),
"%s %s", uloadbuf, "%s %s", uloadbuf,
paused ? "PAUSED" : ""); paused ? "PAUSED" : "");