summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-11-15 22:17:23 +0100
committerGünther Deschner <gd@samba.org>2009-02-07 01:52:28 +0100
commitb56c5bf5105ef3ddb1dd7525476323d2f503e59e (patch)
tree8d1db489e2a4a60d7472d7d6bca626506a1b5144
parentb8cd20cd5c3ff537d48a05dd04886ced107da7ae (diff)
downloadsamba-b56c5bf5105ef3ddb1dd7525476323d2f503e59e.tar.gz
samba-b56c5bf5105ef3ddb1dd7525476323d2f503e59e.tar.bz2
samba-b56c5bf5105ef3ddb1dd7525476323d2f503e59e.zip
s3-spoolss: rework some form functions and add form_by_string functions.
Guenther
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/printing/nt_printing.c31
2 files changed, 23 insertions, 10 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index aae8dbfd54..ed875b1caa 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4788,10 +4788,12 @@ uint32 update_c_setprinter(bool initialize);
uint32 get_c_setprinter(void);
int get_builtin_ntforms(nt_forms_struct **list);
bool get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form);
+bool get_a_builtin_ntform_by_string(const char *form_name, nt_forms_struct *form);
int get_ntforms(nt_forms_struct **list);
int write_ntforms(nt_forms_struct **list, int number);
bool add_a_form(nt_forms_struct **list, const FORM *form, int *count);
bool delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR *ret);
+bool delete_a_form_by_string(nt_forms_struct **list, const char *del_name, int *count, WERROR *ret);
void update_a_form(nt_forms_struct **list, const FORM *form, int count);
int get_ntdrivers(fstring **list, const char *architecture, uint32 version);
const char *get_short_archi(const char *long_archi);
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index bfbc35f3d3..da31945ed0 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -773,11 +773,9 @@ int get_builtin_ntforms(nt_forms_struct **list)
get a builtin form struct
****************************************************************************/
-bool get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form)
+bool get_a_builtin_ntform_by_string(const char *form_name, nt_forms_struct *form)
{
int i,count;
- fstring form_name;
- unistr2_to_ascii(form_name, uni_formname, sizeof(form_name));
DEBUGADD(6,("Looking for builtin form %s \n", form_name));
count = sizeof(default_forms) / sizeof(default_forms[0]);
for (i=0;i<count;i++) {
@@ -791,6 +789,13 @@ bool get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form)
return (i !=count);
}
+bool get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form)
+{
+ fstring form_name;
+ unistr2_to_ascii(form_name, uni_formname, sizeof(form_name));
+ return get_a_builtin_ntform_by_string(form_name, form);
+}
+
/****************************************************************************
get a form struct list.
****************************************************************************/
@@ -937,25 +942,22 @@ bool add_a_form(nt_forms_struct **list, const FORM *form, int *count)
Delete a named form struct.
****************************************************************************/
-bool delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR *ret)
+bool delete_a_form_by_string(nt_forms_struct **list, const char *del_name, int *count, WERROR *ret)
{
char *key = NULL;
int n=0;
- fstring form_name;
*ret = WERR_OK;
- unistr2_to_ascii(form_name, del_name, sizeof(form_name));
-
for (n=0; n<*count; n++) {
- if (!strncmp((*list)[n].name, form_name, strlen(form_name))) {
- DEBUG(103, ("delete_a_form, [%s] in list\n", form_name));
+ if (!strncmp((*list)[n].name, del_name, strlen(del_name))) {
+ DEBUG(103, ("delete_a_form, [%s] in list\n", del_name));
break;
}
}
if (n == *count) {
- DEBUG(10,("delete_a_form, [%s] not found\n", form_name));
+ DEBUG(10,("delete_a_form, [%s] not found\n", del_name));
*ret = WERR_INVALID_PARAM;
return False;
}
@@ -973,6 +975,15 @@ bool delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR
return true;
}
+bool delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR *ret)
+{
+ fstring form_name;
+
+ unistr2_to_ascii(form_name, del_name, sizeof(form_name));
+
+ return delete_a_form_by_string(list, form_name, count, ret);
+}
+
/****************************************************************************
Update a form struct.
****************************************************************************/