summaryrefslogtreecommitdiff
path: root/source3/smbwrapper/smbw_stat.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-04 09:42:51 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-04 09:42:51 +0000
commit6760e69a68571e01ee57b959193a56278962a23c (patch)
treecab4036d3fcb04cd2ab1ee3ab1eedcd3a1fd2b79 /source3/smbwrapper/smbw_stat.c
parentce843e9735742626bb03cbea61041fff5d215930 (diff)
downloadsamba-6760e69a68571e01ee57b959193a56278962a23c.tar.gz
samba-6760e69a68571e01ee57b959193a56278962a23c.tar.bz2
samba-6760e69a68571e01ee57b959193a56278962a23c.zip
added support for printing via smbwrapper
You can print using "cp filename /smb/SERVER/PRINTER/jobname" You can list the current printqueue using ls (This used to be commit 080fb61b69620e26e8122705383dc2bd0468a519)
Diffstat (limited to 'source3/smbwrapper/smbw_stat.c')
-rw-r--r--source3/smbwrapper/smbw_stat.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c
index ae8671c591..69ca38a2ae 100644
--- a/source3/smbwrapper/smbw_stat.c
+++ b/source3/smbwrapper/smbw_stat.c
@@ -74,6 +74,38 @@ BOOL smbw_getatr(struct smbw_server *srv, char *path,
return False;
}
+
+static struct print_job_info printjob;
+
+/*****************************************************
+gather info from a printjob listing
+*******************************************************/
+static void smbw_printjob_stat(struct print_job_info *job)
+{
+ if (strcmp(job->name, printjob.name) == 0) {
+ printjob = *job;
+ }
+}
+
+/*****************************************************
+stat a printjob
+*******************************************************/
+int smbw_stat_printjob(struct smbw_server *srv,char *path,
+ size_t *size, time_t *m_time)
+{
+ if (path[0] == '\\') path++;
+
+ ZERO_STRUCT(printjob);
+
+ fstrcpy(printjob.name, path);
+ cli_print_queue(&srv->cli, smbw_printjob_stat);
+
+ *size = printjob.size;
+ *m_time = printjob.t;
+ return 0;
+}
+
+
/*****************************************************
a wrapper for fstat()
*******************************************************/
@@ -151,8 +183,16 @@ int smbw_stat(const char *fname, struct stat *st)
goto failed;
}
- if (strcmp(share,"IPC$") == 0) {
+ if (strncmp(srv->cli.dev,"IPC",3) == 0) {
mode = aDIR | aRONLY;
+ } else if (strncmp(srv->cli.dev,"LPT",3) == 0) {
+ if (strcmp(path,"\\") == 0) {
+ mode = aDIR | aRONLY;
+ } else {
+ mode = aRONLY;
+ smbw_stat_printjob(srv, path, &size, &m_time);
+ c_time = a_time = m_time;
+ }
} else {
if (!smbw_getatr(srv, path,
&mode, &size, &c_time, &a_time, &m_time)) {
@@ -163,8 +203,8 @@ int smbw_stat(const char *fname, struct stat *st)
smbw_setup_stat(st, path, size, mode);
- st->st_atime = time(NULL);
- st->st_ctime = m_time;
+ st->st_atime = a_time;
+ st->st_ctime = c_time;
st->st_mtime = m_time;
st->st_dev = srv->dev;