1*e0758482Smsf /* $OpenBSD: keynote-main.c,v 1.10 2004/06/25 05:06:49 msf Exp $ */
2e482c692Sangelos /*
3e482c692Sangelos * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
4e482c692Sangelos *
5e482c692Sangelos * This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
6e482c692Sangelos * in April-May 1998
7e482c692Sangelos *
8e482c692Sangelos * Copyright (C) 1998, 1999 by Angelos D. Keromytis.
9e482c692Sangelos *
105e4ac158Sderaadt * Permission to use, copy, and modify this software with or without fee
11e482c692Sangelos * is hereby granted, provided that this entire notice is included in
12e482c692Sangelos * all copies of any software which is or includes a copy or
13e482c692Sangelos * modification of this software.
14e482c692Sangelos *
15e482c692Sangelos * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
16e482c692Sangelos * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
17e482c692Sangelos * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
18e482c692Sangelos * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
19e482c692Sangelos * PURPOSE.
20e482c692Sangelos */
21e482c692Sangelos
22e482c692Sangelos #include <sys/types.h>
23e482c692Sangelos #include <sys/stat.h>
24*e0758482Smsf
25*e0758482Smsf #include <ctype.h>
26*e0758482Smsf #include <fcntl.h>
27e482c692Sangelos #include <stdlib.h>
28e482c692Sangelos #include <stdio.h>
299186b70cSangelos #include <string.h>
30e482c692Sangelos #include <unistd.h>
31e482c692Sangelos
32a8a6ad51Sangelos #include "header.h"
33e482c692Sangelos
34aa31cba2Sderaadt void mainusage(void);
35aa31cba2Sderaadt
36d3eba4dbSangelos void
mainusage(void)37aa31cba2Sderaadt mainusage(void)
38d3eba4dbSangelos {
39d3eba4dbSangelos fprintf(stderr, "Usage:\n");
40*e0758482Smsf fprintf(stderr, "\tkeygen ...\n");
41d3eba4dbSangelos fprintf(stderr, "\tsign ...\n");
42d3eba4dbSangelos fprintf(stderr, "\tsigver ...\n");
43d3eba4dbSangelos fprintf(stderr, "\tverify ...\n");
447c54d23fSangelos fprintf(stderr, "Issue one of the commands by itself to get more help, "
457c54d23fSangelos "e.g., keynote sign\n");
46d3eba4dbSangelos }
47d3eba4dbSangelos
48e482c692Sangelos int
main(int argc,char * argv[])49e482c692Sangelos main(int argc, char *argv[])
50e482c692Sangelos {
5182db8f81Sangelos if (argc < 2)
5282db8f81Sangelos {
53d3eba4dbSangelos mainusage();
543cb7a939Sangelos exit(1);
5582db8f81Sangelos }
56e482c692Sangelos
5782db8f81Sangelos if (!strcmp(argv[1], "sign"))
5882db8f81Sangelos keynote_sign(argc - 1, argv + 1);
5982db8f81Sangelos else
6082db8f81Sangelos if (!strcmp(argv[1], "verify"))
6182db8f81Sangelos keynote_verify(argc - 1, argv + 1);
6282db8f81Sangelos else
6382db8f81Sangelos if (!strcmp(argv[1], "sigver"))
6482db8f81Sangelos keynote_sigver(argc - 1, argv + 1);
6582db8f81Sangelos else
6682db8f81Sangelos if (!strcmp(argv[1], "keygen"))
6782db8f81Sangelos keynote_keygen(argc - 1, argv + 1);
6882db8f81Sangelos
69d3eba4dbSangelos mainusage();
703cb7a939Sangelos exit(1);
71e482c692Sangelos }
72