Mercurial > emacs
comparison src/fileio.c @ 2591:a53b4a566cb6
(Fexpand_file_name): Don't remove trailing / from NEWDIR if just "/".
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Mon, 26 Apr 1993 21:54:00 +0000 |
parents | b6c62e4abf59 |
children | fcf578723758 |
comparison
equal
deleted
inserted
replaced
2590:9dace03bd76c | 2591:a53b4a566cb6 |
---|---|
1 /* File IO for GNU Emacs. | 1 /* File IO for GNU Emacs. |
2 Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc. | 2 Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GNU Emacs. | 4 This file is part of GNU Emacs. |
5 | 5 |
6 GNU Emacs is free software; you can redistribute it and/or modify | 6 GNU Emacs is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
845 | 845 |
846 if (newdir != 0) | 846 if (newdir != 0) |
847 { | 847 { |
848 /* Get rid of any slash at the end of newdir. */ | 848 /* Get rid of any slash at the end of newdir. */ |
849 int length = strlen (newdir); | 849 int length = strlen (newdir); |
850 if (newdir[length - 1] == '/') | 850 if (length > 1 && newdir[length - 1] == '/') |
851 { | 851 { |
852 unsigned char *temp = (unsigned char *) alloca (length); | 852 unsigned char *temp = (unsigned char *) alloca (length); |
853 bcopy (newdir, temp, length - 1); | 853 bcopy (newdir, temp, length - 1); |
854 temp[length - 1] = 0; | 854 temp[length - 1] = 0; |
855 newdir = temp; | 855 newdir = temp; |