kopia lustrzana https://gitlab.com/sane-project/backends
plist output from sane-desc
rodzic
aabcf395c4
commit
b7ea951e7c
|
@ -1,3 +1,7 @@
|
||||||
|
2006-05-27 Mattias Ellert <mattias.ellert@tsl.uu.se>
|
||||||
|
|
||||||
|
* tools/sane-desc.c: Added plist output
|
||||||
|
|
||||||
2006-05-26 Mattias Ellert <mattias.ellert@tsl.uu.se>
|
2006-05-26 Mattias Ellert <mattias.ellert@tsl.uu.se>
|
||||||
|
|
||||||
* po/Makefile.in, po/sane-backends.*.po: updated with translation
|
* po/Makefile.in, po/sane-backends.*.po: updated with translation
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
Copyright (C) 2002-2006 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
Copyright (C) 2002-2006 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||||
Copyright (C) 2004 Jose Gato <jgato@gsyc.escet.urjc.es> (XML output)
|
Copyright (C) 2004 Jose Gato <jgato@gsyc.escet.urjc.es> (XML output)
|
||||||
|
Copyright (C) 2006 Mattias Ellert <mattias.ellert@tsl.uu.se> (plist output)
|
||||||
|
|
||||||
This file is part of the SANE package.
|
This file is part of the SANE package.
|
||||||
|
|
||||||
|
@ -74,7 +75,8 @@ typedef enum output_mode
|
||||||
output_mode_statistics,
|
output_mode_statistics,
|
||||||
output_mode_usermap,
|
output_mode_usermap,
|
||||||
output_mode_db,
|
output_mode_db,
|
||||||
output_mode_udev
|
output_mode_udev,
|
||||||
|
output_mode_plist
|
||||||
}
|
}
|
||||||
output_mode;
|
output_mode;
|
||||||
|
|
||||||
|
@ -289,8 +291,8 @@ print_usage (char *program_name)
|
||||||
" "
|
" "
|
||||||
"(multiple directories can be concatenated by \":\")\n");
|
"(multiple directories can be concatenated by \":\")\n");
|
||||||
printf (" -m|--mode mode "
|
printf (" -m|--mode mode "
|
||||||
"Output mode (ascii, html-backends-split,\n"
|
"Output mode (ascii, html-backends-split, html-mfgs,\n"
|
||||||
" html-mfgs, xml, statistics, usermap, db, udev)\n");
|
" xml, statistics, usermap, db, udev, plist)\n");
|
||||||
printf (" -t|--title \"title\" The title used for HTML pages\n");
|
printf (" -t|--title \"title\" The title used for HTML pages\n");
|
||||||
printf (" -i|--intro \"intro\" A short description of the "
|
printf (" -i|--intro \"intro\" A short description of the "
|
||||||
"contents of the page\n");
|
"contents of the page\n");
|
||||||
|
@ -387,6 +389,11 @@ get_options (int argc, char **argv)
|
||||||
DBG_INFO ("Output mode: %s\n", optarg);
|
DBG_INFO ("Output mode: %s\n", optarg);
|
||||||
mode = output_mode_udev;
|
mode = output_mode_udev;
|
||||||
}
|
}
|
||||||
|
else if (strcmp (optarg, "plist") == 0)
|
||||||
|
{
|
||||||
|
DBG_INFO ("Output mode: %s\n", optarg);
|
||||||
|
mode = output_mode_plist;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBG_ERR ("Unknown output mode: %s\n", optarg);
|
DBG_ERR ("Unknown output mode: %s\n", optarg);
|
||||||
|
@ -3108,7 +3115,6 @@ print_db_header (void)
|
||||||
"#\n");
|
"#\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_db (void)
|
print_db (void)
|
||||||
{
|
{
|
||||||
|
@ -3160,8 +3166,6 @@ print_udev_header (void)
|
||||||
"#\n");
|
"#\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_udev (void)
|
print_udev (void)
|
||||||
{
|
{
|
||||||
|
@ -3190,6 +3194,38 @@ print_udev (void)
|
||||||
printf ("\nLABEL=\"libsane_rules_end\"\n");
|
printf ("\nLABEL=\"libsane_rules_end\"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_plist (void)
|
||||||
|
{
|
||||||
|
usbid_type *usbid = create_usbids_table ();
|
||||||
|
|
||||||
|
printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||||
|
printf ("<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n");
|
||||||
|
printf ("<plist version=\"1.0\">\n");
|
||||||
|
printf ("<dict>\n");
|
||||||
|
printf ("\t<key>device info version</key>\n");
|
||||||
|
printf ("\t<string>2.0</string>\n");
|
||||||
|
printf ("\t<key>usb</key>\n");
|
||||||
|
printf ("\t<dict>\n");
|
||||||
|
printf ("\t\t<key>IOUSBDevice</key>\n");
|
||||||
|
printf ("\t\t<array>\n");
|
||||||
|
while (usbid)
|
||||||
|
{
|
||||||
|
printf ("\t\t\t<dict>\n");
|
||||||
|
printf ("\t\t\t\t<key>device type</key>\n");
|
||||||
|
printf ("\t\t\t\t<string>scanner</string>\n");
|
||||||
|
printf ("\t\t\t\t<key>product</key>\n");
|
||||||
|
printf ("\t\t\t\t<string>%s</string>\n", usbid->usb_product_id);
|
||||||
|
printf ("\t\t\t\t<key>vendor</key>\n");
|
||||||
|
printf ("\t\t\t\t<string>%s</string>\n", usbid->usb_vendor_id);
|
||||||
|
printf ("\t\t\t</dict>\n");
|
||||||
|
usbid = usbid->next;
|
||||||
|
}
|
||||||
|
printf ("\t\t</array>\n");
|
||||||
|
printf ("\t</dict>\n");
|
||||||
|
printf ("</dict>\n");
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -3229,6 +3265,9 @@ main (int argc, char **argv)
|
||||||
case output_mode_udev:
|
case output_mode_udev:
|
||||||
print_udev ();
|
print_udev ();
|
||||||
break;
|
break;
|
||||||
|
case output_mode_plist:
|
||||||
|
print_plist ();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
DBG_ERR ("Unknown output mode\n");
|
DBG_ERR ("Unknown output mode\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Ładowanie…
Reference in New Issue