1 /*-
2  * Copyright (c) 2001, 2004 Lev Walkin <vlm@lionet.info>.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $Id: usage.c,v 1.14 2004/04/12 09:07:18 vlm Exp $
27  */
28 
29 
30 #include "ipcad.h"
31 
32 void
usage()33 usage() {
34 
35 	fprintf(stderr,
36 	IPCAD_VERSION_STRING
37 	IPCAD_COPYRIGHT "\n"
38 	"Usage: ipcad [-hv] [-d] [-c <config>] [-r] [-s]\n"
39 	"Options are:\n"
40 	"\t-h:\tthis page\n"
41 	"\t-v:\tversion information\n"
42 	"\t-c:\tspecify configuration file\n"
43 	"\t-d:\tbecome daemon (otherwise, work in foreground)\n"
44 	"\t-r:\timport the dump file on startup\n"
45 	"\t-s:\tdump the active table on exit\n"
46 	);
47 
48 #ifdef	EX_USAGE
49 	exit(EX_USAGE);
50 #else
51 	exit(1);
52 #endif
53 };
54 
55 void
rsh_usage(FILE * f)56 rsh_usage(FILE *f) {
57 
58 	if(!f)
59 		return;
60 
61 	fprintf(f,
62 	"Builtin commands:\n"
63 	"\tshow ip accounting\t # Show actual IP accounting\n"
64 	"\tclear ip accounting\t # Move IP accounting to checkpoint\n"
65 	"\tshow ip accounting checkpoint\t # Show saved IP accounting\n"
66 	"\tclear ip accounting checkpoint\t # Clear checkpoint database\n"
67 	"\n"
68 	"\tshow ip cache flow\t # Show NetFlow cache\n"
69 	"\n"
70 	"\tshow interface <iface>\t # Show interface counters\n"
71 	"\n"
72 	"\tdump [<path>]   \t # Dump current IP accounting\n"
73 	"\trestore [<path>]\t # Restore IP accounting\n"
74 	"\timport [<path>] \t # Import (add) IP accounting\n"
75 	"\n"
76 	"\tstat            \t # Show current statistics\n"
77 	"\tshow version    \t # Show version and uptime\n"
78 	"\n"
79 	"\tshutdown        \t # Shutdown ipcad\n"
80 	);
81 
82 };
83 
84