From d95777ac34f68a3525786103b9217f6397d9f1d4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 1 Aug 2000 00:41:19 +0000 Subject: 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) --- source3/printing/printing.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'source3/printing/printing.c') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 64d5a7c4b11..c6252b8fb1c 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; -- cgit