--- old/src/jdk.pack/share/native/unpack200/main.cpp 2018-06-09 00:02:02.000000000 -0700 +++ new/src/jdk.pack/share/native/unpack200/main.cpp 2018-06-09 00:02:01.000000000 -0700 @@ -139,7 +139,7 @@ } static const char* nbasename(const char* progname) { - const char* slash = strrchr(progname, '/'); + const char* slash = strrchr(progname, PATH_SEPARATOR); if (slash != null) progname = ++slash; return progname; } @@ -161,6 +161,13 @@ "Exit Status:\n" \ " 0 if successful, >0 if an error occurred\n" +#define DEPRECATE_WARNING \ + "\nWarning: The %s tool is planned to be removed in a future JDK release.\n\n" + +#define SUPPRESS_DEPRECATE_MSG "-XDsuppress-tool-removal-message" + +static bool suppress_warning = false; + static void usage(unpacker* u, const char* progname, bool full = false) { // WinMain does not set argv[0] to the progrname progname = (progname != null) ? nbasename(progname) : "unpack200"; @@ -182,7 +189,11 @@ char* buf = (char*) strdup(env); const char* delim = "\n\t "; for (char* p = strtok(buf, delim); p != null; p = strtok(null, delim)) { - envargs.add(p); + if (!strcmp(p, SUPPRESS_DEPRECATE_MSG)) { + suppress_warning = true; + } else { + envargs.add(p); + } } } // allocate extra margin at both head and tail @@ -194,7 +205,11 @@ } for (i = 1; i < argc; i++) { // note: skip argv[0] (program name) - *argp++ = (char*) strdup(argv[i]); // make a scratch copy + if (!strcmp(argv[i], SUPPRESS_DEPRECATE_MSG)) { + suppress_warning = true; + } else { + *argp++ = (char*) strdup(argv[i]); // make a scratch copy + } } *argp = null; // sentinel envargc = envargs.length(); // report this count to next_arg @@ -293,6 +308,10 @@ int verbose = 0; char* logfile = null; + if (!suppress_warning) { + fprintf(u.errstrm, DEPRECATE_WARNING, nbasename(argv[0])); + } + for (;;) { const char* arg = (*argp == null)? "": u.saveStr(*argp); bool isenvarg = (argp < arg0);