/* WARNING: This file was generated by dkct. Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: test-opt.ctr */ /** @file test-opt.c The test-opt module. */ #line 1 "test-opt.ctr" #include "dk4conf.h" #include "dk4types.h" #include "dk4mem.h" #include "dk4opt.h" #line 10 "test-opt.ctr" /** Command line options for program. */ static dk4_option_t options[] = { { { dkT('i'), dkT("interactive"), DK4_OPT_ARG_NONE }, { NULL }, 0}, { { dkT('s'), dkT("socket"), DK4_OPT_ARG_STRING }, { NULL }, 0}, { { dkT('h'), dkT("host"), DK4_OPT_ARG_STRING }, { NULL }, 0}, { { dkT('p'), dkT("port"), DK4_OPT_ARG_UNSIGNED }, { NULL }, 0} }; static const size_t szoptions = sizeof(options)/sizeof(dk4_option_t); /** Main function. @param argc Number of command line arguments. @param argv Command line arguments array. @return 0 on success, all other values indicate errors. */ #if DK4_CHAR_SIZE > 1 int wmain(int argc, wchar_t *argv[]) #else int main(int argc, char *argv[]) #endif { dkChar *filenames[32]; size_t szfn = DK4_SIZEOF(filenames,DK4_PDKCHAR); int res; #line 45 "test-opt.ctr" #line 46 "test-opt.ctr" res = dk4opt_process_argv( options, szoptions, argc, argv, filenames, &szfn, 1, 1, NULL ); if (0 != res) { if (0 != options[0].found) { fputs("Option -i found.\n", stdout); } if (0 != options[1].found) { fputs("Option -s found.\nArgument: ", stdout); if (NULL != options[1].val.t) { fputs(options[1].val.t, stdout); } fputc('\n', stdout); fflush(stdout); } if (0 != options[2].found) { fputs("Option -h found.\n", stdout); if (NULL != options[2].val.t) { fputs(options[2].val.t, stdout); } fputc('\n', stdout); fflush(stdout); } if (0 != options[3].found) { fputs("Option -p found.\n", stdout); fprintf(stdout, "Argument: %ju\n", options[3].val.u); fflush(stdout); } } #line 77 "test-opt.ctr" #line 78 "test-opt.ctr" exit(0); return 0; }