#include <stdio.h>
#include "emp.h"
#include "ship.h"
FILE *fopen(), *fdsec, *fdship;
struct sector s;
struct shpstr Ship;
extern char Stype[], Cenflags[];
extern char Rscan[MAXSCN][2*MAXSCN], Raddes[];
extern int Nrows, Xrad, Yrad, Rngrad;
int Radflag;
int Maphdr = 0;
int Mapx, Mapy, Maplcol, Maptens;
int Colno = 0;
int Line = 0;
int Debug = 0;
int loo_corm[2], i, n;
int Xfly, Yfly;
main(argc, argv)
int argc;
char **argv;
{
extern FILE *fopen(), *fdsec;
extern int yydebug, Debug;
extern struct sector s;
extern int optind;
extern char *optarg;
int c, x, y, n;
int pflg, errflg;
if( (fdsec=fopen("empsect","r+")) == NULL ) {
fprintf(stderr,"Can't open empsect\n");
exit(1);
}
if( (fdship=fopen("empship","r+")) == NULL ) {
fprintf(stderr,"Can't open empship\n");
}
while(( c = getopt(argc, argv, "pd")) != EOF ) {
switch( c ) {
case 'p':
pflg++;
break;
case 'd':
Debug++;
break;
case '?':
errflg++;
}
if( errflg ) {
fprintf(stderr, "Usage: %s [-p]\n", argv[0] );
exit(2);
}
if( pflg ) {
fprintf(stderr, "Purging world\n");
for( y = 0; y < XYMAX; y++ ) {
for( x = 0; x < XYMAX; x++ ) {
getsec(&s, (n = secno(x, y)));
if( s.s_coun == 0 &&
s.s_des != '.' && s.s_des != ' ' &&
s.s_des != '\0' &&
(s.s_rsrc[CIV]>0 || s.s_rsrc[MIL]>0)){
s.s_coun = 98;
putsec(&s, n);
}
}
}
fprintf(stderr, "World purged\n");
exit(0);
}
}
yyparse();
}
%}
%token EOL SECTLET SECTNLET ANYCHAR
%token NUM CMD EX
%token SPY DPRTD
%token SHIP SECT
%token STPD SUB AT
%token EFF WITH APPRX CIVTKN MILTKN
%token SHLTKN GUNTKN PLNTKN ORETKN BARTKN
%token DLVR FROM TO THRSH
%token YOUR UNOWN
%token BAROM RANGE RADAR
%token CMSGPOB CENFLGS SECTORS
%token NWOVR FLYOVR CMPRTLY CNSTRCTD
%token MAPHDR
%start session
%%
session : cmdout
| session cmdout
;
cmdout : cprompt
| EOL
| cenout
| mapout
| ship_rec
| nav_rec
| nav_info
| loo_rec
| radout
| del_rec
| spy_rec
| fly_rec
| error EOL
{
if( Debug ) {
printf("%dp\n", Line);
}
}
;
cprompt : '[' NUM ':' NUM ']' cmd_or_ex ':'
{printf("[%d:%d]\n", $2, $4);
}
;
cmd_or_ex : CMD
| EX
;
cenout : error CMSGPOB
error EOL
cen_recs NUM SECTORS EOL
{ printf("%d sectors\n", $6); }
;
cen_recs : cen_rec
| cen_recs cen_rec
;
cen_rec : error EOL
| NUM ',' NUM CENFLGS SECT NUM '%'
NUM NUM NUM NUM NUM NUM NUM NUM NUM NUM NUM EOL
{
getsec(&s, (n = secno($1, $3)));
s.s_coun = 0;
s.s_ckpt = Cenflags[0];
for( i = 0; i <= 6; i++ ) {
setdel(Cenflags[i+1], &s.s_del[i]);
}
s.s_def = Cenflags[8];
s.s_des = $5;
s.s_eff = $6;
s.s_min = $8;
s.s_gold = $9;
s.s_mob = $10;
s.s_rsrc[0] = $11;
s.s_rsrc[1] = $12;
s.s_rsrc[2] = $13;
s.s_rsrc[3] = $14;
s.s_rsrc[4] = $15;
s.s_rsrc[5] = $16;
s.s_rsrc[6] = $17;
s.s_prod = $18;
putsec(&s, n);
}
;
mapout : MAPHDR EOL MAPHDR EOL map_recs MAPHDR EOL MAPHDR EOL
;
map_recs : map_rec
| map_recs map_rec
;
map_rec : NUM
{ Mapy = $1; }
map_chars NUM EOL
| NUM NUM EOL
;
map_chars : map_char
{ if( Colno < 6 || Colno > Maplcol ) YYERROR;
if( Colno%2 != 0 ) YYERROR;
domap(Mapx, Mapy, Colno, (char)$1);
}
| map_chars map_char
{ if( Colno < 6 || Colno > Maplcol ) YYERROR;
if( Colno%2 != 0 ) YYERROR;
domap(Mapx, Mapy, Colno, (char)$2);
}
;
map_char : SECTLET
| SECTNLET
| '#'
{ $$ = (int)'#'; }
| ')'
{ $$ = (int)')'; }
| '.'
{ $$ = (int)'.'; }
;
ship_rec : NUM SHIP NUM ',' NUM ship_fleet NUM '%'
{ if( $4 != 20 || $8 != 30 ) YYERROR;
}
NUM NUM NUM NUM NUM NUM NUM EOL
{ Ship.shp_type = $2;
Ship.shp_own = 0;
Ship.shp_xp = $3;
Ship.shp_yp = $5;
Ship.shp_fleet= $6;
Ship.shp_effc = $7;
Ship.shp_crew = $10;
Ship.shp_shels= $11;
Ship.shp_gun = $12;
Ship.shp_plns = $13;
Ship.shp_or = $14;
Ship.shp_gld = $15;
Ship.shp_mbl = $16;
putship(&Ship, $1);
}
;
ship_fleet : SECTLET
| ANYCHAR
|
{ $$ = ' '; }
;
nav_rec : SHIP '#' NUM STPD AT NUM ',' NUM EOL
{ printf("Ship %d stopped at %3d,%-3d\n",
$3, $6, $8);
if( getship(&Ship, $3) == ERROR ) {
Ship.shp_fleet = ' ';
Ship.shp_crew = 0;
Ship.shp_shels = Ship.shp_gun = 0;
Ship.shp_plns = Ship.shp_or = 0;
Ship.shp_gld = Ship.shp_mbl = 0;
Ship.shp_effc = 100;
}
Ship.shp_own = 0;
Ship.shp_xp = $6;
Ship.shp_yp = $8;
putship(&Ship, $3);
}
;
nav_info : '<' NUM '.' NUM ':' NUM '.' NUM ':' NUM ',' NUM '>'
;
loo_rec : loo_count SHIP '#' NUM '@' NUM ',' NUM EOL
{ if( getship(&Ship, $4) == ERROR ) {
Ship.shp_fleet = ' ';
Ship.shp_crew = 0;
Ship.shp_shels = Ship.shp_gun = 0;
Ship.shp_plns = Ship.shp_or = 0;
Ship.shp_gld = Ship.shp_mbl = 0;
}
Ship.shp_effc = 100;
Ship.shp_own = $1;
Ship.shp_type = $2;
Ship.shp_xp = $6;
Ship.shp_yp = $8;
putship(&Ship, $4);
}
| SUB AT NUM ',' NUM EOL
{ printf("Sub at %3d,%-3d\n", $3, $5);
}
| loo_count SECT NUM '%' EFF
{ loo_corm[0] = -1;
loo_corm[1] = -1;
}
loo_cntnt '@' NUM ',' NUM EOL
{
if( $1 != 0 ) {
getsec(&s, (n = secno($9, $11)));
s.s_coun = $1;
s.s_des = $2;
s.s_eff = $3 * 2;
if( loo_corm[0] > 0 ) {
s.s_rsrc[CIV]=loo_corm[0];
if( s.s_des == 'u' ) {
s.s_rsrc[CIV] *= 10;
}
}
if( loo_corm[1] > 0 ) {
s.s_rsrc[MIL]=loo_corm[1];
}
putsec(&s, n);
}
}
;
loo_count : UNOWN
{ $$ = 99 ; }
| YOUR
{ $$ = 0; }
| error '(' '#' NUM ')'
{ $$ = $4; }
;
loo_cntnt :
| WITH NUM loo_rsrc
{ loo_corm[$3] = $2; }
| WITH APPRX NUM loo_rsrc
{ loo_corm[$4] = $3 * 2; }
| WITH NUM loo_rsrc '&' NUM loo_rsrc
{
loo_corm[$3] = $2;
loo_corm[$6] = $5;
}
| WITH APPRX NUM loo_rsrc WITH APPRX NUM loo_rsrc
{
loo_corm[$4] = $3 * 2;
loo_corm[$8] = $7 * 2;
}
;
loo_rsrc : CIVTKN
{ $$ = 0; }
| MILTKN
{ $$ = 1; }
;
radout : rad_source NUM ',' NUM EOL
{
Xrad = $2;
Yrad = $4;
}
EFF NUM '%' ',' BAROM AT NUM ','
RANGE NUM '.'
{
Rngrad = $16;
Radflag = 1;
Nrows = 0;
}
NUM EOL
;
rad_source : RADAR AT
| SHIP NUM AT
;
del_rec : DLVR del_rsrc FROM SECT '@' NUM ',' NUM
TO NUM ',' NUM del_thrsh EOL
{
i = $13/8;
getsec(&s, (n = secno($6, $8)));
if( $4 == 'u' && $2 == CIV ) i /= 10;
if( $4 == 'b' && $2 == BAR ) i /= 4;
if( $4 == 'w' && ($2==SHL || $2==GUN ||
$2==ORE) ) i /= 10;
s.s_del[$2] &= 017;
s.s_del[$2] |= (i & 017) << 4;
putsec(&s, n);
}
;
del_rsrc : CIVTKN
| MILTKN
| SHLTKN
| GUNTKN
| PLNTKN
| ORETKN
| BARTKN
;
del_thrsh :
{ $$ = 0; }
| '(' THRSH NUM ')'
{ $$ = $3; }
;
spy_rec : NUM ',' NUM NUM spy_sect NUM '%'
{
if( $2 != 4 || $7 != 17 ) YYERROR;
}
NUM NUM NUM NUM NUM NUM EOL
{
getsec(&s, (n = secno($1, $3)));
s.s_coun = ($4==0 ? 99 : $4);
s.s_des = (char)$5;
s.s_eff = 2 * $6;
s.s_rsrc[CIV] = 2 * $9;
s.s_rsrc[MIL] = 2 * $10;
s.s_rsrc[SHL] = 2 * $11;
s.s_rsrc[GUN] = 2 * $12;
s.s_rsrc[ORE] = 2 * $13;
s.s_rsrc[PLN] = 2 * $14;
putsec(&s, n);
}
| SPY DPRTD FROM NUM ',' NUM '.' EOL
{
getsec(&s, (n = secno($4, $6)));
if( s.s_coun == 0 ) {
s.s_coun = 98;
putsec(&s, n);
}
}
;
spy_sect : SECTLET
| SECTNLET
| '#'
{ $$ = (int)'#'; }
| ')'
{ $$ = (int)')'; }
;
fly_rec : fly_info fly_rec
| fly_info NWOVR CMPRTLY CNSTRCTD SECT '.' EOL
{
getsec(&s, n = secno(Xfly, Yfly));
s.s_des = $5;
putsec(&s, n);
}
| fly_info FLYOVR SECT '.' EOL
{
getsec(&s, n = secno(Xfly, Yfly));
s.s_des = $3;
putsec(&s, n);
}
;
fly_info : '<' NUM '.' NUM ':' NUM ':' NUM ':' NUM ',' NUM '>'
{
Xfly = $10;
Yfly = $12;
}
;
%%
#include "lex.yy.c"
yyerror(s)
char *s;
{
}
@//E*O*F ./EUPD/eupd.y//
chmod u=rw,g=r,o=r ./EUPD/eupd.y
echo x - ./EUPD/Makefile
sed 's/^@//' > "./EUPD/Makefile" <<'@//E*O*F ./EUPD/Makefile//'
CFLAGS = -c
HDRDIR=../hdrs
INSDIR=..
LIBDIR=../_unix.O
GENLIB=$(LIBDIR)/genlib.a
UPDLIB=$(LIBDIR)/updlib.a
eupd: $(INSDIR)/eupd
$(INSDIR)/eupd: _unix.O/y.tab.o $(UPDLIB) $(GENLIB)
$(CC) -o $@ _unix.O/y.tab.o $(UPDLIB) $(GENLIB) -ll
_unix.O/y.tab.o: y.tab.c lex.yy.c $(HDRDIR)/emp.h $(HDRDIR)/ship.h
$(CC) $(CFLAGS) -I$(HDRDIR) y.tab.c
@mv y.tab.o $@
y.tab.c: eupd.y
yacc eupd.y
lex.yy.c: eupd.l
lex -n eupd.l
clean:
rm -f lex.yy.c y.tab.c _unix.O/y.tab.o
clobber: clean
rm -f $(INSDIR)/eupd
@//E*O*F ./EUPD/Makefile//
chmod u=rw,g=r,o=r ./EUPD/Makefile
echo mkdir - ./EUPD/_unix.O
mkdir ./EUPD/_unix.O
chmod u=rwx,g=rx,o=rx ./EUPD/_unix.O
echo x - ./EUPD/_unix.O/y.tab.o
sed 's/^@//' > "./EUPD/_unix.O/y.tab.o" <<'@//E*O*F ./EUPD/_unix.O/y.tab.o//'
@//E*O*F ./EUPD/_unix.O/y.tab.o//
chmod u=rw,g=r,o=r ./EUPD/_unix.O/y.tab.o
echo x - ./EUPD/eupd.l
sed 's/^@//' > "./EUPD/eupd.l" <<'@//E*O*F ./EUPD/eupd.l//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
RADDES [-.^cudg*ihamwtfr+#)=!bxs? BCDFMPST/]
SECTDES [-.^cudg*ihamwtfr+#)=!bxs]
%{
#define SMAXNO 24
char *Sect[] = { "se", "mo", "sa", "wi", "ca", "ur", "de",
"sh", "mi", "go", "ha", "wa", "ai",
"ag", "te", "fo", "re", "hi", "ra",
"we", "br", "br", "ba", "ex"
};
char Sectchar[] = { '.', '^', 's', '-', 'c', 'u', 'd',
'i', 'm', 'g', 'h', 'w', '*',
'a', 't', 'f', 'r', '+', ')',
'!', '#', '=', 'b', 'x'
};
char Cenflags[16];
extern int Maphdr, Maptens, Maplcol, Mapx;
extern int Colno, Line;
extern int Nrows, Radflag;
extern char Stype[];
int j;
%}
%p 3000
%Start RAD CEN MAP
%%
cmsgpob {
Colno += yyleng;
BEGIN CEN;
return(CMSGPOB);
}
<CEN>("*"|" ")[$.0-7]+("%"|" ") {
if( Colno != 7 ) REJECT;
if( yyleng != 9 ) REJECT;
strncpy(Cenflags, yytext, 9);
Colno += yyleng;
return(CENFLGS);
}
<CEN>" "{SECTDES}" " {
if( Colno != 16 ) REJECT;
Colno += yyleng;
yylval = (int)yytext[1];
return(SECT);
}
<CEN>" sector"s? {
Colno += yyleng;
BEGIN 0;
return(SECTORS);
}
<RAD>^({RADDES}[ /])+{RADDES} {
strncpy(Rscan[Nrows++], yytext, MAXSCN*2);
Colno += yyleng;
}
<RAD>. {
Radflag = 0;
if( Nrows ) dorad();
BEGIN 0;
REJECT;
}
<MAP>^" "[-0-9](" "[-0-9])+ {
if( yyleng < 8 ) REJECT;
Maphdr++;
if( Maphdr == 4 ) {
Maphdr = 0;
BEGIN 0;
return(MAPHDR);
}
if( Maphdr == 2 ) {
Mapx = yytext[5] - '0'; /* units part first */
j = Mapx - yytext[7] + '0'; /* check sign */
Mapx += Maptens * 10; /* now add in tens */
if( j == 1 || j == -9 ) Mapx = -Mapx;
Maplcol = yyleng;
}
return(MAPHDR);
}
" "[-0-9](" "[-0-9])+ {
if( Maphdr != 0 || yyleng < 8 ) REJECT;
if( yytext[5] == '-' ) {
Maptens = 0;
} else {
Maptens = yytext[5] - '0';
}
Maphdr = 1;
BEGIN MAP;
return(MAPHDR);
}
"rad"a?r? {
Colno += yyleng;
return(RADAR);
}
"Efficiency" {
Colno += yyleng;
return(EFF);
}
"barometer" {
Colno += yyleng;
return(BAROM);
}
"max range" {
Colno += yyleng;
return(RANGE);
}
"Command" {
Colno += 7;
BEGIN 0;
return(CMD);
}
"Execute" {
Colno += 7;
BEGIN 0;
return(EX);
}
"Spy" {
Colno += yyleng;
return(SPY);
}
"deported" {
Colno += yyleng;
return(DPRTD);
}
(pt" "b|mines|destr|subma|freig|tende|battl|carri)[^ ]* {
Colno += yyleng;
for( j=0; i<=TMAXNO; j++ ) {
if( yytext[0] == Stype[j] ) break;
}
yylval = j;
return(SHIP);
}
"stopped" {
Colno += yyleng;
return(STPD);
}
"Snorkel" {
Colno += yyleng;
return(SUB);
}
Your {
Colno += yyleng;
return(YOUR);
}
Unowned {
Colno += yyleng;
return(UNOWN);
}
eff {
Colno += yyleng;
return(EFF);
}
with {
Colno += yyleng;
return(WITH);
}
approx"." {
Colno += yyleng;
return(APPRX);
}
Deliver {
Colno += yyleng;
return(DLVR);
}
"from " {
Colno += yyleng;
return(FROM);
}
" to " {
Colno += yyleng;
return(TO);
}
thresh {
Colno += yyleng;
return(THRSH);
}
"Now over" {
Colno += yyleng;
return(NWOVR);
}
"Flying over" {
Colno += yyleng;
return(FLYOVR);
}
(completely|partially|minimally) {
Colno += yyleng;
return(CMPRTLY);
}
constructed {
Colno += yyleng;
return(CNSTRCTD);
}
civilians {
Colno += yyleng;
yylval = CIV;
return(CIVTKN);
}
(troops|military) {
Colno += yyleng;
yylval = MIL;
return(MILTKN);
}
shells {
Colno += yyleng;
yylval = SHL;
return(SHLTKN);
}
guns {
Colno += yyleng;
yylval = GUN;
return(GUNTKN);
}
planes {
Colno += yyleng;
yylval = PLN;
return(PLNTKN);
}
" ore " {
Colno += yyleng;
yylval = ORE;
return(ORETKN);
}
"bars of gold" {
Colno += yyleng;
yylval = BAR;
return(BARTKN);
}
(sea|mount|sanct|wilde|capit|urban" "a|defense" "p)[a-z]* {
Colno += yyleng;
yylval = schar(yytext);
return(SECT);
}
(shell" "i|mine|gold" "m|harb|ware|airf|agri)[a-z]* {
Colno += yyleng;
yylval = schar(yytext);
return(SECT);
}
(technical" "c|fortr|research" "l|high|radar" "i)[a-z]* {
Colno += yyleng;
yylval = schar(yytext);
return(SECT);
}
(weather" "s|bridge" "h|bridge" "s|bank|exch)[a-z]* {
Colno += yyleng;
yylval = schar(yytext);
return(SECT);
}
-?[0-9]+ {
Colno += yyleng;
yylval = atoi(yytext);
return(NUM);
}
" at" {
Colno += yyleng;
return(AT);
}
[ \t] Colno++;
\n {
Colno = 0;
Line++;
if( Radflag ) {
BEGIN RAD;
}
return(EOL);
}
([:,%#.@<>()&]|"["|"]") {
Colno++;
yylval = Colno;
return((int)*yytext);
}
[abcdfghimrstuwx] {
Colno++;
yylval = (int)*yytext;
return(SECTLET);
}
[-!=^*+?] {
Colno++;
yylval = (int)*yytext;
return(SECTNLET);
}
@. {
Colno++;
yylval = Colno;
return(ANYCHAR);
}
%%
schar(s)
char *s;
{
extern char *Sect[], Sectchar[];
int i;
for( i=0; i<SMAXNO; i++ ) {
if( strncmp( s, Sect[i], 2) == 0 ) break;
}
/*
Adjust for bridge span
*/
if( Sectchar[i] == '#' && s[7] == 's' ) i++;
return( (int)Sectchar[i] );
}
@//E*O*F ./EUPD/eupd.l//
chmod u=rw,g=r,o=r ./EUPD/eupd.l
echo mkdir - ./GENLIB
mkdir ./GENLIB
chmod u=rwx,g=rx,o=rx ./GENLIB
echo x - ./GENLIB/Makefile
sed 's/^@//' > "./GENLIB/Makefile" <<'@//E*O*F ./GENLIB/Makefile//'
CFLAGS= -c -O
HDRDIR =../hdrs
INSDIR=../_unix.O
LIB=$(INSDIR)/genlib.a
$(LIB): \
$(LIB)(getopt.o) \
$(LIB)(strchr.o) \
$(LIB)(strspn.o) \
$(LIB)(secno.o) \
$(LIB)(getsec.o) \
$(LIB)(getship.o)
$(CC) $(CFLAGS) -I$(HDRDIR) $(?:.o=.c)
@ar r $(LIB) *.o
@rm -f *.o
@echo $@ is now up to date
@.c.a:;
$(LIB)(secno.o): $(HDRDIR)/emp.h
$(LIB)(getsec.o): $(HDRDIR)/emp.h
$(LIB)(getship.o): $(HDRDIR)/emp.h $(HDRDIR)/ship.h
clean:
clobber:
rm -f $(LIB)
@.PRECIOUS: $(LIB)
@//E*O*F ./GENLIB/Makefile//
chmod u=rw,g=r,o=r ./GENLIB/Makefile
echo x - ./GENLIB/secno.c
sed 's/^@//' > "./GENLIB/secno.c" <<'@//E*O*F ./GENLIB/secno.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include "emp.h"
secno(x, y)
int x, y;
{
return((x + XYMAX) % XYMAX + ((y + XYMAX) % XYMAX) * XYMAX);
}
@//E*O*F ./GENLIB/secno.c//
chmod u=rw,g=r,o=r ./GENLIB/secno.c
echo x - ./GENLIB/getsec.c
sed 's/^@//' > "./GENLIB/getsec.c" <<'@//E*O*F ./GENLIB/getsec.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include <stdio.h>
#include "emp.h"
extern FILE *fdsec;
getsec(buf, n)
struct sector *buf;
int n;
{
if( fseek(fdsec, ((long)n)*sizeof(struct sector), 0) != 0 ) return(ERROR);
if( fread(buf, sizeof(struct sector), 1, fdsec) != 1) return(ERROR);
}
putsec(buf, n)
struct sector *buf;
int n;
{
if( fseek(fdsec, ((long)n)*sizeof(struct sector), 0) != 0 ) return(ERROR);
if( fwrite(buf, sizeof(struct sector), 1, fdsec) != 1 ) return(ERROR);
}
@//E*O*F ./GENLIB/getsec.c//
chmod u=rw,g=r,o=r ./GENLIB/getsec.c
echo x - ./GENLIB/getship.c
sed 's/^@//' > "./GENLIB/getship.c" <<'@//E*O*F ./GENLIB/getship.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include <stdio.h>
#include "emp.h"
#include "ship.h"
extern FILE *fdship;
getship(buf, num)
struct shpstr *buf;
int num;
{
if( fseek(fdship, ((long)num)*sizeof(struct shpstr), 0 ) != 0 ) return(ERROR);
if( fread(buf, sizeof(struct shpstr), 1, fdship) != 1 ) return(ERROR);
return(OK);
}
putship(buf, num)
struct shpstr *buf;
int num;
{
if( fseek(fdship, ((long)num)*sizeof(struct shpstr), 0 ) != 0 ) return(ERROR);
if( fwrite(buf, sizeof(struct shpstr), 1, fdship) != 1 ) return(ERROR);
return(OK);
}
@//E*O*F ./GENLIB/getship.c//
chmod u=rw,g=r,o=r ./GENLIB/getship.c
echo x - ./GENLIB/getopt.c
sed 's/^@//' > "./GENLIB/getopt.c" <<'@//E*O*F ./GENLIB/getopt.c//'
#include <stdio.h>
int optind = 1;
char *optarg;
getopt(argc, argv, ostr)
int argc;
char **argv, *ostr;
{
int c;
char *cp, *strchr();
if( optind >= argc ||
argv[optind][0] != '-' || argv[optind][1] == '\0' )
return(EOF);
c = argv[optind][1];
if( (cp = strchr(ostr, c)) == NULL ) {
optind++;
return((int)'?');
}
if( *++cp == ':' ) {
if( argv[optind][2] != '\0' ) {
optarg = &argv[optind][2];
} else if( ++optind >= argc ) {
fprintf(stderr, "missing argument to %c option\n", c);
return((int)'?');
} else {
optarg = argv[optind];
}
}
optind++;
return(c);
}
@//E*O*F ./GENLIB/getopt.c//
chmod u=rw,g=r,o=r ./GENLIB/getopt.c
echo x - ./GENLIB/4.2mkfile
sed 's/^@//' > "./GENLIB/4.2mkfile" <<'@//E*O*F ./GENLIB/4.2mkfile//'
CFLAGS=-c -O
HDRDIR=../hdrs
INSDIR=../_unix.O
LIB=$(INSDIR)/genlib.a
LIBSRC= \
getopt.c \
strchr.c \
strspn.c \
getsec.c \
getship.c \
secno.c
$(LIB):: $(HDRDIR)/emp.h
@touch getsec.c getship.c secno.c; # header change implies source change
$(LIB):: $(HDRDIR)/ship.h
@touch getship.c; # header change implies source change
$(LIB):: $(LIBSRC)
$(CC) $(CFLAGS) -I$(HDRDIR) $?
@ar r $(LIB) *.o
@ranlib $(LIB); # 4.2 archive needs table of contents
@rm -f *.o
@echo $(LIB) is now up to date
clean:
clobber:
rm -f $(LIB)
@.PRECIOUS: $(LIB)
@//E*O*F ./GENLIB/4.2mkfile//
chmod u=rw,g=r,o=r ./GENLIB/4.2mkfile
echo x - ./GENLIB/strchr.c
sed 's/^@//' > "./GENLIB/strchr.c" <<'@//E*O*F ./GENLIB/strchr.c//'
#include <stdio.h>
char *
strchr(s, c)
char *s, c;
{
register char *p;
for( p = s; *p != '\0'; p++ ) {
if( *p == c ) return(p);
}
return((char *)NULL);
}
@//E*O*F ./GENLIB/strchr.c//
chmod u=rw,g=r,o=r ./GENLIB/strchr.c
echo x - ./GENLIB/strspn.c
sed 's/^@//' > "./GENLIB/strspn.c" <<'@//E*O*F ./GENLIB/strspn.c//'
strspn(s, cset)
char *s;
char *cset;
{
char *s1, *s2;
for( s1 = s; *s1 != '\0'; s1++ ) {
for( s2 = cset; *s2 != '\0' && *s2 != *s1; s2++ )
;
if( *s2 == '\0' )
break;
}
return(s1 - s);
}
@//E*O*F ./GENLIB/strspn.c//
chmod u=rw,g=r,o=r ./GENLIB/strspn.c
echo mkdir - ./TERMLIB
mkdir ./TERMLIB
chmod u=rwx,g=rx,o=rx ./TERMLIB
echo x - ./TERMLIB/termcap.c
sed 's/^@//' > "./TERMLIB/termcap.c" <<'@//E*O*F ./TERMLIB/termcap.c//'
/* Copyright (c) 1979 Regents of the University of California */
#define BUFSIZ 1024
#define MAXHOP 32 /* max number of tc= indirections */
#include <ctype.h>
#include "uparm.h"
/*
* termcap - routines for dealing with the terminal capability data base
*
* BUG: Should use a "last" pointer in tbuf, so that searching
* for capabilities alphabetically would not be a n**2/2
* process when large numbers of capabilities are given.
* Note: If we add a last pointer now we will screw up the
* tc capability. We really should compile termcap.
*
* Essentially all the work here is scanning and decoding escapes
* in string capabilities. We don't use stdio because the editor
* doesn't, and because living w/o it is not hard.
*/
static char *tbuf;
static int hopcount; /* detect infinite loops in termcap, init 0 */
char *tskip();
char *tgetstr();
char *tdecode();
char *getenv();
/*
* Get an entry for terminal name in buffer bp,
* from the termcap file. Parse is very rudimentary;
* we just notice escaped newlines.
*/
tgetent(bp, name)
char *bp, *name;
{
register char *cp;
register int c;
register int i = 0, cnt = 0;
char ibuf[BUFSIZ];
char *cp2, *getenv(), *strcat();
int tf;
tbuf = bp;
tf = 0;
#ifndef V6
/*
* Default/form file name for termcap.
*
* Use, $TERMCAP, else $EXLIB/termcap, else TERMFILE.
*/
cp = getenv("TERMCAP");
if ( !cp && (cp=getenv("EXLIB")) )
cp = strcat( strcpy(ibuf,cp), "/termcap" );
/*
* TERMCAP can have one of two things in it. It can be the
* name of a file to use instead of /etc/termcap. In this
* case it better start with a "/", or ".". Or it can be an entry to
* use so we don't have to read the file. In this case it
* has to already have the newlines crunched out.
*/
if (cp && *cp) {
if ( (*cp!='/') && (*cp!='.') ){
cp2 = getenv("TERM");
if (cp2==(char *) 0 || strcmp(name,cp2)==0) {
strcpy(bp,cp);
return(tnchktc());
} else {
tf = open(E_TERMCAP, 0);
}
} else
tf = open(cp, 0);
}
if (tf==0)
tf = open(E_TERMCAP, 0);
#else
tf = open(E_TERMCAP, 0);
#endif
if (tf < 0)
return (-1);
for (;;) {
cp = bp;
for (;;) {
if (i == cnt) {
cnt = read(tf, ibuf, BUFSIZ);
if (cnt <= 0) {
close(tf);
return (0);
}
i = 0;
}
c = ibuf[i++];
if (c == '\n') {
if (cp > bp && cp[-1] == '\\'){
cp--;
continue;
}
break;
}
if (cp >= bp+BUFSIZ) {
write(2,"Termcap entry too long\n", 23);
break;
} else
*cp++ = c;
}
*cp = 0;
/*
* The real work for the match.
*/
if (tnamatch(name)) {
close(tf);
return(tnchktc());
}
}
}
/*
* tnchktc: check the last entry, see if it's tc=xxx. If so,
* recursively find xxx and append that entry (minus the names)
* to take the place of the tc=xxx entry. This allows termcap
* entries to say "like an HP2621 but doesn't turn on the labels".
* Note that this works because of the left to right scan.
*/
tnchktc()
{
register char *p, *q;
char tcname[16]; /* name of similar terminal */
char tcbuf[BUFSIZ];
char *holdtbuf = tbuf;
int l;
p = tbuf + strlen(tbuf) - 2; /* before the last colon */
while (*--p != ':')
if (p<tbuf) {
write(2, "Bad termcap entry\n", 18);
return (0);
}
p++;
/* p now points to beginning of last field */
if (p[0] != 't' || p[1] != 'c')
return(1);
strcpy(tcname,p+3);
q = tcname;
while (q && *q != ':')
q++;
*q = 0;
if (++hopcount > MAXHOP) {
write(2, "Infinite tc= loop\n", 18);
return (0);
}
if (tgetent(tcbuf, tcname) != 1)
return(0);
for (q=tcbuf; *q != ':'; q++)
;
l = p - holdtbuf + strlen(q);
if (l > BUFSIZ) {
write(2, "Termcap entry too long\n", 23);
q[BUFSIZ - (p-tbuf)] = 0;
}
strcpy(p, q+1);
tbuf = holdtbuf;
return(1);
}
/*
* Tnamatch deals with name matching. The first field of the termcap
* entry is a sequence of names separated by |'s, so we compare
* against each such name. The normal : terminator after the last
* name (before the first field) stops us.
*/
tnamatch(np)
char *np;
{
register char *Np, *Bp;
Bp = tbuf;
if (*Bp == '#')
return(0);
for (;;) {
for (Np = np; *Np && *Bp == *Np; Bp++, Np++)
continue;
if (*Np == 0 && (*Bp == '|' || *Bp == ':' || *Bp == 0))
return (1);
while (*Bp && *Bp != ':' && *Bp != '|')
Bp++;
if (*Bp == 0 || *Bp == ':')
return (0);
Bp++;
}
}
/*
* Skip to the next field. Notice that this is very dumb, not
* knowing about \: escapes or any such. If necessary, :'s can be put
* into the termcap file in octal.
*/
static char *
tskip(bp)
register char *bp;
{
while (*bp && *bp != ':')
bp++;
if (*bp == ':')
bp++;
return (bp);
}
/*
* Return the (numeric) option id.
* Numeric options look like
* li#80
* i.e. the option string is separated from the numeric value by
* a # character. If the option is not found we return -1.
* Note that we handle octal numbers beginning with 0.
*/
tgetnum(id)
char *id;
{
register int i, base;
register char *bp = tbuf;
for (;;) {
bp = tskip(bp);
if (*bp == 0)
return (-1);
if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
continue;
if (*bp == '@')
return(-1);
if (*bp != '#')
continue;
bp++;
base = 10;
if (*bp == '0')
base = 8;
i = 0;
while (isdigit(*bp))
i *= base, i += *bp++ - '0';
return (i);
}
}
/*
* Handle a flag option.
* Flag options are given "naked", i.e. followed by a : or the end
* of the buffer. Return 1 if we find the option, or 0 if it is
* not given.
*/
tgetflag(id)
char *id;
{
register char *bp = tbuf;
for (;;) {
bp = tskip(bp);
if (!*bp)
return (0);
if (*bp++ == id[0] && *bp != 0 && *bp++ == id[1]) {
if (!*bp || *bp == ':')
return (1);
else if (*bp == '@')
return(0);
}
}
}
/*
* Get a string valued option.
* These are given as
* cl=^Z
* Much decoding is done on the strings, and the strings are
* placed in area, which is a ref parameter which is updated.
* No checking on area overflow.
*/
char *
tgetstr(id, area)
char *id, **area;
{
register char *bp = tbuf;
for (;;) {
bp = tskip(bp);
if (!*bp)
return (0);
if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
continue;
if (*bp == '@')
return(0);
if (*bp != '=')
continue;
bp++;
return (tdecode(bp, area));
}
}
/*
* Tdecode does the grung work to decode the
* string capability escapes.
*/
static char *
tdecode(str, area)
register char *str;
char **area;
{
register char *cp;
register int c;
register char *dp;
int i;
cp = *area;
while ((c = *str++) && c != ':') {
switch (c) {
case '^':
c = *str++ & 037;
break;
case '\\':
dp = "E\033^^\\\\::n\nr\rt\tb\bf\f";
c = *str++;
nextc:
if (*dp++ == c) {
c = *dp++;
break;
}
dp++;
if (*dp)
goto nextc;
if (isdigit(c)) {
c -= '0', i = 2;
do
c <<= 3, c |= *str++ - '0';
while (--i && isdigit(*str));
}
break;
}
*cp++ = c;
}
*cp++ = 0;
str = *area;
*area = cp;
return (str);
}
@//E*O*F ./TERMLIB/termcap.c//
chmod u=rw,g=r,o=r ./TERMLIB/termcap.c
echo x - ./TERMLIB/tgoto.c
sed 's/^@//' > "./TERMLIB/tgoto.c" <<'@//E*O*F ./TERMLIB/tgoto.c//'
/* Copyright (c) 1979 Regents of the University of California */
#define CTRL(c) ('c' & 037)
char *UP;
char *BC;
/*
* Routine to perform cursor addressing.
* CM is a string containing printf type escapes to allow
* cursor addressing. We start out ready to print the destination
* line, and switch each time we print row or column.
* The following escapes are defined for substituting row/column:
*
* %d as in printf
* %2 like %2d
* %3 like %3d
* %. gives %c hacking special case characters
* %+x like %c but adding x first
*
* The codes below affect the state but don't use up a value.
*
* %>xy if value > x add y
* %r reverses row/column
* %i increments row/column (for one origin indexing)
* %% gives %
* %B BCD (2 decimal digits encoded in one byte)
* %D Delta Data (backwards bcd)
*
* all other characters are ``self-inserting''.
*/
char *
tgoto(CM, destcol, destline)
char *CM;
int destcol, destline;
{
static char result[16];
static char added[10];
char *cp = CM;
register char *dp = result;
register int c;
int oncol = 0;
register int which = destline;
if (cp == 0) {
toohard:
/*
* ``We don't do that under BOZO's big top''
*/
return ("OOPS");
}
added[0] = 0;
while (c = *cp++) {
if (c != '%') {
*dp++ = c;
continue;
}
switch (c = *cp++) {
#ifdef CM_N
case 'n':
destcol ^= 0140;
destline ^= 0140;
goto setwhich;
#endif
case 'd':
if (which < 10)
goto one;
if (which < 100)
goto two;
/* fall into... */
case '3':
*dp++ = (which / 100) | '0';
which %= 100;
/* fall into... */
case '2':
two:
*dp++ = which / 10 | '0';
one:
*dp++ = which % 10 | '0';
swap:
oncol = 1 - oncol;
setwhich:
which = oncol ? destcol : destline;
continue;
#ifdef CM_GT
case '>':
if (which > *cp++)
which += *cp++;
else
cp++;
continue;
#endif
case '+':
which += *cp++;
/* fall into... */
case '.':
casedot:
/*
* This code is worth scratching your head at for a
* while. The idea is that various weird things can
* happen to nulls, EOT's, tabs, and newlines by the
* tty driver, arpanet, and so on, so we don't send
* them if we can help it.
*
* Tab is taken out to get Ann Arbors to work, otherwise
* when they go to column 9 we increment which is wrong
* because bcd isn't continuous. We should take out
* the rest too, or run the thing through more than
* once until it doesn't make any of these, but that
* would make termlib (and hence pdp-11 ex) bigger,
* and also somewhat slower. This requires all
* programs which use termlib to stty tabs so they
* don't get expanded. They should do this anyway
* because some terminals use ^I for other things,
* like nondestructive space.
*/
if (which == 0 || which == CTRL(d) || which == '\t' || which == '\n') {
if (oncol || UP) /* Assumption: backspace works */
/*
* Loop needed because newline happens
* to be the successor of tab.
*/
do {
strcat(added, oncol ? (BC ? BC : "\b") : UP);
which++;
} while (which == '\n');
}
*dp++ = which;
goto swap;
case 'r':
oncol = 1;
goto setwhich;
case 'i':
destcol++;
destline++;
which++;
continue;
case '%':
*dp++ = c;
continue;
#ifdef CM_B
case 'B':
which = (which/10 << 4) + which%10;
continue;
#endif
#ifdef CM_D
case 'D':
which = which - 2 * (which%16);
continue;
#endif
default:
goto toohard;
}
}
strcpy(dp, added);
return (result);
}
@//E*O*F ./TERMLIB/tgoto.c//
chmod u=rw,g=r,o=r ./TERMLIB/tgoto.c
echo x - ./TERMLIB/tputs.c
sed 's/^@//' > "./TERMLIB/tputs.c" <<'@//E*O*F ./TERMLIB/tputs.c//'
/* Copyright (c) 1979 Regents of the University of California */
#include <sgtty.h>
#include <ctype.h>
/*
* The following array gives the number of tens of milliseconds per
* character for each speed as returned by gtty. Thus since 300
* baud returns a 7, there are 33.3 milliseconds per char at 300 baud.
*/
static
short tmspc10[] = {
0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10
};
short ospeed;
char PC;
/*
* Put the character string cp out, with padding.
* The number of affected lines is affcnt, and the routine
* used to output one character is outc.
*/
tputs(cp, affcnt, outc)
register char *cp;
int affcnt;
int (*outc)();
{
register int i = 0;
register int mspc10;
if (cp == 0)
return;
/*
* Convert the number representing the delay.
*/
if (isdigit(*cp)) {
do
i = i * 10 + *cp++ - '0';
while (isdigit(*cp));
}
i *= 10;
if (*cp == '.') {
cp++;
if (isdigit(*cp))
i += *cp - '0';
/*
* Only one digit to the right of the decimal point.
*/
while (isdigit(*cp))
cp++;
}
/*
* If the delay is followed by a `*', then
* multiply by the affected lines count.
*/
if (*cp == '*')
cp++, i *= affcnt;
/*
* The guts of the string.
*/
while (*cp)
(*outc)(*cp++);
/*
* If no delay needed, or output speed is
* not comprehensible, then don't try to delay.
*/
if (i == 0)
return;
if (ospeed <= 0 || ospeed >= (sizeof tmspc10 / sizeof tmspc10[0]))
return;
/*
* Round up by a half a character frame,
* and then do the delay.
* Too bad there are no user program accessible programmed delays.
* Transmitting pad characters slows many
* terminals down and also loads the system.
*/
mspc10 = tmspc10[ospeed];
i += mspc10 / 2;
for (i /= mspc10; i > 0; i--)
(*outc)(PC);
}
@//E*O*F ./TERMLIB/tputs.c//
chmod u=rw,g=r,o=r ./TERMLIB/tputs.c
echo x - ./TERMLIB/Makefile
sed 's/^@//' > "./TERMLIB/Makefile" <<'@//E*O*F ./TERMLIB/Makefile//'
CFLAGS= -c -O -DCM_N -DCM_GT -DCM_B -DCM_D
HDRDIR =./hdrs
INSDIR=../_unix.O
LIB=$(INSDIR)/termlib.a
HDRDEP=$(LIB)(termcap.o)
$(LIB): \
$(LIB)(termcap.o) \
$(LIB)(tgoto.o) \
$(LIB)(tputs.o)
$(CC) $(CFLAGS) -I$(HDRDIR) $(?:.o=.c)
@ar r $(LIB) *.o
@rm -f *.o
@echo $@ is now up to date
@.c.a:;
$(HDRDEP): $(HDRDIR)/uparm.h
clean:
clobber:
rm -f $(LIB)
@.PRECIOUS: $(LIB)
@//E*O*F ./TERMLIB/Makefile//
chmod u=rw,g=r,o=r ./TERMLIB/Makefile
echo mkdir - ./TERMLIB/hdrs
mkdir ./TERMLIB/hdrs
chmod u=rwx,g=rx,o=rx ./TERMLIB/hdrs
echo x - ./TERMLIB/hdrs/uparm.h
sed 's/^@//' > "./TERMLIB/hdrs/uparm.h" <<'@//E*O*F ./TERMLIB/hdrs/uparm.h//'
extern char *libpath();
#define loclibpath(file) "/usr/local/lib/file"
#define binpath(file) "/usr/ucb/file"
#define usrpath(file) "/usr/file"
#define LIBPATH "/usr/lib"
#define E_TERMCAP "/etc/termcap"
#define B_CSH "/bin/csh"
@//E*O*F ./TERMLIB/hdrs/uparm.h//
chmod u=rw,g=r,o=r ./TERMLIB/hdrs/uparm.h
echo x - ./TERMLIB/4.2mkfile
sed 's/^@//' > "./TERMLIB/4.2mkfile" <<'@//E*O*F ./TERMLIB/4.2mkfile//'
CFLAGS=-c -O
HDRDIR=./hdrs
INSDIR=../_unix.O
LIB=$(INSDIR)/termlib.a
LIBSRC= \
termcap.c \
tgoto.c \
tputs.c
$(LIB):: $(HDRDIR)/uparm.h
@touch termcap.c; # header change implies source change
$(LIB):: $(LIBSRC)
$(CC) $(CFLAGS) -I$(HDRDIR) $?
@ar r $(LIB) *.o
@ranlib $(LIB); # 4.2 archive needs table of contents
@rm -f *.o
@echo $(LIB) is now up to date
clean:
clobber:
rm -f $(LIB)
@.PRECIOUS: $(LIB)
@//E*O*F ./TERMLIB/4.2mkfile//
chmod u=rw,g=r,o=r ./TERMLIB/4.2mkfile
echo mkdir - ./UPDLIB
mkdir ./UPDLIB
chmod u=rwx,g=rx,o=rx ./UPDLIB
echo x - ./UPDLIB/Makefile
sed 's/^@//' > "./UPDLIB/Makefile" <<'@//E*O*F ./UPDLIB/Makefile//'
CFLAGS= -c -O
HDRDIR =../hdrs
INSDIR=../_unix.O
LIB=$(INSDIR)/updlib.a
HDRDEP= \
$(LIB)(docen.o) \
$(LIB)(domap.o) \
$(LIB)(dorad.o) \
$(LIB)(dospy.o)
$(LIB): \
$(LIB)(docen.o) \
$(LIB)(domap.o) \
$(LIB)(dorad.o) \
$(LIB)(dospy.o)
$(CC) $(CFLAGS) -I$(HDRDIR) $(?:.o=.c)
@ar r $(LIB) *.o
@rm -f *.o
@echo $@ is now up to date
@.c.a:;
$(HDRDEP): $(HDRDIR)/emp.h
clean:
clobber:
rm -f $(LIB)
@.PRECIOUS: $(LIB)
@//E*O*F ./UPDLIB/Makefile//
chmod u=rw,g=r,o=r ./UPDLIB/Makefile
echo x - ./UPDLIB/docen.c
sed 's/^@//' > "./UPDLIB/docen.c" <<'@//E*O*F ./UPDLIB/docen.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include <stdio.h>
#include "emp.h"
char Stype[] = { 'p', 'm', 'd', 's', 'f', 't', 'b', 'c' };
extern struct sector s;
docen(line)
char *line;
{
int x, y, n;
if( sscanf(line," %d,%d ", &x, &y) != 2 ) {
fprintf(stderr,"empupd: bad x,y\n");
return(ERROR);
}
if( getsec(&s, (n = secno(x,y))) == ERROR ) {
fprintf(stderr,"getsec: ERROR\n");
return(ERROR);
}
s.s_coun = 0;
s.s_ckpt = line[7];
setdel( line[8], &s.s_del[0] );
setdel( line[9], &s.s_del[1] );
setdel( line[10], &s.s_del[2] );
setdel( line[11], &s.s_del[3] );
setdel( line[12], &s.s_del[4] );
setdel( line[13], &s.s_del[5] );
setdel( line[14], &s.s_del[6] );
s.s_def = line[15];
s.s_des = line[17];
sscanf(&line[18],"%d%*c %d %d %d %d %d %d %d %d %d %d %d",
&s.s_eff, &s.s_min, &s.s_gold, &s.s_mob,
&s.s_rsrc[0], &s.s_rsrc[1], &s.s_rsrc[2], &s.s_rsrc[3],
&s.s_rsrc[4], &s.s_rsrc[5], &s.s_rsrc[6], &s.s_prod);
if( putsec(&s, n) == ERROR ) {
printf(stderr,"putsec: ERROR\n");
return(ERROR);
}
}
setdel( dchar, sdel )
char dchar, *sdel;
{
*sdel &= 0360;
switch( dchar ) {
case '.':
break;
case '$':
*sdel |= 01;
break;
default:
*sdel |= ((dchar - '0')&017) | 010;
break;
}
}
@//E*O*F ./UPDLIB/docen.c//
chmod u=rw,g=r,o=r ./UPDLIB/docen.c
echo x - ./UPDLIB/domap.c
sed 's/^@//' > "./UPDLIB/domap.c" <<'@//E*O*F ./UPDLIB/domap.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include "emp.h"
extern struct sector s;
domap(mapx, y, col, mapchar)
int mapx, y, col;
char mapchar;
{
int x, n;
x = (col - 6)/2 + mapx;
getsec(&s, (n = secno(x, y)));
if( mapchar == '?' ) {
if( s.s_des == ' ' || s.s_des == '\0' ) s.s_des = '?';
if( s.s_coun == 0 ) s.s_coun = 98;
} else {
s.s_des = mapchar;
}
putsec(&s, n);
}
@//E*O*F ./UPDLIB/domap.c//
chmod u=rw,g=r,o=r ./UPDLIB/domap.c
echo x - ./UPDLIB/dorad.c
sed 's/^@//' > "./UPDLIB/dorad.c" <<'@//E*O*F ./UPDLIB/dorad.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include <stdio.h>
#include "emp.h"
char Rscan[MAXSCN][2*MAXSCN];
char Raddes[] = "-.^cudg*ihamwtfr+#)=!bxs?";
int Nrows = 0;
int Xrad, Yrad, Rngrad;
extern struct sector s;
extern FILE *fdsec;
dorad()
{
int i, j, lcol, rcol, trow, brow;
int cencol, cenrow;
int row, col, n, x, y;
char c;
cencol = cenrow = 0;
for( i=0; i<Nrows; i++ ) {
lcol = rcol = -1;
for( j=0; j<MAXSCN*2; j += 2 ) {
if( Rscan[i][j] != ' ' && Rscan[i][j] != '\0' ) break;
}
if( j < MAXSCN*2 ) {
if( strspn(&Rscan[i][j], Raddes) == 1 ) lcol=j;
}
for( j=MAXSCN*2 - 2; j>=0; j -= 2 ) {
if( Rscan[i][j] != ' ' && Rscan[i][j] != '\0' ) break;
}
if( j >= 0 ) {
if( strspn(&Rscan[i][j], Raddes) == 1 ) rcol=j;
}
if( lcol >= 0 && rcol > 0 ) {
if( ((rcol - lcol)%4) == 0 ) {
cencol = (rcol - lcol)/2 + lcol;
break;
}
}
}
if( cencol == 0 ) {
Nrows = 0;
return;
}
for( i=0; i<MAXSCN*2; i += 2 ) {
trow = brow = -1;
for( j=0; j<Nrows; j++ ) {
if( Rscan[j][i] != ' ' && Rscan[j][i] != '\0' ) break;
}
if( j < Nrows ) {
if( strspn(&Rscan[j][i], Raddes) == 1 ) trow=j;
}
for( j=Nrows-1; j>=0; j-- ) {
if( Rscan[j][i] != ' ' && Rscan[j][i] != '\0' ) break;
}
if( j >= 0 ) {
if( strspn(&Rscan[j][i], Raddes) == 1 ) brow=j;
}
if( trow >= 0 && brow > 0 ) {
if( ((brow - trow)%2) == 0 ) {
cenrow = (brow - trow)/2 + trow;
break;
}
}
}
if( cenrow == 0 ) {
Nrows = 0;
return;
}
if( (cenrow-Rngrad+1) < 0 || (cenrow+Rngrad-1) >= Nrows ||
(cencol-2*Rngrad+2) < 0 || (cencol+2*Rngrad-2) >= 2*MAXSCN ) {
Nrows = 0;
return;
}
y = Yrad - Rngrad;
for( row=cenrow-Rngrad; row<=cenrow+Rngrad; row++ ) {
x = Xrad - Rngrad;
for( col=cencol-2*Rngrad; col<=cencol+2*Rngrad; col += 2) {
if( strspn(&Rscan[row][col], Raddes) == 1 ) {
getsec( &s, (n = secno(x, y)) );
c = Rscan[row][col];
if( c == '?' ) {
if( s.s_coun == 0 ) s.s_coun = 98;
if( s.s_des == ' ' ) s.s_des = '?';
} else {
s.s_des = c;
}
putsec( &s, n );
}
x++;
}
y++;
}
Nrows = 0;
}
@//E*O*F ./UPDLIB/dorad.c//
chmod u=rw,g=r,o=r ./UPDLIB/dorad.c
echo x - ./UPDLIB/dospy.c
sed 's/^@//' > "./UPDLIB/dospy.c" <<'@//E*O*F ./UPDLIB/dospy.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include "emp.h"
extern struct sector s;
dospy(line)
char *line;
{
int x, y, n;
if( sscanf(line," %d,%d", &x, &y ) != 2 ) return;
getsec( &s, (n = secno(x,y)) );
if( sscanf(&line[7]," %d %*c %d%% %d %d %d %d %d %d",
&s.s_coun,
&s.s_eff,
&s.s_rsrc[CIV], &s.s_rsrc[MIL],
&s.s_rsrc[SHL], &s.s_rsrc[GUN],
&s.s_rsrc[ORE], &s.s_rsrc[PLN] ) != 8 ) return;
s.s_des = line[11];
s.s_eff *= 2;
s.s_rsrc[CIV] *= 2;
s.s_rsrc[MIL] *= 2;
s.s_rsrc[SHL] *= 2;
s.s_rsrc[GUN] *= 2;
s.s_rsrc[PLN] *= 2;
s.s_rsrc[ORE] *= 2;
putsec( &s, n );
}
@//E*O*F ./UPDLIB/dospy.c//
chmod u=rw,g=r,o=r ./UPDLIB/dospy.c
echo x - ./UPDLIB/4.2mkfile
sed 's/^@//' > "./UPDLIB/4.2mkfile" <<'@//E*O*F ./UPDLIB/4.2mkfile//'
CFLAGS=-c -O
HDRDIR=../hdrs
INSDIR=../_unix.O
LIB=$(INSDIR)/updlib.a
LIBSRC= \
dospy.c \
domap.c \
docen.c \
dorad.c
$(LIB):: $(HDRDIR)/emp.h
@touch $(LIBSRC); # header change implies source change
$(LIB):: $(LIBSRC)
$(CC) $(CFLAGS) -I$(HDRDIR) $?
@ar r $(LIB) *.o
@ranlib $(LIB); # 4.2 archive needs table of contents
@rm -f *.o
@echo $(LIB) is now up to date
clean:
clobber:
rm -f $(LIB)
@.PRECIOUS: $(LIB)
@//E*O*F ./UPDLIB/4.2mkfile//
chmod u=rw,g=r,o=r ./UPDLIB/4.2mkfile
echo mkdir - ./MISC
mkdir ./MISC
chmod u=rwx,g=rx,o=rx ./MISC
echo x - ./MISC/clust.sh
sed 's/^@//' > "./MISC/clust.sh" <<'@//E*O*F ./MISC/clust.sh//'
# clust - shell/awk program to show where ships are clustered
# input: output of rdship command
# output: sorted list of coordinates and number of ships at that location
# 1 4,3
# 4 -5,-16
# 23 10,-2
# .. ..
# usage: rdship [-c cno] [| optional_filter] | clust
awk '
$2 ~ /pt/ {
if( x[$4] == 0 ) x[n++] = $4;
x[$4]++;
next;
}
{
if( x[$3] == 0 ) x[n++] = $3;
x[$3]++;
}
END {
for( i=0; i<n; i++ ) {
printf "%3d\t%s\n", x[x[i]], x[i];
}
}
' | sort -n
@//E*O*F ./MISC/clust.sh//
chmod u=rwx,g=rx,o=rx ./MISC/clust.sh
echo x - ./MISC/Makefile
sed 's/^@//' > "./MISC/Makefile" <<'@//E*O*F ./MISC/Makefile//'
INSDIR=..
LIBDIR=../_unix.O
GENLIB=$(LIBDIR)/genlib.a
HDRDIR=../hdrs
CFLAGS= -c -O
all: pworld rdship
pworld: $(INSDIR)/pworld
$(INSDIR)/pworld: _unix.O/pworld.o $(GENLIB)
$(CC) -o $(INSDIR)/pworld _unix.O/pworld.o $(GENLIB)
_unix.O/pworld.o: pworld.c $(HDRDIR)/emp.h
$(CC) $(CFLAGS) -I$(HDRDIR) pworld.c
@mv pworld.o _unix.O/pworld.o
rdship: $(INSDIR)/rdship
$(INSDIR)/rdship: _unix.O/rdship.o $(GENLIB)
$(CC) -o $(INSDIR)/rdship _unix.O/rdship.o $(GENLIB)
_unix.O/rdship.o: rdship.c $(HDRDIR)/ship.h
$(CC) $(CFLAGS) -I$(HDRDIR) rdship.c
@mv rdship.o _unix.O/rdship.o
clean:
rm -f _unix.O/*.o
clobber: clean
rm -f $(INSDIR)/pworld $(INSDIR)/rdship
FRC:
@//E*O*F ./MISC/Makefile//
chmod u=rw,g=r,o=r ./MISC/Makefile
echo mkdir - ./MISC/_unix.O
mkdir ./MISC/_unix.O
chmod u=rwx,g=rx,o=rx ./MISC/_unix.O
echo x - ./MISC/_unix.O/pworld.o
sed 's/^@//' > "./MISC/_unix.O/pworld.o" <<'@//E*O*F ./MISC/_unix.O/pworld.o//'
@//E*O*F ./MISC/_unix.O/pworld.o//
chmod u=rw,g=r,o=r ./MISC/_unix.O/pworld.o
echo x - ./MISC/nomine.sh
sed 's/^@//' > "./MISC/nomine.sh" <<'@//E*O*F ./MISC/nomine.sh//'
# nomine - shell program to clear a mine
# Use this when you're sure all the mines have been cleared
# usage: nomine x,y
(
echo "[0:0] Command :"
echo " sect cmsgpob des eff min gold mob civ mil sh gun pl ore bar prod"
SECT=`expr " $1 " : ".*\(...,...\).*"`
echo "$SECT ....... . 0% 0 0 0 0 0 0 0 0 0 0 0"
echo " 1 sectors"
) | eupd
@//E*O*F ./MISC/nomine.sh//
chmod u=rwx,g=rx,o=rx ./MISC/nomine.sh
echo x - ./MISC/pworld.c
sed 's/^@//' > "./MISC/pworld.c" <<'@//E*O*F ./MISC/pworld.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include "emp.h"
#include <stdio.h>
FILE *fdsec, *fdship;
main()
{
struct sector sect;
int i, j;
if( (fdsec = fopen("empsect", "r")) == NULL ) {
fprintf(stderr, "Can't open empsect file\n");
exit(1);
}
putchar('\n');
for( j = -32; j <= 31; j++ ) {
for( i = -32; i <= 31; i++ ) {
getsec(§, secno(i, j));
putchar(sect.s_des);
putchar(' ');
}
putchar('\n');
}
}
@//E*O*F ./MISC/pworld.c//
chmod u=rw,g=r,o=r ./MISC/pworld.c
echo x - ./MISC/pl.sh
sed 's/^@//' > "./MISC/pl.sh" <<'@//E*O*F ./MISC/pl.sh//'
# pl - shell program to enter empire, save output, provide minimal security
# usage: pl [ > /dev/null ]
trap "chmod 700 .;mv .yout .oyout" 1 2 3 9 15
chmod 711 . # open up read access for empire
empire Cname rep | tee eout # execute the script (.yout)
chmod 700 . # prevent access by snoopy adversaries
mv .yout .oyout # save script in case it's needed
@//E*O*F ./MISC/pl.sh//
chmod u=rwx,g=rx,o=rx ./MISC/pl.sh
echo x - ./MISC/rdship.c
sed 's/^@//' > "./MISC/rdship.c" <<'@//E*O*F ./MISC/rdship.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include <stdio.h>
#include "emp.h"
#include "ship.h"
FILE *fopen(), *fdshp, *fdnshp;
struct shpstr Ship;
char *Stype[] = {
"pt boat", "minesweep", "destroyer", "submarine",
"freighter", "tender", "battleship", "carrier" };
main(argc, argv)
int argc;
char **argv;
{
short n, shipnum;
short mbl;
char *getenv(), *foestr;
int c;
short errflg;
short cflg, cno;
short relocflg, newx, newy;
char *fname;
extern char *optarg;
newx = newy = cflg = 0;
fname = NULL;
while( (c = getopt(argc, argv, "c:x:y:f:")) != EOF ) {
switch( c ) {
case 'c':
cno = atoi(optarg);
cflg++;
break;
case 'x':
newx = atoi(optarg);
break;
case 'y':
newy = atoi(optarg);
break;
case 'f':
fname = optarg;
break;
case '?':
errflg++;
break;
}
}
if( errflg ) {
printf("Usage: %s [-c country_no] [-x newx] [-y newy]\n",
argv[0]);
exit(1);
}
if( newx || newy ) {
relocflg++;
if( (fdnshp = fopen("newship","w")) == NULL ) {
fprintf(stderr,"Can't create newship file\n");
exit(2);
}
}
if( fname == NULL ) fname = "empship";
if( (fdshp = fopen(fname, "r")) == NULL ) {
fprintf(stderr, "Can't access %s file\n", fname);
exit(3);
}
if( cno == 0 ) {
foestr = getenv("FOES");
if( foestr == NULL ) {
cno = 0;
} else {
cno = atoi(foestr);
}
}
shipnum = -1;
while( (n=fread(&Ship, sizeof(struct shpstr), 1, fdshp)) == 1 ) {
shipnum++;
if( !relocflg && Ship.shp_own != cno ) continue;
if( Ship.shp_effc < 20 ) continue;
if( relocflg ) {
Ship.shp_xp -= newx;
Ship.shp_yp -= newy;
}
Ship.shp_xp = Ship.shp_xp % XYMAX;
if( Ship.shp_xp > XYMAX/2 ) Ship.shp_xp -= XYMAX;
Ship.shp_yp = Ship.shp_yp % XYMAX;
if( Ship.shp_yp > XYMAX/2 ) Ship.shp_yp -= XYMAX;
if( relocflg ) {
fwrite(&Ship, sizeof(struct shpstr), 1, fdnshp);
} else {
if( (mbl = Ship.shp_mbl) > 127 ) mbl -= 256;
printf("%4d %-11s%3d,%-3d%6d%%%4d%4d%4d%4d%4d%4d%4d\n",
shipnum,
Stype[(int)Ship.shp_type],
Ship.shp_xp, Ship.shp_yp,
(int)Ship.shp_effc,
(int)Ship.shp_crew,
(int)Ship.shp_shels, (int)Ship.shp_gun,
(int)Ship.shp_plns, (int)Ship.shp_or,
(int)Ship.shp_gld, mbl);
}
}
if( relocflg ) fclose(fdnshp);
}
@//E*O*F ./MISC/rdship.c//
chmod u=rw,g=r,o=r ./MISC/rdship.c
echo x - ./MISC/mine.sh
sed 's/^@//' > "./MISC/mine.sh" <<'@//E*O*F ./MISC/mine.sh//'
# mine - shell program to drop a mine (shell) in sea sector
# Use this whenever one (or more!) of your ships
# "detects" one of the little cuties
# usage: mine x,y
(
echo "[0:0] Command :"
echo " sect cmsgpob des eff min gold mob civ mil sh gun pl ore bar prod"
SECT=`expr " $1 " : ".*\(...,...\).*"`
echo "$SECT ....... . 0% 0 0 0 0 0 1 0 0 0 0 0"
echo " 1 sectors"
) | eupd
@//E*O*F ./MISC/mine.sh//
chmod u=rwx,g=rx,o=rx ./MISC/mine.sh
echo x - ./MISC/sink.sh
sed 's/^@//' > "./MISC/sink.sh" <<'@//E*O*F ./MISC/sink.sh//'
# sink - shell program to remove ships from ship file
# usage: sink [shipno ...]
(
echo "[0:0] Command :"
for i
do
SHIP=`expr " $i" : ".*\(....\)"`
echo "$SHIP battleship 0,0 0% 0 0 0 0 0 0 0"
done
) | eupd
@//E*O*F ./MISC/sink.sh//
chmod u=rwx,g=rx,o=rx ./MISC/sink.sh
echo x - ./MISC/makeloo.sh
sed 's/^@//' > "./MISC/makeloo.sh" <<'@//E*O*F ./MISC/makeloo.sh//'
# makeloo - shell/awk program to generate a script of loo commands that
# is a comprehensive coverage of everything the ships given as
# input can see. Try to get a B and D in each sector (for
# range and sonar). If neither B nor D is in a sector then use
# a S if present, and also one of the following: C, P, T, F, M if
# present.
# Creates a file called "looall" in current directory. Use empire
# "ex" command to execute the script (ex looall).
# usage: makeloo
trap "rm -f /usr/tmp/ml.$$ /usr/tmp/ml.$$.q" 1 2 3 9 15
rm -f /usr/tmp/ml.$$ /usr/tmp/ml.$$.q
umask 077
rdship > /usr/tmp/ml.$$
echo rdship done
# Set up for awk:
# Save only ship no., type, and coord
# Change pt boat to pt_boat
# Change comma between x and y coord to space
sed -e "s/ *[^ ]*%.*//" -e "s/pt b/pt_b/" -e "s/,/ /" < /usr/tmp/ml.$$ > /usr/tmp/ml.$$.q
echo sed done
# Sort by coordinate
sort -n -o /usr/tmp/ml.$$ +2 -3 +3 -4 /usr/tmp/ml.$$.q
echo sort done
umask 022
awk '
{
coord = $3 "," $4;
if( x[coord] == 0 ) x[n++] = coord;
x[coord]++;
if( $2 == "pt_boat" ) p[coord] = $1;
if( $2 == "minesweep" ) m[coord] = $1;
if( $2 == "destroyer" ) d[coord] = $1;
if( $2 == "submarine" ) s[coord] = $1;
if( $2 == "freighter" ) f[coord] = $1;
if( $2 == "tender" ) t[coord] = $1;
if( $2 == "battleship") b[coord] = $1;
if( $2 == "carrier" ) c[coord] = $1;
}
END {
ships = 0;
loostr = "loo ";
for( i=0; i<n; i++ ) {
coord = x[i];
batt = "";
if( b[coord] != "" ) batt = b[coord];
dest = "";
if( d[coord] != "" ) dest = d[coord];
sub = "";
if( batt == "" && dest == "" ) {
if( s[coord] != "" ) {
sub = s[coord];
}
}
other = "";
if( batt == "" && dest == "" ) {
if( c[coord] != "" )
other = c[coord];
else if( p[coord] != "" )
other = p[coord];
else if( t[coord] != "" )
other = t[coord];
else if( f[coord] != "" )
other = f[coord];
else if( m[coord] != "" )
other = m[coord];
}
if( batt != "" ) {
loostr = loostr batt "/";
ships++;
}
if( dest != "" ) {
loostr = loostr dest "/";
ships++;
}
if( sub != "" ) {
loostr = loostr sub "/";
ships++;
}
if( other != "" ) {
loostr = loostr other "/";
ships++;
}
if( ships < 12 ) continue;
print substr(loostr,1,length(loostr)-1);
ships = 0;
loostr = "loo ";
}
if( ships > 0 ) print substr(loostr,1,length(loostr)-1);
}
' /usr/tmp/ml.$$ > looall
rm -f /usr/tmp/ml.$$ /usr/tmp/ml.$$.q
@//E*O*F ./MISC/makeloo.sh//
chmod u=rwx,g=rx,o=rx ./MISC/makeloo.sh
echo x - ./MISC/vspos.sh
sed 's/^@//' > "./MISC/vspos.sh" <<'@//E*O*F ./MISC/vspos.sh//'
# vspos - shell/awk program to update the ship file with info obtained
# from buzzing harbors/sea from planes
# Save the output from a flyover and strip everything but the
# type shipno
# list. Note the coordinates, and guess at the country number
# To update the ship file:
# vspos coord cno < shiplist | eupd
if [ $# -eq 0 ];then
echo "Usage: $0 coord cno < shiplist(type,shipno)"
exit 1
fi
echo "[0:0] Command :"
awk '{
type = $1;
numb = $2;
if( $1 == "pt" ) {
type = $1 " " $2;
numb = $3;
}
printf "Country (#%d) %s %s @%s\n", CNO, type, numb, COORD;
}' COORD=$1 CNO=$2 -
@//E*O*F ./MISC/vspos.sh//
chmod u=rwx,g=rx,o=rx ./MISC/vspos.sh
echo x - ./MISC/shsup.A
sed 's/^@//' > "./MISC/shsup.A" <<'@//E*O*F ./MISC/shsup.A//'
# shsup.A - awk filter to list ships in need of supply
# input: output of rdship command
# output: same as input with well supplied ships deleted
# carriers should have 60 mil, 40 shells, 2 guns, 20 planes
$2=="carrier" {if( $5<60 || $6<40 || $7<2 || $8<20 ) print $0 }
# battleships should have 10 mil, 127 shells, 4 guns
$2=="battleship" {
if( $5<10 || $6<127 || $7<4 ) print $0
}
# destroyers should have 10 mil, 40 shells, 2 guns
$2=="destroyer" {if( $5<10 || $6<40 || $7<2 ) print $0 }
# tenders should have 100 mil, 127 shells, 10 guns
$2=="tender" {if( $5<100 || $6<127 || $7<10 ) print $0 }
# submarine should have 25 shells, 2 guns
$2=="submarine" {if( $6<25 || $7<2 ) print $0 }
@//E*O*F ./MISC/shsup.A//
chmod u=rw,g=r,o=r ./MISC/shsup.A
echo mkdir - ./ECRE
mkdir ./ECRE
chmod u=rwx,g=rx,o=rx ./ECRE
echo x - ./ECRE/ecre.c
sed 's/^@//' > "./ECRE/ecre.c" <<'@//E*O*F ./ECRE/ecre.c//'
/* Copyright (c) 1985 by Thomas S. Fisher - Westminster, CO 80030 */
#include <stdio.h>
#include "emp.h"
FILE *fopen(), *fdnew, *fdold;
struct sector s;
extern int optind;
extern char *optarg;
main(argc, argv)
int argc;
char **argv;
{
int c, errflg;
int capx, capy, capflg;
capx = capy = capflg = 0;
while( (c = getopt(argc, argv, "x:y:")) != EOF ) {
switch( c ) {
case 'x':
capx = atoi(optarg);
capflg++;
break;
case 'y':
capy = atoi(optarg);
capflg++;
break;
case '?':
errflg++;
break;
}
}
if( errflg ) {
printf("Usage: %s [-x new_capx] [-y new_capy]\n", argv[0]);
exit(1);
}
if( capflg ) {
movwrld(capx, capy);
} else {
newwrld();
}
}
newwrld()
{
int x, y;
s.s_des = ' ';
if( (fdnew = fopen("newsect", "w")) == NULL ) {
fprintf(stderr, "Can't create newsect\n");
exit(1);
}
for( y = 0; y < XYMAX; y++ ) {
for( x = 0; x < XYMAX; x++ ) {
if( ptsec(fdnew, &s, sctno(x,y)) == ERROR ) {
fprintf(stderr, "ptsec: ERROR\n");
exit(3);
}
}
}
}
movwrld(capx, capy)
int capx, capy;
{
int x, y;
if( (fdold = fopen("empsect", "r")) == NULL ) {
fprintf(stderr, "Can't access empsect\n");
exit(1);
}
if( (fdnew = fopen("newsect", "w")) == NULL ) {
fprintf(stderr, "Can't create newsect\n");
exit(2);
}
for( y = 0; y < XYMAX; y++ ) {
for( x = 0; x < XYMAX; x++ ) {
gtsec(fdold, &s, sctno(x, y));
ptsec(fdnew, &s, sctno(x-capx, y-capy));
}
}
}
sctno(x, y)
int x, y;
{
return((x + XYMAX) % XYMAX + ((y+XYMAX) % XYMAX) * XYMAX );
}
ptsec(fd, buf, n)
FILE *fd;
struct sector *buf;
int n;
{
if( fseek(fd, ((long)n)*sizeof(struct sector), 0) != 0 ) return(ERROR);
if( fwrite(buf, sizeof(struct sector), 1, fd) != 1 ) return(ERROR);
}
gtsec(fd, buf, n)
FILE *fd;
struct sector *buf;
int n;
{
if( fseek(fd, ((long)n)*sizeof(struct sector), 0) != 0 ) return(ERROR);
if( fread(buf, sizeof(struct sector), 1, fd) != 1 ) return(ERROR);
}
@//E*O*F ./ECRE/ecre.c//
chmod u=rw,g=r,o=r ./ECRE/ecre.c
echo x - ./ECRE/Makefile
sed 's/^@//' > "./ECRE/Makefile" <<'@//E*O*F ./ECRE/Makefile//'
INSDIR=..
LIBDIR=../_unix.O
GENLIB=$(LIBDIR)/genlib.a
HDRDIR=../hdrs
CFLAGS= -c -O
ecre: $(INSDIR)/ecre
$(INSDIR)/ecre: _unix.O/ecre.o $(GENLIB)
$(CC) -o $(INSDIR)/ecre _unix.O/ecre.o $(GENLIB)
_unix.O/ecre.o: ecre.c $(HDRDIR)/emp.h
$(CC) $(CFLAGS) -I$(HDRDIR) ecre.c
@mv ecre.o _unix.O/ecre.o
clean:
rm -f _unix.O/*.o
clobber: clean
rm -f $(INSDIR)/ecre
FRC:
@//E*O*F ./ECRE/Makefile//
chmod u=rw,g=r,o=r ./ECRE/Makefile
echo mkdir - ./ECRE/_unix.O
mkdir ./ECRE/_unix.O
chmod u=rwx,g=rx,o=rx ./ECRE/_unix.O
echo x - ./ECRE/_unix.O/ecre.o
sed 's/^@//' > "./ECRE/_unix.O/ecre.o" <<'@//E*O*F ./ECRE/_unix.O/ecre.o//'
@//E*O*F ./ECRE/_unix.O/ecre.o//
chmod u=rw,g=r,o=r ./ECRE/_unix.O/ecre.o
exit 0