we might as well de-obfuscate by writing directory and path separators
explicitly.
+Sun Apr 16 18:35:33 2006 Ben Pfaff <blp@gnu.org>
+
+ We don't really support anything but Unix-like environments well,
+ so we might as well de-obfuscate by writing directory and path
+ separators explicitly.
+
+ * file-name.h: (macro DIR_SEPARATOR) Removed. Changed all usages
+ to just '/'.
+ (macro PATH_SEPARATOR) Removed. Changed all usages to just ':'.
+ (macro DIR_SEPARATOR_STRING) Removed. Changed all usages to just
+ "/".
+ (macro PATH_SEPARATOR_STRING) Removed. Changed all usages to just
+ ":"
+
Sun Apr 16 18:28:35 2006 Ben Pfaff <blp@gnu.org>
GNU standards require "file name" instead of "filename" in
Sun Apr 16 18:28:35 2006 Ben Pfaff <blp@gnu.org>
GNU standards require "file name" instead of "filename" in
-/* Searches for a configuration file with name NAME in the path given
- by PATH, which is tilde- and environment-interpolated. Directories
- in PATH are delimited by PATH_DELIMITER, defined in <pref.h>.
- Returns the malloc'd full name of the first file found, or NULL if
- none is found.
+/* Searches for a configuration file with name NAME in the path
+ given by PATH, which is tilde- and environment-interpolated.
+ Directories in PATH are delimited by ':'. Returns the
+ malloc'd full name of the first file found, or NULL if none is
+ found.
If PREFIX is non-NULL, then it is prefixed to each filename;
i.e., it looks like PREFIX/PATH_COMPONENT/NAME. This is not done
If PREFIX is non-NULL, then it is prefixed to each filename;
i.e., it looks like PREFIX/PATH_COMPONENT/NAME. This is not done
verbose_msg (2, _("searching for \"%s\" in path \"%s\""),
base_name, ds_c_str (&path));
verbose_msg (2, _("searching for \"%s\" in path \"%s\""),
base_name, ds_c_str (&path));
- while (ds_separate (&path, &dir, PATH_DELIMITER_STRING, &save_idx))
+ while (ds_separate (&path, &dir, ":", &save_idx))
{
/* Do tilde expansion. */
if (ds_first (&dir) == '~')
{
/* Do tilde expansion. */
if (ds_first (&dir) == '~')
if (prefix != NULL && !fn_is_absolute (ds_c_str (&dir)))
{
ds_puts (&file, prefix);
if (prefix != NULL && !fn_is_absolute (ds_c_str (&dir)))
{
ds_puts (&file, prefix);
- ds_putc (&file, DIR_SEPARATOR);
}
ds_puts (&file, ds_c_str (&dir));
}
ds_puts (&file, ds_c_str (&dir));
- if (ds_length (&dir) && ds_last (&file) != DIR_SEPARATOR)
- ds_putc (&file, DIR_SEPARATOR);
+ if (ds_length (&dir) && ds_last (&file) != '/')
+ ds_putc (&file, '/');
ds_puts (&file, base_name);
/* Check whether file exists. */
ds_puts (&file, base_name);
/* Check whether file exists. */
dest = fn2 = xmalloc (maxlen + 1);
src = fn1;
dest = fn2 = xmalloc (maxlen + 1);
src = fn1;
- if (*src == DIR_SEPARATOR)
fn2 = xrealloc (fn2, maxlen + 1);
dest = fn2 + ofs;
}
fn2 = xrealloc (fn2, maxlen + 1);
dest = fn2 + ofs;
}
- if (dest[-1] != DIR_SEPARATOR)
- *dest++ = DIR_SEPARATOR;
+ if (dest[-1] != '/')
+ *dest++ = '/';
- if (c == DIR_SEPARATOR || c == 0)
+ if (c == '/' || c == 0)
{
/* remove `./', `../' from directory */
{
/* remove `./', `../' from directory */
- if (dest[-1] == '.' && dest[-2] == DIR_SEPARATOR)
+ if (dest[-1] == '.' && dest[-2] == '/')
- else if (dest[-1] == '.' && dest[-2] == '.' && dest[-3] == DIR_SEPARATOR)
+ else if (dest[-1] == '.' && dest[-2] == '.' && dest[-3] == '/')
{
dest -= 3;
if (dest == fn2)
dest++;
{
dest -= 3;
if (dest == fn2)
dest++;
- while (dest[-1] != DIR_SEPARATOR)
+ while (dest[-1] != '/')
- else if (dest[-1] != DIR_SEPARATOR) /* remove extra slashes */
+ else if (dest[-1] != '/') /* remove extra slashes */
- if (dest[-1] == DIR_SEPARATOR && dest > fn2 + 1)
+ if (dest[-1] == '/' && dest > fn2 + 1)
dest--;
*dest = 0;
free (fn1);
dest--;
*dest = 0;
free (fn1);
len = strlen (filename);
if (len == 1 && filename[0] == '/')
p = filename + 1;
len = strlen (filename);
if (len == 1 && filename[0] == '/')
p = filename + 1;
- else if (len && filename[len - 1] == DIR_SEPARATOR)
+ else if (len && filename[len - 1] == '/')
p = buf_find_reverse (filename, len - 1, filename + len - 1, 1);
else
p = buf_find_reverse (filename, len - 1, filename + len - 1, 1);
else
- p = strrchr (filename, DIR_SEPARATOR);
+ p = strrchr (filename, '/');
if (p == NULL)
p = filename;
if (p == NULL)
p = filename;
-/* Directory separator and path delimiter for this OS. */
-#ifndef __MSDOS__
-#define DIR_SEPARATOR '/'
-#define PATH_DELIMITER ':'
-#define DIR_SEPARATOR_STRING "/"
-#define PATH_DELIMITER_STRING ":"
-#else
-#define DIR_SEPARATOR '\\'
-#define PATH_DELIMITER ';'
-#define DIR_SEPARATOR_STRING "\\"
-#define PATH_DELIMITER_STRING ";"
-#endif
-
/* Search path for configuration files. */
extern const char *config_path;
/* Search path for configuration files. */
extern const char *config_path;
parent_dir = P_tmpdir;
*filename = xmalloc (strlen (parent_dir) + 32);
parent_dir = P_tmpdir;
*filename = xmalloc (strlen (parent_dir) + 32);
- sprintf (*filename, "%s%cpsppXXXXXX", parent_dir, DIR_SEPARATOR);
+ sprintf (*filename, "%s/psppXXXXXX", parent_dir);
*fd = mkstemp (*filename);
if (*fd < 0)
{
*fd = mkstemp (*filename);
if (*fd < 0)
{
*filename = xmalloc (strlen (parent_dir) + 32);
*filename = xmalloc (strlen (parent_dir) + 32);
- sprintf (*filename, "%s%cpspp%d.png", parent_dir, DIR_SEPARATOR, serial++);
+ sprintf (*filename, "%s/pspp%d.png", parent_dir, serial++);
*fp = fopen(*filename, "w");
*fp = fopen(*filename, "w");
getl_add_include_dir (const char *path)
{
if (ds_length (&getl_include_path))
getl_add_include_dir (const char *path)
{
if (ds_length (&getl_include_path))
- ds_putc (&getl_include_path, PATH_DELIMITER);
+ ds_putc (&getl_include_path, ':');
ds_puts (&getl_include_path, path);
}
ds_puts (&getl_include_path, path);
}
static inline int
char_is_break (int quote, int c)
{
static inline int
char_is_break (int quote, int c)
{
- return ((quote && c == DIR_SEPARATOR)
- || (!quote && (isspace (c) || c == '-' || c == '/')));
+ return ((quote && c == '/')
+ || (!quote && (isspace (c) || c == '-' || c == '/')));
}
/* Returns 1 if C is a break character where the break should be made
}
/* Returns 1 if C is a break character where the break should be made
return xstrdup (name);
else
{
return xstrdup (name);
else
{
- char *base_name = xasprintf ("psfonts%c%s", DIR_SEPARATOR, name);
+ char *base_name = xasprintf ("psfonts/%s", name);
char *file_name = fn_search_path (base_name, config_path, NULL);
free (base_name);
return file_name;
char *file_name = fn_search_path (base_name, config_path, NULL);
free (base_name);
return file_name;