emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Supporting parameters that include the = character in configure.bat


From: Ben Key
Subject: Re: Supporting parameters that include the = character in configure.bat
Date: Sun, 10 Apr 2011 03:46:39 -0500

Hello,

Eli Zaretskii wrote:
> This isn't a problem, because we don't support building Emacs on
> Windows 9X anyway.

I was not aware of this.  Configure.bat still has some comments that refer to Windows 9x and command.com so I thought it was still a consideration.

> So please prepare a patch along these lines.  It should include a
> corresponding addition to the "usage" text in the batch file and a
> similar addition to instructions in nt/INSTALL.

Before submitting a patch I wanted to do some more research into this technique to ensure that it will always work.  It turns out that the %~1 functionality to strip " characters only works if command extensions are enabled.  As far as I know they are always enabled by default but they can be disabled by a system administrator.  This means that it will still be necessary to determine if command extensions are enabled before attempting to use this functionality.  This can be done as follows.

<batch_file>
@echo off
set use_extensions=1
setlocal enableextensions
if errorlevel 1 set use_extensions=0

set sep1=
:again

if "%1" == "--cflags" goto usercflags
if "%1" == "" goto checkutils

:usercflags

if "%use_extensions%" == "1" goto ucflagex
goto ucflag

:ucflagex
shift
set usercflags=%usercflags%%sep1%%~1
set sep1= %nothing%
shift
goto again

:ucflag
shift
set usercflags=%usercflags%%sep1%%1
set sep1= %nothing%
shift
goto again

:checkutils

echo usercflags=%usercflags%
</batch_file>

I assume that I should use this technique when implementing my patch.  If this is what you want me to do, just let me know.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]