static char *sccsid
= "@(#)gcos.c 4.1 (Berkeley) 81/02/28";
/* GCOS DEPENDENT PROCEDURES */
/* DEFAULT RULES FOR GCOS */
".SUFFIXES : .d .c .y .lib",
/* all kinds of static declarations that must be used.. */
static double day
{ 64*1000*60*60*24 }; /* length of day in clock ticks */
struct { int lhs
:18, rhs
:18; };
datcreat
, datmod
, datused
,
struct { int :3, slot
:18; }; /* slot where time from cat. block fits */
int cat1
, cat2
, cpass1
, cpass2
,
file1
, file2
, filep1
, filep2
,
extern int _q_reg
, _a_reg
;
# define A10(x,y) 10*x + y
/* interpret the mm/dd/yy format */
struct d9
{ int :5, m1
:4, :5, m2
:4, :9,
struct d6
{ int :2, m61
:4, :2, m62
:4,
static day6( d6word
){ /* return the day number of a word in bci format */
y
= A10( d6word
.y61
, d6word
.y62
);
m
= A10( d6word
.m61
, d6word
.m62
);
d
= A10( d6word
.d61
, d6word
.d62
);
return( d
+ 31*( m
+ 12*(y
-YZERO
) ) );
static day9( p
) register int *p
; {
return( d
+ 31*( m
+ 12*(y
-YZERO
) ) );
static int dfold( dayno
, timeno
){
kk
= ( day
*dayno
+ timeno
) / 32768.;
return( dfold( day9(date
), _q_reg
) );
# define DODRL ar[0] = status; ar[1] = &b.cat1; drldrl(30,sp1,sp2); p=ar[0]<<18;
static struct { int fn1
, fn2
; int ftm
; } fbb
[MAXCSIZE
];
b
.cat1
= b
.cat2
= b
.file1
= -1;
b
.cpass1
= b
.cpass2
= 0202020202020;
for( i
=0; p
!=0 && i
<MAXCSIZE
; ++i
){
fbb
[i
].fn1
= b
.file1
= p
->name1
;
fbb
[i
].fn2
= b
.file2
= p
->name2
;
fbb
[i
].ftm
= dfold( day6(p
->datmod
), temp
);
cheat about names with slashes -- try opening;
if it is openable, it exists, and assume it was made
at t=1 (long time ago); otherwise, assume it
if(i
= copen(cp
,'r') < 0)
if(gtcalled
== 0) getcat();
for( i
=0; *cp
; ++i
) name
[i
] = *cp
++;
while( i
<12 ) name
[i
++] = ' ';
for ( i
=0; i
<catsiz
; ++i
){
if( fbb
[i
].fn1
== bcd
[0] && fbb
[i
].fn2
== bcd
[1] )
static char *n13end
&n13
[12];
struct depblock
*srchdir(pat
, mkchain
, nextdbl
)
char *pat
; /* pattern to be matched in directory */
int mkchain
; /* nonzero if results to be remembered */
struct depblock
*nextdbl
; /* final value for chain */
char *dirname
, *dirpref
, *endir
, *filepat
, *p
, temp
[100];
char fullname
[100], *p1
, *p2
, *copys();
struct depblock
*thisdbl
;
if(gtcalled
== 0) getcat();
for(patp
=firstpat
; patp
!=0 ; patp
= patp
->nxtpattern
)
if(! unequal(pat
, patp
->patval
)) return(0);
patp
->nxtpattern
= firstpat
;
patp
->patval
= copys(pat
);
for(p
=pat
; *p
!='\0'; ++p
)
fatal("File name has an embedded slash");
dirpref
= concat(dirname
, "/", temp
);
f6to9(*intp1
, *intp2
, 12);
for(p1
=n13
; p1
<n13end
&& *p1
!=' ' ; ++p1
)
if('A'<=*p1
&& *p1
<='Z') *p1
=+ ('a'-'A');
if( amatch(n13
,filepat
) )
concat(dirpref
,n13
,fullname
);
if( (q
=srchname(fullname
)) ==0)
q
= makename(copys(fullname
));
thisdbl
= ALLOC(depblock
);
thisdbl
->nextp
= nextdbl
;
if(endir
!= 0) *endir
= '/';
/* stolen from glob through find */
return(amatch(++s
, ++p
));
k
=| lc
<= scc
& scc
<= (cc
=p
[1]);
if(scc
) return(amatch(++s
, ++p
));
if (amatch(s
++,p
)) return(1);
for(p
=comstring
; *p
!='\0' ; ++p
);
fatal("Command string longer than 80 characters");
fprintf(stderr
, "touch not yet implemented on GCOS\n");