prologue of main tldr it doesn't matter
Code snippets taken from GNU coreutils are under license GPL-3.0
TL;DR: none of these matters unless you want to dig deep into locale and
ancient machines. Perhaps the only thing to look at is atexit()
There are a few function calls at the beginning of main
, for example cp.c
;
(note, what happens between _start
and main
is per standard library, that’s
another story)
|
|
initialize_main
: macro defined insystem.h
.. used for OS/2, which calls_wildcard
and_response
macros, of which I have no idea1….set_program_name
, functoin defined ingnulib/lib/progname.{c,h}
. Basically storing the program’s calling name (argv[0]
) into a global variable (w/ absolute path). Also involves some temporary executable relatinglibtool
…setlocale
set current locale (man 3 setlocale
)On startup of the main program, the portable "C" locale is selected as default. A program may be made portable to all locales by calling: setlocale(LC_ALL, "");
bindtextdomain
/textdomain
. Also locale related but that’s another storyatexit
:man 3 atexit
- register a function to be called at normal process terminationinitialize_exit_failure
.. setexit_failure
to given status code (on error return)
-
weirdly I don’t even know where these are defined. This article says: If you want Unix-like wildcard expansion built into the program, use
int main (int argc, char *argv[]) { _wildcard (&argc, &argv); /* ... the program ... */ }
This should be done at the very beginning of
main()
, beforeARGC
andARGV
are used. See_wildcard()
and_response()
yeah … I want to see but where??? ↩︎