static char sccsid
[] = "@(#)netrm.c 4.2 (Berkeley) 9/12/82";
static char *netrm_sid
= "@(#)netrm.c 1.2";
* 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
;
int cnt
, mach
, i
, all
= 0;
printf("usage: netrm [-] file1 file2 ... filen\n");
hisuid
= uidmask(hisuid
);
while (++cnt
< argc
)rmfile(argv
[cnt
]);
visit
[chtoinx(local
)] = 1; /* skip this machine */
for(i
= 0; i
< MAXINX
; i
++)
if((mach
= gothru(local
,inxtoch(i
)))
&& !visit
[chtoinx(mach
)]){
visit
[chtoinx(mach
)] = 1;
senddir
[strlen(senddir
)-1] = mach
;
register struct direct
*dp
;
while((dp
= readdir(df
)) != NULL
){
|| stat(dp
->d_name
,&statbuf
) < 0)
if(guid(statbuf
.st_uid
,statbuf
.st_gid
) != hisuid
)
/* kludge in file name */
dp
->d_name
[3] = dp
->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
);