mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
r5891: Make enum- and getform use the same form_display-function.
Guenther (This used to be commit dec1ab360691d628cb83c7efdef55ea0447f6558)
This commit is contained in:
parent
5794ada01f
commit
416cf9886a
@ -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);
|
||||
display_form(&forms[i]);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
done:
|
||||
|
Loading…
x
Reference in New Issue
Block a user