summaryrefslogtreecommitdiff
path: root/test/gen-printer-list.c
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2015-08-09 14:40:26 +0200
committerDidier Raboud <odyx@debian.org>2015-08-09 14:40:26 +0200
commit92976f71a4aa7f84cd8aadf013d2b03873dead7c (patch)
treecf693495783f07f67a0a2c8c12437fd6ed220593 /test/gen-printer-list.c
parent58b4abe145a14a936e420a3ba5b7d0c6c56fa839 (diff)
Imported Upstream version 5.2.11~pre1
Diffstat (limited to 'test/gen-printer-list.c')
-rw-r--r--test/gen-printer-list.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/gen-printer-list.c b/test/gen-printer-list.c
new file mode 100644
index 0000000..f6d38ed
--- /dev/null
+++ b/test/gen-printer-list.c
@@ -0,0 +1,53 @@
+/*
+ * "$Id: gen-printer-list.c,v 1.1 2014/05/22 02:08:20 rlk Exp $"
+ *
+ * Test pattern generator for Gutenprint
+ *
+ * Copyright 2014 Robert Krawitz <rlk@alum.mit.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Generate list of printers for supported printer list
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <gutenprint/gutenprint.h>
+#include <string.h>
+
+int
+main(int argc, char **argv)
+{
+ int i;
+
+ stp_init();
+ for (i = 0; i < stp_printer_model_count(); i++)
+ {
+ const stp_printer_t *p = stp_get_printer_by_index(i);
+ if (strcmp(stp_printer_get_family(p), "ps") &&
+ strcmp(stp_printer_get_family(p), "raw"))
+ printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
+ stp_printer_get_long_name(p),
+ stp_printer_get_driver(p),
+ stp_printer_get_foomatic_id(p) ? stp_printer_get_foomatic_id(p) : "",
+ stp_printer_get_comment(p) ? stp_printer_get_comment(p) : "");
+ }
+ return 0;
+}
+