jobs array

Michael Sweet mike at easysw.com
Mon Aug 2 07:26:34 PDT 2004


pieterjandeboeck at yahoo.co.uk wrote:
> ...
> ONLY_PROCESSING_JOBS (value 0) indicates it only returns jobs
> currently being processed. Although it also returns jobs in
> IPP_JOB_HELD state.

Actually, that boolean maps to the IPP "which-jobs" attribute
which supports the values "completed" and "not-completed".
Passing 1 returns completed jobs and 0 returns not-completed
jobs.

 > ...
> for (int i=0; i < currentNewJobCount; i++) { if ( jobs[i] ==
> IPP_JOB_HELD )
> 
> how do i remove a job from this array?

What I would do is something like:

     int i;
     int num_jobs;
     cups_job_t *jobs;

     num_jobs = cupsGetJobs(&jobs, NULL, 0, 0);

     for (i = num_jobs - 1; i >= 0; i --)
       if (jobs[i].state == IPP_JOB_HELD)
       {
         if (i < (num_jobs - 1))
           memmove(jobs + i, jobs + i + 1,
                   (num_jobs - 1 - i) * sizeof(cups_job_t));

         num_jobs --;
       }

The alternative is just to not display jobs with the held state
(or visa-versa).

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Printing Software for UNIX                       http://www.easysw.com




More information about the cups mailing list