提交 2a0c910d 编写于 作者: K ksrini

8006536: [launcher] removes trailing slashes on arguments

Reviewed-by: ksrini, akhil
Contributed-by: jviswana@linux.vnet.ibm.com
上级 b92b8a14
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -104,6 +104,11 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) { ...@@ -104,6 +104,11 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
case ' ': case ' ':
case '\t': case '\t':
if (prev == '\\') {
for (i = 0 ; i < slashes; i++) {
*dest++ = prev;
}
}
if (quotes % 2 == 1) { if (quotes % 2 == 1) {
*dest++ = ch; *dest++ = ch;
} else { } else {
...@@ -591,6 +596,12 @@ int main(int argc, char* argv[]) { ...@@ -591,6 +596,12 @@ int main(int argc, char* argv[]) {
// v->disable(); // v->disable();
vectors[i++] = v; vectors[i++] = v;
v= new Vector(argv[0], "a b\\\\ d");
v->add("a", FALSE);
v->add("b\\\\", FALSE);
v->add("d", FALSE);
vectors[i++] = v;
dotest(vectors); dotest(vectors);
printf("All tests pass [%d]\n", i); printf("All tests pass [%d]\n", i);
doexit(0); doexit(0);
......
/* /*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -309,6 +309,7 @@ public class Arrrghs extends TestHelper { ...@@ -309,6 +309,7 @@ public class Arrrghs extends TestHelper {
checkArgumentParsing("../../*", "../../*"); checkArgumentParsing("../../*", "../../*");
checkArgumentParsing("..\\..\\", "..\\..\\"); checkArgumentParsing("..\\..\\", "..\\..\\");
checkArgumentParsing("../../", "../../"); checkArgumentParsing("../../", "../../");
checkArgumentParsing("a b\\ c", "a", "b\\", "c");
} }
private void initEmptyDir(File emptyDir) throws IOException { private void initEmptyDir(File emptyDir) throws IOException {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册