qse/regress/awk/lang-017.awk

42 lines
437 B
Awk
Raw Normal View History

2007-12-07 23:58:44 +00:00
2007-12-08 00:24:28 +00:00
function error() { exit (200); }
2007-12-08 00:24:28 +00:00
function getx()
{
if (x == 2) error();
return x++;
}
2007-12-07 23:58:44 +00:00
2007-12-08 00:24:28 +00:00
function gety() { return y++; }
2007-12-07 23:58:44 +00:00
2007-12-08 00:24:28 +00:00
function main() {
x = 0;
y = 0;
2007-12-08 00:24:28 +00:00
print getx() + gety();
print getx() + gety();
print getx() + gety();
print getx() + gety();
2007-12-07 23:58:44 +00:00
2007-12-08 00:24:28 +00:00
return 999;
}
2007-12-07 23:58:44 +00:00
BEGIN {
main ();
}
2007-12-07 23:58:44 +00:00
2007-12-08 00:24:28 +00:00
END {
print "END OF PROGRAM";
return 10;
}
2007-12-07 23:58:44 +00:00
2007-12-08 00:24:28 +00:00
END {
print "END OF PROGRAM 2";
exit (100);
}
2007-12-07 23:58:44 +00:00
2007-12-08 00:24:28 +00:00
END {
print "END OF PROGRAM 3";
exit (900);
}