xref: /csrg-svn/usr.bin/xsend/enroll/enroll.c (revision 62464)
148337Sbostic /*-
248337Sbostic  * %sccs.include.proprietary.c%
348337Sbostic  */
448337Sbostic 
511785Ssam #ifndef lint
6*62464Sbostic static char sccsid[] = "@(#)enroll.c	8.1 (Berkeley) 06/06/93";
748337Sbostic #endif /* not lint */
811785Ssam 
937916Sbostic #include <sys/types.h>
1037916Sbostic #include <pwd.h>
1111785Ssam #include "xmail.h"
1237916Sbostic #include "pathnames.h"
1337916Sbostic 
1411785Ssam MINT *a[42], *x, *b, *one, *c64, *t45, *z, *q, *r, *two, *t15;
1511785Ssam char buf[256];
1637916Sbostic char maildir[] = _PATH_SECRETMAIL;
main()1711785Ssam main()
1811785Ssam {
1911785Ssam 	int uid, i;
2011785Ssam 	FILE *fd;
2111785Ssam 	char *myname, fname[128];
2211785Ssam 	uid = getuid();
2312564Sralph 	myname = (char *) getlogin();
2411785Ssam 	if(myname == NULL)
2511785Ssam 		myname = getpwuid(uid)->pw_name;
2611785Ssam 	sprintf(fname, "%s/%s.key", maildir, myname);
2711785Ssam 	comminit();
2811785Ssam 	setup(getpass("Gimme key: "));
2911785Ssam 	mkb();
3011785Ssam 	mkx();
3111785Ssam #ifdef debug
3211785Ssam 	omout(b);
3311785Ssam 	omout(x);
3411785Ssam #endif
3511785Ssam 	mka();
3611785Ssam 	i = creat(fname, 0644);
3711785Ssam 	if(i<0)
3812564Sralph 	{	perror(fname);
3911785Ssam 		exit(1);
4011785Ssam 	}
4111785Ssam 	close(i);
4211785Ssam 	fd = fopen(fname, "w");
4311785Ssam 	for(i=0; i<42; i++)
4411785Ssam 		nout(a[i], fd);
4511785Ssam 	exit(0);
4611785Ssam }
47