From: Ben Pfaff Date: Mon, 12 Feb 2007 02:10:54 +0000 (+0000) Subject: Reduce platform dependence. X-Git-Tag: v0.6.0~553 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=44326932c8227c64a87f7a92ef16ce83c2fba2d4 Reduce platform dependence. This helps with build on mingw32 (and probably other platforms). Patch #5731. --- diff --git a/ChangeLog b/ChangeLog index e50320c4..b5000702 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Thu Feb 8 14:56:18 2007 Ben Pfaff + + Reduce platform dependence. + + * Makefile.am: Don't add -Dunix or -D__MSDOS__ to compiler command + line. Add $(top_builddir)/intl to include path to fix building + with the included libintl. + + * Smake (GNULIB_MODULES): Add `canonicalize', `sys_stat', + `mkstemp' modules. Remove `stat-macros' module, which is no + longer what we want, because what we want is provided by sys_stat + now, and remove its inclusions. Remove `strstr' module, which is + no longer in gnulib. Remove `readlink', `xreadlink', because we + no longer use either function. + + * configure.ac: Move gl_EARLY before AC_PROG_CC, where the gnulib + manual says it should be. Check for presence of execl, fork, + and popen. Drop check for unix versus msdos as host OS. + Sat Nov 4 15:59:31 2006 Ben Pfaff * configure.ac: Check for the "round" function added in C99. diff --git a/Makefile.am b/Makefile.am index ad84db7d..0b37ce97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,8 @@ SUBDIRS = intl gl po DISTCLEANFILES = ./intl/plural.c ./po/stamp-po BUILT_SOURCES = -AM_CPPFLAGS=-I$(top_srcdir)/intl -I$(top_srcdir)/gl -I$(top_builddir)/gl +AM_CPPFLAGS=-I$(top_srcdir)/intl -I$(top_builddir)/intl \ + -I$(top_srcdir)/gl -I$(top_builddir)/gl AM_CFLAGS= @@ -15,14 +16,6 @@ AM_CFLAGS+=-Wall -W -Wwrite-strings -Wstrict-prototypes \ -Wpointer-arith -Wno-sign-compare -Wmissing-prototypes endif -if unix -AM_CFLAGS+=-Dunix -endif - -if msdos -AM_CFLAGS+=-D__MSDOS__ -endif - .q.c: @$(top_srcdir)/mkinstalldirs `dirname $@` ./src/language/lexer/q2c $< $@ diff --git a/Smake b/Smake index 74202e99..00d64d2f 100644 --- a/Smake +++ b/Smake @@ -9,6 +9,7 @@ GNULIB_MODULES = \ alloca-opt \ assert \ byteswap \ + canonicalize \ c-ctype \ c-strtod \ exit \ @@ -30,10 +31,9 @@ GNULIB_MODULES = \ memmove \ mempcpy \ memset \ + mkstemp \ progname \ - readlink \ snprintf \ - stat-macros \ stdarg \ stdbool \ stdint \ @@ -43,17 +43,16 @@ GNULIB_MODULES = \ strerror \ strftime \ strsep \ - strstr \ strtod \ strtok_r \ strtol \ strtoul \ + sys_stat \ unistd \ unlocked-io \ vsnprintf \ xalloc \ xalloc-die \ - xreadlink \ xsize \ xstrndup \ xvasprintf diff --git a/configure.ac b/configure.ac index 47c0e7e0..9e9835e8 100644 --- a/configure.ac +++ b/configure.ac @@ -42,10 +42,10 @@ fi AM_CONDITIONAL(WITHGUI, test x"$with_gui" != x"no") AC_ARG_WITH(gui_tools, [ --with-gui-tools build the gui developer tools]) -if test x"$with_gui_tools" == x"yes" ; then +if test x"$with_gui_tools" = x"yes" ; then PKG_CHECK_MODULES(GLADE_UI, libgladeui-1.0) fi -AM_CONDITIONAL(WITH_GUI_TOOLS, test x"$with_gui_tools" == x"yes") +AM_CONDITIONAL(WITH_GUI_TOOLS, test x"$with_gui_tools" = x"yes") PSPP_OFF_T @@ -80,14 +80,10 @@ AC_DEFINE(FPREP_IEEE754, 1, AC_C_BIGENDIAN AC_FUNC_VPRINTF -AC_CHECK_FUNCS([__setfpucw isinf isnan finite getpid feholdexcept round trunc]) +AC_CHECK_FUNCS([__setfpucw execl fork isinf isnan finite getpid feholdexcept popen round trunc]) AC_PROG_LN_S - -AM_CONDITIONAL(unix, test x"$host_os" != x"msdos" ) -AM_CONDITIONAL(msdos, test x"$host_os" = x"msdos" ) - dnl This is needed otherwise --with-included-gettext fails AH_BOTTOM([#include ]) diff --git a/doc/configuring.texi b/doc/configuring.texi index 49f4ccdf..833840b3 100644 --- a/doc/configuring.texi +++ b/doc/configuring.texi @@ -22,7 +22,7 @@ This chapter describe how to configure PSPP for your system. PSPP searches each directory in the configuration file path for most configuration files. The default configuration file path searches first -@file{~/.pspp}, then the package system configuration directory (usually +@file{$HOME/.pspp}, then the package system configuration directory (usually @file{/usr/local/etc/pspp} or @file{/etc/pspp}). The value of environment variable @env{PSPP_CONFIG_PATH}, if defined, overrides this default path. Finally, @samp{-B @var{path}} or @@ -836,7 +836,7 @@ across operating systems: @file{.} @item -@file{~/.pspp/include} +@file{$HOME/.pspp/include} @item @file{/usr/local/lib/pspp/include} diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 67f571db..0f82351b 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,22 @@ +Thu Feb 8 14:59:05 2007 Ben Pfaff + + Reduce platform dependence. + + * file-name.c (fn_tilde_expand): Removed, and removed calls to it. + Everywhere we using this, we really should have just depended on + the shell to expand tildes. + (fn_search_path): Simplify, given that we don't do tilde expansion + any longer. + (fn_normalize): Removed. Caller changed to use the canonicalize + module from gnulib. + (fn_get_cwd): Removed. Only user was fn_normalize. + (fn_is_absolute): Really only test for absolute names. + (fn_is_special): Use pipe files if HAVE_POPEN, not if we're in + unix. + (fn_readlink): Removed, as it was only used fn_normalize. + (fn_exists): Assume the stat function is available; gnulib does. + (fn_open): Use pipe files if HAVE_POPEN, not if we're in unix. + Sat Feb 3 21:52:17 2007 Ben Pfaff * dictionary.c (dict_create_vector_assert): New function. diff --git a/src/data/data-out.h b/src/data/data-out.h index 68ad53a9..d9b68831 100644 --- a/src/data/data-out.h +++ b/src/data/data-out.h @@ -20,6 +20,7 @@ #define DATA_OUT_H 1 #include +#include #include struct fmt_spec; diff --git a/src/data/file-name.c b/src/data/file-name.c index f9375926..acf27c3c 100644 --- a/src/data/file-name.c +++ b/src/data/file-name.c @@ -25,10 +25,10 @@ #include #include +#include "canonicalize.h" #include "intprops.h" #include "minmax.h" #include "settings.h" -#include "xreadlink.h" #include #include @@ -40,25 +40,8 @@ #include "gettext.h" #define _(msgid) gettext (msgid) -/* PORTME: Everything in this file is system dependent. */ - -#ifdef unix -#include #include #include -#include "stat-macros.h" -#endif - -#ifdef __WIN32__ -#define NOGDI -#define NOUSER -#define NONLS -#include -#endif - -#if __DJGPP__ -#include -#endif /* Initialization. */ @@ -118,60 +101,8 @@ fn_interp_vars (struct substring src, const char *(*getenv) (const char *), ds_destroy (&dst); } -#ifdef unix -/* Expands csh tilde notation from the path INPUT into a malloc()'d - returned string. */ -char * -fn_tilde_expand (const char *input) -{ - struct string output = DS_EMPTY_INITIALIZER; - if (input[0] == '~') - { - const char *home = NULL; - const char *remainder = NULL; - if (input[1] == '/' || input[1] == '\0') - { - home = fn_getenv ("HOME"); - remainder = input + 1; - } - else - { - struct string user_name = DS_EMPTY_INITIALIZER; - struct passwd *pwd; - - ds_assign_substring (&user_name, - ss_buffer (input + 1, - strcspn (input + 1, "/"))); - pwd = getpwnam (ds_cstr (&user_name)); - if (pwd != NULL && pwd->pw_dir[0] != '\0') - { - home = xstrdup (pwd->pw_dir); - remainder = input + 1 + ds_length (&user_name); - } - ds_destroy (&user_name); - } - - if (home != NULL) - { - ds_put_cstr (&output, home); - if (*remainder != '\0') - ds_put_cstr (&output, remainder); - } - } - if (ds_is_empty (&output)) - ds_put_cstr (&output, input); - return ds_cstr (&output); -} -#else /* !unix */ -char * -fn_tilde_expand (const char *input) -{ - return xstrdup (input); -} -#endif /* !unix */ - /* Searches for a configuration file with name NAME in the path - given by PATH, which is tilde- and environment-interpolated. + given by PATH, which is 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. */ @@ -179,12 +110,12 @@ char * fn_search_path (const char *base_name, const char *path_) { struct string path; - struct substring dir_; + struct substring dir; struct string file = DS_EMPTY_INITIALIZER; size_t save_idx = 0; if (fn_is_absolute (base_name)) - return fn_tilde_expand (base_name); + return xstrdup (base_name); /* Interpolate environment variables. */ ds_init_cstr (&path, path_); @@ -192,26 +123,14 @@ fn_search_path (const char *base_name, const char *path_) verbose_msg (2, _("searching for \"%s\" in path \"%s\""), base_name, ds_cstr (&path)); - while (ds_separate (&path, ss_cstr (":"), &save_idx, &dir_)) + while (ds_separate (&path, ss_cstr (":"), &save_idx, &dir)) { - struct string dir; - - /* Do tilde expansion. */ - ds_init_substring (&dir, dir_); - if (ds_first (&dir) == '~') - { - char *tmp_str = fn_tilde_expand (ds_cstr (&dir)); - ds_assign_cstr (&dir, tmp_str); - free (tmp_str); - } - /* Construct file name. */ ds_clear (&file); - ds_put_cstr (&file, ds_cstr (&dir)); + ds_put_substring (&file, dir); if (!ds_is_empty (&file) && ds_last (&file) != '/') ds_put_char (&file, '/'); ds_put_cstr (&file, base_name); - ds_destroy (&dir); /* Check whether file exists. */ if (fn_exists (ds_cstr (&file))) @@ -229,183 +148,6 @@ fn_search_path (const char *base_name, const char *path_) return NULL; } -/* fn_normalize(): This very OS-dependent routine canonicalizes - file name FN1. The file name should not need to be the name of an - existing file. Returns a malloc()'d copy of the canonical name. - This function must always succeed; if it needs to bail out then it - should return xstrdup(FN1). */ -#ifdef unix -char * -fn_normalize (const char *file_name) -{ - const char *src; - char *fn1, *fn2, *dest; - int maxlen; - - if (fn_is_special (file_name)) - return xstrdup (file_name); - - fn1 = fn_tilde_expand (file_name); - - /* Follow symbolic links. */ - for (;;) - { - fn2 = fn1; - fn1 = fn_readlink (fn1); - if (!fn1) - { - fn1 = fn2; - break; - } - free (fn2); - } - - maxlen = strlen (fn1) * 2; - if (maxlen < 31) - maxlen = 31; - dest = fn2 = xmalloc (maxlen + 1); - src = fn1; - - if (*src == '/') - *dest++ = *src++; - else - { - errno = 0; - while (getcwd (dest, maxlen - (dest - fn2)) == NULL && errno == ERANGE) - { - maxlen *= 2; - dest = fn2 = xrealloc (fn2, maxlen + 1); - errno = 0; - } - if (errno) - { - free (fn1); - free (fn2); - return NULL; - } - dest = strchr (fn2, '\0'); - if (dest - fn2 >= maxlen) - { - int ofs = dest - fn2; - maxlen *= 2; - fn2 = xrealloc (fn2, maxlen + 1); - dest = fn2 + ofs; - } - if (dest[-1] != '/') - *dest++ = '/'; - } - - for (;;) - { - int c, f; - - c = *src++; - - f = 0; - if (c == '/' || c == 0) - { - /* remove `./', `../' from directory */ - if (dest[-1] == '.' && dest[-2] == '/') - dest--; - else if (dest[-1] == '.' && dest[-2] == '.' && dest[-3] == '/') - { - dest -= 3; - if (dest == fn2) - dest++; - while (dest[-1] != '/') - dest--; - } - else if (dest[-1] != '/') /* remove extra slashes */ - f = 1; - - if (c == 0) - { - if (dest[-1] == '/' && dest > fn2 + 1) - dest--; - *dest = 0; - free (fn1); - - return xrealloc (fn2, strlen (fn2) + 1); - } - } - else - f = 1; - - if (f) - { - if (dest - fn2 >= maxlen) - { - int ofs = dest - fn2; - maxlen *= 2; - fn2 = xrealloc (fn2, maxlen + 1); - dest = fn2 + ofs; - } - *dest++ = c; - } - } -} -#elif defined (__WIN32__) -char * -fn_normalize (const char *fn1) -{ - DWORD len; - DWORD success; - char *fn2; - - /* Don't change special file names. */ - if (fn_is_special (file_name)) - return xstrdup (file_name); - - /* First find the required buffer length. */ - len = GetFullPathName (fn1, 0, NULL, NULL); - if (!len) - { - fn2 = xstrdup (fn1); - return fn2; - } - - /* Then make a buffer that big. */ - fn2 = xmalloc (len); - success = GetFullPathName (fn1, len, fn2, NULL); - if (success >= len || success == 0) - { - free (fn2); - fn2 = xstrdup (fn1); - return fn2; - } - return fn2; -} -#elif __BORLANDC__ -char * -fn_normalize (const char *fn1) -{ - char *fn2 = _fullpath (NULL, fn1, 0); - if (fn2) - { - char *cp; - for (cp = fn2; *cp; cp++) - *cp = toupper ((unsigned char) (*cp)); - return fn2; - } - return xstrdup (fn1); -} -#elif __DJGPP__ -char * -fn_normalize (const char *fn1) -{ - char *fn2 = xmalloc (1024); - _fixpath (fn1, fn2); - fn2 = xrealloc (fn2, strlen (fn2) + 1); - return fn2; -} -#else /* not Lose32, Unix, or DJGPP */ -char * -fn_normalize (const char *fn) -{ - return xstrdup (fn); -} -#endif /* not Lose32, Unix, or DJGPP */ - /* Returns the directory part of FILE_NAME, as a malloc()'d string. */ char * @@ -444,66 +186,15 @@ fn_extension (const char *file_name) return xstrdup (extension); } -#if unix -/* Returns the current working directory, as a malloc()'d string. - From libc.info. */ -char * -fn_get_cwd (void) -{ - int size = 100; - char *buffer = xmalloc (size); - - for (;;) - { - char *value = getcwd (buffer, size); - if (value != 0) - return buffer; - - size *= 2; - free (buffer); - buffer = xmalloc (size); - } -} -#else -char * -fn_get_cwd (void) -{ - int size = 2; - char *buffer = xmalloc (size); - if ( buffer) - { - buffer[0]='.'; - buffer[1]='\0'; - } - - return buffer; - -} -#endif - /* Find out information about files. */ /* Returns true iff NAME specifies an absolute file name. */ bool fn_is_absolute (const char *name) { -#ifdef unix - if (name[0] == '/' - || !strncmp (name, "./", 2) - || !strncmp (name, "../", 3) - || name[0] == '~') - return true; -#elif defined (__MSDOS__) - if (name[0] == '\\' - || !strncmp (name, ".\\", 2) - || !strncmp (name, "..\\", 3) - || (name[0] && name[1] == ':')) - return true; -#endif - - return false; + return name[0] == '/'; } - + /* Returns true if FILE_NAME is a virtual file that doesn't really exist on disk, false if it's a real file name. */ bool @@ -511,7 +202,7 @@ fn_is_special (const char *file_name) { if (!strcmp (file_name, "-") || !strcmp (file_name, "stdin") || !strcmp (file_name, "stdout") || !strcmp (file_name, "stderr") -#ifdef unix +#ifdef HAVE_POPEN || file_name[0] == '|' || (*file_name && file_name[strlen (file_name) - 1] == '|') #endif @@ -525,25 +216,8 @@ fn_is_special (const char *file_name) bool fn_exists (const char *name) { -#ifdef unix struct stat temp; - return stat (name, &temp) == 0; -#else - FILE *f = fopen (name, "r"); - if (!f) - return false; - fclose (f); - return true; -#endif -} - -/* Returns the symbolic link value for FILE_NAME as a dynamically - allocated buffer, or a null pointer on failure. */ -char * -fn_readlink (const char *file_name) -{ - return xreadlink (file_name, 32); } /* Environment variables. */ @@ -570,6 +244,7 @@ fn_getenv_default (const char *key, const char *def) /* Basic file handling. */ +#if HAVE_POPEN /* Used for giving an error message on a set_safer security violation. */ static FILE * @@ -579,6 +254,7 @@ safety_violation (const char *fn) errno = EPERM; return NULL; } +#endif /* As a general comment on the following routines, a `sensible value' for errno includes 0 if there is no associated system error. The @@ -601,7 +277,7 @@ fn_open (const char *fn, const char *mode) else if (mode[0] == 'w' && !strcmp (fn, "stderr")) return stderr; -#ifdef unix +#if HAVE_POPEN if (fn[0] == '|') { if (get_safer_mode ()) @@ -647,7 +323,7 @@ fn_close (const char *fn, FILE *f) { if (!strcmp (fn, "-")) return 0; -#ifdef unix +#if HAVE_POPEN else if (fn[0] == '|' || (*fn && fn[strlen (fn) - 1] == '|')) { pclose (f); @@ -724,7 +400,10 @@ struct file_identity * fn_get_identity (const char *file_name) { struct file_identity *identity = xmalloc (sizeof *identity); - identity->normalized_file_name = fn_normalize (file_name); + char *cname = canonicalize_filename_mode (file_name, CAN_MISSING); + if (cname == NULL) + cname = xstrdup (file_name); + identity->normalized_file_name = cname; return identity; } diff --git a/src/data/file-name.h b/src/data/file-name.h index a5f62776..edd70f2f 100644 --- a/src/data/file-name.h +++ b/src/data/file-name.h @@ -21,29 +21,23 @@ #include #include +#include /* Search path for configuration files. */ extern const char *config_path; void fn_init (void); -struct string; -struct substring; void fn_interp_vars (struct substring src, const char *(*getenv) (const char *), struct string *dst); -char *fn_tilde_expand (const char *fn); char *fn_search_path (const char *base_name, const char *path); -char *fn_normalize (const char *fn); char *fn_dir_name (const char *fn); char *fn_extension (const char *fn); -char *fn_get_cwd (void); - bool fn_is_absolute (const char *fn); bool fn_is_special (const char *fn); bool fn_exists (const char *fn); -char *fn_readlink (const char *fn); const char *fn_getenv (const char *variable); const char *fn_getenv_default (const char *variable, const char *def); diff --git a/src/data/por-file-writer.c b/src/data/por-file-writer.c index f6ebb73a..d9f16ef4 100644 --- a/src/data/por-file-writer.c +++ b/src/data/por-file-writer.c @@ -35,7 +35,6 @@ #include "file-handle-def.h" #include "format.h" #include "missing-values.h" -#include "stat-macros.h" #include "value-labels.h" #include "variable.h" diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index f82cafad..34f59d33 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -46,7 +46,6 @@ #include "value-labels.h" #include "variable.h" -#include "stat-macros.h" #include "minmax.h" #include "gettext.h" diff --git a/src/language/ChangeLog b/src/language/ChangeLog index afe8195a..33dbf2c6 100644 --- a/src/language/ChangeLog +++ b/src/language/ChangeLog @@ -1,3 +1,13 @@ +Thu Feb 8 15:04:42 2007 Ben Pfaff + + Reduce platform dependence. + + * command.c (shell): Always define this function, instead of only + in unix, but make it a stub when fork or execl is not available. + (run_command): Move parsing code into cmd_host. + (cmd_host): Drop unix dependence now that the shell function is + always defined. + Sun Jan 21 15:31:52 WST 2007 John Darrington * command.c command.h: Renamed cmd_parse to cmd_parse_in_state. diff --git a/src/language/command.c b/src/language/command.c index 2284deed..70d5b02e 100644 --- a/src/language/command.c +++ b/src/language/command.c @@ -718,9 +718,9 @@ cmd_erase (struct lexer *lexer, struct dataset *ds UNUSED) return CMD_SUCCESS; } -#ifdef unix -/* Spawn a shell process. */ -static int +#if HAVE_FORK && HAVE_EXECL +/* Spawn an interactive shell process. */ +static bool shell (void) { int pid; @@ -761,69 +761,48 @@ shell (void) case -1: msg (SE, _("Couldn't fork: %s."), strerror (errno)); - return 0; + return false; default: assert (pid > 0); while (wait (NULL) != pid) ; - return 1; + return true; } } -#endif /* unix */ - -/* Parses the HOST command argument and executes the specified - command. Returns a suitable command return code. */ -static int -run_command (struct lexer *lexer) +#else /* !(HAVE_FORK && HAVE_EXECL) */ +/* Don't know how to spawn an interactive shell. */ +static bool +shell (void) { - const char *cmd; - int string; - - /* Handle either a string argument or a full-line argument. */ - { - int c = lex_look_ahead (lexer); + msg (SE, _("Interactive shell not supported on this platform.")); + return false; +} +#endif - if (c == '\'' || c == '"') - { - lex_get (lexer); - if (!lex_force_string (lexer)) - return CMD_FAILURE; - cmd = ds_cstr (lex_tokstr (lexer)); - string = 1; - } - else - { - cmd = lex_rest_of_line (lexer, NULL); - lex_discard_line (lexer); - string = 0; - } - } +/* Executes the specified COMMAND in a subshell. Returns true if + successful, false otherwise. */ +static bool +run_command (const char *command) +{ + if (system (NULL) == 0) + { + msg (SE, _("Command shell not supported on this platform.")); + return false; + } /* Execute the command. */ - if (system (cmd) == -1) + if (system (command) == -1) msg (SE, _("Error executing command: %s."), strerror (errno)); - /* Finish parsing. */ - if (string) - { - lex_get (lexer); - - if (lex_token (lexer) != '.') - { - lex_error (lexer, _("expecting end of command")); - return CMD_FAILURE; - } - } - - return CMD_SUCCESS; + return true; } /* Parses, performs the HOST command. */ int cmd_host (struct lexer *lexer, struct dataset *ds UNUSED) { - int code; + int look_ahead; if (get_safer_mode ()) { @@ -831,29 +810,30 @@ cmd_host (struct lexer *lexer, struct dataset *ds UNUSED) return CMD_FAILURE; } -#ifdef unix - /* Figure out whether to invoke an interactive shell or to execute a - single shell command. */ - if (lex_look_ahead (lexer) == '.') + look_ahead = lex_look_ahead (lexer); + if (look_ahead == '.') { lex_get (lexer); - code = shell () ? CMD_FAILURE : CMD_SUCCESS; + return shell () ? CMD_SUCCESS : CMD_FAILURE; } - else - code = run_command (lexer); -#else /* !unix */ - /* Make sure that the system has a command interpreter, then run a - command. */ - if (system (NULL) != 0) - code = run_command (lexer); - else + else if (look_ahead == '\'' || look_ahead == '"') { - msg (SE, _("No operating system support for this command.")); - code = CMD_FAILURE; - } -#endif /* !unix */ + bool ok; + + lex_get (lexer); + if (!lex_force_string (lexer)) + NOT_REACHED (); + ok = run_command (ds_cstr (lex_tokstr (lexer))); - return code; + lex_get (lexer); + return ok ? lex_end_of_command (lexer) : CMD_FAILURE; + } + else + { + bool ok = run_command (lex_rest_of_line (lexer, NULL)); + lex_discard_line (lexer); + return ok ? CMD_SUCCESS : CMD_FAILURE; + } } /* Parses, performs the NEW FILE command. */ diff --git a/src/language/utilities/permissions.c b/src/language/utilities/permissions.c index 15a89c5c..b7b0c064 100644 --- a/src/language/utilities/permissions.c +++ b/src/language/utilities/permissions.c @@ -28,7 +28,6 @@ #include #include #include -#include "stat-macros.h" #include #include "gettext.h" diff --git a/src/output/ChangeLog b/src/output/ChangeLog index 336fbd50..60bfc43e 100644 --- a/src/output/ChangeLog +++ b/src/output/ChangeLog @@ -1,3 +1,8 @@ +Sun Feb 11 17:59:30 2007 Ben Pfaff + + * html.c (html_initialise_chart): Mark `this' parameter UNUSED to + account for NO_CHARTS case. + Sat Feb 3 21:56:46 2007 Ben Pfaff * table.c (tab_hline): Allow t->nr as y argument, so that we can diff --git a/src/output/html.c b/src/output/html.c index caaaacb7..d71ba0c2 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -360,7 +360,7 @@ output_tab_table (struct outp_driver *this, struct tab_table *t) } static void -html_initialise_chart (struct outp_driver *this, struct chart *ch) +html_initialise_chart (struct outp_driver *this UNUSED, struct chart *ch) { #ifdef NO_CHARTS ch->lp = NULL; diff --git a/src/ui/gui/glade-register.c b/src/ui/gui/glade-register.c index 5fd23da6..40d3a6b8 100644 --- a/src/ui/gui/glade-register.c +++ b/src/ui/gui/glade-register.c @@ -1,5 +1,7 @@ #include +#include + #include #include "psppire-dialog.h" #include "psppire-buttonbox.h" diff --git a/src/ui/terminal/ChangeLog b/src/ui/terminal/ChangeLog index 5dda93b7..29b9bba1 100644 --- a/src/ui/terminal/ChangeLog +++ b/src/ui/terminal/ChangeLog @@ -1,3 +1,11 @@ +Thu Feb 8 15:07:04 2007 Ben Pfaff + + * read-line.c (readln_initialize): Instead of only supporting + history in unix, always support history, and only support a + history file when $HOME is defined. + (readln_uninitialize): Ditto. + (welcome) Call readln_initialize instead of duplicating code. + Sun Dec 10 11:13:53 2006 Ben Pfaff * command-line.c (pre_syntax_message): Use term "syntax" instead diff --git a/src/ui/terminal/read-line.c b/src/ui/terminal/read-line.c index 41e270f2..f28fb6fe 100644 --- a/src/ui/terminal/read-line.c +++ b/src/ui/terminal/read-line.c @@ -70,16 +70,18 @@ readln_initialize (void) #if HAVE_READLINE rl_basic_word_break_characters = "\n"; -#ifdef unix + using_history (); + stifle_history (500); if (history_file == NULL) { - history_file = tilde_expand ("~/.pspp_history"); - using_history (); - read_history (history_file); - stifle_history (500); + const char *home_dir = getenv ("HOME"); + if (home_dir != NULL) + { + history_file = xasprintf ("%s/.pspp_history", home_dir); + read_history (history_file); + } } #endif -#endif } /* Close getl. */ @@ -88,7 +90,7 @@ readln_uninitialize (void) { initialised = false; -#if HAVE_READLINE && unix +#if HAVE_READLINE if (history_file != NULL && false == get_testing_mode() ) write_history (history_file); clear_history (); @@ -127,23 +129,9 @@ welcome (void) "conditions.\nThere is ABSOLUTELY NO WARRANTY for PSPP; type \"show " "warranty.\" for details.\n", stdout); puts (stat_version); - -#if HAVE_READLINE && unix - if (history_file == NULL) - { - history_file = tilde_expand ("~/.pspp_history"); - using_history (); - read_history (history_file); - stifle_history (500); - } -#endif + readln_initialize (); } - - - - - /* Gets a line from the user and stores it into LINE. Prompts the user with PROMPT. Returns true if successful, false at end of file.