}
}
- /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
+ /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
nm = (char *) alloca (SBYTES (name) + 1);
memcpy (nm, SSDATA (name), SBYTES (name) + 1);
if (drive && IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
nm++;
- /* Discard any previous drive specifier if nm is now in UNC format. */
+ /* Discard any previous drive specifier if nm is now in UNC format. */
if (IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
{
drive = 0;
}
else
#endif
- /* drive must be set, so this is okay */
+ /* Drive must be set, so this is okay. */
if (strcmp (nm - 2, SSDATA (name)) != 0)
{
char temp[] = " :";
if (!(newdir = egetenv ("HOME")))
newdir = "";
nm++;
- /* egetenv may return a unibyte string, which will bite us since
+ /* `egetenv' may return a unibyte string, which will bite us since
we expect the directory to be multibyte. */
tem = build_string (newdir);
if (!STRING_MULTIBYTE (tem))
use the drive's current directory as the prefix if needed. */
if (!newdir && drive)
{
- /* Get default directory if needed to make nm absolute. */
+ /* Get default directory if needed to make nm absolute. */
char *adir = NULL;
if (!IS_DIRECTORY_SEP (nm[0]))
{
}
if (!adir)
{
- /* Either nm starts with /, or drive isn't mounted. */
+ /* Either nm starts with /, or drive isn't mounted. */
adir = alloca (4);
adir[0] = DRIVE_LETTER (drive);
adir[1] = ':';
#endif /* DOS_NT */
/* Finally, if no prefix has been specified and nm is not absolute,
- then it must be expanded relative to default_directory. */
+ then it must be expanded relative to default_directory. */
if (1
#ifndef DOS_NT
- /* /... alone is not absolute on DOS and Windows. */
+ /* /... alone is not absolute on DOS and Windows. */
&& !IS_DIRECTORY_SEP (nm[0])
#endif
#ifdef WINDOWSNT
#ifdef DOS_NT
if (newdir)
{
- /* First ensure newdir is an absolute name. */
+ /* First ensure newdir is an absolute name. */
if (
/* Detect MSDOS file names with drive specifiers. */
! (IS_DRIVE (newdir[0])
Because of the admonition against calling expand-file-name
when we have pointers into lisp strings, we accomplish this
indirectly by prepending newdir to nm if necessary, and using
- cwd (or the wd of newdir's drive) as the new newdir. */
+ cwd (or the wd of newdir's drive) as the new newdir. */
char *adir;
if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1]))
{
newdir = adir;
}
- /* Strip off drive name from prefix, if present. */
+ /* Strip off drive name from prefix, if present. */
if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1]))
{
drive = newdir[0];
else
tlen = 0;
- /* Now concatenate the directory and name to new space in the stack frame */
+ /* Now concatenate the directory and name to new space in the stack frame. */
tlen += strlen (nm) + 1;
#ifdef DOS_NT
/* Reserve space for drive specifier and escape prefix, since either
}
#ifdef DOS_NT
- /* At last, set drive name. */
+ /* At last, set drive name. */
#ifdef WINDOWSNT
/* Except for network file name. */
if (!(IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1])))
and perhaps call the corresponding file handler. This is needed
for filenames such as "/foo/../user@host:/bar/../baz". Expanding
the ".." component gives us "/user@host:/bar/../baz" which needs
- to be expanded again. */
+ to be expanded again. */
handler = Ffind_file_name_handler (result, Qexpand_file_name);
if (!NILP (handler))
{
}
}
- /* Now determine directory to start with and put it in NEWDIR */
+ /* Now determine directory to start with and put it in NEWDIR. */
newdir = 0;
}
else /* ~user/filename */
{
- /* Get past ~ to user */
+ /* Get past ~ to user. */
unsigned char *user = nm + 1;
- /* Find end of name. */
+ /* Find end of name. */
unsigned char *ptr = (unsigned char *) strchr (user, '/');
ptrdiff_t len = ptr ? ptr - user : strlen (user);
- /* Copy the user name into temp storage. */
+ /* Copy the user name into temp storage. */
o = (unsigned char *) alloca (len + 1);
memcpy (o, user, len);
o[len] = 0;
- /* Look up the user name. */
+ /* Look up the user name. */
BLOCK_INPUT;
pw = (struct passwd *) getpwnam (o + 1);
UNBLOCK_INPUT;
newdir = SDATA (defalt);
}
- /* Now concatenate the directory and name to new space in the stack frame */
+ /* Now concatenate the directory and name to new space in the stack frame. */
tlen = (newdir ? strlen (newdir) + 1 : 0) + strlen (nm) + 1;
target = (unsigned char *) alloca (tlen);
strcat (target, nm);
- /* Now canonicalize by removing /. and /foo/.. if they appear */
+ /* Now canonicalize by removing /. and /foo/.. if they appear. */
p = target;
o = target;
)
{
for (s = p; *s && (!IS_DIRECTORY_SEP (*s)); s++);
- if (p[0] == '~' && s > p + 1) /* we've got "/~something/" */
+ if (p[0] == '~' && s > p + 1) /* We've got "/~something/". */
{
char *o = alloca (s - p + 1);
struct passwd *pw;
(make_specified_string (p, -1, endp - p, multibyte));
/* See if any variables are substituted into the string
- and find the total length of their values in `total' */
+ and find the total length of their values in `total'. */
for (p = nm; p != endp;)
if (*p != '$')
goto badsubst;
else if (*p == '$')
{
- /* "$$" means a single "$" */
+ /* "$$" means a single "$". */
p++;
total -= 1;
substituted = 1;
s = p;
}
- /* Copy out the variable name */
+ /* Copy out the variable name. */
target = (char *) alloca (s - o + 1);
strncpy (target, o, s - o);
target[s - o] = 0;
strupr (target); /* $home == $HOME etc. */
#endif /* DOS_NT */
- /* Get variable value */
+ /* Get variable value. */
o = egetenv (target);
if (o)
{
if (!substituted)
return filename;
- /* If substitution required, recopy the string and do it */
- /* Make space in stack frame for the new copy */
+ /* If substitution required, recopy the string and do it. */
+ /* Make space in stack frame for the new copy. */
xnm = (char *) alloca (SBYTES (filename) + total + 1);
x = xnm;
- /* Copy the rest of the name through, replacing $ constructs with values */
+ /* Copy the rest of the name through, replacing $ constructs with values. */
for (p = nm; *p;)
if (*p != '$')
*x++ = *p++;
s = p;
}
- /* Copy out the variable name */
+ /* Copy out the variable name. */
target = (char *) alloca (s - o + 1);
strncpy (target, o, s - o);
target[s - o] = 0;
strupr (target); /* $home == $HOME etc. */
#endif /* DOS_NT */
- /* Get variable value */
+ /* Get variable value. */
o = egetenv (target);
if (!o)
{
stat behaves differently depending! */
if (SCHARS (absname) > 1
&& IS_DIRECTORY_SEP (SREF (absname, SBYTES (absname) - 1))
- && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname)-2)))
+ && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname) - 2)))
/* We cannot take shortcuts; they might be wrong for magic file names. */
absname = Fdirectory_file_name (absname);
return absname;
encoded_filename = ENCODE_FILE (absname);
- /* stat is a good way to tell whether the file exists,
+ /* `stat' is a good way to tell whether the file exists,
regardless of what access permissions it has. */
if (lstat (SSDATA (encoded_filename), &statbuf) >= 0)
{