common/src/fixpath.c
author mkos
Fri, 21 Feb 2014 17:37:39 +0100
changeset 23962 99b559663ecb
parent 23435 098340eccdcb
child 23837 6f3e6fee7b44
permissions -rw-r--r--
8026801: Enhance endpoint addressing Summary: Caching data initialized via TCCL in static context; fix also reviewed by Iaroslav Savytskyi, Alexander Fomin Reviewed-by: ahgross, mgrebac, skoivu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
/*
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
     2
 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     4
 *
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    10
 *
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    15
 * accompanied this code).
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    16
 *
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    20
 *
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    23
 * questions.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    24
 */
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    25
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    26
#include <Windows.h>
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    27
#include <io.h>
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    28
#include <stdio.h>
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    29
#include <string.h>
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    30
#include <malloc.h>
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    31
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    32
void report_error(char const * msg)
15058
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    33
{
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    34
  LPVOID lpMsgBuf;
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    35
  DWORD dw = GetLastError();
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    36
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    37
  FormatMessage(
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    38
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    39
      FORMAT_MESSAGE_FROM_SYSTEM |
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    40
      FORMAT_MESSAGE_IGNORE_INSERTS,
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    41
      NULL,
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    42
      dw,
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    43
      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    44
      (LPTSTR) &lpMsgBuf,
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    45
      0,
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    46
      NULL);
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    47
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    48
  fprintf(stderr,
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    49
          "%s  Failed with error %d: %s\n",
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    50
          msg, dw, lpMsgBuf);
15058
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    51
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    52
  LocalFree(lpMsgBuf);
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    53
}
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
    54
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    55
/*
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    56
 * Test if pos points to /cygdrive/_/ where _ can
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    57
 * be any character.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    58
 */
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    59
int is_cygdrive_here(int pos, char const *in, int len)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    60
{
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    61
  // Length of /cygdrive/c/ is 12
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    62
  if (pos+12 > len) return 0;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    63
  if (in[pos+11]=='/' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    64
      in[pos+9]=='/' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    65
      in[pos+8]=='e' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    66
      in[pos+7]=='v' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    67
      in[pos+6]=='i' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    68
      in[pos+5]=='r' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    69
      in[pos+4]=='d' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    70
      in[pos+3]=='g' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    71
      in[pos+2]=='y' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    72
      in[pos+1]=='c' &&
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    73
      in[pos+0]=='/') {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    74
    return 1;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    75
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    76
  return 0;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    77
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    78
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    79
/*
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    80
 * Replace /cygdrive/_/ with _:/
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    81
 * Works in place since drive letter is always
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    82
 * shorter than /cygdrive/
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    83
 */
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    84
char *replace_cygdrive_cygwin(char const *in)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    85
{
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    86
  size_t len = strlen(in);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    87
  char *out = (char*) malloc(len+1);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    88
  int i,j;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    89
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    90
  if (len < 12) {
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    91
    memmove(out, in, len + 1);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    92
    return out;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    93
  }
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
    94
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    95
  for (i = 0, j = 0; i<len;) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    96
    if (is_cygdrive_here(i, in, len)) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    97
      out[j++] = in[i+10];
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    98
      out[j++] = ':';
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    99
      i+=11;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   100
    } else {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   101
      out[j] = in[i];
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   102
      i++;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   103
      j++;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   104
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   105
  }
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   106
  out[j] = '\0';
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   107
  return out;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   108
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   109
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   110
void append(char **b, size_t *bl, size_t *u, char *add, size_t addlen)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   111
{
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   112
  while ( (addlen+*u+1) > *bl) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   113
    *bl *= 2;
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   114
    *b = (char*) realloc(*b, *bl);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   115
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   116
  memcpy(*b+*u, add, addlen);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   117
  *u += addlen;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   118
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   119
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   120
/*
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   121
 * Creates a new string from in where the first occurance of sub is
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   122
 * replaced by rep.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   123
 */
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   124
char *replace_substring(char *in, char *sub, char *rep)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   125
{
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   126
  int in_len = strlen(in);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   127
  int sub_len = strlen(sub);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   128
  int rep_len = strlen(rep);
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   129
  char *out = (char *) malloc(in_len - sub_len + rep_len + 1);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   130
  char *p;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   131
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   132
  if (!(p = strstr(in, sub))) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   133
    // If sub isn't a substring of in, just return in.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   134
    return in;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   135
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   136
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   137
  // Copy characters from beginning of in to start of sub.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   138
  strncpy(out, in, p - in);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   139
  out[p - in] = '\0';
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   140
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   141
  sprintf(out + (p - in), "%s%s", rep, p + sub_len);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   142
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   143
  return out;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   144
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   145
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   146
char* msys_path_list; // @-separated list of paths prefix to look for
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   147
char* msys_path_list_end; // Points to last \0 in msys_path_list.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   148
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   149
void setup_msys_path_list(char const * argument)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   150
{
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   151
  char* p;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   152
  char* drive_letter_pos;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   153
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   154
  msys_path_list = strdup(&argument[2]);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   155
  msys_path_list_end = &msys_path_list[strlen(msys_path_list)];
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   156
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   157
  // Convert all at-sign (@) in path list to \0.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   158
  // @ was chosen as separator to minimize risk of other tools messing around with it
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   159
  p = msys_path_list;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   160
  do {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   161
    if (p[1] == ':') {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   162
      // msys has mangled our path list, restore it from c:/... to /c/...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   163
      drive_letter_pos = p+1;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   164
      *drive_letter_pos = *p;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   165
      *p = '/';
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   166
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   167
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   168
    // Look for an @ in the list
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   169
    p = strchr(p, '@');
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   170
    if (p != NULL) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   171
      *p = '\0';
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   172
      p++;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   173
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   174
  } while (p != NULL);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   175
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   176
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   177
char *replace_cygdrive_msys(char const *in)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   178
{
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   179
  char* str;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   180
  char* prefix;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   181
  char* p;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   182
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   183
  str = strdup(in);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   184
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   185
  // For each prefix in the path list, search for it and replace /c/... with c:/...
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   186
  for (prefix = msys_path_list; prefix < msys_path_list_end && prefix != NULL; prefix += strlen(prefix)+1) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   187
    p=str;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   188
    while ((p = strstr(p, prefix))) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   189
      char* drive_letter = p+1;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   190
      *p = *drive_letter;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   191
      *drive_letter = ':';
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   192
      p++;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   193
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   194
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   195
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   196
  return str;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   197
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   198
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   199
char*(*replace_cygdrive)(char const *in) = NULL;
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   200
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   201
char *files_to_delete[1024];
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   202
int num_files_to_delete = 0;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   203
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   204
char *fix_at_file(char const *in)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   205
{
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   206
  char *tmpdir;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   207
  char name[2048];
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   208
  char *atname;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   209
  char *buffer;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   210
  size_t buflen=65536;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   211
  size_t used=0;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   212
  size_t len;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   213
  int rc;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   214
  FILE *atout;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   215
  FILE *atin;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   216
  char block[2048];
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   217
  size_t blocklen;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   218
  char *fixed;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   219
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   220
  atin = fopen(in+1, "r");
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   221
  if (atin == NULL) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   222
    fprintf(stderr, "Could not read at file %s\n", in+1);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   223
    exit(-1);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   224
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   225
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   226
  tmpdir = getenv("TEMP");
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   227
  if (tmpdir == NULL) {
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   228
#if _WIN64
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   229
    tmpdir = "c:/cygwin64/tmp";
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   230
#else
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   231
    tmpdir = "c:/cygwin/tmp";
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   232
#endif
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   233
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   234
  _snprintf(name, sizeof(name), "%s\\atfile_XXXXXX", tmpdir);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   235
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   236
  rc = _mktemp_s(name, strlen(name)+1);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   237
  if (rc) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   238
    fprintf(stderr, "Could not create temporary file name for at file!\n");
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   239
    exit(-1);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   240
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   241
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   242
  atout = fopen(name, "w");
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   243
  if (atout == NULL) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   244
    fprintf(stderr, "Could not open temporary file for writing! %s\n", name);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   245
    exit(-1);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   246
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   247
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   248
  buffer = (char*) malloc(buflen);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   249
  while((blocklen = fread(block,1,sizeof(block),atin)) > 0) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   250
    append(&buffer, &buflen, &used, block, blocklen);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   251
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   252
  buffer[used] = 0;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   253
  if (getenv("DEBUG_FIXPATH") != NULL) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   254
    fprintf(stderr, "fixpath input from @-file %s: %s\n", &in[1], buffer);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   255
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   256
  fixed = replace_cygdrive(buffer);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   257
  if (getenv("DEBUG_FIXPATH") != NULL) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   258
    fprintf(stderr, "fixpath converted to @-file %s is: %s\n", name, fixed);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   259
  }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   260
  fwrite(fixed, strlen(fixed), 1, atout);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   261
  fclose(atin);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   262
  fclose(atout);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   263
  free(fixed);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   264
  free(buffer);
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   265
  files_to_delete[num_files_to_delete] = (char*) malloc(strlen(name)+1);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   266
  strcpy(files_to_delete[num_files_to_delete], name);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   267
  num_files_to_delete++;
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   268
  atname = (char*) malloc(strlen(name)+2);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   269
  atname[0] = '@';
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   270
  strcpy(atname+1, name);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   271
  return atname;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   272
}
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   273
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   274
// given an argument, convert it to the windows command line safe quoted version
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   275
// using rules from:
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   276
// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   277
// caller is responsible for freeing both input and output.
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   278
char * quote_arg(char const * in_arg) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   279
  char *quoted = NULL;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   280
  char *current = quoted;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   281
  int pass;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   282
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   283
  if(strpbrk(in_arg, " \t\n\v\r\\\"") == NULL) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   284
     return _strdup(in_arg);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   285
  }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   286
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   287
  // process the arg twice. Once to calculate the size and then to copy it.
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   288
  for(pass=1; pass<=2; pass++) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   289
    char const *arg = in_arg;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   290
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   291
    // initial "
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   292
    if(pass == 2) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   293
      *current = '\"';
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   294
    }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   295
    current++;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   296
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   297
    // process string to be quoted until NUL
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   298
    do {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   299
      int escapes = 0;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   300
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   301
      while (*arg == '\\') {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   302
        // count escapes.
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   303
        escapes++;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   304
        arg++;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   305
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   306
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   307
      if (*arg == '\0') {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   308
         // escape the escapes before final "
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   309
         escapes *= 2;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   310
      } else if (*arg == '"') {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   311
        // escape the escapes and the "
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   312
        escapes = escapes * 2 + 1;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   313
      } else {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   314
         // escapes aren't special, just echo them.
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   315
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   316
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   317
      // emit some escapes
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   318
      while (escapes > 0) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   319
        if (pass == 2) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   320
          *current = '\\';
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   321
        }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   322
        current++;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   323
        escapes--;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   324
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   325
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   326
      // and the current char
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   327
      if (pass == 2) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   328
        *current = *arg;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   329
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   330
      current++;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   331
    } while( *arg++ != '\0');
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   332
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   333
    // allocate the buffer
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   334
    if (pass == 1) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   335
      size_t alloc = (size_t) (current - quoted + (ptrdiff_t) 2);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   336
      current = quoted = (char*) calloc(alloc, sizeof(char));
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   337
    }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   338
  }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   339
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   340
  // final " and \0
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   341
  *(current - 1) = '"';
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   342
  *current = '\0';
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   343
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   344
  return quoted;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   345
}
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   346
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   347
int main(int argc, char const ** argv)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   348
{
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   349
    STARTUPINFO si;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   350
    PROCESS_INFORMATION pi;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   351
    unsigned short rc;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   352
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   353
    char *line;
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   354
    char *current;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   355
    int i, cmd;
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   356
    DWORD exitCode;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   357
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   358
    if (argc<2 || argv[1][0] != '-' || (argv[1][1] != 'c' && argv[1][1] != 'm')) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   359
        fprintf(stderr, "Usage: fixpath -c|m<path@path@...> /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n");
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   360
        exit(0);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   361
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   362
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   363
    if (getenv("DEBUG_FIXPATH") != NULL) {
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   364
      char const * cmdline = GetCommandLine();
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   365
      fprintf(stderr, "fixpath input line >%s<\n", strstr( cmdline , argv[1]));
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   366
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   367
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   368
    if (argv[1][1] == 'c' && argv[1][2] == '\0') {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   369
      if (getenv("DEBUG_FIXPATH") != NULL) {
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   370
        fprintf(stderr, "fixpath using cygwin mode\n");
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   371
      }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   372
      replace_cygdrive = replace_cygdrive_cygwin;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   373
    } else if (argv[1][1] == 'm') {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   374
      if (getenv("DEBUG_FIXPATH") != NULL) {
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   375
        fprintf(stderr, "fixpath using msys mode, with path list: %s\n", &argv[1][2]);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   376
      }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   377
      setup_msys_path_list(argv[1]);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   378
      replace_cygdrive = replace_cygdrive_msys;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   379
    } else {
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   380
      fprintf(stderr, "fixpath Unknown mode: %s\n", argv[1]);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   381
      exit(-1);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   382
    }
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   383
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   384
    i = 2;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   385
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   386
    // handle assignments
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   387
    while (i < argc) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   388
      char const * assignment = strchr(argv[i], '=');
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   389
      if (assignment != NULL && assignment != argv[i]) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   390
        size_t var_len = (size_t) (assignment - argv[i] + (ptrdiff_t) 1);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   391
        char *var = (char *) calloc(var_len, sizeof(char));
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   392
        char *val = replace_cygdrive(assignment + 1);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   393
        memmove(var, argv[i], var_len);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   394
        var[var_len - 1] = '\0';
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   395
        strupr(var);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   396
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   397
        if (getenv("DEBUG_FIXPATH") != NULL) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   398
          fprintf(stderr, "fixpath setting var >%s< to >%s<\n", var, val);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   399
        }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   400
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   401
        rc = SetEnvironmentVariable(var, val);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   402
        if(!rc) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   403
          // Could not set var for some reason.  Try to report why.
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   404
          const int msg_len = 80 + var_len + strlen(val);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   405
          char * msg = (char *) alloca(msg_len);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   406
          _snprintf_s(msg, msg_len, _TRUNCATE, "Could not set environment variable [%s=%s]", var, val);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   407
          report_error(msg);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   408
          exit(1);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   409
        }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   410
        free(var);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   411
        free(val);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   412
      } else {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   413
        // no more assignments;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   414
        break;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   415
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   416
      i++;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   417
    }
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   418
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   419
    // remember index of the command
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   420
    cmd = i;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   421
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   422
    // handle command and it's args.
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   423
    while (i < argc) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   424
      char const *replaced = replace_cygdrive(argv[i]);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   425
      if(replaced[0] == '@') {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   426
        // Found at-file! Fix it!
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   427
        replaced = fix_at_file(replaced);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   428
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   429
      argv[i] = quote_arg(replaced);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   430
      i++;
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   431
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   432
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   433
    // determine the length of the line
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   434
    line = NULL;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   435
    // args
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   436
    for(i = cmd; i < argc; i++) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   437
      line += (ptrdiff_t) strlen(argv[i]);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   438
    }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   439
    // spaces and null
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   440
    line += (ptrdiff_t) (argc - cmd + 1);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   441
    // allocate
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   442
    line = (char*) calloc(line - (char*) NULL, sizeof(char));
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   443
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   444
    // copy in args.
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   445
    current = line;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   446
    for(i = cmd; i < argc; i++) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   447
      ptrdiff_t len = strlen(argv[i]);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   448
      if (i != cmd) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   449
        *current++ = ' ';
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   450
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   451
      memmove(current, argv[i], len);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   452
      current += len;
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   453
    }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   454
    *current = '\0';
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   455
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   456
    if (getenv("DEBUG_FIXPATH") != NULL) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   457
      fprintf(stderr, "fixpath converted line >%s<\n", line);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   458
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   459
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   460
    if(cmd == argc) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   461
       if (getenv("DEBUG_FIXPATH") != NULL) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   462
         fprintf(stderr, "fixpath no command provided!\n");
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   463
       }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   464
       exit(0);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   465
    }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   466
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   467
    ZeroMemory(&si,sizeof(si));
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   468
    si.cb=sizeof(si);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   469
    ZeroMemory(&pi,sizeof(pi));
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   470
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   471
    fflush(stderr);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   472
    fflush(stdout);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   473
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   474
    rc = CreateProcess(NULL,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   475
                       line,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   476
                       0,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   477
                       0,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   478
                       TRUE,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   479
                       0,
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   480
                       NULL,
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   481
                       NULL,
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   482
                       &si,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   483
                       &pi);
15058
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
   484
    if(!rc) {
61c4ac49cbda 8005635: build-infra: Support building install in jprt
erikj
parents: 14111
diff changeset
   485
      // Could not start process for some reason.  Try to report why:
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   486
      report_error("Could not start process!");
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   487
      exit(126);
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   488
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   489
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   490
    WaitForSingleObject(pi.hProcess,INFINITE);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   491
    GetExitCodeProcess(pi.hProcess,&exitCode);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   492
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   493
    if (getenv("DEBUG_FIXPATH") != NULL) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   494
      for (i=0; i<num_files_to_delete; ++i) {
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   495
        fprintf(stderr, "fixpath Not deleting temporary file %s\n",
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   496
                files_to_delete[i]);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   497
      }
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   498
    } else {
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   499
      for (i=0; i<num_files_to_delete; ++i) {
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   500
        remove(files_to_delete[i]);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   501
      }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   502
    }
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   503
23435
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   504
    if (exitCode != 0) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   505
      if (getenv("DEBUG_FIXPATH") != NULL) {
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   506
        fprintf(stderr, "fixpath exit code %d\n",
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   507
                exitCode);
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   508
      }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   509
    }
098340eccdcb 8039411: Enhance fixpath to allow environment variable assignments.
mduigou
parents: 15058
diff changeset
   510
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   511
    exit(exitCode);
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   512
}