[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1565-g94665ad

Günther Deschner gd at samba.org
Tue May 12 09:44:52 GMT 2009


The branch, master has been updated
       via  94665adb484c25534b756012e9b55f01737b7713 (commit)
      from  66dff4073d0013bfd11ac29e341765141393ea23 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 94665adb484c25534b756012e9b55f01737b7713
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 12 11:41:14 2009 +0200

    s3-printing: Fix vlp testprinter application.
    
    Jeremy, we cannot just access cache_path() here without calling lp_load and
    friends as well as parsing configfile from the commandline in order to make
    "make test/selftest" find the correct conffile with path, etc.
    
    I just changed it to pass the target tdbfilename as an argument, ok ?
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 selftest/target/Samba3.pm        |   14 +++++-----
 source3/printing/tests/vlp.c     |   47 ++++++++++++++++++-------------------
 source3/script/tests/selftest.sh |   14 +++++-----
 3 files changed, 37 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 3a51e6f..bf27f36 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -507,13 +507,13 @@ sub provision($$$$$$)
 	copy = tmp
 	printable = yes
 	printing = vlp
-	print command = $bindir_abs/vlp print %p %s
-	lpq command = $bindir_abs/vlp lpq %p
-	lp rm command = $bindir_abs/vlp lprm %p %j
-	lp pause command = $bindir_abs/vlp lppause %p %j
-	lp resume command = $bindir_abs/vlp lpresume %p %j
-	queue pause command = $bindir_abs/vlp queuepause %p
-	queue resume command = $bindir_abs/vlp queueresume %p
+	print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
+	lpq command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpq %p
+	lp rm command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lprm %p %j
+	lp pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lppause %p %j
+	lp resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpresume %p %j
+	queue pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queuepause %p
+	queue resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queueresume %p
 
 [print2]
 	copy = print1
diff --git a/source3/printing/tests/vlp.c b/source3/printing/tests/vlp.c
index ec610d9..5fc363f 100644
--- a/source3/printing/tests/vlp.c
+++ b/source3/printing/tests/vlp.c
@@ -39,7 +39,7 @@ struct vlp_job {
 
 static void usage(void)
 {
-	printf("Usage: print-test lpq|lprm|print|queuepause|queueresume|"
+	printf("Usage: vlp tdbfile=/tmp/vlp.tdb lpq|lprm|print|queuepause|queueresume|"
 	       "lppause|lpresume [args]\n");
 }
 
@@ -375,23 +375,22 @@ static int lpresume_command(int argc, char **argv)
 int main(int argc, char **argv)
 {
 	/* Parameter check */
-	char *printdb_path = NULL;
+	const char *printdb_path = NULL;
 
-	if (argc == 1) {
+	if (argc < 2) {
 		usage();
 		return 1;
 	}
 
-	/* Initialise */
+	if (!strnequal(argv[1], "tdbfile", strlen("tdbfile"))) {
+		usage();
+		return 1;
+	}
 
-#if 0
-	printdb_path = "/tmp/vlp.tdb";
-#else
-	if (asprintf(&printdb_path, "%svlp.tdb",
-                                cache_path("printing/"))) {
+	printdb_path = get_string_param(argv[1]);
+	if (!printdb_path) {
 		return 1;
 	}
-#endif
 
 	if (!(tdb = tdb_open(printdb_path, 0, 0, O_RDWR | O_CREAT,
 			     0666))) {
@@ -405,32 +404,32 @@ int main(int argc, char **argv)
 
 	/* Do commands */
 
-	if (strcmp(argv[1], "lpq") == 0) {
-		return lpq_command(argc - 1, &argv[1]);
+	if (strcmp(argv[2], "lpq") == 0) {
+		return lpq_command(argc - 2, &argv[2]);
 	}
 
-	if (strcmp(argv[1], "lprm") == 0) {
-		return lprm_command(argc - 1, &argv[1]);
+	if (strcmp(argv[2], "lprm") == 0) {
+		return lprm_command(argc - 2, &argv[2]);
 	}
 
-	if (strcmp(argv[1], "print") == 0) {
-		return print_command(argc - 1, &argv[1]);
+	if (strcmp(argv[2], "print") == 0) {
+		return print_command(argc - 2, &argv[2]);
 	}
 
-	if (strcmp(argv[1], "queuepause") == 0) {
-		return queuepause_command(argc - 1, &argv[1]);
+	if (strcmp(argv[2], "queuepause") == 0) {
+		return queuepause_command(argc - 2, &argv[2]);
 	}
 
-	if (strcmp(argv[1], "queueresume") == 0) {
-		return queueresume_command(argc - 1, &argv[1]);
+	if (strcmp(argv[2], "queueresume") == 0) {
+		return queueresume_command(argc - 2, &argv[2]);
 	}
 
-	if (strcmp(argv[1], "lppause") == 0) {
-		return lppause_command(argc - 1, &argv[1]);
+	if (strcmp(argv[2], "lppause") == 0) {
+		return lppause_command(argc - 2, &argv[2]);
 	}
 
-	if (strcmp(argv[1], "lpresume") == 0) {
-		return lpresume_command(argc - 1, &argv[1]);
+	if (strcmp(argv[2], "lpresume") == 0) {
+		return lpresume_command(argc - 2, &argv[2]);
 	}
 
 	/* Unknown command */
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index d069568..8f078d2 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -256,13 +256,13 @@ cat >$SERVERCONFFILE<<EOF
 	copy = tmp
 	printable = yes
 	printing = vlp
-	print command = $BINDIR/vlp print %p %s
-	lpq command = $BINDIR/vlp lpq %p
-	lp rm command = $BINDIR/vlp lprm %p %j
-	lp pause command = $BINDIR/vlp lppause %p %j
-	lp resume command = $BINDIR/vlp lpresume %p %j
-	queue pause command = $BINDIR/vlp queuepause %p
-	queue resume command = $BINDIR/vlp queueresume %p
+	print command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb print %p %s
+	lpq command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lpq %p
+	lp rm command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lprm %p %j
+	lp pause command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lppause %p %j
+	lp resume command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lpresume %p %j
+	queue pause command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb queuepause %p
+	queue resume command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb queueresume %p
 
 [print2]
 	copy = print1


-- 
Samba Shared Repository


More information about the samba-cvs mailing list