Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39fccf0

Browse files
committed
On Windows, cause get_progname to strip any .EXE suffix.
Andrew Dunstan
1 parent0f845a9 commit39fccf0

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

‎src/port/path.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.36 2004/09/2405:16:35 tgl Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.37 2004/10/2422:08:19 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -175,15 +175,38 @@ canonicalize_path(char *path)
175175

176176

177177
/*
178-
* Extracts the actual name of the program as called.
178+
* Extracts the actual name of the program as called -
179+
* stripped of .exe suffix if any
179180
*/
180181
constchar*
181182
get_progname(constchar*argv0)
182183
{
184+
constchar*nodir_name;
185+
183186
if (!last_dir_separator(argv0))
184-
returnargv0;
187+
nodir_name=argv0;
185188
else
186-
returnlast_dir_separator(argv0)+1;
189+
nodir_name=last_dir_separator(argv0)+1;
190+
191+
#if defined(__CYGWIN__)|| defined(WIN32)
192+
/* strip .exe suffix, regardless of case */
193+
if (strlen(nodir_name)>4&&
194+
stricmp(nodir_name+ (strlen(nodir_name)-4),EXE)==0)
195+
{
196+
char*progname;
197+
198+
progname=strdup(nodir_name);
199+
if (progname==NULL)
200+
{
201+
fprintf(stderr,"%s: out of memory\n",nodir_name);
202+
exit(1);
203+
}
204+
progname[strlen(progname)-4]='\0';
205+
nodir_name=progname;
206+
}
207+
#endif
208+
209+
returnnodir_name;
187210
}
188211

189212

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp