X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fglob.c;h=5bf5600f25189eb2be5d7c5b9c5e62e4ad06d02b;hb=f9d47b5bba8416419cf3bcd3aa23c2d40a05fcac;hp=b7ec50a37b18356fc0a4f7eb10fd597dd6286886;hpb=eaf83d4cae00ae2e2ccccc3c02d5262330a31c8a;p=pspp diff --git a/src/glob.c b/src/glob.c index b7ec50a37b..5bf5600f25 100644 --- a/src/glob.c +++ b/src/glob.c @@ -18,7 +18,7 @@ 02111-1307, USA. */ #include - +#include "glob.h" #include #include #include @@ -62,7 +62,7 @@ extern void stifle_history (); #if __DJGPP__ #include -#elif __WIN32__ && __BORLANDC__ +#elif defined (__WIN32__) && defined (__BORLANDC__) #undef gettext #include #define gettext(STRING) \ @@ -78,13 +78,14 @@ extern void stifle_history (); #endif #include "alloc.h" -#include "avl.h" #include "command.h" #include "do-ifP.h" #include "error.h" #include "expr.h" +#include "file-handle.h" #include "filename.h" #include "getline.h" +#include "hash.h" #include "julcal/julcal.h" #include "lexer.h" #include "magic.h" @@ -96,7 +97,7 @@ extern void stifle_history (); #include "vfm.h" /* var.h */ -struct dictionary default_dict; +struct dictionary *default_dict; struct expression *process_if_expr; struct ccase *temp_case; @@ -110,9 +111,6 @@ int FILTER_before_TEMPORARY; struct file_handle *default_handle; -void (*read_active_file) (void); -void (*cancel_input_pgm) (void); - struct ctl_stmt *ctl_stack; /* log.h */ @@ -124,16 +122,18 @@ int logging; static void get_date (void); -#if HAVE_LIBTERMCAP && !__CHECKER__ -static char *term_buffer; +#if HAVE_LIBTERMCAP +static char term_buffer[16384]; #endif void -init_glob (int argc unused, char **argv) +init_glob (int argc UNUSED, char **argv) { /* FIXME: Allow i18n of other locale items (besides LC_MESSAGES). */ #if ENABLE_NLS +#if HAVE_LC_MESSAGES setlocale (LC_MESSAGES, ""); +#endif setlocale (LC_MONETARY, ""); bindtextdomain (PACKAGE, locale_dir); textdomain (PACKAGE); @@ -164,12 +164,7 @@ init_glob (int argc unused, char **argv) #endif /* var.h */ - default_dict.var_by_name = avl_create (NULL, cmp_variable, NULL); - - vec_init (&reinit_sysmis); - vec_init (&reinit_blanks); - vec_init (&init_zero); - vec_init (&init_blanks); + default_dict = dict_create (); last_vfm_invocation = time (NULL); @@ -255,7 +250,7 @@ init_glob (int argc unused, char **argv) set_nullline = 1; set_more = 1; set_prompt = xstrdup ("PSPP> "); - set_seed = 2000000; + set_seed = NOT_LONG; #if __DJGPP__ || __BORLANDC__ { @@ -271,20 +266,11 @@ init_glob (int argc unused, char **argv) int success; /* This code stolen from termcap.info, though modified. */ -#if !__CHECKER__ - term_buffer = xmalloc (2048); -#endif - termtype = getenv ("TERM"); if (!termtype) msg (FE, _("Specify a terminal type with `setenv TERM '.")); -#if __CHECKER__ - success = tgetent (NULL, termtype); -#else success = tgetent (term_buffer, termtype); -#endif - if (success <= 0) { if (success < 0) @@ -312,60 +298,26 @@ init_glob (int argc unused, char **argv) logfile = NULL; /* file-handle.h */ - { - extern void fh_init_files (void); - - fh_init_files (); - } + fh_init_files (); get_date (); } static void -get_date () +get_date (void) { - static const char *months[12] = - { - N_("Jan"), N_("Feb"), N_("Mar"), N_("Apr"), N_("May"), N_("Jun"), - N_("Jul"), N_("Aug"), N_("Sep"), N_("Oct"), N_("Nov"), N_("Dec"), - }; time_t t; - int mn, dy, yr; struct tm *tmp; if ((time_t) -1 == time (&t)) { - strcpy (curdate, "1 Jan 1970"); + strcpy (curdate, "?? ??? 2???"); return; } tmp = localtime (&t); - mn = tmp->tm_mon; - if (mn < 0) - mn = 0; - if (mn > 11) - mn = 11; - - dy = tmp->tm_mday; - if (dy < 0) - dy = 0; - if (dy > 99) - dy = 99; - - yr = tmp->tm_year + 1900; - if (yr < 0) - yr = 0; - if (yr > 9999) - yr = 9999; - - sprintf (curdate, "%2d %s %04d", dy, gettext (months[mn]), yr); -} - -int -cmp_variable (const void *a, const void *b, void *foo unused) -{ - return strcmp (((struct variable *) a)->name, ((struct variable *) b)->name); + strftime (curdate, 12, "%d %b %Y",tmp); } #if __BORLANDC__