* netrm - remove an entry from the network queue.
* first does a creat to truncate the file to zero length in
* case it is being sent. (this stops the daemon!) Next the
char pathname
[]= NETRMNAME
;
static struct stat statbuf
;
static struct direct dirbuf
;
int cnt
, mach
, i
, all
= 0;
printf("usage: netrm [-] file1 file2 ... filen\n");
hisuid
= uidmask(hisuid
);
while (++cnt
< argc
)rmfile(argv
[cnt
]);
visit
[local
- 'a'] = 1; /* skip this machine */
for(i
= 'a'; i
<= 'z'; i
++)
if((mach
= gothru(local
,i
)) && !visit
[mach
- 'a']){
senddir
[strlen(senddir
)-1] = mach
;
if(df
== NULL
|| chdir(str
) < 0){
while(fread(&dirbuf
,1,sizeof dirbuf
,df
) == sizeof dirbuf
){
|| dirbuf
.d_name
[0] != 'd'
|| dirbuf
.d_name
[1] != 'f'
|| stat(dirbuf
.d_name
,&statbuf
) < 0)
if(guid(statbuf
.st_uid
,statbuf
.st_gid
) != hisuid
)
/* kludge in file name */
dirbuf
.d_name
[3] = dirbuf
.d_name
[2];
if(str
[0] != 'd' || str
[1] != 'f' || str
[3] != 'a'){
cp
= pathname
+ strlen(pathname
) - 10;
while(*cp
!= '\0' && (*cp
++ = *ap
++));
pathname
[strlen(pathname
) - 11] = str
[2]; /* set dir for mach */
if (stat(pathname
,&statbuf
) < 0) {
tt
= guid(statbuf
.st_uid
,statbuf
.st_gid
);
if(tt
!= hisuid
&& hisuid
!= 0) {
printf("%s: Permission Denied\n",ostr
);
printf("removing file %s\n",ostr
);