xref: /csrg-svn/usr.bin/xsend/enroll/enroll.c (revision 11785)
1*11785Ssam #ifndef lint
2*11785Ssam static char sccsid[] = "@(#)enroll.c	4.1 03/30/83";
3*11785Ssam #endif
4*11785Ssam 
5*11785Ssam #include "xmail.h"
6*11785Ssam #include "pwd.h"
7*11785Ssam #include "sys/types.h"
8*11785Ssam MINT *a[42], *x, *b, *one, *c64, *t45, *z, *q, *r, *two, *t15;
9*11785Ssam char buf[256];
10*11785Ssam char maildir[] = { "/usr/spool/secretmail"};
11*11785Ssam main()
12*11785Ssam {
13*11785Ssam 	int uid, i;
14*11785Ssam 	FILE *fd;
15*11785Ssam 	char *myname, fname[128];
16*11785Ssam 	uid = getuid();
17*11785Ssam 	myname = getlogin();
18*11785Ssam 	if(myname == NULL)
19*11785Ssam 		myname = getpwuid(uid)->pw_name;
20*11785Ssam 	sprintf(fname, "%s/%s.key", maildir, myname);
21*11785Ssam 	comminit();
22*11785Ssam 	setup(getpass("Gimme key: "));
23*11785Ssam 	mkb();
24*11785Ssam 	mkx();
25*11785Ssam #ifdef debug
26*11785Ssam 	omout(b);
27*11785Ssam 	omout(x);
28*11785Ssam #endif
29*11785Ssam 	mka();
30*11785Ssam 	i = creat(fname, 0644);
31*11785Ssam 	if(i<0)
32*11785Ssam 	{	perror("fname");
33*11785Ssam 		exit(1);
34*11785Ssam 	}
35*11785Ssam 	close(i);
36*11785Ssam 	fd = fopen(fname, "w");
37*11785Ssam 	for(i=0; i<42; i++)
38*11785Ssam 		nout(a[i], fd);
39*11785Ssam 	exit(0);
40*11785Ssam }
41