src/java.base/share/native/libjli/args.c
author ihse
Sat, 03 Mar 2018 08:21:47 +0100
branchihse-warnings-cflags-branch
changeset 56230 489867818774
parent 47216 71c04702a3d5
permissions -rw-r--r--
No longer disable E_OLD_STYLE_FUNC_DEF.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     1
/*
45463
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 45252
diff changeset
     2
 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     4
 *
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    10
 *
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    15
 * accompanied this code).
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    16
 *
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    20
 *
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    23
 * questions.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    24
 */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    25
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    26
#include <stdlib.h>
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    27
#include <stdio.h>
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    28
#include <assert.h>
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    29
#include <sys/stat.h>
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    30
#include <ctype.h>
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    31
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    32
#ifdef DEBUG_ARGFILE
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    33
  #ifndef NO_JNI
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    34
    #define NO_JNI
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    35
  #endif
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    36
  #define JLI_ReportMessage(...) printf(__VA_ARGS__)
43691
f3c0d65c7b17 8173712: Rename JAVA_OPTIONS environment variable to JDK_JAVA_OPTIONS
mchung
parents: 43340
diff changeset
    37
  #define JDK_JAVA_OPTIONS "JDK_JAVA_OPTIONS"
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    38
  int IsWhiteSpaceOption(const char* name) { return 1; }
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    39
#else
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    40
  #include "java.h"
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    41
#endif
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    42
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    43
#include "jli_util.h"
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    44
#include "emessages.h"
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    45
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    46
#define MAX_ARGF_SIZE 0x7fffffffL
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    47
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    48
static char* clone_substring(const char *begin, size_t len) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    49
    char *rv = (char *) JLI_MemAlloc(len + 1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    50
    memcpy(rv, begin, len);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    51
    rv[len] = '\0';
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    52
    return rv;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    53
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    54
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    55
enum STATE {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    56
    FIND_NEXT,
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    57
    IN_COMMENT,
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    58
    IN_QUOTE,
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    59
    IN_ESCAPE,
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    60
    SKIP_LEAD_WS,
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    61
    IN_TOKEN
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    62
};
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    63
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    64
typedef struct {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    65
    enum STATE state;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    66
    const char* cptr;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    67
    const char* eob;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    68
    char quote_char;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    69
    JLI_List parts;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    70
} __ctx_args;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    71
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    72
#define NOT_FOUND -1
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    73
static int firstAppArgIndex = NOT_FOUND;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    74
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    75
static jboolean expectingNoDashArg = JNI_FALSE;
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    76
// Initialize to 1, as the first argument is the app name and not preprocessed
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    77
static size_t argsCount = 1;
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    78
static jboolean stopExpansion = JNI_FALSE;
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    79
static jboolean relaunch = JNI_FALSE;
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    80
45463
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 45252
diff changeset
    81
void JLI_InitArgProcessing(jboolean hasJavaArgs, jboolean disableArgFile) {
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    82
    // No expansion for relaunch
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    83
    if (argsCount != 1) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    84
        relaunch = JNI_TRUE;
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    85
        stopExpansion = JNI_TRUE;
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
    86
        argsCount = 1;
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    87
    } else {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    88
        stopExpansion = disableArgFile;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    89
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    90
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    91
    expectingNoDashArg = JNI_FALSE;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    92
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    93
    // for tools, this value remains 0 all the time.
45463
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 45252
diff changeset
    94
    firstAppArgIndex = hasJavaArgs ? 0: NOT_FOUND;
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    95
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    96
56230
489867818774 No longer disable E_OLD_STYLE_FUNC_DEF.
ihse
parents: 47216
diff changeset
    97
int JLI_GetAppArgIndex(void) {
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    98
    // Will be 0 for tools
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
    99
    return firstAppArgIndex;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   100
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   101
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   102
static void checkArg(const char *arg) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   103
    size_t idx = 0;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   104
    argsCount++;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   105
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   106
    // All arguments arrive here must be a launcher argument,
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   107
    // ie. by now, all argfile expansions must have been performed.
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   108
    if (*arg == '-') {
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   109
        expectingNoDashArg = JNI_FALSE;
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   110
        if (IsWhiteSpaceOption(arg)) {
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   111
            // expect an argument
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   112
            expectingNoDashArg = JNI_TRUE;
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   113
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   114
            if (JLI_StrCmp(arg, "-jar") == 0 ||
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   115
                JLI_StrCmp(arg, "--module") == 0 ||
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   116
                JLI_StrCmp(arg, "-m") == 0) {
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   117
                // This is tricky, we do expect NoDashArg
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   118
                // But that is considered main class to stop expansion
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   119
                expectingNoDashArg = JNI_FALSE;
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   120
                // We can not just update the idx here because if -jar @file
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   121
                // still need expansion of @file to get the argument for -jar
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39640
diff changeset
   122
            }
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   123
        } else if (JLI_StrCmp(arg, "--disable-@files") == 0) {
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   124
            stopExpansion = JNI_TRUE;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   125
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   126
    } else {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   127
        if (!expectingNoDashArg) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   128
            // this is main class, argsCount is index to next arg
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   129
            idx = argsCount;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   130
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   131
        expectingNoDashArg = JNI_FALSE;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   132
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   133
    // only update on java mode and not yet found main class
39640
6f1a839ff43d 8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents: 36511
diff changeset
   134
    if (firstAppArgIndex == NOT_FOUND && idx != 0) {
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   135
        firstAppArgIndex = (int) idx;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   136
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   137
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   138
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   139
/*
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   140
       [\n\r]   +------------+                        +------------+ [\n\r]
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   141
      +---------+ IN_COMMENT +<------+                | IN_ESCAPE  +---------+
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   142
      |         +------------+       |                +------------+         |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   143
      |    [#]       ^               |[#]                 ^     |            |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   144
      |   +----------+               |                [\\]|     |[^\n\r]     |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   145
      v   |                          |                    |     v            |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   146
+------------+ [^ \t\n\r\f]  +------------+['"]>      +------------+         |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   147
| FIND_NEXT  +-------------->+ IN_TOKEN   +-----------+ IN_QUOTE   +         |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   148
+------------+               +------------+   <[quote]+------------+         |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   149
  |   ^                          |                       |  ^   ^            |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   150
  |   |               [ \t\n\r\f]|                 [\n\r]|  |   |[^ \t\n\r\f]v
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   151
  |   +--------------------------+-----------------------+  |  +--------------+
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   152
  |                       ['"]                              |  | SKIP_LEAD_WS |
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   153
  +---------------------------------------------------------+  +--------------+
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   154
*/
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   155
static char* nextToken(__ctx_args *pctx) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   156
    const char* nextc = pctx->cptr;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   157
    const char* const eob = pctx->eob;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   158
    const char* anchor = nextc;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   159
    char *token;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   160
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   161
    for (; nextc < eob; nextc++) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   162
        register char ch = *nextc;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   163
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   164
        // Skip white space characters
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   165
        if (pctx->state == FIND_NEXT || pctx->state == SKIP_LEAD_WS) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   166
            while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f') {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   167
                nextc++;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   168
                if (nextc >= eob) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   169
                    return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   170
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   171
                ch = *nextc;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   172
            }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   173
            pctx->state = (pctx->state == FIND_NEXT) ? IN_TOKEN : IN_QUOTE;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   174
            anchor = nextc;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   175
        // Deal with escape sequences
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   176
        } else if (pctx->state == IN_ESCAPE) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   177
            // concatenation directive
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   178
            if (ch == '\n' || ch == '\r') {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   179
                pctx->state = SKIP_LEAD_WS;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   180
            } else {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   181
            // escaped character
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   182
                char* escaped = (char*) JLI_MemAlloc(2 * sizeof(char));
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   183
                escaped[1] = '\0';
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   184
                switch (ch) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   185
                    case 'n':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   186
                        escaped[0] = '\n';
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   187
                        break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   188
                    case 'r':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   189
                        escaped[0] = '\r';
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   190
                        break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   191
                    case 't':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   192
                        escaped[0] = '\t';
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   193
                        break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   194
                    case 'f':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   195
                        escaped[0] = '\f';
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   196
                        break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   197
                    default:
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   198
                        escaped[0] = ch;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   199
                        break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   200
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   201
                JLI_List_add(pctx->parts, escaped);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   202
                pctx->state = IN_QUOTE;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   203
            }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   204
            // anchor to next character
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   205
            anchor = nextc + 1;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   206
            continue;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   207
        // ignore comment to EOL
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   208
        } else if (pctx->state == IN_COMMENT) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   209
            while (ch != '\n' && ch != '\r') {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   210
                nextc++;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   211
                if (nextc > eob) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   212
                    return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   213
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   214
                ch = *nextc;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   215
            }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   216
            pctx->state = FIND_NEXT;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   217
            continue;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   218
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   219
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   220
        assert(pctx->state != IN_ESCAPE);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   221
        assert(pctx->state != FIND_NEXT);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   222
        assert(pctx->state != SKIP_LEAD_WS);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   223
        assert(pctx->state != IN_COMMENT);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   224
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   225
        switch(ch) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   226
            case ' ':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   227
            case '\t':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   228
            case '\f':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   229
                if (pctx->state == IN_QUOTE) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   230
                    continue;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   231
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   232
                // fall through
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   233
            case '\n':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   234
            case '\r':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   235
                if (pctx->parts->size == 0) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   236
                    token = clone_substring(anchor, nextc - anchor);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   237
                } else {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   238
                    JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   239
                    token = JLI_List_combine(pctx->parts);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   240
                    JLI_List_free(pctx->parts);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   241
                    pctx->parts = JLI_List_new(4);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   242
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   243
                pctx->cptr = nextc + 1;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   244
                pctx->state = FIND_NEXT;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   245
                return token;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   246
            case '#':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   247
                if (pctx->state == IN_QUOTE) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   248
                    continue;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   249
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   250
                pctx->state = IN_COMMENT;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   251
                break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   252
            case '\\':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   253
                if (pctx->state != IN_QUOTE) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   254
                    continue;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   255
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   256
                JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   257
                pctx->state = IN_ESCAPE;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   258
                break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   259
            case '\'':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   260
            case '"':
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   261
                if (pctx->state == IN_QUOTE && pctx->quote_char != ch) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   262
                    // not matching quote
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   263
                    continue;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   264
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   265
                // partial before quote
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   266
                if (anchor != nextc) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   267
                    JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   268
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   269
                // anchor after quote character
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   270
                anchor = nextc + 1;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   271
                if (pctx->state == IN_TOKEN) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   272
                    pctx->quote_char = ch;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   273
                    pctx->state = IN_QUOTE;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   274
                } else {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   275
                    pctx->state = IN_TOKEN;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   276
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   277
                break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   278
            default:
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   279
                break;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   280
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   281
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   282
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   283
    assert(nextc == eob);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   284
    if (anchor != nextc) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   285
        // not yet return until end of stream, we have part of a token.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   286
        JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   287
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   288
    return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   289
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   290
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   291
static JLI_List readArgFile(FILE *file) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   292
    char buf[4096];
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   293
    JLI_List rv;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   294
    __ctx_args ctx;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   295
    size_t size;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   296
    char *token;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   297
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   298
    ctx.state = FIND_NEXT;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   299
    ctx.parts = JLI_List_new(4);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   300
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   301
    /* arbitrarily pick 8, seems to be a reasonable number of arguments */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   302
    rv = JLI_List_new(8);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   303
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   304
    while (!feof(file)) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   305
        size = fread(buf, sizeof(char), sizeof(buf), file);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   306
        if (ferror(file)) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   307
            JLI_List_free(rv);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   308
            return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   309
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   310
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   311
        /* nextc is next character to read from the buffer
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   312
         * eob is the end of input
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   313
         * token is the copied token value, NULL if no a complete token
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   314
         */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   315
        ctx.cptr = buf;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   316
        ctx.eob = buf + size;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   317
        token = nextToken(&ctx);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   318
        while (token != NULL) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   319
            checkArg(token);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   320
            JLI_List_add(rv, token);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   321
            token = nextToken(&ctx);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   322
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   323
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   324
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   325
    // remaining partial token
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   326
    if (ctx.state == IN_TOKEN || ctx.state == IN_QUOTE) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   327
        if (ctx.parts->size != 0) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   328
            JLI_List_add(rv, JLI_List_combine(ctx.parts));
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   329
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   330
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   331
    JLI_List_free(ctx.parts);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   332
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   333
    return rv;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   334
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   335
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   336
/*
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   337
 * if the arg represent a file, that is, prefix with a single '@',
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   338
 * return a list of arguments from the file.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   339
 * otherwise, return NULL.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   340
 */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   341
static JLI_List expandArgFile(const char *arg) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   342
    FILE *fptr;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   343
    struct stat st;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   344
    JLI_List rv;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   345
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   346
    /* failed to access the file */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   347
    if (stat(arg, &st) != 0) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   348
        JLI_ReportMessage(CFG_ERROR6, arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   349
        exit(1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   350
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   351
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   352
    if (st.st_size > MAX_ARGF_SIZE) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   353
        JLI_ReportMessage(CFG_ERROR10, MAX_ARGF_SIZE);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   354
        exit(1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   355
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   356
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   357
    fptr = fopen(arg, "r");
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   358
    /* arg file cannot be openned */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   359
    if (fptr == NULL) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   360
        JLI_ReportMessage(CFG_ERROR6, arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   361
        exit(1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   362
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   363
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   364
    rv = readArgFile(fptr);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   365
    fclose(fptr);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   366
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   367
    /* error occurred reading the file */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   368
    if (rv == NULL) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   369
        JLI_ReportMessage(DLL_ERROR4, arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   370
        exit(1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   371
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   372
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   373
    return rv;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   374
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   375
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   376
JLI_List JLI_PreprocessArg(const char *arg)
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   377
{
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   378
    JLI_List rv;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   379
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   380
    if (firstAppArgIndex > 0) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   381
        // In user application arg, no more work.
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   382
        return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   383
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   384
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   385
    if (stopExpansion) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   386
        // still looking for user application arg
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   387
        checkArg(arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   388
        return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   389
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   390
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   391
    if (arg[0] != '@') {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   392
        checkArg(arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   393
        return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   394
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   395
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   396
    if (arg[1] == '\0') {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   397
        // @ by itself is an argument
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   398
        checkArg(arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   399
        return NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   400
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   401
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   402
    arg++;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   403
    if (arg[0] == '@') {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   404
        // escaped @argument
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   405
        rv = JLI_List_new(1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   406
        checkArg(arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   407
        JLI_List_add(rv, JLI_StringDup(arg));
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   408
    } else {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   409
        rv = expandArgFile(arg);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   410
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   411
    return rv;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   412
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   413
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   414
int isTerminalOpt(char *arg) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   415
    return JLI_StrCmp(arg, "-jar") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   416
           JLI_StrCmp(arg, "-m") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   417
           JLI_StrCmp(arg, "--module") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   418
           JLI_StrCmp(arg, "--dry-run") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   419
           JLI_StrCmp(arg, "-h") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   420
           JLI_StrCmp(arg, "-?") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   421
           JLI_StrCmp(arg, "-help") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   422
           JLI_StrCmp(arg, "--help") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   423
           JLI_StrCmp(arg, "-X") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   424
           JLI_StrCmp(arg, "--help-extra") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   425
           JLI_StrCmp(arg, "-version") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   426
           JLI_StrCmp(arg, "--version") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   427
           JLI_StrCmp(arg, "-fullversion") == 0 ||
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   428
           JLI_StrCmp(arg, "--full-version") == 0;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   429
}
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   430
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   431
jboolean JLI_AddArgsFromEnvVar(JLI_List args, const char *var_name) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   432
    char *env = getenv(var_name);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   433
    char *p, *arg;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   434
    char quote;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   435
    JLI_List argsInFile;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   436
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   437
    if (firstAppArgIndex == 0) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   438
        // Not 'java', return
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   439
        return JNI_FALSE;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   440
    }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   441
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   442
    if (relaunch) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   443
        return JNI_FALSE;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   444
    }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   445
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   446
    if (NULL == env) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   447
        return JNI_FALSE;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   448
    }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   449
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   450
    JLI_ReportMessage(ARG_INFO_ENVVAR, var_name, env);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   451
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   452
    // This is retained until the process terminates as it is saved as the args
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   453
    p = JLI_MemAlloc(JLI_StrLen(env) + 1);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   454
    while (*env != '\0') {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   455
        while (*env != '\0' && isspace(*env)) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   456
            env++;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   457
        }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   458
45252
654115968257 8180447: Trailing space in JDK_JAVA_OPTIONS causes an application fail to launch
henryjen
parents: 43691
diff changeset
   459
        // Trailing space
654115968257 8180447: Trailing space in JDK_JAVA_OPTIONS causes an application fail to launch
henryjen
parents: 43691
diff changeset
   460
        if (*env == '\0') {
654115968257 8180447: Trailing space in JDK_JAVA_OPTIONS causes an application fail to launch
henryjen
parents: 43691
diff changeset
   461
            break;
654115968257 8180447: Trailing space in JDK_JAVA_OPTIONS causes an application fail to launch
henryjen
parents: 43691
diff changeset
   462
        }
654115968257 8180447: Trailing space in JDK_JAVA_OPTIONS causes an application fail to launch
henryjen
parents: 43691
diff changeset
   463
43325
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   464
        arg = p;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   465
        while (*env != '\0' && !isspace(*env)) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   466
            if (*env == '"' || *env == '\'') {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   467
                quote = *env++;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   468
                while (*env != quote && *env != '\0') {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   469
                    *p++ = *env++;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   470
                }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   471
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   472
                if (*env == '\0') {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   473
                    JLI_ReportMessage(ARG_ERROR8, var_name);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   474
                    exit(1);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   475
                }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   476
                env++;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   477
            } else {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   478
                *p++ = *env++;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   479
            }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   480
        }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   481
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   482
        *p++ = '\0';
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   483
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   484
        argsInFile = JLI_PreprocessArg(arg);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   485
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   486
        if (NULL == argsInFile) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   487
            if (isTerminalOpt(arg)) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   488
                JLI_ReportMessage(ARG_ERROR9, arg, var_name);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   489
                exit(1);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   490
            }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   491
            JLI_List_add(args, arg);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   492
        } else {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   493
            size_t cnt, idx;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   494
            char *argFile = arg;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   495
            cnt = argsInFile->size;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   496
            for (idx = 0; idx < cnt; idx++) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   497
                arg = argsInFile->elements[idx];
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   498
                if (isTerminalOpt(arg)) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   499
                    JLI_ReportMessage(ARG_ERROR10, arg, argFile, var_name);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   500
                    exit(1);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   501
                }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   502
                JLI_List_add(args, arg);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   503
            }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   504
            // Shallow free, we reuse the string to avoid copy
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   505
            JLI_MemFree(argsInFile->elements);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   506
            JLI_MemFree(argsInFile);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   507
        }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   508
        /*
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   509
         * Check if main-class is specified after argument being checked. It
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   510
         * must always appear after expansion, as a main-class could be specified
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   511
         * indirectly into environment variable via an @argfile, and it must be
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   512
         * caught now.
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   513
         */
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   514
        if (firstAppArgIndex != NOT_FOUND) {
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   515
            JLI_ReportMessage(ARG_ERROR11, var_name);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   516
            exit(1);
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   517
        }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   518
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   519
        assert (*env == '\0' || isspace(*env));
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   520
    }
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   521
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   522
    return JNI_TRUE;
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   523
}
033e4cced1dc 8170832: Add a new launcher environment variable JAVA_OPTIONS
henryjen
parents: 40261
diff changeset
   524
32267
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   525
#ifdef DEBUG_ARGFILE
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   526
/*
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   527
 * Stand-alone sanity test, build with following command line
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   528
 * $ CC -DDEBUG_ARGFILE -DNO_JNI -g args.c jli_util.c
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   529
 */
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   530
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   531
void fail(char *expected, char *actual, size_t idx) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   532
    printf("FAILED: Token[%lu] expected to be <%s>, got <%s>\n", idx, expected, actual);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   533
    exit(1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   534
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   535
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   536
void test_case(char *case_data, char **tokens, size_t cnt_tokens) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   537
    size_t actual_cnt;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   538
    char *token;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   539
    __ctx_args ctx;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   540
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   541
    actual_cnt = 0;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   542
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   543
    ctx.state = FIND_NEXT;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   544
    ctx.parts = JLI_List_new(4);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   545
    ctx.cptr = case_data;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   546
    ctx.eob = case_data + strlen(case_data);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   547
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   548
    printf("Test case: <%s>, expected %lu tokens.\n", case_data, cnt_tokens);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   549
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   550
    for (token = nextToken(&ctx); token != NULL; token = nextToken(&ctx)) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   551
        // should not have more tokens than expected
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   552
        if (actual_cnt >= cnt_tokens) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   553
            printf("FAILED: Extra token detected: <%s>\n", token);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   554
            exit(2);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   555
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   556
        if (JLI_StrCmp(token, tokens[actual_cnt]) != 0) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   557
            fail(tokens[actual_cnt], token, actual_cnt);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   558
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   559
        actual_cnt++;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   560
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   561
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   562
    char* last = NULL;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   563
    if (ctx.parts->size != 0) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   564
        last = JLI_List_combine(ctx.parts);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   565
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   566
    JLI_List_free(ctx.parts);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   567
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   568
    if (actual_cnt >= cnt_tokens) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   569
        // same number of tokens, should have nothing left to parse
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   570
        if (last != NULL) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   571
            if (*last != '#') {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   572
                printf("Leftover detected: %s", last);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   573
                exit(2);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   574
            }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   575
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   576
    } else {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   577
        if (JLI_StrCmp(last, tokens[actual_cnt]) != 0) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   578
            fail(tokens[actual_cnt], last, actual_cnt);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   579
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   580
        actual_cnt++;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   581
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   582
    if (actual_cnt != cnt_tokens) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   583
        printf("FAILED: Number of tokens not match, expected %lu, got %lu\n",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   584
            cnt_tokens, actual_cnt);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   585
        exit(3);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   586
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   587
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   588
    printf("PASS\n");
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   589
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   590
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   591
#define DO_CASE(name) \
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   592
    test_case(name[0], name + 1, sizeof(name)/sizeof(char*) - 1)
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   593
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   594
int main(int argc, char** argv) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   595
    size_t i, j;
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   596
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   597
    char* case1[] = { "-version -cp \"c:\\\\java libs\\\\one.jar\" \n",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   598
        "-version", "-cp", "c:\\java libs\\one.jar" };
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   599
    DO_CASE(case1);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   600
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   601
    // note the open quote at the end
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   602
    char* case2[] = { "com.foo.Panda \"Furious 5\"\fand\t'Shi Fu' \"escape\tprison",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   603
        "com.foo.Panda", "Furious 5", "and", "Shi Fu", "escape\tprison"};
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   604
    DO_CASE(case2);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   605
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   606
    char* escaped_chars[] = { "escaped chars testing \"\\a\\b\\c\\f\\n\\r\\t\\v\\9\\6\\23\\82\\28\\377\\477\\278\\287\"",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   607
        "escaped", "chars", "testing", "abc\f\n\r\tv96238228377477278287"};
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   608
    DO_CASE(escaped_chars);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   609
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   610
    char* mixed_quote[]  = { "\"mix 'single quote' in double\" 'mix \"double quote\" in single' partial\"quote me\"this",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   611
        "mix 'single quote' in double", "mix \"double quote\" in single", "partialquote methis"};
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   612
    DO_CASE(mixed_quote);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   613
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   614
    char* comments[]  = { "line one #comment\n'line #2' #rest are comment\r\n#comment on line 3\nline 4 #comment to eof",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   615
        "line", "one", "line #2", "line", "4"};
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   616
    DO_CASE(comments);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   617
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   618
    char* open_quote[] = { "This is an \"open quote \n    across line\n\t, note for WS.",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   619
        "This", "is", "an", "open quote ", "across", "line", ",", "note", "for", "WS." };
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   620
    DO_CASE(open_quote);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   621
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   622
    char* escape_in_open_quote[] = { "Try \"this \\\\\\\\ escape\\n double quote \\\" in open quote",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   623
        "Try", "this \\\\ escape\n double quote \" in open quote" };
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   624
    DO_CASE(escape_in_open_quote);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   625
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   626
    char* quote[] = { "'-Dmy.quote.single'='Property in single quote. Here a double quote\" Add some slashes \\\\/'",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   627
        "-Dmy.quote.single=Property in single quote. Here a double quote\" Add some slashes \\/" };
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   628
    DO_CASE(quote);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   629
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   630
    char* multi[] = { "\"Open quote to \n  new \"line \\\n\r   third\\\n\r\\\tand\ffourth\"",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   631
        "Open quote to ", "new", "line third\tand\ffourth" };
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   632
    DO_CASE(multi);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   633
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   634
    char* escape_quote[] = { "c:\\\"partial quote\"\\lib",
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   635
        "c:\\partial quote\\lib" };
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   636
    DO_CASE(escape_quote);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   637
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   638
    if (argc > 1) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   639
        for (i = 0; i < argc; i++) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   640
            JLI_List tokens = JLI_PreprocessArg(argv[i]);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   641
            if (NULL != tokens) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   642
                for (j = 0; j < tokens->size; j++) {
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   643
                    printf("Token[%lu]: <%s>\n", (unsigned long) j, tokens->elements[j]);
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   644
                }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   645
            }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   646
        }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   647
    }
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   648
}
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   649
4e96a9ee01b1 8027634: Support @argfiles for java command-line tool
henryjen
parents:
diff changeset
   650
#endif // DEBUG_ARGFILE