MCPcopy Create free account
hub / github.com/coreutils/coreutils / main

Function main

src/expr.c:305–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303
304
305int
306main (int argc, char **argv)
307{
308 initialize_main (&argc, &argv);
309 set_program_name (argv[0]);
310 setlocale (LC_ALL, "");
311 bindtextdomain (PACKAGE, LOCALEDIR);
312 textdomain (PACKAGE);
313
314 initialize_exit_failure (EXPR_FAILURE);
315 atexit (close_stdout);
316
317 parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
318 usage, AUTHORS, (char const *) NULL);
319
320 /* The above handles --help and --version.
321 Since there is no other invocation of getopt, handle '--' here. */
322 if (1 < argc && streq (argv[1], "--"))
323 {
324 --argc;
325 ++argv;
326 }
327
328 if (argc <= 1)
329 {
330 error (0, 0, _("missing operand"));
331 usage (EXPR_INVALID);
332 }
333
334 args = argv + 1;
335
336 VALUE *v = eval (true);
337 if (!nomoreargs ())
338 error (EXPR_INVALID, 0, _("syntax error: unexpected argument %s"),
339 quotearg_n_style (0, locale_quoting_style, *args));
340
341 printv (v);
342
343 main_exit (null (v));
344}
345
346/* Return a VALUE for I. */
347

Callers

nothing calls this directly

Calls 6

initialize_exit_failureFunction · 0.85
evalFunction · 0.85
nomoreargsFunction · 0.85
printvFunction · 0.85
nullFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected