Macros | Functions | Variables
run.h File Reference

Go to the source code of this file.

Macros

#define PATH_SEP_CHAR_STR   "\\"
 
#define SEP_CHARS   ";"
 
#define MAX_ARGS   20
 
#define Trace(x)
 
#define NUM_EXTENSIONS   2
 

Functions

char * pfopen (char *retval, const char *name, const char *dirs)
 
void error (char *fmt,...)
 
void message (char *fmt,...)
 
void Trace_ (char *fmt,...)
 
int get_exec_name_and_path (char *execname, char *execpath)
 
char * my_strtok (char *s, const char *delim, char **lasts)
 
int parse_cmdline_to_arg_array (char *argv[MAX_ARGS], char *cmdline)
 
void strip_exe (char *s)
 
int start_child (char *cmdline, int wait_for_child)
 
void xemacs_special (char *exec)
 
int build_cmdline (char *new_cmdline, char *exec, int argc, char *argv[])
 
void process_execname (char *exec, const char *execname, const char *execpath)
 
int fileExists (char *fullname, const char *path, const char *name)
 
int endsWith (const char *s1, const char *s2)
 
int fileExistsMulti (char *fullname, const char *path, const char *name_noext, const char *exts[], const int extcnt)
 

Variables

const char * exts [NUM_EXTENSIONS] = { "", ".exe" }
 

Macro Definition Documentation

§ MAX_ARGS

#define MAX_ARGS   20

Definition at line 68 of file run.h.

§ NUM_EXTENSIONS

#define NUM_EXTENSIONS   2

Definition at line 76 of file run.h.

§ PATH_SEP_CHAR_STR

#define PATH_SEP_CHAR_STR   "\\"

Definition at line 62 of file run.h.

§ SEP_CHARS

#define SEP_CHARS   ";"

Definition at line 63 of file run.h.

§ Trace

#define Trace (   x)

Definition at line 73 of file run.h.

Function Documentation

§ build_cmdline()

int build_cmdline ( char *  new_cmdline,
char *  exec,
int  argc,
char *  argv[] 
)

Definition at line 184 of file run.c.

185 {
186  int retval = FALSE;
187  int first_arg = 1;
188  int i;
189  int char_cnt = 0;
190  /*
191  * look for "-wait" as first true argument; we'll apply that ourselves
192  */
193  if ((argc >= 2) && (stricmp(argv[1],"-wait") == 0))
194  {
195  retval = TRUE;
196  first_arg++;
197  }
198 
199  char_cnt = strlen(exec);
200  for (i = first_arg; i < argc; i++)
201  char_cnt += strlen(argv[i]);
202  if (char_cnt > MAX_ARGS*MAX_PATH) /* then we ran out of room */
203  error("command line too long -\n%s",new_cmdline);
204 
205  strcpy(new_cmdline,exec);
206  for (i = first_arg; i < argc; i++)
207  {
208  strcat(new_cmdline," ");
209  strcat(new_cmdline,argv[i]);
210  }
211  return retval;
212 }
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
#define MAX_ARGS
Definition: run.h:68
int i
Definition: cfEzgcd.cc:123
void error(char *fmt,...)
Definition: run.c:421

§ endsWith()

int endsWith ( const char *  s1,
const char *  s2 
)

Definition at line 403 of file run.c.

404 {
405  int len1;
406  int len2;
407  int retval = FALSE;
408  len1 = strlen(s1);
409  len2 = strlen(s2);
410  if (len1 - len2 >= 0)
411  if (stricmp(&(s1[len1-len2]),s2) == 0)
412  retval = TRUE;
413  return retval;
414 }void strip_exe(char* s)
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
void strip_exe(char *s)
Definition: run.c:414

§ error()

void error ( char *  fmt,
  ... 
)

Definition at line 421 of file run.c.

422 {
423  char buf[4096];
424  int j;
425  va_list args;
426  va_start(args, fmt);
427  j = sprintf(buf, "Error: ");
428  j += vsprintf(buf + j,fmt,args);
429  j += sprintf(buf + j,"\n");
430  va_end(args);
431  MessageBox(NULL, buf, "Run.exe", MB_ICONSTOP);
432  exit(1);
433 }
int j
Definition: myNF.cc:70
int status int void * buf
Definition: si_signals.h:59
#define NULL
Definition: omList.c:10

§ fileExists()

int fileExists ( char *  fullname,
const char *  path,
const char *  name 
)

Definition at line 675 of file run.c.

676 {
677  int retval = FALSE;
678  FILE* file;
679  size_t len;
680  char work[FILENAME_MAX];
681  char work2[MAX_PATH + FILENAME_MAX + 100];
682  if (path != NULL)
683  {
684  strcpy(work, path);
685  len = strlen(work);
686  if (len && work[len-1] != '/' && work[len-1] != '\\')
687  strcat(work, PATH_SEP_CHAR_STR);
688  }
689  else
690  work[0]='\0';
691 
692  strcat(work, name);
693 #if defined(__CYGWIN__)
694  CYGWIN_CONV_TO_POSIX_PATH((work, work2));
695 #else
696  strcpy(work2,work);
697 #endif
698 
699 #ifdef DEBUGALL
700  Trace(("looking for...\t%s\n",work2));
701 #endif
702 
703  file = fopen(work2, "rb");
704  if (file != NULL)
705  {
706  if (fullname != NULL)
707  strcpy(fullname,work2);
708  retval = TRUE;
709  fclose(file);
710  }
711  return retval;
712 }
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
#define PATH_SEP_CHAR_STR
Definition: run.h:62
char name(const Variable &v)
Definition: factory.h:178
#define Trace(x)
Definition: run.h:73
#define NULL
Definition: omList.c:10

§ fileExistsMulti()

int fileExistsMulti ( char *  fullname,
const char *  path,
const char *  name_noext,
const char *  exts[],
const int  extcnt 
)

Definition at line 654 of file run.c.

657 {
658  char tryName[MAX_PATH + FILENAME_MAX];
659  int i = 0;
660  int retval = FALSE;
661  fullname[0] = '\0';
662  for (i = 0; i < extcnt; i++)
663  {
664  strcpy(tryName,name_noext);
665  strcat(tryName,exts[i]);
666  if (fileExists(fullname, path, tryName) == TRUE)
667  {
668  retval = TRUE;
669  break;
670  }
671  fullname[0] = '\0';
672  }
673  return retval;
674 }
const char * exts[NUM_EXTENSIONS]
Definition: run.h:77
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
int i
Definition: cfEzgcd.cc:123
int fileExists(char *fullname, const char *path, const char *name)
Definition: run.c:675

§ get_exec_name_and_path()

int get_exec_name_and_path ( char *  execname,
char *  execpath 
)

Definition at line 465 of file run.c.

466 {
467  char modname[MAX_PATH];
468  char* tmp_execname;
469  char* p;
470  int retval = FALSE;
471 
472  if (!GetModuleFileName (NULL, modname, MAX_PATH))
473  error("internal error - can't find my own name");
474  if ((p = strrchr (modname, '\\')) == NULL)
475  error("internal error - my own name has no path\n%s",modname);
476  tmp_execname = p + 1;
477  p[0] = '\0';
478  // if invoked by a name like "runxemacs" then strip off
479  // the "run" and let "xemacs" be execname.
480  // To check for this, make that:
481  // 1) first three chars are "run"
482  // 2) but the string doesn't end there, or start ".exe"
483  // Also, set "compact_invocation" TRUE
484  if ( ((tmp_execname[0] == 'r') || (tmp_execname[0] == 'R')) &&
485  ((tmp_execname[1] == 'u') || (tmp_execname[1] == 'U')) &&
486  ((tmp_execname[2] == 'n') || (tmp_execname[2] == 'N')) &&
487  ((tmp_execname[3] != '.') && (tmp_execname[3] != '\0')) )
488  {
489  tmp_execname += 3;
490  retval = TRUE;
491  }
492  else
493  tmp_execname = NULL;
494 
495  if (tmp_execname == NULL)
496  strcpy(execname,"");
497  else
498  strcpy(execname,tmp_execname);
499 #if defined(__CYGWIN__)
500  CYGWIN_CONV_TO_POSIX_PATH((modname,execpath));
501 #else
502  strcpy(execpath,modname);
503 #endif
504  return retval;
505 }
#define FALSE
Definition: auxiliary.h:95
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:99
void error(char *fmt,...)
Definition: run.c:421
#define NULL
Definition: omList.c:10

§ message()

void message ( char *  fmt,
  ... 
)

Definition at line 434 of file run.c.

435 {
436  char buf[10000];
437  int j;
438  va_list args;
439  va_start(args, fmt);
440  j = vsprintf(buf,fmt,args);
441  j += sprintf(buf + j,"\n");
442  va_end(args);
443  MessageBox(NULL, buf, "Run.exe Message", MB_ICONSTOP);
444 }
int j
Definition: myNF.cc:70
int status int void * buf
Definition: si_signals.h:59
#define NULL
Definition: omList.c:10

§ my_strtok()

char* my_strtok ( char *  s,
const char *  delim,
char **  lasts 
)

Definition at line 514 of file run.c.

515 {
516  char *spanp;
517  int c, sc;
518  char *tok;
519 
520  if ((s == NULL) && ((s = *lasts) == NULL))
521  return NULL;
522  /* Skip leading delimiters */
523 cont:
524  c = *s++;
525  for (spanp = (char *)delim; (sc = *spanp++) != 0;) {
526  if (c == sc)
527  goto cont;
528  }
529  if (c == 0) { /* no non-delimiter characters */
530  *lasts = NULL;
531  return (NULL);
532  }
533  tok = s - 1;
534  /*
535  * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
536  * Note that delim must have one NUL; we stop if we see that, too.
537  * If we see a double quote, continue until next double quote, then
538  * start scanning for delimiters again.
539  * CYGWIN ONLY: if we see a backslash, just copy next character -
540  * don't consider it as a delimiter even if it is in delim string.
541  */
542  for (;;) {
543  /* if this c is ", then scan until we find next " */
544  if (c == '\"')
545  while ((c = *s++) != '\"')
546  if (c == 0) /* oops, forgot to close the ", clean up & return */
547  {
548  s = NULL;
549  *lasts = s;
550  return (tok);
551  }
552 #if defined(__CYGWIN__)
553  if (c == '\\')
554  {
555  c = *s++; /* skip the backslash */
556  if (c == 0) /* if escaped character is end-of-string, clean up & return */
557  {
558  s = NULL;
559  *lasts = s;
560  return (tok);
561  }
562  c = *s++; /* otherwise, skip the escaped character */
563  }
564 #endif
565  spanp = (char *)delim;
566  do {
567  if ((sc = *spanp++) == c) {
568  if (c == 0)
569  s = NULL;
570  else
571  s[-1] = 0;
572  *lasts = s;
573  return (tok);
574  }
575  } while (sc != 0);
576  c = *s++;
577  }
578  /* NOTREACHED */
579 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define NULL
Definition: omList.c:10

§ parse_cmdline_to_arg_array()

int parse_cmdline_to_arg_array ( char *  argv[MAX_ARGS],
char *  cmdline 
)

Definition at line 580 of file run.c.

581 {
582  char seps[] = " \t\n";
583  char* token;
584  int argc = 0;
585  char* lasts;
586 
587  token = my_strtok(cmdline, seps, &lasts);
588  while ((token != NULL) && (argc < MAX_ARGS))
589  {
590  if ((argv[argc] = malloc(strlen(token)+1)) == NULL)
591  {
592  error("internal error - out of memory");
593  }
594  strcpy(argv[argc++],token);
595  token = my_strtok(NULL,seps,&lasts);
596  }
597  if (argc >= MAX_ARGS)
598  error("too many arguments on commandline\n%s",cmdline);
599  return argc;
600 }
#define MAX_ARGS
Definition: run.h:68
void * malloc(size_t size)
Definition: omalloc.c:92
char * my_strtok(char *s, const char *delim, char **lasts)
Definition: run.c:514
void error(char *fmt,...)
Definition: run.c:421
#define NULL
Definition: omList.c:10

§ pfopen()

char* pfopen ( char *  retval,
const char *  name,
const char *  dirs 
)

Definition at line 623 of file run.c.

624 {
625  char *ptr;
626  char *tdirs;
627  char returnval[MAX_PATH + FILENAME_MAX + 100];
628  char *recursive_name;
629  int foundit = FALSE;
630 
631  returnval[0] = '\0';
632 
633  if (dirs == NULL || dirs[0] == '\0')
634  return NULL;
635 
636  if ((tdirs = malloc(strlen(dirs)+1)) == NULL)
637  return NULL;
638 
639  strcpy(tdirs, dirs);
640 
641  for (ptr = strtok(tdirs, SEP_CHARS); (foundit == FALSE) && ptr != NULL;
642  ptr = strtok(NULL, SEP_CHARS))
643  {
644  foundit = fileExists(returnval,ptr,name);
645  }
646 
647  free(tdirs);
648  if (!foundit)
649  retval[0] = '\0';
650  else
651  strcpy(retval,returnval);
652  return retval;
653 }
#define SEP_CHARS
Definition: run.h:63
#define FALSE
Definition: auxiliary.h:95
void * malloc(size_t size)
Definition: omalloc.c:92
#define free
Definition: omAllocFunc.c:12
char name(const Variable &v)
Definition: factory.h:178
#define NULL
Definition: omList.c:10
int fileExists(char *fullname, const char *path, const char *name)
Definition: run.c:675

§ process_execname()

void process_execname ( char *  exec,
const char *  execname,
const char *  execpath 
)

Definition at line 234 of file run.c.

235 {
236  char* orig_pathlist;
237  char* pathlist;
238  char exec_tmp[MAX_PATH + FILENAME_MAX + 100];
239  char exec_tmp2[MAX_PATH + FILENAME_MAX + 100];
240  char buf[MAX_PATH + FILENAME_MAX + 100];
241  int i,j;
242 
243  int len = 0;
244  /*
245  * STARTS WITH / or \
246  * execpath NOT used
247  */
248  if ((execname[0] == '\\') || (execname[0] == '/'))
249  {
250 #if defined(__CYGWIN__)
251  strcpy(exec_tmp,execname);
252 #else
253  exec_tmp[0] = ((char) (_getdrive() + ((int) 'A') - 1));
254  exec_tmp[1] = ':';
255  exec_tmp[2] = '\0';
256  strcat(exec_tmp,execname);
257 #endif
258  Trace(("/ -\nexec_tmp\t%s\nexecname\t%s\nexecpath\t%s\n",
259  exec_tmp,execname,execpath));
260  if (! fileExistsMulti(exec_tmp2,NULL,exec_tmp,exts,NUM_EXTENSIONS) )
261  {
262  j = 0;
263  for (i = 0; i < NUM_EXTENSIONS; i++)
264  j += sprintf(buf + j," [%d]: %s\n",i+1,exts[i]);
265  error("Couldn't locate %s\nI tried appending the following "
266  "extensions: \n%s",exec_tmp,buf);
267  }
268  Trace((exec_tmp2));
269  }
270  /*
271  * STARTS WITH x:\ or x:/
272  * execpath NOT used
273  */
274  else if ((strlen(execname) > 3) && // avoid boundary errors
275  (execname[1] == ':') &&
276  ((execname[2] == '\\') || (execname[2] == '/')))
277  {
278  strcpy(exec_tmp,execname);
279  Trace(("x: -\nexec_tmp\t%s\nexecname\t%s\nexecpath\t%s\n",
280  exec_tmp,execname,execpath));
281  if (! fileExistsMulti(exec_tmp2,NULL,exec_tmp,exts,NUM_EXTENSIONS) )
282  {
283  j = 0;
284  for (i = 0; i < NUM_EXTENSIONS; i++)
285  j += sprintf(buf + j," [%d]: %s\n",i+1,exts[i]);
286  error("Couldn't locate %s\nI tried appending the following "
287  "extensions: \n%s",exec_tmp,buf);
288  }
289  Trace((exec_tmp2));
290  }
291  /*
292  * STARTS WITH ./ or .\
293  */
294  else if ((execname[0] == '.') &&
295  ((execname[1] == '\\') || (execname[1] == '/')))
296  {
297  if (((char*) getcwd(exec_tmp,MAX_PATH))==NULL)
298  error("can't find current working directory");
299  if (! fileExistsMulti(exec_tmp2,exec_tmp,&(execname[2]),
300  exts,NUM_EXTENSIONS) )
301  if (! fileExistsMulti(exec_tmp2,execpath,&(execname[2]),
302  exts,NUM_EXTENSIONS) )
303  {
304  j = 0;
305  for (i = 0; i < NUM_EXTENSIONS; i++)
306  j += sprintf(buf + j," [%d]: %s\n",i+1,exts[i]);
307  error("Couldn't locate %s\n"
308  "I looked in the following directories:\n [1]: %s\n [2]: %s\n"
309  "I also tried appending the following "
310  "extensions: \n%s",execname,exec_tmp,execpath,buf);
311  }
312  Trace((exec_tmp2));
313  }
314  /*
315  * OTHERWISE, SEARCH PATH (prepend '.' and run.exe's directory)
316  * can't use fileExistsMulti because we want to search entire path
317  * for exts[0], then for exts[1], etc.
318  */
319  else
320  {
321  orig_pathlist = getenv("PATH");
322  if ((pathlist = malloc (strlen(orig_pathlist)
323  + strlen(".")
324  + strlen(execpath)+ 3)) == NULL)
325  error("internal error - out of memory");
326  strcpy(pathlist,".");
327  strcat(pathlist,SEP_CHARS);
328  strcat(pathlist,execpath);
329  strcat(pathlist,SEP_CHARS);
330  strcat(pathlist,orig_pathlist);
331 
332  Trace((pathlist));
333  for (i = 0; i < NUM_EXTENSIONS; i++)
334  {
335  strcpy(exec_tmp,execname);
336  strcat(exec_tmp,exts[i]);
337  pfopen(exec_tmp2,exec_tmp,pathlist);
338  if (fileExists(NULL,NULL,exec_tmp2))
339  break;
340  exec_tmp2[0] = '\0';
341  }
342  Trace(("exec_tmp\t%s\npathlist\t%s\n",exec_tmp2,pathlist));
343 
344  free(pathlist);
345  if (exec_tmp2[0] == '\0')
346  {
347  j = 0;
348  for (i = 0; i < NUM_EXTENSIONS; i++)
349  j += sprintf(buf + j," [%d]: %s\n",i+1,exts[i]);
350  error("Couldn't find %s anywhere.\n"
351  "I even looked in the PATH \n"
352  "I also tried appending the following "
353  "extensions: \n%s",execname,buf);
354  }
355  }
356 /*
357  * At this point, we know that exec_tmp2 contains a filename
358  * and we know that exec_tmp2 exists.
359  */
360 #if defined(__CYGWIN__)
361  {
362  struct stat stbuf;
363  char sym_link_name[MAX_PATH+1];
364  char real_name[MAX_PATH+1];
365  char dummy[MAX_PATH+1];
366 
367  strcpy(exec_tmp,exec_tmp2);
368 
369  CYGWIN_CONV_TO_POSIX_PATH((exec_tmp,sym_link_name));
370  Trace((sym_link_name));
371 
372  if (lstat(sym_link_name, &stbuf) == 0)
373  {
374  if ((stbuf.st_mode & S_IFLNK) == S_IFLNK)
375  {
376  if (readlink(sym_link_name, real_name, sizeof(real_name)) == -1)
377  error("problem reading symbolic link for %s",exec_tmp);
378  else
379  {
380  // if realname starts with '/' it's a rootpath
381  if (real_name[0] == '/')
382  strcpy(exec_tmp2,real_name);
383  else // otherwise, it's relative to the symlink's location
384  {
385  CYGWIN_SPLIT_PATH((sym_link_name,exec_tmp2,dummy));
386  if (!endsWith(exec_tmp2,PATH_SEP_CHAR_STR))
387  strcat(exec_tmp2,PATH_SEP_CHAR_STR);
388  strcat(exec_tmp2,real_name);
389  }
390  }
391  }
392  else /* NOT a symlink */
393  strcpy(exec_tmp2, sym_link_name);
394  }
395  else
396  error("can't locate executable - %s",sym_link_name);
397  }
398  CYGWIN_CONV_TO_FULL_WIN32_PATH((exec_tmp2,exec));
399 #else
400  strcpy (exec, exec_tmp2);
401 #endif
402 }
const char * exts[NUM_EXTENSIONS]
Definition: run.h:77
int endsWith(const char *s1, const char *s2)
Definition: run.c:403
#define SEP_CHARS
Definition: run.h:63
int fileExistsMulti(char *fullname, const char *path, const char *name_noext, const char *exts[], const int extcnt)
Definition: run.c:654
char * getenv()
#define PATH_SEP_CHAR_STR
Definition: run.h:62
int j
Definition: myNF.cc:70
int status int void * buf
Definition: si_signals.h:59
void * malloc(size_t size)
Definition: omalloc.c:92
#define free
Definition: omAllocFunc.c:12
int i
Definition: cfEzgcd.cc:123
#define Trace(x)
Definition: run.h:73
#define NUM_EXTENSIONS
Definition: run.h:76
void error(char *fmt,...)
Definition: run.c:421
#define NULL
Definition: omList.c:10
char * pfopen(char *retval, const char *name, const char *dirs)
Definition: run.c:623
int fileExists(char *fullname, const char *path, const char *name)
Definition: run.c:675

§ start_child()

int start_child ( char *  cmdline,
int  wait_for_child 
)

Definition at line 120 of file run.c.

121 {
122  STARTUPINFO start;
123  SECURITY_ATTRIBUTES sec_attrs;
124  SECURITY_DESCRIPTOR sec_desc;
125  PROCESS_INFORMATION child;
126  int retval;
127 
128  memset (&start, 0, sizeof (start));
129  start.cb = sizeof (start);
130  start.dwFlags = STARTF_USESHOWWINDOW;
131  start.wShowWindow = SW_HIDE;
132 
133  sec_attrs.nLength = sizeof (sec_attrs);
134  sec_attrs.lpSecurityDescriptor = NULL;
135  sec_attrs.bInheritHandle = FALSE;
136 
137  if (CreateProcess (NULL, cmdline, &sec_attrs, NULL, TRUE, 0,
138  NULL, NULL, &start, &child))
139  {
140  if (wait_for_child)
141  {
142  WaitForSingleObject (child.hProcess, INFINITE);
143  GetExitCodeProcess (child.hProcess, &retval);
144  }
145  CloseHandle (child.hThread);
146  CloseHandle (child.hProcess);
147  }
148  else
149  error("could not start %s",cmdline);
150  return retval;
151 }
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
void error(char *fmt,...)
Definition: run.c:421
#define NULL
Definition: omList.c:10

§ strip_exe()

void strip_exe ( char *  s)

Definition at line 414 of file run.c.

415 {
416  if ((strlen(s) > 4) && // long enough to have .exe extension
417  // second part not evaluated (short circuit) if exec_arg too short
418  (stricmp(&(s[strlen(s)-4]),".exe") == 0))
419  s[strlen(s)-4] = '\0';
420 }
const CanonicalForm int s
Definition: facAbsFact.cc:55

§ Trace_()

void Trace_ ( char *  fmt,
  ... 
)

Definition at line 445 of file run.c.

446 {
447  char buf[10000];
448  int j;
449  va_list args;
450  va_start(args, fmt);
451  j = vsprintf(buf,fmt,args);
452  j += sprintf(buf + j,"\n");
453  va_end(args);
454  MessageBox(NULL, buf, "Run.exe DEBUG", MB_ICONSTOP);
455 }
int j
Definition: myNF.cc:70
int status int void * buf
Definition: si_signals.h:59
#define NULL
Definition: omList.c:10

§ xemacs_special()

void xemacs_special ( char *  exec)

Definition at line 152 of file run.c.

153 {
154  /*
155  * if we're trying to run xemacs, AND this file was in %emacs_dir%\bin,
156  * then set emacs_dir environment variable
157  */
158  char* p;
159  char* p2;
160  char exec2[MAX_PATH + FILENAME_MAX + 100];
161  char tmp[MAX_PATH + FILENAME_MAX + 100];
162  strcpy(exec2,exec);
163  /* this depends on short-circuit evaluation */
164  if ( ((p = strrchr(exec2,'\\')) && stricmp(p,"\\xemacs") == 0) ||
165  ((p = strrchr(exec2,'/')) && stricmp(p,"/xemacs") == 0) ||
166  ((p = strrchr(exec2,'\\')) && stricmp(p,"\\xemacs.exe") == 0) ||
167  ((p = strrchr(exec2,'/')) && stricmp(p,"/xemacs.exe") == 0) )
168  {
169  if ( ((p2 = strrchr(p, '\\')) && stricmp(p2, "\\bin") == 0) ||
170  ((p2 = strrchr(p, '/')) && stricmp(p2, "/bin") == 0) )
171  {
172  *p2 = '\0';
173 #if defined(__CYGWIN__)
174  CYGWIN_CONV_TO_POSIX_PATH((exec2,tmp));
175  strcpy(exec2,tmp);
176 #else /* NATIVE xemacs DOS-style paths with forward slashes */
177  for (p = exec2; *p; p++)
178  if (*p == '\\') *p = '/';
179 #endif
180  SetEnvironmentVariable ("emacs_dir", exec2);
181  }
182  }
183 }
return P p
Definition: myNF.cc:203
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

Variable Documentation

§ exts

const char* exts[NUM_EXTENSIONS] = { "", ".exe" }

Definition at line 77 of file run.h.