From ca03ad79cfaad48fb20426dfb98a30740fe80a0d Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Mon, 5 Feb 2001 13:02:20 +0000 Subject: Implement two printing related functions and start the remaining two. (This used to be commit c19559a286c3ec6dedefbd2423aa5738edd9ba41) --- source3/include/libsmbclient.h | 4 +-- source3/libsmb/libsmbclient.c | 63 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index a02c0e5317..5469966cf8 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -195,7 +195,7 @@ int smbc_lseekdir(int fd, off_t offset, int whence); * Print a file given the name in fname. It would be a URL ... */ -int smbc_print_file(const char *fname); +int smbc_print_file(const char *fname, const char *printq); /* * Open a print file that can be written to by other calls. This simply @@ -215,6 +215,6 @@ int smbc_list_print_jobs(const char *fname, void (*fn)(struct print_job_info *)) * Delete a print job */ -int smbc_unlink_print_job(int id); +int smbc_unlink_print_job(const char *fname, int id); #endif diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index feb0baaee3..68dbe666f7 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -2138,6 +2138,20 @@ int smbc_fstatdir(int fd, struct stat *st) return 0; +} + +/* + * Routine to print a file on a remote server ... + * + * We open the file, which we assume to be on a remote server, and then + * copy it to a print file on the share specified by printq. + */ + +int smbc_print_file(const char *fname, const char *printq) +{ + + + } /* @@ -2189,3 +2203,52 @@ int smbc_list_print_jobs(const char *fname, void (*fn)(struct print_job_info *)) } +/* + * Delete a print job from a remote printer share + */ + +int smbc_unlink_print_job(const char *fname, int id) +{ + struct smbc_server *srv; + fstring server, share, user, password; + pstring path; + + if (!smbc_initialized) { + + errno = EUCLEAN; + return -1; + + } + + if (!fname) { + + errno = EINVAL; + return -1; + + } + + DEBUG(4, ("smbc_unlink_print_job(%s)\n", fname)); + + smbc_parse_path(fname, server, share, path, user, password); /*FIXME, errors*/ + + if (user[0] == (char)0) pstrcpy(user, smbc_user); + + srv = smbc_server(server, share, lp_workgroup(), user, password); + + if (!srv) { + + return -1; /* errno set by smbc_server */ + + } + + if (cli_printjob_del(&srv->cli, id) < 0) { + + errno = smbc_errno(&srv->cli); + return -1; + + } + + return 0; + +} + -- cgit