1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Make output on Windows identical to output on Unix.

* src/options.cc (Options::print_options): Drop a ".exe" suffix from the
program name before printing it.
This commit is contained in:
Bruno Haible
2025-04-05 10:23:32 +02:00
parent 2dd5061f4d
commit 67c697622f
2 changed files with 25 additions and 7 deletions

View File

@@ -1,3 +1,9 @@
2025-04-05 Bruno Haible <bruno@clisp.org>
Make output on Windows identical to output on Unix.
* src/options.cc (Options::print_options): Drop a ".exe" suffix from the
program name before printing it.
2024-11-16 Bruno Haible <bruno@clisp.org> 2024-11-16 Bruno Haible <bruno@clisp.org>
Avoid "-Wzero-as-null-pointer-constant" warnings on the generated code. Avoid "-Wzero-as-null-pointer-constant" warnings on the generated code.

View File

@@ -1,5 +1,5 @@
/* Handles parsing the Options provided to the user. /* Handles parsing the Options provided to the user.
Copyright (C) 1989-1998, 2000, 2002-2004, 2006-2009, 2011, 2016-2018, 2022-2023 Free Software Foundation, Inc. Copyright (C) 1989-1998, 2000, 2002-2004, 2006-2009, 2011, 2016-2018, 2022-2023, 2025 Free Software Foundation, Inc.
Written by Douglas C. Schmidt <schmidt@ics.uci.edu> Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>. and Bruno Haible <bruno@clisp.org>.
@@ -279,17 +279,29 @@ Options::print_options () const
for (int i = 0; i < _argument_count; i++) for (int i = 0; i < _argument_count; i++)
{ {
const char *arg = _argument_vector[i]; char *arg = _argument_vector[i];
if (i == 0) if (i == 0)
{ {
/* _argument_vector[0] is the program name. Print only its base name. /* _argument_vector[0] is the program name. Print only its base name,
and also drop its ".exe" suffix on native Windows.
This is useful for reproducible builds. */ This is useful for reproducible builds. */
const char *p = arg + strlen (arg); {
char *p = arg + strlen (arg);
while (p > arg && ! ISSLASH (p[-1])) while (p > arg && ! ISSLASH (p[-1]))
p--; p--;
arg = p; arg = p;
} }
{
char *p = arg + strlen (arg);
if (p - arg > 4
&& p[-4] == '.'
&& (p[-3] == 'E' || p[-3] == 'e')
&& (p[-2] == 'X' || p[-2] == 'x')
&& (p[-1] == 'E' || p[-1] == 'e'))
p[-4] = '\0';
}
}
/* Escape arg if it contains shell metacharacters. */ /* Escape arg if it contains shell metacharacters. */
if (*arg == '-') if (*arg == '-')