jdk/src/java.base/share/native/libjli/java.c
changeset 43330 6aa5f2938b75
parent 43325 033e4cced1dc
child 43498 fd3e0590219e
equal deleted inserted replaced
43329:4b34ab4c7ba1 43330:6aa5f2938b75
  1564                 "()Ljava/lang/Class;"));
  1564                 "()Ljava/lang/Class;"));
  1565 
  1565 
  1566     return (*env)->CallStaticObjectMethod(env, cls, mid);
  1566     return (*env)->CallStaticObjectMethod(env, cls, mid);
  1567 }
  1567 }
  1568 
  1568 
       
  1569 static char* expandWildcardOnLongOpt(char* arg) {
       
  1570     char *p, *value;
       
  1571     size_t optLen, valueLen;
       
  1572     p = JLI_StrChr(arg, '=');
       
  1573 
       
  1574     if (p == NULL || p[1] == '\0') {
       
  1575         JLI_ReportErrorMessage(ARG_ERROR1, arg);
       
  1576         exit(1);
       
  1577     }
       
  1578     p++;
       
  1579     value = (char *) JLI_WildcardExpandClasspath(p);
       
  1580     if (p == value) {
       
  1581         // no wildcard
       
  1582         return arg;
       
  1583     }
       
  1584 
       
  1585     optLen = p - arg;
       
  1586     valueLen = JLI_StrLen(value);
       
  1587     p = JLI_MemAlloc(optLen + valueLen + 1);
       
  1588     memcpy(p, arg, optLen);
       
  1589     memcpy(p + optLen, value, valueLen);
       
  1590     p[optLen + valueLen + 1] = '\0';
       
  1591     return p;
       
  1592 }
       
  1593 
  1569 /*
  1594 /*
  1570  * For tools, convert command line args thus:
  1595  * For tools, convert command line args thus:
  1571  *   javac -cp foo:foo/"*" -J-ms32m ...
  1596  *   javac -cp foo:foo/"*" -J-ms32m ...
  1572  *   java -ms32m -cp JLI_WildcardExpandClasspath(foo:foo/"*") ...
  1597  *   java -ms32m -cp JLI_WildcardExpandClasspath(foo:foo/"*") ...
  1573  *
  1598  *
  1614     for (i = 0; i < argc; i++) {
  1639     for (i = 0; i < argc; i++) {
  1615         char *arg = argv[i];
  1640         char *arg = argv[i];
  1616         if (arg[0] == '-') {
  1641         if (arg[0] == '-') {
  1617             if (arg[1] == 'J')
  1642             if (arg[1] == 'J')
  1618                 continue;
  1643                 continue;
  1619             if (IsWildCardEnabled() && arg[1] == 'c'
  1644             if (IsWildCardEnabled()) {
  1620                 && (JLI_StrCmp(arg, "-cp") == 0 ||
  1645                 if (IsClassPathOption(arg) && i < argc - 1) {
  1621                     JLI_StrCmp(arg, "-classpath") == 0)
  1646                     *nargv++ = arg;
  1622                 && i < argc - 1) {
  1647                     *nargv++ = (char *) JLI_WildcardExpandClasspath(argv[i+1]);
  1623                 *nargv++ = arg;
  1648                     i++;
  1624                 *nargv++ = (char *) JLI_WildcardExpandClasspath(argv[i+1]);
  1649                     continue;
  1625                 i++;
  1650                 }
  1626                 continue;
  1651                 if (JLI_StrCCmp(arg, "--class-path=") == 0) {
       
  1652                     *nargv++ = expandWildcardOnLongOpt(arg);
       
  1653                     continue;
       
  1654                 }
  1627             }
  1655             }
  1628         }
  1656         }
  1629         *nargv++ = arg;
  1657         *nargv++ = arg;
  1630     }
  1658     }
  1631     *nargv = 0;
  1659     *nargv = 0;