/* The entry function. */ void _start(char **ap, void (*cleanup)(void)) { int argc; char **argv; char **env; argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); __asm__("eprol:"); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); }
/* The entry function. */ void __start(int argc, char *argv[], char *env[], void (*cleanup)(void)) { handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else { /* * Hack to resolve _end so we read the correct symbol. * Without this it will resolve to the copy in the library * that firsts requests it. We should fix the toolchain, * however this is is needed until this can take place. */ *(volatile long *)&_end; _init_tls(); } #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); __asm__("eprol:"); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); }
int main (int argc, char *argv[]) { struct Options opt; int status; opt.toclose = 0; getstacksize(argc, argv, &opt); /* handle option `-s' */ L = lua_open(opt.stacksize); /* create state */ userinit(); /* open libraries */ register_getargs(argv); /* create `getargs' function */ status = handle_argv(argv+1, &opt); if (opt.toclose) lua_close(L); return status; }
static int pmain (lua_State *l) { struct Smain *s = (struct Smain *)lua_touserdata(l, 1); int status; int interactive = 0; if (s->argv[0] && s->argv[0][0]) progname = s->argv[0]; L = l; lua_userinit(l); /* open libraries */ status = handle_luainit(); if (status == 0) { status = handle_argv(s->argv, &interactive); if (status == 0 && interactive) manual_input(); } s->status = status; return 0; }
static int pmain (lua_State *L) { struct Smain *s = (struct Smain *)lua_touserdata(L, 1); int status; int interactive = 1; if (s->argv[0] && s->argv[0][0]) progname = s->argv[0]; globalL = L; luaL_openlibs(L); /* open libraries */ luapreload_oilall(L); /* preload all OiL libraries */ status = handle_luainit(L); if (status == 0) { status = handle_argv(L, s->argc, s->argv, &interactive); if (status == 0 && interactive) dotty(L); } s->status = status; return 0; }
/* The entry function. */ void __start(int argc, char *argv[], char *env[], void (*cleanup)(void)) { handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); __asm__("eprol:"); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); }
/* The entry function, C part. */ void _start1(fptr cleanup, int argc, char *argv[]) { char **env; env = argv + argc + 1; handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); __asm__("eprol:"); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); }
int main(int argc, char *argv[]) { struct node *file_list; struct node *p; int max_item_len; struct winsize w; ioctl(0, TIOCGWINSZ, &w); LINE_LEN = w.ws_col; printf("Line Length: %d\n", LINE_LEN); file_list = init_list(); file_list->next = NULL; printf("argc: %d\n", argc); handle_argv(argc, argv); printf("a_flag: %d\nr_flag: %d\n", a_flag, r_flag); if (argc == 1) { do_ls(".", file_list); } else { while (--argc) { printf("%s\n", *++argv); if (*argv[0] != '-') { do_ls(*argv, file_list); } } } //print_list(file_list); //printf("Max item length: %d", get_item_max_len(file_list)); free_list(file_list); return 0; }