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.229 2008/06/05 15:10:45 mast Exp $ + || $Id: main.c,v 1.230 2008/06/28 19:23:06 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:146: Inside #if defined(__NT__)
     #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);   #endif       if(!master_location[CONSTANT_STRLEN(MASTER_COOKIE)])    { -  sprintf(master_location + CONSTANT_STRLEN(MASTER_COOKIE), +  SNPRINTF (master_location + CONSTANT_STRLEN(MASTER_COOKIE), +  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)] != '\\') { +  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, +  sizeof (master_location) - CONSTANT_STRLEN (MASTER_COOKIE)); +  } +  } + #endif +     TRACE((stderr, "Default master at \"%s\"...\n",    master_location + CONSTANT_STRLEN(MASTER_COOKIE)));   }      #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));