diff options
author | Kai Blin <kai@samba.org> | 2007-12-10 22:30:24 +0100 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2007-12-11 11:53:57 +0100 |
commit | 5c1e5b30a5edc074a16f8abc32552ed6f42f8686 (patch) | |
tree | 745816008bc79d9b30b327c6b533459d36a615f1 | |
parent | 09fcb233a30e65b4b42f36ce38f70ddd0dfc4746 (diff) | |
download | samba-5c1e5b30a5edc074a16f8abc32552ed6f42f8686.tar.gz samba-5c1e5b30a5edc074a16f8abc32552ed6f42f8686.tar.bz2 samba-5c1e5b30a5edc074a16f8abc32552ed6f42f8686.zip |
vlp: Build vlp (virtual line printer) against current git on make
everything.
(This used to be commit 212ab58a3a7f03bb97c6ad3430e2776f9faba7c9)
-rw-r--r-- | source3/Makefile.in | 16 | ||||
-rw-r--r-- | testsuite/printing/vlp.c | 47 |
2 files changed, 41 insertions, 22 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index e636a9119f..20dba0c4ae 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -194,7 +194,8 @@ BIN_PROGS = @EXTRA_BIN_PROGS@ @SMBMOUNT_PROGS@ \ EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \ bin/talloctort@EXEEXT@ bin/replacetort@EXEEXT@ \ - bin/log2pcap@EXEEXT@ bin/sharesec@EXEEXT@ bin/ndrdump@EXEEXT@ + bin/log2pcap@EXEEXT@ bin/sharesec@EXEEXT@ bin/ndrdump@EXEEXT@ \ + bin/vlp@EXEEXT@ SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ @@ -955,6 +956,14 @@ NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \ $(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \ $(LDB_OBJ) $(ERRORMAP_OBJ) +VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ) + +VLP_OBJ = $(VLP_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \ + $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \ + $(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \ + $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ + $(DISPLAY_SEC_OBJ) + ###################################################################### # now the rules... ###################################################################### @@ -1442,6 +1451,11 @@ bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) +bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) + @echo "Linking $@" + @$(CC) $(FLAGS) -o $@ $(VLP_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \ + $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + @WINBIND_NSS@: $(BINARY_PREREQS) $(WINBIND_NSS_OBJ) @echo "Linking $@" @$(SHLD) $(WINBIND_NSS_LDSHFLAGS) -o $@ $(WINBIND_NSS_OBJ) \ diff --git a/testsuite/printing/vlp.c b/testsuite/printing/vlp.c index db78105e5b..5c8dcd92eb 100644 --- a/testsuite/printing/vlp.c +++ b/testsuite/printing/vlp.c @@ -53,7 +53,7 @@ static void get_job_list(char *printer, struct vlp_job **job_list, TDB_DATA data; slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer); - data = tdb_fetch_by_string(tdb, keystr); + data = tdb_fetch_bystring(tdb, keystr); *job_list = (struct vlp_job *)data.dptr; *num_jobs = data.dsize / sizeof(struct vlp_job); @@ -65,11 +65,13 @@ static void set_job_list(char *printer, struct vlp_job *job_list, int num_jobs) { fstring keystr; + TDB_DATA data; slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer); - tdb_store_by_string(tdb, keystr, job_list, - num_jobs * sizeof(struct vlp_job)); + data.dptr = (unsigned char *)job_list; + data.dsize = num_jobs * sizeof(struct vlp_job); + tdb_store_bystring(tdb, keystr, data, TDB_REPLACE); } /* Return the next job number for a printer */ @@ -83,7 +85,7 @@ static int next_jobnum(char *printer) tdb_lock_bystring(tdb, keystr); - jobnum = tdb_fetch_int(tdb, keystr); + jobnum = tdb_fetch_int32(tdb, keystr); /* Create next job index if none exists */ @@ -92,7 +94,7 @@ static int next_jobnum(char *printer) } jobnum++; - tdb_store_int(tdb, keystr, jobnum); + tdb_store_int32(tdb, keystr, jobnum); tdb_unlock_bystring(tdb, keystr); @@ -105,7 +107,7 @@ static void set_printer_status(char *printer, int status) int result; slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer); - result = tdb_store_int(tdb, keystr, status); + result = tdb_store_int32(tdb, keystr, status); } static int get_printer_status(char *printer) @@ -115,7 +117,7 @@ static int get_printer_status(char *printer) slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer); - data.dptr = keystr; + data.dptr = (unsigned char *)keystr; data.dsize = strlen(keystr) + 1; if (!tdb_exists(tdb, data)) { @@ -123,7 +125,7 @@ static int get_printer_status(char *printer) return LPSTAT_OK; } - return tdb_fetch_int(tdb, keystr); + return tdb_fetch_int32(tdb, keystr); } /* Display printer queue */ @@ -212,7 +214,7 @@ static int print_command(int argc, char **argv) char *printer; fstring keystr; struct passwd *pw; - TDB_DATA value; + TDB_DATA value, queue; struct vlp_job job; int i; @@ -247,30 +249,33 @@ static int print_command(int argc, char **argv) /* Store job entry in queue */ slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer); - - value = tdb_fetch_by_string(tdb, keystr); + + value = tdb_fetch_bystring(tdb, keystr); if (value.dptr) { /* Add job to end of queue */ - value.dptr = realloc(value.dptr, value.dsize + - sizeof(struct vlp_job)); - if (!value.dptr) return 1; + queue.dptr = SMB_MALLOC(value.dsize + sizeof(struct vlp_job)); + if (!queue.dptr) return 1; + + memcpy(queue.dptr, value.dptr, value.dsize); + memcpy(queue.dptr + value.dsize, &job, sizeof(struct vlp_job)); - memcpy(value.dptr + value.dsize, &job, sizeof(struct vlp_job)); + queue.dsize = value.dsize + sizeof(struct vlp_job); - tdb_store_by_string(tdb, keystr, value.dptr, value.dsize + - sizeof(struct vlp_job)); + tdb_store_bystring(tdb, keystr, queue, TDB_REPLACE); - free(value.dptr); + free(queue.dptr); } else { - + /* Create new queue */ + queue.dptr = (unsigned char *)&job; + queue.dsize = sizeof(struct vlp_job); - tdb_store_by_string(tdb, keystr, &job, sizeof(struct vlp_job)); - } + tdb_store_bystring(tdb, keystr, queue, TDB_REPLACE); + } return 0; } |