* DISPLAY MACROS is now implemented.
+ * SHOW ENVIRONMENT is now implemented.
+
* Removed the MODIFY VARS command, which is not in SPSS.
* Building from a Git repository, which previously required GIMP, now
#include "libpspp/i18n.h"
#include "libpspp/integer-format.h"
#include "libpspp/message.h"
+#include "libpspp/string-array.h"
#include "math/random.h"
#include "output/driver.h"
#include "output/journal.h"
}
}
+static void
+show_environment (void)
+{
+ struct pivot_table *pt = pivot_table_create (N_("Environment Variables"));
+ pivot_dimension_create (pt, PIVOT_AXIS_ROW, N_("Variable"));
+
+ struct string_array sa = STRING_ARRAY_INITIALIZER;
+ for (char **env = environ; *env; env++)
+ string_array_append (&sa, *env);
+ string_array_sort (&sa);
+
+ for (size_t i = 0; i < sa.n; i++)
+ {
+ struct substring value = ss_cstr (sa.strings[i]);
+ struct substring variable;
+ ss_get_until (&value, '=', &variable);
+
+ char *variable_s = ss_xstrdup (variable);
+ char *value_s = ss_xstrdup (value);
+ add_row (pt, variable_s, value_s);
+ free (variable_s);
+ free (value_s);
+ }
+ string_array_destroy (&sa);
+ pivot_table_submit (pt);
+}
+
int
cmd_show (struct lexer *lexer, struct dataset *ds)
{
show_copying (ds);
else if (lex_match_id (lexer, "SYSTEM"))
show_system (ds);
+ else if (lex_match_id (lexer, "ENVIRONMENT"))
+ show_environment ();
else if (lex_match_id (lexer, "TITLE"))
{
struct setting s = { .name = "TITLE", .show = show_TITLE };
AT_BANNER([SHOW])
AT_SETUP([SHOW N])
-
AT_DATA([show.sps], [dnl
DATA LIST LIST NOTABLE /x.
BEGIN DATA.
SHOW N.
])
-
AT_CHECK([pspp -O format=csv show.sps], [0], [dnl
Table: Settings
N,3
])
-
AT_CLEANUP
AT_SETUP([SHOW N empty])
-
AT_DATA([shown-empty.sps], [dnl
SHOW N.
])
-
AT_CHECK([pspp -O format=csv shown-empty.sps], [0], [dnl
Table: Settings
N,Unknown
])
-
AT_CLEANUP
+AT_SETUP([SHOW ENVIRONMENT])
+AT_DATA([show.sps], [dnl
+SHOW ENVIRONMENT.
+])
+AT_CHECK([pspp -O format=csv show.sps], [0], [ignore])
+AT_CLEANUP
\ No newline at end of file