336 |
Lisp_Object filename, operation; |
Lisp_Object filename, operation; |
337 |
{ |
{ |
338 |
/* This function must not munge the match data. */ |
/* This function must not munge the match data. */ |
339 |
Lisp_Object chain, inhibited_handlers; |
Lisp_Object chain, inhibited_handlers, result = Qnil; |
340 |
|
int pos = -1; |
341 |
|
|
342 |
CHECK_STRING (filename); |
CHECK_STRING (filename); |
343 |
|
|
354 |
if (CONSP (elt)) |
if (CONSP (elt)) |
355 |
{ |
{ |
356 |
Lisp_Object string; |
Lisp_Object string; |
357 |
|
int match_pos; |
358 |
string = XCAR (elt); |
string = XCAR (elt); |
359 |
if (STRINGP (string) && fast_string_match (string, filename) >= 0) |
if (STRINGP (string) |
360 |
|
&& (match_pos = fast_string_match (string, filename)) > pos) |
361 |
{ |
{ |
362 |
Lisp_Object handler, tem; |
Lisp_Object handler, tem; |
363 |
|
|
364 |
handler = XCDR (elt); |
handler = XCDR (elt); |
365 |
tem = Fmemq (handler, inhibited_handlers); |
tem = Fmemq (handler, inhibited_handlers); |
366 |
if (NILP (tem)) |
if (NILP (tem)) |
367 |
return handler; |
{ |
368 |
|
result = handler; |
369 |
|
pos = match_pos; |
370 |
|
} |
371 |
} |
} |
372 |
} |
} |
373 |
|
|
374 |
QUIT; |
QUIT; |
375 |
} |
} |
376 |
return Qnil; |
return result; |
377 |
} |
} |
378 |
|
|
379 |
DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, |
DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, |
2107 |
|
|
2108 |
/* Get variable value */ |
/* Get variable value */ |
2109 |
o = (unsigned char *) egetenv (target); |
o = (unsigned char *) egetenv (target); |
2110 |
if (!o) goto badvar; |
if (o) |
2111 |
total += strlen (o); |
{ |
2112 |
substituted = 1; |
total += strlen (o); |
2113 |
|
substituted = 1; |
2114 |
|
} |
2115 |
|
else if (*p == '}') |
2116 |
|
goto badvar; |
2117 |
} |
} |
2118 |
|
|
2119 |
if (!substituted) |
if (!substituted) |
2163 |
/* Get variable value */ |
/* Get variable value */ |
2164 |
o = (unsigned char *) egetenv (target); |
o = (unsigned char *) egetenv (target); |
2165 |
if (!o) |
if (!o) |
2166 |
goto badvar; |
{ |
2167 |
|
*x++ = '$'; |
2168 |
if (STRING_MULTIBYTE (filename)) |
strcpy (x, target); x+= strlen (target); |
2169 |
|
} |
2170 |
|
else if (STRING_MULTIBYTE (filename)) |
2171 |
{ |
{ |
2172 |
/* If the original string is multibyte, |
/* If the original string is multibyte, |
2173 |
convert what we substitute into multibyte. */ |
convert what we substitute into multibyte. */ |