Fossil

Check-in [bac4b248f5]
Login

Check-in [bac4b248f5]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge trunk g.nameOfExe should have filename_to_utf translation as well on UNIX/OSX
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | cmdline-expansion
Files: files | file ages | folders
SHA1: bac4b248f50b31389302f409787c16b3116e26c5
User & Date: jan.nijtmans 2012-11-30 14:24:30.826
Context
2012-11-30
16:43
merge trunk. Add fallback mechanism for MinGW ... (check-in: 2459ee7b71 user: jan.nijtmans tags: cmdline-expansion)
14:24
merge trunk g.nameOfExe should have filename_to_utf translation as well on UNIX/OSX ... (check-in: bac4b248f5 user: jan.nijtmans tags: cmdline-expansion)
14:09
fix testcase ... (check-in: e08073d333 user: jan.nijtmans tags: trunk)
13:27
(experimental) command-line expansion for MinGW-w64. Should work on MSVC as well. Doesn't work with MinGW. ... (check-in: b1036fe5bf user: jan.nijtmans tags: cmdline-expansion)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
370
371
372
373
374
375
376

377
378
379
380
381
382
383
384
385
386
387
388
389
390
  FILE * zInFile;           /* input FILE */
#if defined(_WIN32)
  WCHAR buf[MAX_PATH];
#endif

  g.argc = argc;
  g.argv = argv;

#if defined(_WIN32)
  GetModuleFileNameW(NULL, buf, MAX_PATH);
  g.nameOfExe = fossil_filename_to_utf8(buf);
#else
  g.nameOfExe = g.argv[0];
#endif
  for(i=0; i<g.argc; i++) g.argv[i] = fossil_filename_to_utf8(g.argv[i]);
  for(i=1; i<g.argc-1; i++){
    z = g.argv[i];
    if( z[0]!='-' ) continue;
    z++;
    if( z[0]=='-' ) z++;
    if( z[0]==0 ) return;   /* Stop searching at "--" */
    if( fossil_strcmp(z, "args")==0 ) break;







>






<







370
371
372
373
374
375
376
377
378
379
380
381
382
383

384
385
386
387
388
389
390
  FILE * zInFile;           /* input FILE */
#if defined(_WIN32)
  WCHAR buf[MAX_PATH];
#endif

  g.argc = argc;
  g.argv = argv;
  for(i=0; i<g.argc; i++) g.argv[i] = fossil_filename_to_utf8(g.argv[i]);
#if defined(_WIN32)
  GetModuleFileNameW(NULL, buf, MAX_PATH);
  g.nameOfExe = fossil_filename_to_utf8(buf);
#else
  g.nameOfExe = g.argv[0];
#endif

  for(i=1; i<g.argc-1; i++){
    z = g.argv[i];
    if( z[0]!='-' ) continue;
    z++;
    if( z[0]=='-' ) z++;
    if( z[0]==0 ) return;   /* Stop searching at "--" */
    if( fossil_strcmp(z, "args")==0 ) break;
Changes to test/cmdline.test.
18
19
20
21
22
23
24
25
26
27
28
29
30
# Test command line parsing
#

proc cmd-line {testname args} {
  set i 1
  foreach {cmdline result} $args {
    fossil test-echo $cmdline
    test cmd-line-$testname.$i {[lrange [split $::RESULT \n] 2 end]=="\{argv\[2\] = \[$result\]\}"}
    incr i
  }
}
cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
cmd-line 101 * * *.* *.*







|





18
19
20
21
22
23
24
25
26
27
28
29
30
# Test command line parsing
#

proc cmd-line {testname args} {
  set i 1
  foreach {cmdline result} $args {
    fossil test-echo $cmdline
    test cmd-line-$testname.$i {[lrange [split $::RESULT \n] 3 end]=="\{argv\[2\] = \[$result\]\}"}
    incr i
  }
}
cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
cmd-line 101 * * *.* *.*