1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

vlp: Build vlp (virtual line printer) against current git on make

everything.
This commit is contained in:
Kai Blin 2007-12-10 22:30:24 +01:00
parent 3f6cc82637
commit 212ab58a3a
2 changed files with 42 additions and 23 deletions

View File

@ -194,7 +194,8 @@ BIN_PROGS = @EXTRA_BIN_PROGS@ @SMBMOUNT_PROGS@ \
EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \ EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \
bin/talloctort@EXEEXT@ bin/replacetort@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@ 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) \ $(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \
$(LDB_OBJ) $(ERRORMAP_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... # now the rules...
###################################################################### ######################################################################
@ -1442,6 +1451,11 @@ bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@
@$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ @$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_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) @WINBIND_NSS@: $(BINARY_PREREQS) $(WINBIND_NSS_OBJ)
@echo "Linking $@" @echo "Linking $@"
@$(SHLD) $(WINBIND_NSS_LDSHFLAGS) -o $@ $(WINBIND_NSS_OBJ) \ @$(SHLD) $(WINBIND_NSS_LDSHFLAGS) -o $@ $(WINBIND_NSS_OBJ) \

View File

@ -53,7 +53,7 @@ static void get_job_list(char *printer, struct vlp_job **job_list,
TDB_DATA data; TDB_DATA data;
slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer); 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; *job_list = (struct vlp_job *)data.dptr;
*num_jobs = data.dsize / sizeof(struct vlp_job); *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) int num_jobs)
{ {
fstring keystr; fstring keystr;
TDB_DATA data;
slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer); slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
tdb_store_by_string(tdb, keystr, job_list, data.dptr = (unsigned char *)job_list;
num_jobs * sizeof(struct vlp_job)); data.dsize = num_jobs * sizeof(struct vlp_job);
tdb_store_bystring(tdb, keystr, data, TDB_REPLACE);
} }
/* Return the next job number for a printer */ /* Return the next job number for a printer */
@ -83,7 +85,7 @@ static int next_jobnum(char *printer)
tdb_lock_bystring(tdb, keystr); tdb_lock_bystring(tdb, keystr);
jobnum = tdb_fetch_int(tdb, keystr); jobnum = tdb_fetch_int32(tdb, keystr);
/* Create next job index if none exists */ /* Create next job index if none exists */
@ -92,7 +94,7 @@ static int next_jobnum(char *printer)
} }
jobnum++; jobnum++;
tdb_store_int(tdb, keystr, jobnum); tdb_store_int32(tdb, keystr, jobnum);
tdb_unlock_bystring(tdb, keystr); tdb_unlock_bystring(tdb, keystr);
@ -105,7 +107,7 @@ static void set_printer_status(char *printer, int status)
int result; int result;
slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer); 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) 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); slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer);
data.dptr = keystr; data.dptr = (unsigned char *)keystr;
data.dsize = strlen(keystr) + 1; data.dsize = strlen(keystr) + 1;
if (!tdb_exists(tdb, data)) { if (!tdb_exists(tdb, data)) {
@ -123,7 +125,7 @@ static int get_printer_status(char *printer)
return LPSTAT_OK; return LPSTAT_OK;
} }
return tdb_fetch_int(tdb, keystr); return tdb_fetch_int32(tdb, keystr);
} }
/* Display printer queue */ /* Display printer queue */
@ -212,7 +214,7 @@ static int print_command(int argc, char **argv)
char *printer; char *printer;
fstring keystr; fstring keystr;
struct passwd *pw; struct passwd *pw;
TDB_DATA value; TDB_DATA value, queue;
struct vlp_job job; struct vlp_job job;
int i; int i;
@ -248,28 +250,31 @@ static int print_command(int argc, char **argv)
slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer); slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
value = tdb_fetch_by_string(tdb, keystr); value = tdb_fetch_bystring(tdb, keystr);
if (value.dptr) { if (value.dptr) {
/* Add job to end of queue */ /* Add job to end of queue */
value.dptr = realloc(value.dptr, value.dsize + queue.dptr = SMB_MALLOC(value.dsize + sizeof(struct vlp_job));
sizeof(struct vlp_job)); if (!queue.dptr) return 1;
if (!value.dptr) return 1;
memcpy(value.dptr + value.dsize, &job, sizeof(struct vlp_job)); memcpy(queue.dptr, value.dptr, value.dsize);
memcpy(queue.dptr + value.dsize, &job, sizeof(struct vlp_job));
tdb_store_by_string(tdb, keystr, value.dptr, value.dsize + queue.dsize = value.dsize + sizeof(struct vlp_job);
sizeof(struct vlp_job));
free(value.dptr); tdb_store_bystring(tdb, keystr, queue, TDB_REPLACE);
free(queue.dptr);
} else { } else {
/* Create new queue */ /* 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; return 0;