Skip to content

Commit

Permalink
Original 4.3BSD-Quasijarus0a release notes
Browse files Browse the repository at this point in the history
4.3BSD-Quasijarus0a was released on 1999-10-10.

As you can read on the Quasijarus Project History page, this release does what 4.3BSD-Quasijarus0 was intended but unfortunately failed to do: provide a demark between CSRG and Quasijarus. It is the UNIX operating system in its state at the point of its transition from CSRG to Quasijarus. In preparing this release, I have sweated for 9 months to reconstruct, stabilize, shape up, and package up the system I have inherited from CSRG, but very carefully avoided any changes of my own. In particular, the VAX hardware support in this release consists of all CPUs and devices that CSRG supported or tried to support. This support has been highly polished, i.e., all of it works as expected and as advertised, which at CSRG was not the case in some areas. However, no all-new hardware support has been added. This release has been carefully polished and shined for both users and developers. For users I have been extremely careful to make this release of full production quality not less than that of the very original 4.3BSD. In the system as distributed, the system header files are copied to /usr/include rather than symlinked, so that a production site can run without any sources installed and still give users the full functionality, including the ability to compile their own programs. For developers, the source tree has been fully SCCS-reconstructed, polished, and shined. The system fully rebuilds from the source like a charm.

4.3BSD-Quasijarus0 and 4.3BSD-Quasijarus0a contain a serious bug in c2, the peephole optimiser, which causes it under certain circumstances to throw out instructions loading registers which are later used in deferred or indexed addressing modes. The resulting misoptimised code thus dereferences bogus addresses, dumping core or even worse, behaving unpredictably. Since all system binaries are compiled with -O this potentially affects every binary in the system. This bug has been fixed in 4.3BSD-Quasijarus0b.

@(#)0a.html 1.1 03/12/18

Michael Sokolov
[email protected]
  • Loading branch information
abs0 committed Jan 3, 2017
1 parent 0ed28e2 commit e20d687
Show file tree
Hide file tree
Showing 1,799 changed files with 348,364 additions and 7,050 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#)Makefile 4.18 (Berkeley) 6/30/88
# @(#)Makefile 4.19 (Berkeley) 1/14/99
#
# This makefile is designed to be run in one of three ways:
#
Expand Down Expand Up @@ -59,11 +59,11 @@ LIBCDEFS= HOSTLOOKUP=${HOSTLOOKUP} DFLMON=${DFLMON} DEFS="${DEFS}"
#
DESTDIR=
CFLAGS= -O
SRC_MFLAGS= -k
SRC_MFLAGS=

LIBDIR= lib usr.lib
# order is important, old and man must be #1 and #2
SRCDIR= old man bin usr.bin etc ucb new games local
SRCDIR= old man bin usr.bin etc ucb games

all: ${LIBDIR} ${SRCDIR}

Expand Down
44 changes: 15 additions & 29 deletions bin/adb/adb.tahoe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# @(#)Makefile 1.3 (Berkeley) 6/2/87
# @(#)Makefile 5.3 (Berkeley) 6/2/87
#
CFLAGS= -O
LIBC= /lib/libc.a
Expand Down Expand Up @@ -44,8 +44,7 @@ FRC:
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

access.o: access.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
access.o: /usr/include/signal.h /usr/include/machine/trap.h
access.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
access.o: /usr/include/signal.h /usr/include/machine/machparam.h
access.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
access.o: /usr/include/machine/pte.h /usr/include/sys/user.h
access.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -57,8 +56,7 @@ access.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
access.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
access.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
command.o: command.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
command.o: /usr/include/signal.h /usr/include/machine/trap.h
command.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
command.o: /usr/include/signal.h /usr/include/machine/machparam.h
command.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
command.o: /usr/include/machine/pte.h /usr/include/sys/user.h
command.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -70,8 +68,7 @@ command.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
command.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
command.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
expr.o: expr.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
expr.o: /usr/include/signal.h /usr/include/machine/trap.h
expr.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
expr.o: /usr/include/signal.h /usr/include/machine/machparam.h
expr.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
expr.o: /usr/include/machine/pte.h /usr/include/sys/user.h
expr.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -82,8 +79,7 @@ expr.o: mode.h machine.h /usr/include/sys/vm.h /usr/include/sys/vmparam.h
expr.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
expr.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
format.o: format.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
format.o: /usr/include/signal.h /usr/include/machine/trap.h
format.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
format.o: /usr/include/signal.h /usr/include/machine/machparam.h
format.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
format.o: /usr/include/machine/pte.h /usr/include/sys/user.h
format.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -95,8 +91,7 @@ format.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
format.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
format.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
input.o: input.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
input.o: /usr/include/signal.h /usr/include/machine/trap.h
input.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
input.o: /usr/include/signal.h /usr/include/machine/machparam.h
input.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
input.o: /usr/include/machine/pte.h /usr/include/sys/user.h
input.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -108,8 +103,7 @@ input.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
input.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
input.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
main.o: main.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
main.o: /usr/include/signal.h /usr/include/machine/trap.h
main.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
main.o: /usr/include/signal.h /usr/include/machine/machparam.h
main.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
main.o: /usr/include/machine/pte.h /usr/include/sys/user.h
main.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -124,8 +118,7 @@ message.o: /usr/include/sys/vmparam.h /usr/include/machine/vmparam.h
message.o: /usr/include/sys/vmmac.h /usr/include/sys/vmmeter.h
message.o: /usr/include/sys/vmsystm.h
opset.o: opset.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
opset.o: /usr/include/signal.h /usr/include/machine/trap.h
opset.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
opset.o: /usr/include/signal.h /usr/include/machine/machparam.h
opset.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
opset.o: /usr/include/machine/pte.h /usr/include/sys/user.h
opset.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -137,8 +130,7 @@ opset.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
opset.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
opset.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h optab.h
optab.o: optab.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
optab.o: /usr/include/signal.h /usr/include/machine/trap.h
optab.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
optab.o: /usr/include/signal.h /usr/include/machine/machparam.h
optab.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
optab.o: /usr/include/machine/pte.h /usr/include/sys/user.h
optab.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -151,8 +143,7 @@ optab.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
optab.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h optab.h
optab.o: instrs
output.o: output.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
output.o: /usr/include/signal.h /usr/include/machine/trap.h
output.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
output.o: /usr/include/signal.h /usr/include/machine/machparam.h
output.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
output.o: /usr/include/machine/pte.h /usr/include/sys/user.h
output.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -164,8 +155,7 @@ output.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
output.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
output.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
pcs.o: pcs.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
pcs.o: /usr/include/signal.h /usr/include/machine/trap.h
pcs.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
pcs.o: /usr/include/signal.h /usr/include/machine/machparam.h
pcs.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
pcs.o: /usr/include/machine/pte.h /usr/include/sys/user.h
pcs.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -176,8 +166,7 @@ pcs.o: mode.h machine.h /usr/include/sys/vm.h /usr/include/sys/vmparam.h
pcs.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
pcs.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
print.o: print.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
print.o: /usr/include/signal.h /usr/include/machine/trap.h
print.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
print.o: /usr/include/signal.h /usr/include/machine/machparam.h
print.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
print.o: /usr/include/machine/pte.h /usr/include/sys/user.h
print.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -189,8 +178,7 @@ print.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
print.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
print.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
runpcs.o: runpcs.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
runpcs.o: /usr/include/signal.h /usr/include/machine/trap.h
runpcs.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
runpcs.o: /usr/include/signal.h /usr/include/machine/machparam.h
runpcs.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
runpcs.o: /usr/include/machine/pte.h /usr/include/sys/user.h
runpcs.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -202,8 +190,7 @@ runpcs.o: /usr/include/sys/vm.h /usr/include/sys/vmparam.h
runpcs.o: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
runpcs.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
setup.o: setup.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
setup.o: /usr/include/signal.h /usr/include/machine/trap.h
setup.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
setup.o: /usr/include/signal.h /usr/include/machine/machparam.h
setup.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
setup.o: /usr/include/machine/pte.h /usr/include/sys/user.h
setup.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand All @@ -217,8 +204,7 @@ setup.o: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h head.h
setup.o: /usr/include/frame.h /usr/include/ctype.h /usr/include/sys/stat.h
setup.o: /usr/include/sys/file.h /usr/include/machine/rpb.h
sym.o: sym.c defs.h /usr/include/sys/param.h /usr/include/sys/types.h
sym.o: /usr/include/signal.h /usr/include/machine/trap.h
sym.o: /usr/include/machine/machparam.h /usr/include/machine/endian.h
sym.o: /usr/include/signal.h /usr/include/machine/machparam.h
sym.o: /usr/include/sys/dir.h /usr/include/machine/psl.h
sym.o: /usr/include/machine/pte.h /usr/include/sys/user.h
sym.o: /usr/include/machine/pcb.h /usr/include/sys/dmap.h
Expand Down
2 changes: 1 addition & 1 deletion bin/adb/adb.tahoe/format.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static char sccsid[] = "@(#)format.c 1.4 (Berkeley) 4/1/87";
static char sccsid[] = "@(#)format.c 1.6 (Berkeley) 6/9/99";
#endif
/*
*
Expand Down
9 changes: 7 additions & 2 deletions bin/adb/adb.tahoe/instrs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/* %WW% (Berkeley) 11/20/86 */
/* Copyright(c) 1980 Regents of the University of California */
/*
* Copyright (c) 1980 The Regents of the University of California
* All rights reserved.
*
* @(#)instrs 1.1 (Berkeley) 11/20/86
*/

OP("adda",0x8e,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0),
OP("addb2",0x08,2,ACCR+TYPB,ACCM+TYPB,0,0,0,0),
OP("addb3",0x18,3,ACCR+TYPB,ACCR+TYPB,ACCW+TYPB,0,0,0),
Expand Down
4 changes: 2 additions & 2 deletions bin/adb/adb.vax/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# @(#)Makefile 4.7 (Berkeley) 6/5/87
# @(#)Makefile 5.1 (Berkeley) 6/5/87
#
LIBC= /lib/libc.a
DFLAGS= -DADB
Expand All @@ -30,7 +30,7 @@ optab.o: instrs.adb
${CC} ${CFLAGS} -c -R -I. -I${AS} optab.c

instrs.adb: ${AS}/instrs
{echo FLAVOR ADB; cat ${AS}/instrs) | awk -f ${AS}/instrs > instrs.adb
(echo FLAVOR ADB; cat ${AS}/instrs) | awk -f ${AS}/instrs > instrs.adb

clean: FRC
rm -f ${OBJS} core adb
Expand Down
10 changes: 5 additions & 5 deletions bin/adb/adb.vax/format.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static char sccsid[] = "@(#)format.c 4.5 4/24/88";
static char sccsid[] = "@(#)format.c 4.6 7/18/88";
#endif
/*
*
Expand Down Expand Up @@ -227,16 +227,16 @@ STRING ifp;
* fw.sa = wx;
*/
(*(struct bad_programming *)&fw).sa = wx;
IF (wx & ~0xFFFF00FF) == 0x8000
THEN printf("(reserved oprnd)");
IF (wx & ~0xFFFF007F) == 0x8000
THEN printf("(reserved operand)");
ELSE printf("%-16.9f", fw);
FI
dotinc=4; break;

case 'F':
(*(struct bad_programming *)&fw).sa = wx;
IF (wx & ~0xFFFF00FF) == 0x8000
THEN printf("%-32s", "(reserved oprnd)");
IF (wx & ~0xFFFF007F) == 0x8000
THEN printf("%-32s", "(reserved operand)");
ELSE printf("%-32.18F", fw);
FI
dotinc=8; break;
Expand Down
8 changes: 7 additions & 1 deletion bin/adb/adb.vax/opset.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static char sccsid[] = "@(#)opset.c 4.6 1/10/88";
static char sccsid[] = "@(#)opset.c 4.7 7/18/88";
#endif /* lint */
/*
* UNIX debugger
Expand Down Expand Up @@ -475,9 +475,15 @@ bignumprint(nbytes, optype)
valuep = snarf(nbytes);
switch(A_TYPEXT(optype)){
case TYPF:
if ((valuep->num_num.numFf_float.Ff_ushort[0] & 0xff80) == 0x8000) {
printf("0f::"); goto qprint;
}
printf("0f%f", valuep->num_num.numFf_float.Ff_value);
break;
case TYPD:
if ((valuep->num_num.numFd_float.Fd_ushort[0] & 0xff80) == 0x8000) {
printf("0d::"); goto qprint;
}
printf("0d%f", valuep->num_num.numFd_float.Fd_value);
break;
case TYPG:
Expand Down
2 changes: 1 addition & 1 deletion bin/as/as.tahoe/asparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 1982 Regents of the University of California
*/
#ifndef lint
static char sccsid[] = "$W$ (Berkeley) 5/31/88";
static char sccsid[] = "@(#)asparse.c 1.7 (Berkeley) 6/10/99";
#endif not lint

#include <stdio.h>
Expand Down
11 changes: 11 additions & 0 deletions bin/awk/test/Compare
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
for i
do
echo $i:
awk -f $i foo >junk1
a.out -f $i foo >junk2
if cmp -s junk1 junk2
then echo $i: good
else echo $i: BAD
fi
diff -b junk1 junk2 | ind
done
1 change: 1 addition & 0 deletions bin/awk/test/t.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{i = i+1; print i, NR}
1 change: 1 addition & 0 deletions bin/awk/test/t.1.x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{i="count" $1 $2; print i , $0}
1 change: 1 addition & 0 deletions bin/awk/test/t.2.x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{i=2; j=$3; $1=i;print i,j,$1}
1 change: 1 addition & 0 deletions bin/awk/test/t.3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$1 == "5" || $1 == "4"
7 changes: 7 additions & 0 deletions bin/awk/test/t.3.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
x = $1
while (x > 1) {
print x
x = x / 10
}
}
1 change: 1 addition & 0 deletions bin/awk/test/t.4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$1 ~ /5/ || $1 ~ /4/
1 change: 1 addition & 0 deletions bin/awk/test/t.4.x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{i=$(1); print i}
1 change: 1 addition & 0 deletions bin/awk/test/t.5.x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{$(1) = "xxx"; print $1,$0}
8 changes: 8 additions & 0 deletions bin/awk/test/t.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/a|b|c/ {
i = $1
print
while (i >= 1) {
print " ", i
i = i / 10
}
}
1 change: 1 addition & 0 deletions bin/awk/test/t.6.x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{print NF,$0}
5 changes: 5 additions & 0 deletions bin/awk/test/t.6a
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/a|b|c/ {
print
for (i = $1; i >= 1; )
print " ", i /= 10
}
5 changes: 5 additions & 0 deletions bin/awk/test/t.6b
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/a|b|c/ {
print
for (i = $1; (i /= 10)>= 1; )
print " ", i
}
1 change: 1 addition & 0 deletions bin/awk/test/t.8.x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{$2=$1; print}
6 changes: 6 additions & 0 deletions bin/awk/test/t.a
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{if (amount[$2] "" == "") item[num++] = $2;
amount[$2] += $1
}
END {for (i=0; i<num; i++)
print item[i], amount[item[i]]
}
1 change: 1 addition & 0 deletions bin/awk/test/t.aeiou
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/^[^aeiouy]*[aeiou][^aeiouy][aeiouy][aeiouy]*[^aeiouy]*$/
1 change: 1 addition & 0 deletions bin/awk/test/t.aeiouy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/^[^aeiouy]*a[^aeiouy]*e[^aeiouy]*i[^aeiouy]*o[^aeiouy]*u[^aeiouy]*y[^aeiouy]*$/
1 change: 1 addition & 0 deletions bin/awk/test/t.arith
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ print $1, $1+$1, $1-$1, $1 * $1, $1/$1, $1 % NR }
13 changes: 13 additions & 0 deletions bin/awk/test/t.array
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ x[NR] = $0 }

END {
i = 1
while (i <= NR) {
print x[i]
split (x[i], y)
usage = y[1]
name = y[2]
print " ", name, usage
i++
}
}
10 changes: 10 additions & 0 deletions bin/awk/test/t.array1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{for(i=1; i<=NF; i++) {
if (x[$i] == "")
y[n++] = $i
x[$i]++
}
}
END {
for (i=0; i<n; i++)
print (y[i], x[y[i]])
}
4 changes: 4 additions & 0 deletions bin/awk/test/t.array2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$2 ~ /^[a-l]/ { x["a"] = x["a"] + 1 }
$2 ~ /^[m-z]/ { x["m"] = x["m"] + 1 }
$2 !~ /^[a-z]/ { x["other"] = x["other"] + 1 }
END { print NR, x["a"], x["m"], x["other"] }
5 changes: 5 additions & 0 deletions bin/awk/test/t.avg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{s = s + $1; c = c + 1}
END {
print "sum=", s, " count=", c
print "avg=", s/c
}
1 change: 1 addition & 0 deletions bin/awk/test/t.b.x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{$6=":::" ; print $6; print NF, $0}
2 changes: 2 additions & 0 deletions bin/awk/test/t.be
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BEGIN { print FILENAME }
END { print NR }
7 changes: 7 additions & 0 deletions bin/awk/test/t.break
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
for (i=1; i <= NF; i++)
if ($i ~ /^[a-z]+$/) {
print $i " is alphabetic"
break
}
}
Loading

0 comments on commit e20d687

Please sign in to comment.