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

Function main

src/fmt.c:331–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329};
330
331int
332main (int argc, char **argv)
333{
334 int optchar;
335 bool ok = true;
336 char const *max_width_option = NULL;
337 char const *goal_width_option = NULL;
338
339 initialize_main (&argc, &argv);
340 set_program_name (argv[0]);
341 setlocale (LC_ALL, "");
342 bindtextdomain (PACKAGE, LOCALEDIR);
343 textdomain (PACKAGE);
344
345 atexit (close_stdout);
346
347 if (argc > 1 && argv[1][0] == '-' && c_isdigit (argv[1][1]))
348 {
349 /* Old option syntax; a dash followed by one or more digits. */
350 max_width_option = argv[1] + 1;
351
352 /* Make the option we just parsed invisible to getopt. */
353 argv[1] = argv[0];
354 argv++;
355 argc--;
356 }
357
358 while ((optchar = getopt_long (argc, argv, "0123456789cstuw:p:g:",
359 long_options, NULL))
360 != -1)
361 switch (optchar)
362 {
363 default:
364 if (c_isdigit (optchar))
365 error (0, 0, _("invalid option -- %c; -WIDTH is recognized\
366 only when it is the first\noption; use -w N instead"),
367 optchar);
368 usage (EXIT_FAILURE);
369
370 case 'c':
371 crown = true;
372 break;
373
374 case 's':
375 split = true;
376 break;
377
378 case 't':
379 tagged = true;
380 break;
381
382 case 'u':
383 uniform = true;
384 break;
385
386 case 'w':
387 max_width_option = optarg;
388 break;

Callers

nothing calls this directly

Calls 3

set_prefixFunction · 0.85
fmtFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected