Mercurial > emacs
comparison src/fileio.c @ 43564:1874239cb5be
(Fsubstitute_in_file_name): Fix the change from 2002-02-08.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 26 Feb 2002 18:41:36 +0000 |
parents | 4934ed73c7a4 |
children | d12db931f164 fa717c37ad16 |
comparison
equal
deleted
inserted
replaced
43563:1440b9054cb4 | 43564:1874239cb5be |
---|---|
2067 for (s = p; *s && (!IS_DIRECTORY_SEP (*s) | 2067 for (s = p; *s && (!IS_DIRECTORY_SEP (*s) |
2068 #ifdef VMS | 2068 #ifdef VMS |
2069 && *s != ':' | 2069 && *s != ':' |
2070 #endif /* VMS */ | 2070 #endif /* VMS */ |
2071 ); s++); | 2071 ); s++); |
2072 if (s > p + 1) | 2072 if (p[0] == '~' && s > p + 1) /* we've got "/~something/" */ |
2073 { | 2073 { |
2074 o = (unsigned char *) alloca (s - p + 1); | 2074 o = (unsigned char *) alloca (s - p + 1); |
2075 bcopy ((char *) p, o, s - p); | 2075 bcopy ((char *) p, o, s - p); |
2076 o [s - p] = 0; | 2076 o [s - p] = 0; |
2077 | 2077 |
2078 pw = (struct passwd *) getpwnam (o + 1); | 2078 pw = (struct passwd *) getpwnam (o + 1); |
2079 } | 2079 } |
2080 /* If we have ~/ or ~user and `user' exists, discard | 2080 /* If we have ~/ or ~user and `user' exists, discard |
2081 everything up to ~. But if `user' does not exist, leave | 2081 everything up to ~. But if `user' does not exist, leave |
2082 ~user alone, it might be a literal file name. */ | 2082 ~user alone, it might be a literal file name. */ |
2083 if (s == p + 1 || pw) | 2083 if (IS_DIRECTORY_SEP (p[0]) || s == p + 1 || pw) |
2084 { | 2084 { |
2085 nm = p; | 2085 nm = p; |
2086 substituted = 1; | 2086 substituted = 1; |
2087 } | 2087 } |
2088 } | 2088 } |