1 /*
2 * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
118 } catch (Exception e) {
119 fail("Unexpected exception" + e.toString());
120 }
121 }
122
123 public static void main(String[] args) throws Exception {
124 File systemRoot =
125 getenv("SystemRoot") != null ? new File(getenv("SystemRoot")) :
126 getenv("WINDIR") != null ? new File(getenv ("WINDIR")) :
127 null;
128 if (systemRoot == null || ! systemRoot.isDirectory())
129 return; // Not Windows as we know it
130
131 String systemDirW = new File(systemRoot, "System32").getPath();
132 String systemDirM = systemDirW.replace('\\', '/');
133 out.printf("systemDirW=%s%n", systemDirW);
134 out.printf("systemDirM=%s%n", systemDirM);
135
136 // Win9x systems don't have a cmd.exe
137 if (new File(systemDirW, "cmd.exe").exists()) {
138 out.println("Running cmd.exe tests...");
139 writeFile("cdcmd.cmd", "@echo off\r\nCD\r\n");
140 writeFile("cdbat.bat", "@echo off\r\nCD\r\n");
141 checkCD("cmd",
142 "cmd.exe",
143 systemDirW + "\\cmd.exe",
144 // Only the ".exe" extension can be omitted
145 systemDirW + "\\cmd",
146 systemDirM + "/cmd.exe",
147 systemDirM + "/cmd",
148 "/" + systemDirM + "/cmd",
149 "cdcmd.cmd", "./cdcmd.cmd", ".\\cdcmd.cmd",
150 "cdbat.bat", "./cdbat.bat", ".\\cdbat.bat");
151 }
152
153 // 16-bit apps like command.com must have a console;
154 // fix this someday...
155
156 // // Win64 systems don't have a command.com
157 // if (new File(systemDirW, "command.com").exists()
158 // // no output if running without a console;
159 // // fix this in Mustang
160 // && ! outputOf("command.com", "/C", "CD").equals("")) {
161 // out.println("Running command.com tests...");
162 // checkCD("command.com",
163 // systemDirM + "/command.com",
164 // systemDirW + "\\command.com");
165 // }
166
167 // Win9x systems have a %SYSTEMDRIVE%\command.com
168 // if (new File("C:\\COMMAND.COM").exists()
169 // && ! outputOf("COMMAND.COM", "/C", "CD").equals("")) {
170 // out.println("Running COMMAND.COM tests...");
|
1 /*
2 * Copyright (c) 2004, 2013 Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
118 } catch (Exception e) {
119 fail("Unexpected exception" + e.toString());
120 }
121 }
122
123 public static void main(String[] args) throws Exception {
124 File systemRoot =
125 getenv("SystemRoot") != null ? new File(getenv("SystemRoot")) :
126 getenv("WINDIR") != null ? new File(getenv ("WINDIR")) :
127 null;
128 if (systemRoot == null || ! systemRoot.isDirectory())
129 return; // Not Windows as we know it
130
131 String systemDirW = new File(systemRoot, "System32").getPath();
132 String systemDirM = systemDirW.replace('\\', '/');
133 out.printf("systemDirW=%s%n", systemDirW);
134 out.printf("systemDirM=%s%n", systemDirM);
135
136 // Win9x systems don't have a cmd.exe
137 if (new File(systemDirW, "cmd.exe").exists()) {
138 try {
139 out.println("Running cmd.exe tests...");
140 writeFile("cdcmd.cmd", "@echo off\r\nCD\r\n");
141 writeFile("cdbat.bat", "@echo off\r\nCD\r\n");
142 checkCD("cmd",
143 "cmd.exe",
144 systemDirW + "\\cmd.exe",
145 // Only the ".exe" extension can be omitted
146 systemDirW + "\\cmd",
147 systemDirM + "/cmd.exe",
148 systemDirM + "/cmd",
149 "/" + systemDirM + "/cmd",
150 "cdcmd.cmd", "./cdcmd.cmd", ".\\cdcmd.cmd",
151 "cdbat.bat", "./cdbat.bat", ".\\cdbat.bat");
152 } finally {
153 new File("cdcmd.cmd").delete();
154 new File("cdbat.bat").delete();
155 }
156 }
157
158 // 16-bit apps like command.com must have a console;
159 // fix this someday...
160
161 // // Win64 systems don't have a command.com
162 // if (new File(systemDirW, "command.com").exists()
163 // // no output if running without a console;
164 // // fix this in Mustang
165 // && ! outputOf("command.com", "/C", "CD").equals("")) {
166 // out.println("Running command.com tests...");
167 // checkCD("command.com",
168 // systemDirM + "/command.com",
169 // systemDirW + "\\command.com");
170 // }
171
172 // Win9x systems have a %SYSTEMDRIVE%\command.com
173 // if (new File("C:\\COMMAND.COM").exists()
174 // && ! outputOf("COMMAND.COM", "/C", "CD").equals("")) {
175 // out.println("Running COMMAND.COM tests...");
|