summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-03-18 23:48:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:07 -0500
commit416cf9886a9014f85db6380a5f9e170cfe1b491d (patch)
tree24a3264ce001b960a67bf0a91d453541b21e66b1
parent5794ada01fdeb63c0e7df56abbc7592d9ff861fa (diff)
downloadsamba-416cf9886a9014f85db6380a5f9e170cfe1b491d.tar.gz
samba-416cf9886a9014f85db6380a5f9e170cfe1b491d.tar.bz2
samba-416cf9886a9014f85db6380a5f9e170cfe1b491d.zip
r5891: Make enum- and getform use the same form_display-function.
Guenther (This used to be commit dec1ab360691d628cb83c7efdef55ea0447f6558)
-rw-r--r--source3/rpcclient/cmd_spoolss.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 49f22b3654..60b1aaa6b8 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1813,6 +1813,38 @@ static WERROR cmd_spoolss_setform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
return werror;
}
+static const char *get_form_flag(int form_flag)
+{
+ switch (form_flag) {
+ case FORM_USER:
+ return "FORM_USER";
+ case FORM_BUILTIN:
+ return "FORM_BUILTIN";
+ case FORM_PRINTER:
+ return "FORM_PRINTER";
+ default:
+ return "unknown";
+ }
+}
+
+static void display_form(FORM_1 *form)
+{
+ fstring form_name = "";
+
+ if (form->name.buffer)
+ rpcstr_pull(form_name, form->name.buffer,
+ sizeof(form_name), -1, STR_TERMINATE);
+
+ printf("%s\n" \
+ "\tflag: %s (%d)\n" \
+ "\twidth: %d, length: %d\n" \
+ "\tleft: %d, right: %d, top: %d, bottom: %d\n\n",
+ form_name, get_form_flag(form->flag), form->flag,
+ form->width, form->length,
+ form->left, form->right,
+ form->top, form->bottom);
+}
+
/* Get a form */
static WERROR cmd_spoolss_getform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
@@ -1847,7 +1879,7 @@ static WERROR cmd_spoolss_getform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
got_handle = True;
- /* Set the form */
+ /* Get the form */
werror = cli_spoolss_getform(cli, mem_ctx, 0, &needed,
&handle, argv[2], 1, &form);
@@ -1859,12 +1891,7 @@ static WERROR cmd_spoolss_getform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (!W_ERROR_IS_OK(werror))
goto done;
- printf("width: %d\n", form.width);
- printf("length: %d\n", form.length);
- printf("left: %d\n", form.left);
- printf("top: %d\n", form.top);
- printf("right: %d\n", form.right);
- printf("bottom: %d\n", form.bottom);
+ display_form(&form);
done:
if (got_handle)
@@ -1925,20 +1952,6 @@ static WERROR cmd_spoolss_deleteform(struct cli_state *cli,
/* Enumerate forms */
-static const char *get_form_flag(int form_flag)
-{
- switch (form_flag) {
- case FORM_USER:
- return "FORM_USER";
- case FORM_BUILTIN:
- return "FORM_BUILTIN";
- case FORM_PRINTER:
- return "FORM_PRINTER";
- default:
- return "unknown";
- }
-}
-
static WERROR cmd_spoolss_enum_forms(struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
@@ -1988,20 +2001,9 @@ static WERROR cmd_spoolss_enum_forms(struct cli_state *cli,
/* Display output */
for (i = 0; i < num_forms; i++) {
- fstring form_name;
-
- if (forms[i].name.buffer)
- rpcstr_pull(form_name, forms[i].name.buffer,
- sizeof(form_name), -1, STR_TERMINATE);
-
- printf("%s\n" \
- "\tflag: %s (%d)\n" \
- "\twidth: %d, length: %d\n" \
- "\tleft: %d, right: %d, top: %d, bottom: %d\n\n",
- form_name, get_form_flag(forms[i].flag), forms[i].flag,
- forms[i].width, forms[i].length,
- forms[i].left, forms[i].right,
- forms[i].top, forms[i].bottom);
+
+ display_form(&forms[i]);
+
}
done: