aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-04-05 23:22:14 -0800
committerDavid M. Syzdek <david@syzdek.net>2022-04-05 23:25:14 -0800
commitbdff93464cb854e29d9e02660be65b26ceb8d4bf (patch)
treef5adc8611bc7ab4a96929c6e5239d3bfe90d113a /src
parent771b32848ccf7193a5bd47e7609e0cb55da6ba5c (diff)
downloadtinytac-bdff93464cb854e29d9e02660be65b26ceb8d4bf.tar.gz
tinytac-bdff93464cb854e29d9e02660be65b26ceb8d4bf.tar.bz2
tinytac-bdff93464cb854e29d9e02660be65b26ceb8d4bf.tar.xz
tinytac-bdff93464cb854e29d9e02660be65b26ceb8d4bf.zip
project: adding source code stubs
Diffstat (limited to 'src')
-rw-r--r--src/ttu/tinytacutil.c180
-rw-r--r--src/ttu/tinytacutil.h94
2 files changed, 274 insertions, 0 deletions
diff --git a/src/ttu/tinytacutil.c b/src/ttu/tinytacutil.c
new file mode 100644
index 0000000..c45e3ed
--- /dev/null
+++ b/src/ttu/tinytacutil.c
@@ -0,0 +1,180 @@
1/*
2 * Tiny TACACS+ Client Library
3 * Copyright (C) 2022 David M. Syzdek <david@syzdek.net>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of David M. Syzdek nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31#define _SRC_TRU_TINYTACUTIL_C 1
32#include "tinytacutil.h"
33
34///////////////
35// //
36// Headers //
37// //
38///////////////
39#pragma mark - Headers
40
41#include <stdio.h>
42#include <stdlib.h>
43#include <string.h>
44#include <strings.h>
45#include <unistd.h>
46#include <getopt.h>
47#include <unistd.h>
48#include <assert.h>
49#include <errno.h>
50
51
52///////////////////
53// //
54// Definitions //
55// //
56///////////////////
57#pragma mark - Definitions
58
59#undef PROGRAM_NAME
60#define PROGRAM_NAME "tinytac"
61
62#ifndef PACKAGE_BUGREPORT
63# define PACKAGE_BUGREPORT "unknown"
64#endif
65#ifndef PACKAGE_COPYRIGHT
66# define PACKAGE_COPYRIGHT "unknown"
67#endif
68#ifndef PACKAGE_NAME
69# define PACKAGE_NAME "Tiny RADIUS Client Library"
70#endif
71#ifndef PACKAGE_VERSION
72# define PACKAGE_VERSION "unknown"
73#endif
74
75
76//////////////////
77// //
78// Data Types //
79// //
80//////////////////
81#pragma mark - Data Types
82
83
84//////////////////
85// //
86// Prototypes //
87// //
88//////////////////
89#pragma mark - Prototypes
90
91int
92main(
93 int argc,
94 char * argv[] );
95
96
97/////////////////
98// //
99// Variables //
100// //
101/////////////////
102#pragma mark - Variables
103
104
105/////////////////
106// //
107// Functions //
108// //
109/////////////////
110#pragma mark - Functions
111
112//---------------//
113// main function //
114//---------------//
115#pragma mark main function
116
117int main(int argc, char * argv[])
118{
119 int c;
120 int opt_index;
121
122 // getopt options
123 static char short_opt[] = "hVvq";
124 static struct option long_opt[] =
125 {
126 {"help", no_argument, NULL, 'h' },
127 {"quiet", no_argument, NULL, 'q' },
128 {"silent", no_argument, NULL, 'q' },
129 {"version", no_argument, NULL, 'V' },
130 {"verbose", no_argument, NULL, 'v' },
131 { NULL, 0, NULL, 0 }
132 };
133
134 while((c = getopt_long(argc, argv, short_opt, long_opt, &opt_index)) != -1)
135 {
136 switch(c)
137 {
138 case -1: /* no more arguments */
139 case 0: /* long options toggles */
140 break;
141
142 case 'd':
143 break;
144
145 case 'h':
146 printf("Usage: %s [OPTIONS]\n", PROGRAM_NAME);
147 printf("OPTIONS:\n");
148 printf(" -d, --debug print debug messages\n");
149 printf(" -h, --help print this help and exit\n");
150 printf(" -q, --quiet, --silent do not print messages\n");
151 printf(" -V, --version print version number and exit\n");
152 printf(" -v, --verbose print verbose messages\n");
153 printf("\n");
154 return(0);
155
156 case 'q':
157 break;
158
159 case 'V':
160 printf("%s (%s) %s\n", PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION);
161 return(0);
162
163 case 'v':
164 break;
165
166 case '?':
167 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME);
168 return(1);
169
170 default:
171 fprintf(stderr, "%s: unrecognized option `--%c'\n", PROGRAM_NAME, c);
172 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME);
173 return(1);
174 };
175 };
176
177 return(0);
178}
179
180/* end of source */
diff --git a/src/ttu/tinytacutil.h b/src/ttu/tinytacutil.h
new file mode 100644
index 0000000..6db8e96
--- /dev/null
+++ b/src/ttu/tinytacutil.h
@@ -0,0 +1,94 @@
1/*
2 * Tiny TACACS+ Client Library
3 * Copyright (C) 2022 David M. Syzdek <david@syzdek.net>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of David M. Syzdek nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31#ifndef _SRC_TRU_TINYTACUTIL_H
32#define _SRC_TRU_TINYTACUTIL_H 1
33
34///////////////
35// //
36// Headers //
37// //
38///////////////
39#pragma mark - Headers
40
41#include <tinytac_compat.h>
42
43#include <stdio.h>
44#include <stdarg.h>
45#include <stdlib.h>
46#include <string.h>
47#include <strings.h>
48#include <unistd.h>
49#include <getopt.h>
50#include <sys/types.h>
51#include <sys/stat.h>
52#include <sys/uio.h>
53#include <unistd.h>
54#include <assert.h>
55#include <fcntl.h>
56#include <errno.h>
57
58
59///////////////////
60// //
61// Definitions //
62// //
63///////////////////
64#pragma mark - Definitions
65
66#undef PROGRAM_NAME
67#define PROGRAM_NAME "tinytac"
68
69
70//////////////////
71// //
72// Data Types //
73// //
74//////////////////
75#pragma mark - Data Types
76
77
78/////////////////
79// //
80// Variables //
81// //
82/////////////////
83#pragma mark - Variables
84
85
86//////////////////
87// //
88// Prototypes //
89// //
90//////////////////
91#pragma mark - Prototypes
92
93
94#endif /* end of header */