static char sccsid
[] = "@(#)xsend.c 4.6 5/11/89";
char *myname
, *dest
, *keyfile
[128], line
[128];
char *maildir
= _PATH_SECRETMAIL
;
MINT
*a
[42], *cd
[6][128];
extern char *malloc(), *getlogin();
main(argc
, argv
) char **argv
;
xfatal("mail to exactly one person");
p
= getpwuid(uid
)->pw_name
;
myname
= malloc(strlen(p
)+1);
strcpy(keyfile
, maildir
);
if(stat(keyfile
, &stbuf
) <0)
xfatal("addressee not enrolled");
destuid
= getpwnam(dest
)->pw_uid
;
if(destuid
!= stbuf
.st_uid
)
fprintf(stderr
, "warning: addressee's key file may be subverted\n");
kf
= fopen(keyfile
, "r");
xfatal("addressee's key weird");
while ((dbuf
=readdir(df
))!=NULL
)
{ if(sscanf(dbuf
->d_name
, line
, &i
) != 1)
{ sprintf(line
, "%s%s.%d", maildir
, dest
, nmax
+i
);
if(creat(line
, 0666) >= 0) break;
if(i
==10) xfatal("cannot create mail file");
sprintf(buf
, "From %s %s", myname
, ctime(&now
) );
char hostname
[MAXHOSTNAMELEN
];
sprintf(buf
, "%s %s", _PATH_MAIL
, dest
);
if ((nf
= popen(buf
, "w")) == NULL
)
xfatal("cannot pipe to %s", _PATH_MAIL
);
passp
= getpwuid(getuid());
gethostname(hostname
, sizeof(hostname
));
fprintf(nf
, "Subject: %s@%s sent you secret mail\n",
passp
->pw_name
, hostname
);
"Your secret mail can be read on host %s using ``xget''.\n",
for(k
=j
, n
=0; k
>0 && n
<7; n
++, k
>>=1)
if(k
&01) madd(cd
[i
][j
], a
[7*i
+n
], cd
[i
][j
]);
madd(msg
, cd
[i
][s
[i
]&0177], msg
);
fgets(p
, sizeof(buf
)-6, stdin
);
if(strcmp(p
, ".\n") == 0 || feof(stdin
))
{ for(i
=0; i
<6; i
++) *p
++ = ' ';