diff options
| author | David M. Syzdek <david@syzdek.net> | 2022-06-02 01:00:02 -0800 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2022-06-02 01:00:02 -0800 |
| commit | 1f40773047aee56b7c9fc4140b438a311640190d (patch) | |
| tree | 3ee6f3acff53797cd9468b51049bab0f197ecf53 /src | |
| parent | 47fa849089576b39d70db0df54bd725f754c7668 (diff) | |
| download | tinytac-1f40773047aee56b7c9fc4140b438a311640190d.tar.gz tinytac-1f40773047aee56b7c9fc4140b438a311640190d.tar.bz2 tinytac-1f40773047aee56b7c9fc4140b438a311640190d.tar.xz tinytac-1f40773047aee56b7c9fc4140b438a311640190d.zip | |
tinytac: adding stubs for initial widgets
Diffstat (limited to 'src')
| -rw-r--r-- | src/ttu/tinytacutil.c | 359 | ||||
| -rw-r--r-- | src/ttu/tinytacutil.h | 111 | ||||
| -rw-r--r-- | src/ttu/widget-acct.c | 110 | ||||
| -rw-r--r-- | src/ttu/widget-authen.c | 110 | ||||
| -rw-r--r-- | src/ttu/widget-author.c | 110 | ||||
| -rw-r--r-- | src/ttu/widget-config.c | 68 |
6 files changed, 840 insertions, 28 deletions
diff --git a/src/ttu/tinytacutil.c b/src/ttu/tinytacutil.c index 4287eb1..3cd1f2b 100644 --- a/src/ttu/tinytacutil.c +++ b/src/ttu/tinytacutil.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. |
| 30 | */ | 30 | */ |
| 31 | #define _SRC_TRU_TINYTACUTIL_C 1 | 31 | #define _SRC_TTU_TINYTACUTIL_C 1 |
| 32 | #include "tinytacutil.h" | 32 | #include "tinytacutil.h" |
| 33 | 33 | ||
| 34 | /////////////// | 34 | /////////////// |
| @@ -45,10 +45,12 @@ | |||
| 45 | #include <unistd.h> | 45 | #include <unistd.h> |
| 46 | #include <getopt.h> | 46 | #include <getopt.h> |
| 47 | #include <unistd.h> | 47 | #include <unistd.h> |
| 48 | #include <stdarg.h> | ||
| 48 | #include <assert.h> | 49 | #include <assert.h> |
| 49 | #include <errno.h> | 50 | #include <errno.h> |
| 50 | 51 | ||
| 51 | #include <tinytac.h> | 52 | #include <tinytac.h> |
| 53 | #include <bindle_prefix.h> | ||
| 52 | 54 | ||
| 53 | 55 | ||
| 54 | /////////////////// | 56 | /////////////////// |
| @@ -96,6 +98,17 @@ main( | |||
| 96 | char * argv[] ); | 98 | char * argv[] ); |
| 97 | 99 | ||
| 98 | 100 | ||
| 101 | static void | ||
| 102 | ttu_cleanup( | ||
| 103 | ttu_config_t * cnf ); | ||
| 104 | |||
| 105 | |||
| 106 | static ttu_widget_t * | ||
| 107 | ttu_widget_lookup( | ||
| 108 | const char * wname, | ||
| 109 | int exact ); | ||
| 110 | |||
| 111 | |||
| 99 | ///////////////// | 112 | ///////////////// |
| 100 | // // | 113 | // // |
| 101 | // Variables // | 114 | // Variables // |
| @@ -103,6 +116,46 @@ main( | |||
| 103 | ///////////////// | 116 | ///////////////// |
| 104 | #pragma mark - Variables | 117 | #pragma mark - Variables |
| 105 | 118 | ||
| 119 | #pragma mark ttu_widget_map[] | ||
| 120 | ttu_widget_t ttu_widget_map[] = | ||
| 121 | { | ||
| 122 | { .name = "acct", | ||
| 123 | .desc = "TACACS+ accounting client", | ||
| 124 | .usage = NULL, | ||
| 125 | .aliases = (const char * const[]) { "accounting", NULL }, | ||
| 126 | .func_exec = &ttu_widget_acct, | ||
| 127 | .func_usage = NULL, | ||
| 128 | }, | ||
| 129 | { .name = "authen", | ||
| 130 | .desc = "TACACS+ authentication client", | ||
| 131 | .usage = " username", | ||
| 132 | .aliases = (const char * const[]) { "authentication", NULL }, | ||
| 133 | .func_exec = &ttu_widget_authen, | ||
| 134 | .func_usage = NULL, | ||
| 135 | }, | ||
| 136 | { .name = "author", | ||
| 137 | .desc = "TACACS+ authorization client", | ||
| 138 | .usage = " username cmd [ arg1 arg2 ... argN ]", | ||
| 139 | .aliases = (const char * const[]) { "authorization", NULL }, | ||
| 140 | .func_exec = &ttu_widget_author, | ||
| 141 | .func_usage = NULL, | ||
| 142 | }, | ||
| 143 | { .name = "config", | ||
| 144 | .desc = "print configuration", | ||
| 145 | .usage = NULL, | ||
| 146 | .aliases = (const char * const[]) { "configuration", NULL }, | ||
| 147 | .func_exec = &ttu_widget_config, | ||
| 148 | .func_usage = NULL, | ||
| 149 | }, | ||
| 150 | { .name = NULL, | ||
| 151 | .desc = NULL, | ||
| 152 | .usage = NULL, | ||
| 153 | .aliases = NULL, | ||
| 154 | .func_exec = NULL, | ||
| 155 | .func_usage = NULL, | ||
| 156 | } | ||
| 157 | }; | ||
| 158 | |||
| 106 | 159 | ||
| 107 | ///////////////// | 160 | ///////////////// |
| 108 | // // | 161 | // // |
| @@ -118,13 +171,156 @@ main( | |||
| 118 | 171 | ||
| 119 | int main(int argc, char * argv[]) | 172 | int main(int argc, char * argv[]) |
| 120 | { | 173 | { |
| 121 | int c; | ||
| 122 | int rc; | 174 | int rc; |
| 123 | int opt; | 175 | ttu_config_t cnfdata; |
| 124 | int opt_index; | 176 | |
| 177 | memset(&cnfdata, 0, sizeof(cnfdata)); | ||
| 178 | |||
| 179 | // determine program name | ||
| 180 | if ((cnfdata.prog_name = strrchr(argv[0], '/')) != NULL) | ||
| 181 | cnfdata.prog_name = &cnfdata.prog_name[1]; | ||
| 182 | if (!(cnfdata.prog_name)) | ||
| 183 | cnfdata.prog_name = argv[0]; | ||
| 184 | |||
| 185 | // initialize state | ||
| 186 | if ((rc = tinytac_set_option(NULL, TTAC_OPT_DEBUG_IDENT, PROGRAM_NAME)) != TTAC_SUCCESS) | ||
| 187 | { | ||
| 188 | fprintf(stderr, "%s: tinytac_set_option(%s): %s\n", PROGRAM_NAME, "TTAC_OPT_DEBUG_IDENT", tinytac_strerror(rc)); | ||
| 189 | return(1); | ||
| 190 | }; | ||
| 191 | if ((rc = tinytac_initialize(&cnfdata.tt, NULL, NULL, 0)) != TTAC_SUCCESS) | ||
| 192 | { | ||
| 193 | fprintf(stderr, "%s: tinytac_initialize(): %s\n", PROGRAM_NAME, tinytac_strerror(rc)); | ||
| 194 | return(1); | ||
| 195 | }; | ||
| 196 | |||
| 197 | // skip argument processing if called via alias | ||
| 198 | if ((cnfdata.widget = ttu_widget_lookup(cnfdata.prog_name, TTAC_YES)) != NULL) | ||
| 199 | { | ||
| 200 | cnfdata.argc = argc; | ||
| 201 | cnfdata.argv = argv; | ||
| 202 | rc = cnfdata.widget->func_exec(&cnfdata); | ||
| 203 | ttu_cleanup(&cnfdata); | ||
| 204 | return(rc); | ||
| 205 | }; | ||
| 206 | |||
| 207 | // initial processing of cli arguments | ||
| 208 | if ((rc = ttu_cli_arguments(&cnfdata, argc, argv)) != 0) | ||
| 209 | return((rc == -1) ? 0 : 1); | ||
| 210 | if ((argc - optind) < 1) | ||
| 211 | { | ||
| 212 | fprintf(stderr, "%s: missing required argument\n", cnfdata.prog_name); | ||
| 213 | fprintf(stderr, "Try `%s --help' for more information.\n", cnfdata.prog_name); | ||
| 214 | return(1); | ||
| 215 | }; | ||
| 216 | cnfdata.argc = (argc - optind); | ||
| 217 | cnfdata.argv = &argv[optind]; | ||
| 218 | |||
| 219 | // looks up widget | ||
| 220 | if ((cnfdata.widget = ttu_widget_lookup(argv[optind], TTAC_NO)) == NULL) | ||
| 221 | { | ||
| 222 | fprintf(stderr, "%s: unknown or ambiguous widget -- \"%s\"\n", cnfdata.prog_name, cnfdata.argv[0]); | ||
| 223 | fprintf(stderr, "Try `%s --help' for more information.\n", cnfdata.prog_name); | ||
| 224 | return(1); | ||
| 225 | }; | ||
| 226 | |||
| 227 | rc = cnfdata.widget->func_exec(&cnfdata); | ||
| 228 | ttu_cleanup(&cnfdata); | ||
| 229 | |||
| 230 | return(rc); | ||
| 231 | } | ||
| 232 | |||
| 233 | |||
| 234 | //-------------------// | ||
| 235 | // logging functions // | ||
| 236 | //-------------------// | ||
| 237 | #pragma mark logging functions | ||
| 238 | |||
| 239 | int | ||
| 240 | ttu_error( | ||
| 241 | ttu_config_t * cnf, | ||
| 242 | int rc, | ||
| 243 | const char * fmt, | ||
| 244 | ... ) | ||
| 245 | { | ||
| 246 | va_list args; | ||
| 247 | if ((cnf->opts & TTUTILS_OPT_QUIET)) | ||
| 248 | return(rc); | ||
| 249 | fprintf(stderr, "%s: ", (((cnf->prog_name)) ? cnf->prog_name : PROGRAM_NAME)); | ||
| 250 | va_start(args, fmt); | ||
| 251 | vfprintf(stderr, fmt, args); | ||
| 252 | va_end(args); | ||
| 253 | fprintf(stderr, "\n"); | ||
| 254 | return(rc); | ||
| 255 | } | ||
| 256 | |||
| 257 | |||
| 258 | int | ||
| 259 | ttu_printf( | ||
| 260 | ttu_config_t * cnf, | ||
| 261 | const char * fmt, | ||
| 262 | ... ) | ||
| 263 | { | ||
| 264 | int rc; | ||
| 265 | va_list args; | ||
| 266 | if ((cnf->opts & TTUTILS_OPT_QUIET)) | ||
| 267 | return(0); | ||
| 268 | va_start(args, fmt); | ||
| 269 | rc = vprintf(fmt, args); | ||
| 270 | va_end(args); | ||
| 271 | return(rc); | ||
| 272 | } | ||
| 273 | |||
| 274 | |||
| 275 | int | ||
| 276 | tru_verbose( | ||
| 277 | ttu_config_t * cnf, | ||
| 278 | const char * fmt, | ||
| 279 | ... ) | ||
| 280 | { | ||
| 281 | int rc; | ||
| 282 | va_list args; | ||
| 283 | if (!(cnf->opts & TTUTILS_OPT_VERBOSE)) | ||
| 284 | return(0); | ||
| 285 | va_start(args, fmt); | ||
| 286 | rc = vprintf(fmt, args); | ||
| 287 | va_end(args); | ||
| 288 | return(rc); | ||
| 289 | } | ||
| 290 | |||
| 291 | |||
| 292 | //-------------------------// | ||
| 293 | // miscellaneous functions // | ||
| 294 | //-------------------------// | ||
| 295 | #pragma mark miscellaneous functions | ||
| 296 | |||
| 297 | void | ||
| 298 | ttu_cleanup( | ||
| 299 | ttu_config_t * cnf ) | ||
| 300 | { | ||
| 301 | tinytac_free(cnf->tt); | ||
| 302 | return; | ||
| 303 | } | ||
| 304 | |||
| 305 | |||
| 306 | //-----------------// | ||
| 307 | // usage functions // | ||
| 308 | //-----------------// | ||
| 309 | #pragma mark usage functions | ||
| 310 | |||
| 311 | int | ||
| 312 | ttu_cli_arguments( | ||
| 313 | ttu_config_t * cnf, | ||
| 314 | int argc, | ||
| 315 | char * const * argv ) | ||
| 316 | { | ||
| 317 | int c; | ||
| 318 | int opt_index; | ||
| 319 | int opt; | ||
| 320 | int rc; | ||
| 125 | 321 | ||
| 126 | // getopt options | 322 | // getopt options |
| 127 | static char short_opt[] = "46dhVvq"; | 323 | static const char * short_opt = "+46dH:hVvq"; |
| 128 | static struct option long_opt[] = | 324 | static struct option long_opt[] = |
| 129 | { | 325 | { |
| 130 | {"help", no_argument, NULL, 'h' }, | 326 | {"help", no_argument, NULL, 'h' }, |
| @@ -135,11 +331,11 @@ int main(int argc, char * argv[]) | |||
| 135 | { NULL, 0, NULL, 0 } | 331 | { NULL, 0, NULL, 0 } |
| 136 | }; | 332 | }; |
| 137 | 333 | ||
| 138 | if ((rc = tinytac_set_option(NULL, TTAC_OPT_DEBUG_IDENT, PROGRAM_NAME)) != TTAC_SUCCESS) | 334 | optind = 1; |
| 139 | { | 335 | opt_index = 0; |
| 140 | fprintf(stderr, "%s: tinytac_set_option(%s): %s\n", PROGRAM_NAME, "TTAC_OPT_DEBUG_IDENT", tinytac_strerror(rc)); | 336 | |
| 141 | return(1); | 337 | if ((cnf->widget)) |
| 142 | }; | 338 | short_opt = &short_opt[1]; |
| 143 | 339 | ||
| 144 | while((c = getopt_long(argc, argv, short_opt, long_opt, &opt_index)) != -1) | 340 | while((c = getopt_long(argc, argv, short_opt, long_opt, &opt_index)) != -1) |
| 145 | { | 341 | { |
| @@ -150,40 +346,40 @@ int main(int argc, char * argv[]) | |||
| 150 | break; | 346 | break; |
| 151 | 347 | ||
| 152 | case '4': | 348 | case '4': |
| 153 | opt = TTAC_YES; tinytac_set_option(NULL, TTAC_OPT_IPV4, &opt); | 349 | opt = TTAC_YES; tinytac_set_option(cnf->tt, TTAC_OPT_IPV4, &opt); |
| 154 | opt = TTAC_NO; tinytac_set_option(NULL, TTAC_OPT_IPV6, &opt); | 350 | opt = TTAC_NO; tinytac_set_option(cnf->tt, TTAC_OPT_IPV6, &opt); |
| 155 | break; | 351 | break; |
| 156 | 352 | ||
| 157 | case '6': | 353 | case '6': |
| 158 | opt = TTAC_YES; tinytac_set_option(NULL, TTAC_OPT_IPV6, &opt); | 354 | opt = TTAC_YES; tinytac_set_option(cnf->tt, TTAC_OPT_IPV6, &opt); |
| 159 | opt = TTAC_NO; tinytac_set_option(NULL, TTAC_OPT_IPV4, &opt); | 355 | opt = TTAC_NO; tinytac_set_option(cnf->tt, TTAC_OPT_IPV4, &opt); |
| 160 | break; | 356 | break; |
| 161 | 357 | ||
| 162 | case 'd': | 358 | case 'd': |
| 163 | opt = TTAC_DEBUG_ANY; tinytac_set_option(NULL, TTAC_OPT_DEBUG_LEVEL, &opt); | 359 | opt = TTAC_DEBUG_ANY; tinytac_set_option(NULL, TTAC_OPT_DEBUG_LEVEL, &opt); |
| 164 | break; | 360 | break; |
| 165 | 361 | ||
| 362 | case 'H': | ||
| 363 | if ((rc = tinytac_set_option(cnf->tt, TTAC_OPT_HOSTS, optarg)) != TTAC_SUCCESS) | ||
| 364 | return(ttu_error(cnf, 1, "tinytac_set_option(TTAC_OPT_HOSTS): %s", tinytac_strerror(rc))); | ||
| 365 | break; | ||
| 366 | |||
| 166 | case 'h': | 367 | case 'h': |
| 167 | printf("Usage: %s [OPTIONS]\n", PROGRAM_NAME); | 368 | ttu_usage(cnf); |
| 168 | printf("OPTIONS:\n"); | 369 | return(-1); |
| 169 | printf(" -4 use IPv4\n"); | ||
| 170 | printf(" -6 use IPv6\n"); | ||
| 171 | printf(" -d, --debug print debug messages\n"); | ||
| 172 | printf(" -h, --help print this help and exit\n"); | ||
| 173 | printf(" -q, --quiet, --silent do not print messages\n"); | ||
| 174 | printf(" -V, --version print version number and exit\n"); | ||
| 175 | printf(" -v, --verbose print verbose messages\n"); | ||
| 176 | printf("\n"); | ||
| 177 | return(0); | ||
| 178 | 370 | ||
| 179 | case 'q': | 371 | case 'q': |
| 372 | cnf->opts |= TTUTILS_OPT_QUIET; | ||
| 373 | cnf->opts &= ~TTUTILS_OPT_VERBOSE; | ||
| 180 | break; | 374 | break; |
| 181 | 375 | ||
| 182 | case 'V': | 376 | case 'V': |
| 183 | printf("%s (%s) %s\n", PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION); | 377 | printf("%s (%s) %s\n", PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION); |
| 184 | return(0); | 378 | return(-1); |
| 185 | 379 | ||
| 186 | case 'v': | 380 | case 'v': |
| 381 | cnf->opts |= TTUTILS_OPT_VERBOSE; | ||
| 382 | cnf->opts &= ~TTUTILS_OPT_QUIET; | ||
| 187 | break; | 383 | break; |
| 188 | 384 | ||
| 189 | case '?': | 385 | case '?': |
| @@ -200,4 +396,115 @@ int main(int argc, char * argv[]) | |||
| 200 | return(0); | 396 | return(0); |
| 201 | } | 397 | } |
| 202 | 398 | ||
| 399 | |||
| 400 | int | ||
| 401 | ttu_usage( | ||
| 402 | ttu_config_t * cnf ) | ||
| 403 | { | ||
| 404 | size_t pos; | ||
| 405 | const char * widget_name; | ||
| 406 | const char * widget_help; | ||
| 407 | ttu_widget_t * widget; | ||
| 408 | |||
| 409 | widget_name = (!(cnf->widget)) ? "widget" : cnf->widget->name; | ||
| 410 | widget_help = ""; | ||
| 411 | if ((cnf->widget)) | ||
| 412 | widget_help = ((cnf->widget->usage)) ? cnf->widget->usage : ""; | ||
| 413 | |||
| 414 | printf("Usage: %s [OPTIONS] %s [OPTIONS]%s\n", PROGRAM_NAME, widget_name, widget_help); | ||
| 415 | printf(" %s-%s [OPTIONS]%s\n", PROGRAM_NAME, widget_name, widget_help); | ||
| 416 | printf(" %s%s [OPTIONS]%s\n", PROGRAM_NAME, widget_name, widget_help); | ||
| 417 | printf("OPTIONS:\n"); | ||
| 418 | printf(" -4 use IPv4\n"); | ||
| 419 | printf(" -6 use IPv6\n"); | ||
| 420 | printf(" -d, --debug print debug messages\n"); | ||
| 421 | printf(" -H host TACACS+ host\n"); | ||
| 422 | printf(" -h, --help print this help and exit\n"); | ||
| 423 | printf(" -q, --quiet, --silent do not print messages\n"); | ||
| 424 | printf(" -V, --version print version number and exit\n"); | ||
| 425 | printf(" -v, --verbose print verbose messages\n"); | ||
| 426 | if (!(cnf->widget)) | ||
| 427 | { | ||
| 428 | printf("WIDGETS:\n"); | ||
| 429 | for(pos = 0; ttu_widget_map[pos].name != NULL; pos++) | ||
| 430 | { | ||
| 431 | widget = &ttu_widget_map[pos]; | ||
| 432 | if ((widget->desc)) | ||
| 433 | printf(" %-25s %s\n", widget->name, widget->desc); | ||
| 434 | }; | ||
| 435 | }; | ||
| 436 | if ((cnf->widget)) | ||
| 437 | if ((cnf->widget->func_usage)) | ||
| 438 | cnf->widget->func_usage(cnf); | ||
| 439 | printf("\n"); | ||
| 440 | |||
| 441 | return(0); | ||
| 442 | } | ||
| 443 | |||
| 444 | |||
| 445 | ttu_widget_t * | ||
| 446 | ttu_widget_lookup( | ||
| 447 | const char * wname, | ||
| 448 | int exact ) | ||
| 449 | { | ||
| 450 | size_t x; | ||
| 451 | size_t y; | ||
| 452 | size_t len; | ||
| 453 | size_t wname_len; | ||
| 454 | const char * alias; | ||
| 455 | ttu_widget_t * match; | ||
| 456 | ttu_widget_t * widget; | ||
| 457 | |||
| 458 | // strip program prefix from widget name | ||
| 459 | len = strlen(PROGRAM_NAME); | ||
| 460 | if (!(strncasecmp(wname, PROGRAM_NAME, len))) | ||
| 461 | wname = &wname[len]; | ||
| 462 | if (wname[0] == '-') | ||
| 463 | wname = &wname[1]; | ||
| 464 | if (!(wname[0])) | ||
| 465 | return(NULL); | ||
| 466 | |||
| 467 | match = NULL; | ||
| 468 | wname_len = strlen(wname); | ||
| 469 | |||
| 470 | for(x = 0; ((ttu_widget_map[x].name)); x++) | ||
| 471 | { | ||
| 472 | // check widget | ||
| 473 | widget = &ttu_widget_map[x]; | ||
| 474 | if (widget->func_exec == NULL) | ||
| 475 | continue; | ||
| 476 | |||
| 477 | // compare widget name for match | ||
| 478 | if (!(strncmp(widget->name, wname, wname_len))) | ||
| 479 | { | ||
| 480 | if (widget->name[wname_len] == '\0') | ||
| 481 | return(widget); | ||
| 482 | if ( ((match)) && (match != widget) ) | ||
| 483 | return(NULL); | ||
| 484 | if (exact == TTAC_NO) | ||
| 485 | match = widget; | ||
| 486 | }; | ||
| 487 | |||
| 488 | if (!(widget->aliases)) | ||
| 489 | continue; | ||
| 490 | |||
| 491 | for(y = 0; ((widget->aliases[y])); y++) | ||
| 492 | { | ||
| 493 | alias = widget->aliases[y]; | ||
| 494 | if (!(strncmp(alias, wname, wname_len))) | ||
| 495 | { | ||
| 496 | if (alias[wname_len] == '\0') | ||
| 497 | return(widget); | ||
| 498 | if ( ((match)) && (match != widget) ) | ||
| 499 | return(NULL); | ||
| 500 | if (exact == TTAC_NO) | ||
| 501 | match = widget; | ||
| 502 | }; | ||
| 503 | }; | ||
| 504 | }; | ||
| 505 | |||
| 506 | return((exact == TTAC_NO) ? match : NULL); | ||
| 507 | } | ||
| 508 | |||
| 509 | |||
| 203 | /* end of source */ | 510 | /* end of source */ |
diff --git a/src/ttu/tinytacutil.h b/src/ttu/tinytacutil.h index 60799a4..afc5471 100644 --- a/src/ttu/tinytacutil.h +++ b/src/ttu/tinytacutil.h | |||
| @@ -28,8 +28,8 @@ | |||
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. |
| 30 | */ | 30 | */ |
| 31 | #ifndef _SRC_TRU_TINYTACUTIL_H | 31 | #ifndef _SRC_TTU_TINYTACUTIL_H |
| 32 | #define _SRC_TRU_TINYTACUTIL_H 1 | 32 | #define _SRC_TTU_TINYTACUTIL_H 1 |
| 33 | 33 | ||
| 34 | /////////////// | 34 | /////////////// |
| 35 | // // | 35 | // // |
| @@ -40,6 +40,9 @@ | |||
| 40 | 40 | ||
| 41 | #include <tinytac_compat.h> | 41 | #include <tinytac_compat.h> |
| 42 | 42 | ||
| 43 | #include <stdlib.h> | ||
| 44 | #include <tinytac.h> | ||
| 45 | |||
| 43 | 46 | ||
| 44 | /////////////////// | 47 | /////////////////// |
| 45 | // // | 48 | // // |
| @@ -51,6 +54,9 @@ | |||
| 51 | #undef PROGRAM_NAME | 54 | #undef PROGRAM_NAME |
| 52 | #define PROGRAM_NAME "tinytac" | 55 | #define PROGRAM_NAME "tinytac" |
| 53 | 56 | ||
| 57 | #define TTUTILS_OPT_QUIET 0x00000001U | ||
| 58 | #define TTUTILS_OPT_VERBOSE 0x00000002U | ||
| 59 | |||
| 54 | 60 | ||
| 55 | ////////////////// | 61 | ////////////////// |
| 56 | // // | 62 | // // |
| @@ -59,6 +65,30 @@ | |||
| 59 | ////////////////// | 65 | ////////////////// |
| 60 | #pragma mark - Data Types | 66 | #pragma mark - Data Types |
| 61 | 67 | ||
| 68 | typedef struct _tinytac_util_widget ttu_widget_t; | ||
| 69 | typedef struct _tinytac_util_config ttu_config_t; | ||
| 70 | |||
| 71 | struct _tinytac_util_config | ||
| 72 | { | ||
| 73 | unsigned opts; | ||
| 74 | int argc; | ||
| 75 | char ** argv; | ||
| 76 | const char * prog_name; | ||
| 77 | const ttu_widget_t * widget; | ||
| 78 | TinyTac * tt; | ||
| 79 | }; | ||
| 80 | |||
| 81 | |||
| 82 | struct _tinytac_util_widget | ||
| 83 | { | ||
| 84 | const char * name; | ||
| 85 | const char * desc; | ||
| 86 | const char * usage; | ||
| 87 | const char * const * aliases; | ||
| 88 | int (*func_exec)(ttu_config_t * cnf); | ||
| 89 | int (*func_usage)(ttu_config_t * cnf); | ||
| 90 | }; | ||
| 91 | |||
| 62 | 92 | ||
| 63 | ///////////////// | 93 | ///////////////// |
| 64 | // // | 94 | // // |
| @@ -67,6 +97,8 @@ | |||
| 67 | ///////////////// | 97 | ///////////////// |
| 68 | #pragma mark - Variables | 98 | #pragma mark - Variables |
| 69 | 99 | ||
| 100 | extern ttu_widget_t ttu_widget_map[]; | ||
| 101 | |||
| 70 | 102 | ||
| 71 | ////////////////// | 103 | ////////////////// |
| 72 | // // | 104 | // // |
| @@ -75,5 +107,80 @@ | |||
| 75 | ////////////////// | 107 | ////////////////// |
| 76 | #pragma mark - Prototypes | 108 | #pragma mark - Prototypes |
| 77 | 109 | ||
| 110 | //--------------------// | ||
| 111 | // logging prototypes // | ||
| 112 | //--------------------// | ||
| 113 | #pragma mark logging prototypes | ||
| 114 | |||
| 115 | extern int | ||
| 116 | ttu_error( | ||
| 117 | ttu_config_t * cnf, | ||
| 118 | int rc, | ||
| 119 | const char * fmt, | ||
| 120 | ... ); | ||
| 121 | |||
| 122 | |||
| 123 | extern int | ||
| 124 | ttu_printf( | ||
| 125 | ttu_config_t * cnf, | ||
| 126 | const char * fmt, | ||
| 127 | ... ); | ||
| 128 | |||
| 129 | |||
| 130 | extern int | ||
| 131 | tru_verbose( | ||
| 132 | ttu_config_t * cnf, | ||
| 133 | const char * fmt, | ||
| 134 | ... ); | ||
| 135 | |||
| 136 | |||
| 137 | //------------------// | ||
| 138 | // usage prototypes // | ||
| 139 | //------------------// | ||
| 140 | #pragma mark usage prototypes | ||
| 141 | |||
| 142 | extern int | ||
| 143 | ttu_cli_arguments( | ||
| 144 | ttu_config_t * cnf, | ||
| 145 | int argc, | ||
| 146 | char * const * argv ); | ||
| 147 | |||
| 148 | |||
| 149 | extern int | ||
| 150 | ttu_usage( | ||
| 151 | ttu_config_t * cnf ); | ||
| 152 | |||
| 153 | |||
| 154 | extern int | ||
| 155 | tru_verbose( | ||
| 156 | ttu_config_t * cnf, | ||
| 157 | const char * fmt, | ||
| 158 | ... ); | ||
| 159 | |||
| 160 | |||
| 161 | //-------------------// | ||
| 162 | // widget prototypes // | ||
| 163 | //-------------------// | ||
| 164 | #pragma mark widget prototypes | ||
| 165 | |||
| 166 | extern int | ||
| 167 | ttu_widget_acct( | ||
| 168 | ttu_config_t * cnf ); | ||
| 169 | |||
| 170 | |||
| 171 | extern int | ||
| 172 | ttu_widget_authen( | ||
| 173 | ttu_config_t * cnf ); | ||
| 174 | |||
| 175 | |||
| 176 | extern int | ||
| 177 | ttu_widget_author( | ||
| 178 | ttu_config_t * cnf ); | ||
| 179 | |||
| 180 | |||
| 181 | extern int | ||
| 182 | ttu_widget_config( | ||
| 183 | ttu_config_t * cnf ); | ||
| 184 | |||
| 78 | 185 | ||
| 79 | #endif /* end of header */ | 186 | #endif /* end of header */ |
diff --git a/src/ttu/widget-acct.c b/src/ttu/widget-acct.c new file mode 100644 index 0000000..32bc821 --- /dev/null +++ b/src/ttu/widget-acct.c | |||
| @@ -0,0 +1,110 @@ | |||
| 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_TTU_WIDGET_ACCT_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 | #include <tinytac.h> | ||
| 52 | #include <bindle_prefix.h> | ||
| 53 | |||
| 54 | |||
| 55 | /////////////////// | ||
| 56 | // // | ||
| 57 | // Definitions // | ||
| 58 | // // | ||
| 59 | /////////////////// | ||
| 60 | #pragma mark - Definitions | ||
| 61 | |||
| 62 | |||
| 63 | ////////////////// | ||
| 64 | // // | ||
| 65 | // Data Types // | ||
| 66 | // // | ||
| 67 | ////////////////// | ||
| 68 | #pragma mark - Data Types | ||
| 69 | |||
| 70 | |||
| 71 | ////////////////// | ||
| 72 | // // | ||
| 73 | // Prototypes // | ||
| 74 | // // | ||
| 75 | ////////////////// | ||
| 76 | #pragma mark - Prototypes | ||
| 77 | |||
| 78 | |||
| 79 | ///////////////// | ||
| 80 | // // | ||
| 81 | // Variables // | ||
| 82 | // // | ||
| 83 | ///////////////// | ||
| 84 | #pragma mark - Variables | ||
| 85 | |||
| 86 | |||
| 87 | ///////////////// | ||
| 88 | // // | ||
| 89 | // Functions // | ||
| 90 | // // | ||
| 91 | ///////////////// | ||
| 92 | #pragma mark - Functions | ||
| 93 | |||
| 94 | int | ||
| 95 | ttu_widget_acct( | ||
| 96 | ttu_config_t * cnf ) | ||
| 97 | { | ||
| 98 | int rc; | ||
| 99 | |||
| 100 | assert(cnf != NULL); | ||
| 101 | |||
| 102 | // initial processing of cli arguments | ||
| 103 | if ((rc = ttu_cli_arguments(cnf, cnf->argc, cnf->argv)) != 0) | ||
| 104 | return((rc == -1) ? 0 : 1); | ||
| 105 | |||
| 106 | return(0); | ||
| 107 | } | ||
| 108 | |||
| 109 | |||
| 110 | /* end of source */ | ||
diff --git a/src/ttu/widget-authen.c b/src/ttu/widget-authen.c new file mode 100644 index 0000000..210fc83 --- /dev/null +++ b/src/ttu/widget-authen.c | |||
| @@ -0,0 +1,110 @@ | |||
| 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_TTU_WIDGET_AUTHEN_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 | #include <tinytac.h> | ||
| 52 | #include <bindle_prefix.h> | ||
| 53 | |||
| 54 | |||
| 55 | /////////////////// | ||
| 56 | // // | ||
| 57 | // Definitions // | ||
| 58 | // // | ||
| 59 | /////////////////// | ||
| 60 | #pragma mark - Definitions | ||
| 61 | |||
| 62 | |||
| 63 | ////////////////// | ||
| 64 | // // | ||
| 65 | // Data Types // | ||
| 66 | // // | ||
| 67 | ////////////////// | ||
| 68 | #pragma mark - Data Types | ||
| 69 | |||
| 70 | |||
| 71 | ////////////////// | ||
| 72 | // // | ||
| 73 | // Prototypes // | ||
| 74 | // // | ||
| 75 | ////////////////// | ||
| 76 | #pragma mark - Prototypes | ||
| 77 | |||
| 78 | |||
| 79 | ///////////////// | ||
| 80 | // // | ||
| 81 | // Variables // | ||
| 82 | // // | ||
| 83 | ///////////////// | ||
| 84 | #pragma mark - Variables | ||
| 85 | |||
| 86 | |||
| 87 | ///////////////// | ||
| 88 | // // | ||
| 89 | // Functions // | ||
| 90 | // // | ||
| 91 | ///////////////// | ||
| 92 | #pragma mark - Functions | ||
| 93 | |||
| 94 | int | ||
| 95 | ttu_widget_authen( | ||
| 96 | ttu_config_t * cnf ) | ||
| 97 | { | ||
| 98 | int rc; | ||
| 99 | |||
| 100 | assert(cnf != NULL); | ||
| 101 | |||
| 102 | // initial processing of cli arguments | ||
| 103 | if ((rc = ttu_cli_arguments(cnf, cnf->argc, cnf->argv)) != 0) | ||
| 104 | return((rc == -1) ? 0 : 1); | ||
| 105 | |||
| 106 | return(0); | ||
| 107 | } | ||
| 108 | |||
| 109 | |||
| 110 | /* end of source */ | ||
diff --git a/src/ttu/widget-author.c b/src/ttu/widget-author.c new file mode 100644 index 0000000..0f2d351 --- /dev/null +++ b/src/ttu/widget-author.c | |||
| @@ -0,0 +1,110 @@ | |||
| 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_TTU_WIDGET_AUTHOR_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 | #include <tinytac.h> | ||
| 52 | #include <bindle_prefix.h> | ||
| 53 | |||
| 54 | |||
| 55 | /////////////////// | ||
| 56 | // // | ||
| 57 | // Definitions // | ||
| 58 | // // | ||
| 59 | /////////////////// | ||
| 60 | #pragma mark - Definitions | ||
| 61 | |||
| 62 | |||
| 63 | ////////////////// | ||
| 64 | // // | ||
| 65 | // Data Types // | ||
| 66 | // // | ||
| 67 | ////////////////// | ||
| 68 | #pragma mark - Data Types | ||
| 69 | |||
| 70 | |||
| 71 | ////////////////// | ||
| 72 | // // | ||
| 73 | // Prototypes // | ||
| 74 | // // | ||
| 75 | ////////////////// | ||
| 76 | #pragma mark - Prototypes | ||
| 77 | |||
| 78 | |||
| 79 | ///////////////// | ||
| 80 | // // | ||
| 81 | // Variables // | ||
| 82 | // // | ||
| 83 | ///////////////// | ||
| 84 | #pragma mark - Variables | ||
| 85 | |||
| 86 | |||
| 87 | ///////////////// | ||
| 88 | // // | ||
| 89 | // Functions // | ||
| 90 | // // | ||
| 91 | ///////////////// | ||
| 92 | #pragma mark - Functions | ||
| 93 | |||
| 94 | int | ||
| 95 | ttu_widget_author( | ||
| 96 | ttu_config_t * cnf ) | ||
| 97 | { | ||
| 98 | int rc; | ||
| 99 | |||
| 100 | assert(cnf != NULL); | ||
| 101 | |||
| 102 | // initial processing of cli arguments | ||
| 103 | if ((rc = ttu_cli_arguments(cnf, cnf->argc, cnf->argv)) != 0) | ||
| 104 | return((rc == -1) ? 0 : 1); | ||
| 105 | |||
| 106 | return(0); | ||
| 107 | } | ||
| 108 | |||
| 109 | |||
| 110 | /* end of source */ | ||
diff --git a/src/ttu/widget-config.c b/src/ttu/widget-config.c new file mode 100644 index 0000000..e3e962e --- /dev/null +++ b/src/ttu/widget-config.c | |||
| @@ -0,0 +1,68 @@ | |||
| 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_TTU_WIDGET_ACCT_C 1 | ||
| 32 | #include "tinytacutil.h" | ||
| 33 | |||
| 34 | /////////////// | ||
| 35 | // // | ||
| 36 | // Headers // | ||
| 37 | // // | ||
| 38 | /////////////// | ||
| 39 | #pragma mark - Headers | ||
| 40 | |||
| 41 | #include <stdio.h> | ||
| 42 | #include <assert.h> | ||
| 43 | |||
| 44 | #include <tinytac.h> | ||
| 45 | #include <bindle_prefix.h> | ||
| 46 | |||
| 47 | |||
| 48 | ///////////////// | ||
| 49 | // // | ||
| 50 | // Functions // | ||
| 51 | // // | ||
| 52 | ///////////////// | ||
| 53 | #pragma mark - Functions | ||
| 54 | |||
| 55 | int | ||
| 56 | ttu_widget_config( | ||
| 57 | ttu_config_t * cnf ) | ||
| 58 | { | ||
| 59 | int rc; | ||
| 60 | assert(cnf != NULL); | ||
| 61 | if ((rc = ttu_cli_arguments(cnf, cnf->argc, cnf->argv)) != 0) | ||
| 62 | return((rc == -1) ? 0 : 1); | ||
| 63 | tinytac_conf_print(cnf->tt); | ||
| 64 | return(0); | ||
| 65 | } | ||
| 66 | |||
| 67 | |||
| 68 | /* end of source */ | ||
