pike.git / src / main.c

version» Context lines:

pike.git/src/main.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: main.c,v 1.230 2008/06/28 19:23:06 mast Exp $ + || $Id: main.c,v 1.231 2008/06/29 10:40:55 mast Exp $   */      #include "global.h"   #include "fdlib.h"   #include "backend.h"   #include "module.h"   #include "object.h"   #include "lex.h"   #include "pike_types.h"   #include "builtin_functions.h"
pike.git/src/main.c:130: Inside #if defined(__NT__)
   /* FIXME: Look at len? UNICODE? */    set_master(buffer);    }    RegCloseKey(k);    }   }   #endif /* __NT__ */      static void set_default_master(void)   { +  char *mp = master_location + CONSTANT_STRLEN (MASTER_COOKIE); +    #ifdef HAVE_GETENV -  if(!master_location[CONSTANT_STRLEN(MASTER_COOKIE)] && -  getenv("PIKE_MASTER")) { +  if(!*mp && getenv("PIKE_MASTER")) {    set_master(getenv("PIKE_MASTER"));    }   #endif      #ifdef __NT__ -  if(!master_location[CONSTANT_STRLEN(MASTER_COOKIE)]) -  get_master_key(HKEY_CURRENT_USER); -  if(!master_location[CONSTANT_STRLEN(MASTER_COOKIE)]) -  get_master_key(HKEY_LOCAL_MACHINE); +  if(!*mp) get_master_key(HKEY_CURRENT_USER); +  if(!*mp) get_master_key(HKEY_LOCAL_MACHINE);   #endif    -  if(!master_location[CONSTANT_STRLEN(MASTER_COOKIE)]) +  if(!*mp)    { -  SNPRINTF (master_location + CONSTANT_STRLEN(MASTER_COOKIE), -  sizeof (master_location) - CONSTANT_STRLEN (MASTER_COOKIE), +  SNPRINTF (mp, sizeof (master_location) - CONSTANT_STRLEN (MASTER_COOKIE),    DEFAULT_MASTER,    PIKE_MAJOR_VERSION,    PIKE_MINOR_VERSION,    PIKE_BUILD_VERSION);    }      #ifdef __NT__ -  if (master_location[CONSTANT_STRLEN (MASTER_COOKIE)] != '/' && -  master_location[CONSTANT_STRLEN (MASTER_COOKIE)] != '\\') { +  if (!(*mp == '/' || *mp == '\\' || (isalpha (*mp) && mp[1] == ':'))) {    char exepath[MAXPATHLEN];    if (!GetModuleFileName (NULL, exepath, _MAX_PATH))    fprintf (stderr, "Failed to get path to exe file: %d\n",    GetLastError());    else {    char tmp[MAXPATHLEN * 2];    char *p = strrchr (exepath, '\\');    if (p) *p = 0; -  SNPRINTF (tmp, sizeof (tmp), "%s/%s", exepath, -  master_location + CONSTANT_STRLEN (MASTER_COOKIE)); -  strncpy (master_location + CONSTANT_STRLEN (MASTER_COOKIE), tmp, +  SNPRINTF (tmp, sizeof (tmp), "%s/%s", exepath, mp); +  strncpy (mp, tmp,    sizeof (master_location) - CONSTANT_STRLEN (MASTER_COOKIE));    }    }   #endif    -  TRACE((stderr, "Default master at \"%s\"...\n", -  master_location + CONSTANT_STRLEN(MASTER_COOKIE))); +  TRACE((stderr, "Default master at \"%s\"...\n", mp));   }      #ifdef LIBPIKE   static char libpike_file[MAXPATHLEN * 2];   static void *libpike;      static void (*init_pike)(const char **argv, const char *file);   static void (*init_pike_runtime)(void (*exit_cb)(int));   #endif /* LIBPIKE */