pike.git / src / main.c

version» Context lines:

pike.git/src/main.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: main.c,v 1.28 1997/12/28 09:29:10 hubbe Exp $"); + RCSID("$Id: main.c,v 1.29 1998/01/02 01:05:48 hubbe Exp $"); + #include "fdlib.h"   #include "backend.h"   #include "module.h"   #include "object.h"   #include "lex.h"   #include "pike_types.h"   #include "builtin_functions.h"   #include "array.h"   #include "stralloc.h"   #include "interpret.h"   #include "error.h"   #include "pike_macros.h"   #include "callback.h"   #include "signal_handler.h"   #include "threads.h"   #include "dynamic_load.h"   #include "gc.h"   #include "mapping.h" -  + #include "cpp.h"    -  + #ifdef HAVE_WINSOCK_H + #include "winsock.h" + #endif +    #include <errno.h>      #ifdef HAVE_LOCALE_H   #include <locale.h>   #endif      #include "time_stuff.h"      #ifdef HAVE_SYS_RESOURCE_H   #include <sys/resource.h>
pike.git/src/main.c:49:   static struct callback_list post_master_callbacks;      struct callback *add_post_master_callback(callback_func call,    void *arg,    callback_func free_func)   {    return add_to_callback(&post_master_callbacks, call, arg, free_func);   }       - void main(int argc, char **argv, char **env) + void main(int argc, char **argv)   {    JMP_BUF back;    int e, num;    char *p;    struct array *a;       ARGV=argv;    - #ifndef __NT__ -  /* Close extra fds (if any) */ -  for (e=3; e < MAX_OPEN_FILEDESCRIPTORS; e++) { -  do { -  num = close(e); -  } while ((num < 0) && (errno == EINTR)); +  fd_init(); +  + #ifdef HAVE_WINSOCK_H +  { +  WSADATA wsadata; +  if(WSAStartup(MAKEWORD(2,0), &wsadata) != 0) +  { +  fatal("No winsock available.\n");    } -  +  }   #endif      #ifdef HAVE_SETLOCALE   #ifdef LC_NUMERIC    setlocale(LC_NUMERIC, "C");   #endif   #ifdef LC_CTYPE    setlocale(LC_CTYPE, "");   #endif   #ifdef LC_TIME
pike.git/src/main.c:211: Inside #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
   lim.rlim_cur=tmp;    setrlimit(RLIMIT_NOFILE, &lim);    }    }   #endif       GETTIMEOFDAY(&current_time);       init_shared_string_table();    init_interpreter(); +  init_cpp();    init_lex();    init_types();       init_modules();    master();    call_callback(& post_master_callbacks, 0);    free_callback(& post_master_callbacks);       a=allocate_array_no_init(argc,0);    for(num=0;num<argc;num++)    {    ITEM(a)[num].u.string=make_shared_string(argv[num]);    ITEM(a)[num].type=T_STRING;    }    push_array(a);    -  for(num=0;env[num];num++); +  for(num=0;environ[num];num++);    a=allocate_array_no_init(num,0); -  for(num=0;env[num];num++) +  for(num=0;environ[num];num++)    { -  ITEM(a)[num].u.string=make_shared_string(env[num]); +  ITEM(a)[num].u.string=make_shared_string(environ[num]);    ITEM(a)[num].type=T_STRING;    }    push_array(a);       if(SETJMP(back))    {    ONERROR tmp;    SET_ONERROR(tmp,exit_on_error,"Error in handle_error in master object!");    assign_svalue_no_free(sp, & throw_value);    sp++;
pike.git/src/main.c:287:   void low_exit_main(void)   {    void cleanup_added_efuns(void);    void cleanup_pike_types(void);    void cleanup_program(void);       th_cleanup();    exit_dynamic_load();    exit_signals();    exit_lex(); +  exit_cpp();    cleanup_interpret();    cleanup_added_efuns();    cleanup_pike_types();    cleanup_program();       do_gc();       cleanup_callbacks();    zap_all_arrays();    zap_all_mappings();       cleanup_shared_string_table();   }