Annotation of templates/template.c, revision 1.1.1.1
1.1 nick 1: /* *****************************************************************************
2: *
3: * Copyright Nicholas DeClario 2010
4: * Nicholas DeClario <nick@demandred.dyndns.org>
5: * June 2009
6: * $Id$
7: *
8: * ****************************************************************************/
9: #include <ctype.h>
10: #include <stdio.h>
11: #include <stdlib.h>
12: #include <unistd.h>
13: #include <time.h>
14: #include <sys/types.h>
15:
16: /*
17: * Static Defines
18: */
19: #define VERSION "$Id$"
20:
21: /*
22: * Structures
23: */
24: typedef struct {
25: int help;
26: } optsObj;
27:
28: /*
29: * Function prototypes
30: */
31: optsObj fetchOptions( int argc, char **argv );
32: void dispHelp( void );
33:
34: /*
35: * Variable declarations
36: */
37: optsObj opts;
38:
39:
40: /* ****************************************************************************
41: *
42: * opts = fetchOptions( argc, argv );
43: *
44: * Grab our command line arguments and toss them in to optsObj struct
45: *
46: * ***************************************************************************/
47: optsObj fetchOptions( int argc, char **argv ) {
48: optsObj obj;
49: int c;
50:
51: while( ( c = getopt ( argc, argv, "h:" ) ) != -1 )
52: switch( c ) {
53: case 'h':
54: opts.help = 1;
55: dispHelp( );
56: break;
57: default:
58: dispHelp( );
59: }
60:
61: return obj;
62: }
63:
64: /* ****************************************************************************
65: *
66: * Display the default help screen
67: *
68: * ***************************************************************************/
69: void dispHelp( void ) {
70: fprintf( stderr, "Usage ...\n" );
71: exit( 2 );
72: }
73:
74: /* ****************************************************************************
75: *
76: * Our main program starts here
77: *
78: * ***************************************************************************/
79: int main( int argc, char **argv ) {
80: opts = fetchOptions( argc, argv );
81:
82: return EXIT_SUCCESS;
83: }
84:
85:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>