+ {
+ /* Create our own "pspp-stock-reset" item, using the
+ GTK_STOCK_REFRESH icon set */
+
+ GtkStockItem items[] = {
+ {"pspp-stock-reset", N_("_Reset"), 0, 0, PACKAGE},
+ {"pspp-stock-select", N_("_Select"), 0, 0, PACKAGE}
+ };
+
+
+ gtk_stock_add (items, 2);
+ gtk_icon_factory_add (factory, "pspp-stock-reset",
+ gtk_icon_factory_lookup_default (GTK_STOCK_REFRESH)
+ );
+
+ gtk_icon_factory_add (factory, "pspp-stock-select",
+ gtk_icon_factory_lookup_default (GTK_STOCK_INDEX)
+ );
+ }
+
+ gtk_icon_factory_add_default (factory);
+}
+
+\f
+
+static error_t
+parse_non_options (int key, char *arg, struct argp_state *state)
+{
+ struct source_stream *ss = state->input;
+
+ if ( NULL == ss )
+ return 0;
+
+ switch (key)
+ {
+ case ARGP_KEY_ARG:
+ {
+ struct string syntax;
+ FILE *fp = fopen (arg, "r");
+ if (NULL == fp)
+ {
+ const int errnum = errno;
+ fprintf (state->err_stream, _("Cannot open %s: %s.\n"),
+ arg, strerror (errnum));
+ return 0;
+ }
+ if ( sfm_detect (fp))
+ {
+ ds_init_cstr (&syntax, "GET FILE=");
+ goto close;
+ }
+ rewind (fp);
+ if (pfm_detect (fp))
+ {
+ ds_init_cstr (&syntax, "IMPORT FILE=");
+ goto close;
+ }
+
+ fclose (fp);
+ msg (ME, _("%s is neither a system nor portable file"), arg);
+ break;
+
+ close:
+ fclose (fp);
+
+ syntax_gen_string (&syntax, ss_cstr (arg));
+ ds_put_cstr (&syntax, ".");
+
+ getl_append_source (ss,
+ create_syntax_string_source (ds_cstr (&syntax)),
+ GETL_BATCH,
+ ERRMODE_CONTINUE);
+
+ ds_destroy (&syntax);
+ break;
+ }
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+ return 0;