summaryrefslogtreecommitdiff
path: root/source3/printing/printing.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-08-01 00:41:19 +0000
committerJeremy Allison <jra@samba.org>2000-08-01 00:41:19 +0000
commitd95777ac34f68a3525786103b9217f6397d9f1d4 (patch)
tree08979563f948bea642c0afeeea00f79179c4e104 /source3/printing/printing.c
parent55ff9cb38bbabfaee591f6f5190e57b5564f3942 (diff)
downloadsamba-d95777ac34f68a3525786103b9217f6397d9f1d4.tar.gz
samba-d95777ac34f68a3525786103b9217f6397d9f1d4.tar.bz2
samba-d95777ac34f68a3525786103b9217f6397d9f1d4.zip
Added print job substitutions for %{printername}, %{sharename} and %{portname}
from the NT printer tdb. Also added checks for time restrictions before allowing a job to print. Jeremy. (This used to be commit 8cfb55e81abebf0354e6d470ed68bbac1d6560ad)
Diffstat (limited to 'source3/printing/printing.c')
-rw-r--r--source3/printing/printing.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 64d5a7c4b1..c6252b8fb1 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -716,8 +716,9 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
}
/****************************************************************************
-print a file - called on closing the file. This spools the job
+ Print a file - called on closing the file. This spools the job.
****************************************************************************/
+
BOOL print_job_end(int jobid)
{
struct printjob *pjob = print_job_find(jobid);
@@ -728,13 +729,16 @@ BOOL print_job_end(int jobid)
char *wd, *p;
pstring jobname;
- if (!pjob) return False;
+ if (!pjob)
+ return False;
- if (pjob->spooled || pjob->pid != local_pid) return False;
+ if (pjob->spooled || pjob->pid != local_pid)
+ return False;
snum = print_job_snum(jobid);
- if (sys_fstat(pjob->fd, &sbuf) == 0) pjob->size = sbuf.st_size;
+ if (sys_fstat(pjob->fd, &sbuf) == 0)
+ pjob->size = sbuf.st_size;
close(pjob->fd);
pjob->fd = -1;
@@ -749,14 +753,17 @@ BOOL print_job_end(int jobid)
/* we print from the directory path to give the best chance of
parsing the lpq output */
wd = sys_getwd(current_directory);
- if (!wd) return False;
+ if (!wd)
+ return False;
pstrcpy(print_directory, pjob->filename);
p = strrchr(print_directory,'/');
- if (!p) return False;
+ if (!p)
+ return False;
*p++ = 0;
- if (chdir(print_directory) != 0) return False;
+ if (chdir(print_directory) != 0)
+ return False;
pstrcpy(jobname, pjob->jobname);
pstring_sub(jobname, "'", "_");
@@ -780,10 +787,10 @@ BOOL print_job_end(int jobid)
return True;
}
-
/****************************************************************************
-check if the print queue has been updated recently enough
+ Check if the print queue has been updated recently enough.
****************************************************************************/
+
static BOOL print_cache_expired(int snum)
{
fstring key;