pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src message.c data/ChangeLog data/file-nam...


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src message.c data/ChangeLog data/file-nam...
Date: Mon, 17 Apr 2006 01:37:52 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Branch:         
Changes by:     Ben Pfaff <address@hidden>      06/04/17 01:37:52

Modified files:
        src            : message.c 
        src/data       : ChangeLog file-name.c file-name.h make-file.c 
        src/language   : line-buffer.c 
        src/output     : postscript.c 

Log message:
        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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/message.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/ChangeLog.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/file-name.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/file-name.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/make-file.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/line-buffer.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/output/postscript.c.diff?tr1=1.12&tr2=1.13&r1=text&r2=text

Patches:
Index: pspp/src/data/ChangeLog
diff -u pspp/src/data/ChangeLog:1.17 pspp/src/data/ChangeLog:1.18
--- pspp/src/data/ChangeLog:1.17        Mon Apr 17 01:30:21 2006
+++ pspp/src/data/ChangeLog     Mon Apr 17 01:37:52 2006
@@ -1,3 +1,17 @@
+Sun Apr 16 18:35:33 2006  Ben Pfaff  <address@hidden>
+
+       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  <address@hidden>
 
        GNU standards require "file name" instead of "filename" in
Index: pspp/src/data/file-name.c
diff -u pspp/src/data/file-name.c:1.1 pspp/src/data/file-name.c:1.2
--- pspp/src/data/file-name.c:1.1       Mon Apr 17 01:30:21 2006
+++ pspp/src/data/file-name.c   Mon Apr 17 01:37:52 2006
@@ -204,11 +204,11 @@
 }
 #endif /* !unix */
 
-/* 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
@@ -230,7 +230,7 @@
 
   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) == '~') 
@@ -245,11 +245,11 @@
       if (prefix != NULL && !fn_is_absolute (ds_c_str (&dir)))
        {
          ds_puts (&file, prefix);
-         ds_putc (&file, DIR_SEPARATOR);
+         ds_putc (&file, '/');
        }
       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. */
@@ -307,7 +307,7 @@
   dest = fn2 = xmalloc (maxlen + 1);
   src = fn1;
 
-  if (*src == DIR_SEPARATOR)
+  if (*src == '/')
     *dest++ = *src++;
   else
     {
@@ -332,8 +332,8 @@
          fn2 = xrealloc (fn2, maxlen + 1);
          dest = fn2 + ofs;
        }
-      if (dest[-1] != DIR_SEPARATOR)
-       *dest++ = DIR_SEPARATOR;
+      if (dest[-1] != '/')
+       *dest++ = '/';
     }
 
   for (;;)
@@ -343,25 +343,25 @@
       c = *src++;
 
       f = 0;
-      if (c == DIR_SEPARATOR || c == 0)
+      if (c == '/' || c == 0)
        {
          /* remove `./', `../' from directory */
-         if (dest[-1] == '.' && dest[-2] == DIR_SEPARATOR)
+         if (dest[-1] == '.' && dest[-2] == '/')
            dest--;
-         else if (dest[-1] == '.' && dest[-2] == '.' && dest[-3] == 
DIR_SEPARATOR)
+         else if (dest[-1] == '.' && dest[-2] == '.' && dest[-3] == '/')
            {
              dest -= 3;
              if (dest == fn2)
                dest++;
-             while (dest[-1] != DIR_SEPARATOR)
+             while (dest[-1] != '/')
                dest--;
            }
-         else if (dest[-1] != DIR_SEPARATOR)   /* remove extra slashes */
+         else if (dest[-1] != '/')     /* remove extra slashes */
            f = 1;
 
          if (c == 0)
            {
-             if (dest[-1] == DIR_SEPARATOR && dest > fn2 + 1)
+             if (dest[-1] == '/' && dest > fn2 + 1)
                dest--;
              *dest = 0;
              free (fn1);
@@ -459,10 +459,10 @@
   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 = strrchr (filename, DIR_SEPARATOR);
+    p = strrchr (filename, '/');
   if (p == NULL)
     p = filename;
 
Index: pspp/src/data/file-name.h
diff -u pspp/src/data/file-name.h:1.1 pspp/src/data/file-name.h:1.2
--- pspp/src/data/file-name.h:1.1       Mon Apr 17 01:30:21 2006
+++ pspp/src/data/file-name.h   Mon Apr 17 01:37:52 2006
@@ -22,19 +22,6 @@
 
 #include <stdio.h>
 
-/* 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;
 
Index: pspp/src/data/make-file.c
diff -u pspp/src/data/make-file.c:1.4 pspp/src/data/make-file.c:1.5
--- pspp/src/data/make-file.c:1.4       Mon Apr 17 01:30:21 2006
+++ pspp/src/data/make-file.c   Mon Apr 17 01:37:52 2006
@@ -53,7 +53,7 @@
     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)
     {
@@ -93,7 +93,7 @@
   *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");
 
Index: pspp/src/language/line-buffer.c
diff -u pspp/src/language/line-buffer.c:1.6 pspp/src/language/line-buffer.c:1.7
--- pspp/src/language/line-buffer.c:1.6 Mon Apr 17 01:30:21 2006
+++ pspp/src/language/line-buffer.c     Mon Apr 17 01:37:52 2006
@@ -123,7 +123,7 @@
 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);
 }
Index: pspp/src/message.c
diff -u pspp/src/message.c:1.5 pspp/src/message.c:1.6
--- pspp/src/message.c:1.5      Mon Apr 17 01:30:21 2006
+++ pspp/src/message.c  Mon Apr 17 01:37:51 2006
@@ -243,8 +243,8 @@
 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
Index: pspp/src/output/postscript.c
diff -u pspp/src/output/postscript.c:1.12 pspp/src/output/postscript.c:1.13
--- pspp/src/output/postscript.c:1.12   Mon Apr 17 01:30:22 2006
+++ pspp/src/output/postscript.c        Mon Apr 17 01:37:52 2006
@@ -433,7 +433,7 @@
     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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]