annotate lib-src/run.h @ 388:aabb7f5b1c81 r21-2-9

Import from CVS: tag r21-2-9
author cvs
date Mon, 13 Aug 2007 11:09:42 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
1 // #define DEBUG
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
2 // #define DEBUGALL
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
3
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
4 // B19 - egcs automatically defines CYGWIN32 but not CYGWIN
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
5 // B20 - egcs automatically defines both CYGWIN32 and CYGWIN
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
6 // Bfuture - (???) defines CYGWIN but not CYGWIN32
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
7 #if defined(__CYGWIN32__)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
8 #if !defined(__CYGWIN__)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
9 #define B19
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
10 #define __CYGWIN__
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
11 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
12 #define B20
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
13 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
14 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
15 #if defined(__CYGWIN__)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
16 #define B21
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
17 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
18 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
19 // Now: use __CYGWIN__ to represent any version
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
20 // distinguish using B19, B20, or B21
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
21
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
22 #if defined(__CYGWIN__)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
23 #ifdef B19
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
24 #define CYGWIN_ATTACH_HANDLE_TO_FD(a) cygwin32_attach_handle_to_fd a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
25 #define CYGWIN_CONV_TO_FULL_POSIX_PATH(a) cygwin32_conv_to_full_posix_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
26 #define CYGWIN_CONV_TO_FULL_WIN32_PATH(a) cygwin32_conv_to_full_win32_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
27 #define CYGWIN_CONV_TO_POSIX_PATH(a) cygwin32_conv_to_posix_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
28 #define CYGWIN_CONV_TO_WIN32_PATH(a) cygwin32_conv_to_win32_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
29 #define CYGWIN_DETACH_DLL(a) cygwin32_detach_dll a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
30 #define CYGWIN_GETSHARED(a) cygwin32_getshared a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
31 #define CYGWIN_INTERNAL(a) cygwin32_internal a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
32 #define CYGWIN_POSIX_PATH_LIST_P(a) cygwin32_posix_path_list_p a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
33 #define CYGWIN_POSIX_TO_WIN32_PATH_LIST(a) cygwin32_posix_to_win32_path_list a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
34 #define CYGWIN_POSIX_TO_WIN32_PATH_LIST_BUF_SIZE(a) cygwin32_posix_to_win32_path_list_buf_size a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
35 #define CYGWIN_SPLIT_PATH(a) cygwin32_split_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
36 #define CYGWIN_WIN32_TO_POSIX_PATH_LIST(a) cygwin32_win32_to_posix_path_list a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
37 #define CYGWIN_WIN32_TO_POSIX_PATH_LIST_BUF_SIZE(a) cygwin32_win32_to_posix_path_list_buf_size a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
38 #define CYGWIN_WINPID_TO_PID(a) cygwin32_winpid_to_pid a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
39 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
40 #define CYGWIN_ATTACH_HANDLE_TO_FD(a) cygwin_attach_handle_to_fd a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
41 #define CYGWIN_CONV_TO_FULL_POSIX_PATH(a) cygwin_conv_to_full_posix_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
42 #define CYGWIN_CONV_TO_FULL_WIN32_PATH(a) cygwin_conv_to_full_win32_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
43 #define CYGWIN_CONV_TO_POSIX_PATH(a) cygwin_conv_to_posix_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
44 #define CYGWIN_CONV_TO_WIN32_PATH(a) cygwin_conv_to_win32_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
45 #define CYGWIN_DETACH_DLL(a) cygwin_detach_dll a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
46 #define CYGWIN_GETSHARED(a) cygwin_getshared a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
47 #define CYGWIN_INTERNAL(a) cygwin_internal a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
48 #define CYGWIN_POSIX_PATH_LIST_P(a) cygwin_posix_path_list_p a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
49 #define CYGWIN_POSIX_TO_WIN32_PATH_LIST(a) cygwin_posix_to_win32_path_list a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
50 #define CYGWIN_POSIX_TO_WIN32_PATH_LIST_BUF_SIZE(a) cygwin_posix_to_win32_path_list_buf_size a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
51 #define CYGWIN_SPLIT_PATH(a) cygwin_split_path a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
52 #define CYGWIN_WIN32_TO_POSIX_PATH_LIST(a) cygwin_win32_to_posix_path_list a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
53 #define CYGWIN_WIN32_TO_POSIX_PATH_LIST_BUF_SIZE(a) cygwin_win32_to_posix_path_list_buf_size a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
54 #define CYGWIN_WINPID_TO_PID(a) cygwin_winpid_to_pid a
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
55 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
56 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
57
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
58 #if defined(__CYGWIN__)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
59 #define PATH_SEP_CHAR_STR "/"
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
60 #define SEP_CHARS ":"
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
61 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
62 #define PATH_SEP_CHAR_STR "\\"
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
63 #define SEP_CHARS ";"
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
64 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
65
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
66 #ifndef RC_INVOKED
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
67
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
68 #define MAX_ARGS 20
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
69
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
70 #ifdef DEBUG
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
71 #define Trace(x) Trace_ x
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
72 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
73 #define Trace(x)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
74 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
75
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
76 #define NUM_EXTENSIONS 2
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
77 const char* exts[NUM_EXTENSIONS] = { "", ".exe" };
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
78
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
79 char* pfopen(char *retval, const char *name, const char *dirs);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
80 void error(char* fmt, ...);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
81 void message(char* fmt, ...);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
82 void Trace_(char* fmt, ...);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
83 int get_exec_name_and_path(char* execname, char* execpath);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
84 char* my_strtok(char* s, const char* delim, char** lasts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
85 int parse_cmdline_to_arg_array(char* argv[MAX_ARGS], char* cmdline);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
86 void strip_exe(char* s);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
87 int start_child(char* cmdline, int wait_for_child);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
88 void xemacs_special(char* exec);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
89 int build_cmdline(char* new_cmdline, char* exec, int argc, char* argv[]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
90 void process_execname(char *exec, const char* execname, const char* execpath);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
91 int fileExists(char* fullname, const char* path, const char* name);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
92 int endsWith(const char* s1, const char* s2);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
93 int fileExistsMulti(char* fullname, const char* path,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
94 const char* name_noext, const char* exts[],
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
95 const int extcnt);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
96
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
97 #endif /* RC_INVOKED */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
98
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
99
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
100