/**************************************************************************** change status of a printer queue entry ****************************************************************************/ void status_printjob(int cnum,int snum,int jobid,int status) { char *lpstatus_command = (status==LPQ_PAUSED?lp_lppausecommand(snum):lp_lpresumecommand(snum)); char *printername = PRINTERNAME(snum); pstring syscmd; char jobstr[20]; int ret; if (!printername || !*printername) { DEBUG(6,("replacing printer name with service (snum=(%s,%d))\n", lp_servicename(snum),snum)); printername = lp_servicename(snum); } if (!lpstatus_command || !(*lpstatus_command)) { DEBUG(5,("No lpstatus command to %s job\n", (status==LPQ_PAUSED?"pause":"resume"))); return; } slprintf(jobstr,sizeof(jobstr)-1,"%d",jobid); pstrcpy(syscmd,lpstatus_command); string_sub(syscmd,"%p",printername); string_sub(syscmd,"%j",jobstr); standard_sub(cnum,syscmd); ret = smbrun(syscmd,NULL,False); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); lpq_reset(snum); /* queue has changed */ }
/**************************************************************************** resume a job ****************************************************************************/ static int generic_job_resume(int snum, struct printjob *pjob) { fstring jobstr; /* need to pause the spooled entry */ slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); return print_run_command(snum, lp_printername(snum), True, lp_lpresumecommand(snum), NULL, "%j", jobstr, NULL); }