Changeset 725 for trunk/src/gmake/function.c
- Timestamp:
- Dec 15, 2006, 6:18:47 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/function.c
r720 r725 2119 2119 return o; 2120 2120 } 2121 2122 #ifdef CONFIG_WITH_ABSPATHEX 2123 /* same as abspath except that the current path is given as the 2nd argument. */ 2124 static char * 2125 func_abspathex (char *o, char **argv, const char *funcname UNUSED) 2126 { 2127 /* Expand the argument. */ 2128 char *p = argv[0]; 2129 PATH_VAR (current_directory); 2130 char *cwd = argv[1]; 2131 unsigned int cwd_len = ~0U; 2132 char *path = 0; 2133 int doneany = 0; 2134 unsigned int len = 0; 2135 PATH_VAR (in); 2136 PATH_VAR (out); 2137 2138 while ((path = find_next_token (&p, &len)) != 0) 2139 { 2140 if (len < GET_PATH_MAX) 2141 { 2142 #ifdef HAVE_DOS_PATHS 2143 if (path[0] != '/' && path[0] != '\\' && (len < 2 || path[1] != ':') && cwd) 2144 #else 2145 if (path[0] != '/' && cwd) 2146 #endif 2147 { 2148 /* relative path, prefix with cwd. */ 2149 if (cwd_len == ~0U) 2150 cwd_len = strlen (cwd); 2151 if (cwd_len + len + 1 >= GET_PATH_MAX) 2152 continue; 2153 memcpy (in, cwd, cwd_len) 2154 in[cwd_len] = '/'; 2155 memcpy (in + cwd_len + 1, path, len); 2156 in[cwd_len + len + 1] = '\0'; 2157 } 2158 else 2159 { 2160 /* absolute path pass it as-is. */ 2161 memcpy (in, path, len); 2162 in[len] = '\0'; 2163 } 2164 2165 if (abspath (in, out)) 2166 { 2167 o = variable_buffer_output (o, out, strlen (out)); 2168 o = variable_buffer_output (o, " ", 1); 2169 doneany = 1; 2170 } 2171 } 2172 } 2173 2174 /* Kill last space. */ 2175 if (doneany) 2176 --o; 2177 2178 return o; 2179 } 2180 #endif 2121 2181 2122 2182 #ifdef CONFIG_WITH_TOUPPER_TOLOWER … … 2378 2438 { STRING_SIZE_TUPLE("tolower"), 0, 1, 1, func_toupper_tolower}, 2379 2439 #endif 2440 #ifdef CONFIG_WITH_ABSPATHEX 2441 { STRING_SIZE_TUPLE("abspathex"), 0, 2, 1, func_abspathex}, 2442 #endif 2380 2443 #if defined(CONFIG_WITH_VALUE_LENGTH) && defined(CONFIG_WITH_COMPARE) 2381 2444 { STRING_SIZE_TUPLE("comp-vars"), 3, 3, 1, func_comp_vars},
Note:
See TracChangeset
for help on using the changeset viewer.