summaryrefslogtreecommitdiff
path: root/source3/rpcclient/display.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-06 20:36:07 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-06 20:36:07 +0000
commit4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0 (patch)
tree1827e581147bf7cbde9ded3ba1dc01861d49de43 /source3/rpcclient/display.c
parent0f18ca772da544a93799ca130a8f23529aad98f6 (diff)
downloadsamba-4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0.tar.gz
samba-4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0.tar.bz2
samba-4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0.zip
fixed string function for reading in printer_info_N.
(This used to be commit 0249ae50ad8135cf3fd11a3b85f771f2347fcb29)
Diffstat (limited to 'source3/rpcclient/display.c')
-rw-r--r--source3/rpcclient/display.c194
1 files changed, 194 insertions, 0 deletions
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index 74d75776b4..3f3f9488a4 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -2525,6 +2525,200 @@ void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
}
}
+/****************************************************************************
+printer info level 0 display function
+****************************************************************************/
+void display_print_info_0(FILE *out_hnd, enum action_type action,
+ PRINTER_INFO_0 *i0)
+{
+ if (i0 == NULL)
+ {
+ return;
+ }
+
+ switch (action)
+ {
+ case ACTION_HEADER:
+ {
+ fprintf(out_hnd, "Printer Info Level 0:\n");
+
+ break;
+ }
+ case ACTION_ENUMERATE:
+ {
+ fstring name;
+ fstring serv;
+
+ unistr_to_ascii(name, i0->printername.buffer, sizeof(name)-1);
+ unistr_to_ascii(serv, i0->servername .buffer, sizeof(serv)-1);
+
+ fprintf(out_hnd, "\tprinter name:\t%s\n", name);
+ fprintf(out_hnd, "\tserver name:\t%s\n", serv);
+ fprintf(out_hnd, "\t[Other info not displayed]\n");
+
+ break;
+ }
+ case ACTION_FOOTER:
+ {
+ fprintf(out_hnd, "\n");
+ break;
+ }
+ }
+
+}
+
+/****************************************************************************
+printer info level 1 display function
+****************************************************************************/
+void display_print_info_1(FILE *out_hnd, enum action_type action,
+ PRINTER_INFO_1 *i1)
+{
+ if (i1 == NULL)
+ {
+ return;
+ }
+
+ switch (action)
+ {
+ case ACTION_HEADER:
+ {
+ fprintf(out_hnd, "Printer Info Level 1:\n");
+
+ break;
+ }
+ case ACTION_ENUMERATE:
+ {
+ fstring desc;
+ fstring name;
+ fstring comm;
+
+ unistr_to_ascii(desc, i1->description.buffer, sizeof(desc)-1);
+ unistr_to_ascii(name, i1->name .buffer, sizeof(name)-1);
+ unistr_to_ascii(comm, i1->comment .buffer, sizeof(comm)-1);
+
+ fprintf(out_hnd, "\tflags:\t%d\n", i1->flags);
+ fprintf(out_hnd, "\tname:\t%s\n", name);
+ fprintf(out_hnd, "\tdescription:\t%s\n", desc);
+ fprintf(out_hnd, "\tcomment:\t%s\n", comm);
+
+ break;
+ }
+ case ACTION_FOOTER:
+ {
+ fprintf(out_hnd, "\n");
+ break;
+ }
+ }
+
+}
+
+/****************************************************************************
+connection info level 0 container display function
+****************************************************************************/
+void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action,
+ uint32 count, PRINTER_INFO_0 **ctr)
+{
+ if (ctr == NULL)
+ {
+ fprintf(out_hnd, "display_printer_info_0_ctr: unavailable due to an internal error\n");
+ return;
+ }
+
+ switch (action)
+ {
+ case ACTION_HEADER:
+ {
+ break;
+ }
+ case ACTION_ENUMERATE:
+ {
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ display_print_info_0(out_hnd, ACTION_HEADER , ctr[i]);
+ display_print_info_0(out_hnd, ACTION_ENUMERATE, ctr[i]);
+ display_print_info_0(out_hnd, ACTION_FOOTER , ctr[i]);
+ }
+ break;
+ }
+ case ACTION_FOOTER:
+ {
+ break;
+ }
+ }
+}
+
+/****************************************************************************
+connection info level 1 container display function
+****************************************************************************/
+void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action,
+ uint32 count, PRINTER_INFO_1 **ctr)
+{
+ if (ctr == NULL)
+ {
+ fprintf(out_hnd, "display_printer_info_1_ctr: unavailable due to an internal error\n");
+ return;
+ }
+
+ switch (action)
+ {
+ case ACTION_HEADER:
+ {
+ break;
+ }
+ case ACTION_ENUMERATE:
+ {
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ display_print_info_1(out_hnd, ACTION_HEADER , ctr[i]);
+ display_print_info_1(out_hnd, ACTION_ENUMERATE, ctr[i]);
+ display_print_info_1(out_hnd, ACTION_FOOTER , ctr[i]);
+ }
+ break;
+ }
+ case ACTION_FOOTER:
+ {
+ break;
+ }
+ }
+}
+
+/****************************************************************************
+connection info container display function
+****************************************************************************/
+void display_printer_info_ctr(FILE *out_hnd, enum action_type action,
+ uint32 level, uint32 count, void **ctr)
+{
+ if (ctr == NULL)
+ {
+ fprintf(out_hnd, "display_printer_info_ctr: unavailable due to an internal error\n");
+ return;
+ }
+
+ switch (level)
+ {
+ case 0:
+ {
+ display_printer_info_0_ctr(out_hnd, action,
+ count, (PRINTER_INFO_0**)ctr);
+ break;
+ }
+ case 1:
+ {
+ display_printer_info_1_ctr(out_hnd, action,
+ count, (PRINTER_INFO_1**)ctr);
+ break;
+ }
+ default:
+ {
+ fprintf(out_hnd, "display_printer_info_ctr: Unknown Info Level\n");
+ break;
+ }
+ }
+}
#if COPY_THIS_TEMPLATE
/****************************************************************************