diff options
Diffstat (limited to 'source3/rpcclient/cmd_spoolss.c')
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 72 |
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: |