xref: /openbsd/lib/libkeynote/keynote-main.c (revision d415bd75)
1 /* $OpenBSD: keynote-main.c,v 1.10 2004/06/25 05:06:49 msf Exp $ */
2 /*
3  * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
4  *
5  * This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
6  * in April-May 1998
7  *
8  * Copyright (C) 1998, 1999 by Angelos D. Keromytis.
9  *
10  * Permission to use, copy, and modify this software with or without fee
11  * is hereby granted, provided that this entire notice is included in
12  * all copies of any software which is or includes a copy or
13  * modification of this software.
14  *
15  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
16  * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
17  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
18  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
19  * PURPOSE.
20  */
21 
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 
25 #include <ctype.h>
26 #include <fcntl.h>
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30 #include <unistd.h>
31 
32 #include "header.h"
33 
34 void	mainusage(void);
35 
36 void
37 mainusage(void)
38 {
39     fprintf(stderr, "Usage:\n");
40     fprintf(stderr, "\tkeygen ...\n");
41     fprintf(stderr, "\tsign ...\n");
42     fprintf(stderr, "\tsigver ...\n");
43     fprintf(stderr, "\tverify ...\n");
44     fprintf(stderr, "Issue one of the commands by itself to get more help, "
45 		    "e.g., keynote sign\n");
46 }
47 
48 int
49 main(int argc, char *argv[])
50 {
51     if (argc < 2)
52     {
53 	mainusage();
54 	exit(1);
55     }
56 
57     if (!strcmp(argv[1], "sign"))
58       keynote_sign(argc - 1, argv + 1);
59     else
60       if (!strcmp(argv[1], "verify"))
61 	keynote_verify(argc - 1, argv + 1);
62       else
63 	if (!strcmp(argv[1], "sigver"))
64 	  keynote_sigver(argc - 1, argv + 1);
65 	else
66 	  if (!strcmp(argv[1], "keygen"))
67 	    keynote_keygen(argc - 1, argv + 1);
68 
69     mainusage();
70     exit(1);
71 }
72