- Timestamp:
- Oct 22, 2012, 2:48:13 PM (13 years ago)
- Location:
- trunk/src/peldr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/peldr/helpers.c
r21942 r22028 75 75 } 76 76 77 const char *str_find_last_char(const char *s, int c) 78 { 79 int len = strlen (s); 80 const char *e = s + len; 81 while (e >= s && *e != c) 82 e--; 83 return e < s ? s + len : e; 84 } 85 77 86 // 78 87 // BEGIN: taken from _ras.cpp -
trunk/src/peldr/helpers.h
r21942 r22028 20 20 const char *str_skip_char(const char *s, int c); 21 21 const char *str_find_char(const char *s, int c); 22 const char *str_find_last_char(const char *s, int c); 22 23 int vsnprintf (char *buf, int n, const char *fmt, va_list args); 23 24 int snprintf(char *buf, int n, const char *fmt, ...); -
trunk/src/peldr/pe.c
r22016 r22028 199 199 win32cmdline = pszTemp; 200 200 201 // add the .EXE extension if missing (only if there's no path) 202 if (*str_find_char(exeName, '.') == '\0' && 203 *str_find_char(exeName, '\\') == '\0' && 204 *str_find_char(exeName, '/') == '\0') 201 // add the .EXE extension if missing (only if there's no extension already) 202 if (*str_find_last_char(exeName, '.') == '\0') 205 203 { 206 204 int i = strlen(exeName); 207 if (i < 4 || !((exeName[i-1] == 'E' || exeName[i-1] == 'e') && 208 (exeName[i-2] == 'X' || exeName[i-2] == 'x') && 209 (exeName[i-3] == 'E' || exeName[i-3] == 'e') && 210 exeName[i-4] == '.')) 211 { 212 if (i + 4 < CCHMAXPATH) 213 strcat(exeName, ".exe"); 214 } 205 if (i + 4 < CCHMAXPATH) 206 strcat(exeName, ".exe"); 215 207 } 216 208
Note:
See TracChangeset
for help on using the changeset viewer.