2009-06-20 17:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* utils/hbmk2/hbmk2.prg
    + Added experimental filename escaping for *nix systems.
      Currently only space is escaped. I'd like to ask *nix
      users to make that complete.
      TODO: For speed and completeness, maybe such escaping (quoting) 
            function would come handy in RTL. Przemek, it would be 
            great if you could add one if you agree.
      TODO: It should also be enabled for linux/watcom, but
            I cannot test this.
    ! Minor addition to Windows escaping in ArrayToList().
This commit is contained in:
Viktor Szakats
2009-06-20 15:28:27 +00:00
parent 5b9c36c33a
commit 1773bd8474
2 changed files with 29 additions and 0 deletions

View File

@@ -17,6 +17,18 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-20 17:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
+ Added experimental filename escaping for *nix systems.
Currently only space is escaped. I'd like to ask *nix
users to make that complete.
TODO: For speed and completeness, maybe such escaping (quoting)
function would come handy in RTL. Przemek, it would be
great if you could add one if you agree.
TODO: It should also be enabled for linux/watcom, but
I cannot test this.
! Minor addition to Windows escaping in ArrayToList().
2009-06-20 16:39 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
% Reworked space in filename support to be generic. Now all

View File

@@ -168,6 +168,7 @@ REQUEST hbmk_KEYW
#define _ESC_NONE 0
#define _ESC_DBLQUOTE 1
#define _ESC_NIX 2
#define _LNG_MARKER "${lng}"
@@ -2022,6 +2023,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 )
( hbmk[ _HBMK_cARCH ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ;
( hbmk[ _HBMK_cARCH ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "gpp" )
nOpt_Esc := _ESC_NIX
IF hbmk[ _HBMK_lDEBUG ]
AAdd( hbmk[ _HBMK_aOPTC ], "-g" )
ENDIF
@@ -4545,6 +4547,10 @@ STATIC FUNCTION ArrayToList( array, cSeparator, nEscapeMode, cPrefix )
CASE _ESC_DBLQUOTE
FOR tmp := 1 TO Len( array )
IF " " $ array[ tmp ]
/* Sloppy */
IF Right( array[ tmp ], 1 ) == "\"
array[ tmp ] += "\"
ENDIF
cString += cPrefix + '"' + array[ tmp ] + '"'
ELSE
cString += cPrefix + array[ tmp ]
@@ -4554,6 +4560,14 @@ STATIC FUNCTION ArrayToList( array, cSeparator, nEscapeMode, cPrefix )
ENDIF
NEXT
EXIT
CASE _ESC_NIX
FOR tmp := 1 TO Len( array )
cString += cPrefix + FN_Escape( array[ tmp ], nEscapeMode )
IF tmp < Len( array )
cString += cSeparator
ENDIF
NEXT
EXIT
ENDSWITCH
RETURN cString
@@ -4773,6 +4787,9 @@ STATIC FUNCTION FN_Escape( cFileName, nEscapeMode )
RETURN '"' + cFileName + '"'
ENDIF
EXIT
CASE _ESC_NIX
cFileName := StrTran( cFileName, " ", "\ " )
EXIT
ENDSWITCH
RETURN cFileName