Mercurial > emacs
comparison src/fileio.c @ 5647:7bd40f51b9e9
(double_dollars): New function.
(Fread_file_name_internal): Use double_dollars.
(Fread_file_name): Likewise.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 20 Jan 1994 23:50:37 +0000 |
parents | 67a8c4a8c80e |
children | 23821c197271 |
comparison
equal
deleted
inserted
replaced
5646:9e5b5196aae9 | 5647:7bd40f51b9e9 |
---|---|
3455 } | 3455 } |
3456 | 3456 |
3457 /* Reading and completing file names */ | 3457 /* Reading and completing file names */ |
3458 extern Lisp_Object Ffile_name_completion (), Ffile_name_all_completions (); | 3458 extern Lisp_Object Ffile_name_completion (), Ffile_name_all_completions (); |
3459 | 3459 |
3460 /* In the string VAL, change each $ to $$ and return the result. */ | |
3461 | |
3462 static Lisp_Object | |
3463 double_dollars (val) | |
3464 Lisp_Object val; | |
3465 { | |
3466 register unsigned char *old, *new; | |
3467 register int n; | |
3468 int osize, count; | |
3469 | |
3470 osize = XSTRING (val)->size; | |
3471 /* Quote "$" as "$$" to get it past substitute-in-file-name */ | |
3472 for (n = osize, count = 0, old = XSTRING (val)->data; n > 0; n--) | |
3473 if (*old++ == '$') count++; | |
3474 if (count > 0) | |
3475 { | |
3476 old = XSTRING (val)->data; | |
3477 val = Fmake_string (make_number (osize + count), make_number (0)); | |
3478 new = XSTRING (val)->data; | |
3479 for (n = osize; n > 0; n--) | |
3480 if (*old != '$') | |
3481 *new++ = *old++; | |
3482 else | |
3483 { | |
3484 *new++ = '$'; | |
3485 *new++ = '$'; | |
3486 old++; | |
3487 } | |
3488 } | |
3489 return val; | |
3490 } | |
3491 | |
3460 DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_internal, | 3492 DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_internal, |
3461 3, 3, 0, | 3493 3, 3, 0, |
3462 "Internal subroutine for read-file-name. Do not call this.") | 3494 "Internal subroutine for read-file-name. Do not call this.") |
3463 (string, dir, action) | 3495 (string, dir, action) |
3464 Lisp_Object string, dir, action; | 3496 Lisp_Object string, dir, action; |
3509 } | 3541 } |
3510 | 3542 |
3511 if (!NILP (specdir)) | 3543 if (!NILP (specdir)) |
3512 val = concat2 (specdir, val); | 3544 val = concat2 (specdir, val); |
3513 #ifndef VMS | 3545 #ifndef VMS |
3514 { | 3546 return double_dollars (val); |
3515 register unsigned char *old, *new; | 3547 #else /* not VMS */ |
3516 register int n; | |
3517 int osize, count; | |
3518 | |
3519 osize = XSTRING (val)->size; | |
3520 /* Quote "$" as "$$" to get it past substitute-in-file-name */ | |
3521 for (n = osize, count = 0, old = XSTRING (val)->data; n > 0; n--) | |
3522 if (*old++ == '$') count++; | |
3523 if (count > 0) | |
3524 { | |
3525 old = XSTRING (val)->data; | |
3526 val = Fmake_string (make_number (osize + count), make_number (0)); | |
3527 new = XSTRING (val)->data; | |
3528 for (n = osize; n > 0; n--) | |
3529 if (*old != '$') | |
3530 *new++ = *old++; | |
3531 else | |
3532 { | |
3533 *new++ = '$'; | |
3534 *new++ = '$'; | |
3535 old++; | |
3536 } | |
3537 } | |
3538 } | |
3539 #endif /* Not VMS */ | |
3540 return val; | 3548 return val; |
3549 #endif /* not VMS */ | |
3541 } | 3550 } |
3542 UNGCPRO; | 3551 UNGCPRO; |
3543 | 3552 |
3544 if (EQ (action, Qt)) | 3553 if (EQ (action, Qt)) |
3545 return Ffile_name_all_completions (name, realdir); | 3554 return Ffile_name_all_completions (name, realdir); |
3597 | 3606 |
3598 args[0] = insdef; | 3607 args[0] = insdef; |
3599 args[1] = initial; | 3608 args[1] = initial; |
3600 insdef = Fconcat (2, args); | 3609 insdef = Fconcat (2, args); |
3601 pos = make_number (XSTRING (dir)->size); | 3610 pos = make_number (XSTRING (dir)->size); |
3602 insdef1 = Fcons (insdef, pos); | 3611 insdef1 = Fcons (double_dollars (insdef), pos); |
3603 } | 3612 } |
3613 else | |
3614 insdef1 = double_dollars (insdef); | |
3604 } | 3615 } |
3605 else | 3616 else |
3606 insdef = Qnil, insdef1 = Qnil; | 3617 insdef = Qnil, insdef1 = Qnil; |
3607 | 3618 |
3608 #ifdef VMS | 3619 #ifdef VMS |