svn commit: samba r5891 - branches/SAMBA_3_0/source/rpcclient trunk/source/rpcclient

gd at samba.org gd at samba.org
Fri Mar 18 23:48:46 GMT 2005


Author: gd
Date: 2005-03-18 23:48:46 +0000 (Fri, 18 Mar 2005)
New Revision: 5891

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5891

Log:
Make enum- and getform use the same form_display-function.

Guenther

Modified:
   branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
   trunk/source/rpcclient/cmd_spoolss.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c	2005-03-18 23:31:14 UTC (rev 5890)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c	2005-03-18 23:48:46 UTC (rev 5891)
@@ -1813,6 +1813,38 @@
 	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 @@
 
 	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 @@
 	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 @@
 
 /* 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 @@
 	/* 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:

Modified: trunk/source/rpcclient/cmd_spoolss.c
===================================================================
--- trunk/source/rpcclient/cmd_spoolss.c	2005-03-18 23:31:14 UTC (rev 5890)
+++ trunk/source/rpcclient/cmd_spoolss.c	2005-03-18 23:48:46 UTC (rev 5891)
@@ -1813,6 +1813,38 @@
 	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 @@
 
 	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 @@
 	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 @@
 
 /* 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 @@
 	/* 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:



More information about the samba-cvs mailing list