#include #include #include #include #include #include "global.h" #include "data.h" #include "misc.h" #include "hid.h" #include "../hidint.h" #include "../ps/ps.h" #define CRASH fprintf(stderr, "HID error: pcb called unimplemented PS function %s.\n", __FUNCTION__); abort() static HID_Attribute base_lpr_options[] = { {"lprcommand", "Command to print", HID_String, 0, 0, {0, "cat > /tmp/dj.ps", 0}, 0, 0}, #define HA_lprcommand 0 }; #define NUM_OPTIONS (sizeof(lpr_options)/sizeof(lpr_options[0])) static HID_Attribute *lpr_options = 0; static int num_lpr_options = 0; static HID_Attr_Val *lpr_values; static HID_Attribute * lpr_get_export_options (int *n) { if (lpr_options == 0) { HID_Attribute *ps_opts = ps_hid.get_export_options(&num_lpr_options); lpr_options = (HID_Attribute *)calloc (num_lpr_options, sizeof(HID_Attribute)); memcpy (lpr_options, ps_opts, num_lpr_options* sizeof(HID_Attribute)); memcpy (lpr_options, base_lpr_options, sizeof(base_lpr_options)); lpr_values = (HID_Attr_Val *)calloc (num_lpr_options, sizeof(HID_Attr_Val)); } if (n) *n = num_lpr_options; return lpr_options; } static void lpr_do_export (HID_Attr_Val *options) { FILE *f; int i; char *filename; if (!options) { lpr_get_export_options (0); for (i=0; i