41 #define CB_NO_ARG no_argument
42 #define CB_RQ_ARG required_argument
43 #define CB_OP_ARG optional_argument
54 #if defined(ENABLE_NLS) && defined(COB_NLS_RUNTIME)
56 #define _(s) gettext(s)
57 #define N_(s) gettext_noop(s)
69 int status, day, year;
73 memset (month, 0,
sizeof(month));
76 status = sscanf (__DATE__,
"%s %d %d", month, &day, &year);
79 "%s %2.2d %4.4d %s", month, day, year, __TIME__);
82 "%s %s", __DATE__, __TIME__);
85 printf (
"cobcrun (%s) %s.%d\n",
87 puts (
"Copyright (C) 2004-2012, 2014-2016 Free Software Foundation, Inc.");
88 printf (
_(
"Written by %s\n"),
"Roger While, Simon Sobisch");
89 puts (
_(
"This is free software; see the source for copying conditions. There is NO\n"\
90 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."));
91 printf (
_(
"Built %s"), cob_build_stamp);
100 puts (
_(
"COBOL driver program for GnuCOBOL modules"));
102 printf (
_(
"usage: %s [options] PROGRAM [param ...]"), prog);
104 printf (
_(
" or: %s options"), prog);
107 puts (
_(
"options:"));
108 puts (
_(
" -h, -help display this help and exit"));
109 puts (
_(
" -V, -version display cobcrun and runtime version and exit"));
110 puts (
_(
" -i, -info display runtime information (build/environment)"));
111 puts (
_(
" -c <file>, -config=<file> set runtime configuration from <file>"));
112 puts (
_(
" -r, -runtime-env display current runtime configuration\n"
113 " (value and origin for all settings)"));
124 len = strlen (environment) + strlen (
cob_optarg) + 2U;
126 sprintf (p,
"%s=%s", environment,
cob_optarg);
142 while (++argnum <= argc) {
143 if (strrchr(argv[argnum - 1],
'/') == argv[argnum - 1]) {
144 argv[argnum - 1][0] =
'-';
151 long_options, &idx, 1)) >= 0) {
161 fputs (
_(
"invalid configuration file name"), stderr);
205 #ifdef HAVE_SETLOCALE
206 setlocale (LC_ALL,
"");
218 fputs (
_(
"PROGRAM name exceeds 31 characters"), stderr);
222 cob_init (argc - arg_shift, &argv[arg_shift]);
int cob_getopt_long_long(const int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, const int long_only)
static void cobcrun_print_usage(char *prog)
void * cob_resolve(const char *name)
static int cobcrun_setenv(const char *environment)
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
void cob_init(const int argc, char **argv)
static void cobcrun_print_version(void)
int main(int argc, char **argv)
void cob_call_error(void)
static void process_command_line(int argc, char *argv[])
static const char short_options[]
void * cob_fast_malloc(const size_t size)
static const struct option long_options[]
void cob_stop_run(const int status)