[Pkg-cups-devel] Bug#493457: cupsys: missing accounting function

Leonardo Boselli leo at dicea.unifi.it
Sat Aug 2 19:05:10 UTC 2008


Package: cupsys
Version: 1.2.7-4etch3
Severity: wishlist
Tags: patch

Would have been welcome the capability to list the usage per user and per
printer.
i did this short program. it would be uefl to clean and add to standard
option (possibly even on the html interface).

/* cupspcmon . contatore pagine stampate
   (C) AGPLv3 2008-08-02 Leonardo Boselli */

/* uso: zcat /var/log/page* | cupspcmon | sort */

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

main(int argc,char * argv[])
{
  if (argc>1)
    { printf("error: il programma %s v. 0.1 non ammette opzioni\n",argv[0]);
      return argc;
    }

char
snpri[30],snusr[30],snjob[10],sndat[30],snppr[12],snnps[8],sncod[8],snhos[32];

char prusr[1024][32];
int prct [1024];
int nfc;
char prcmp[32];
int prbuo,prpag;
int i,mi=0;
do
 {
   nfc=scanf("%s %s %s [%[^]]] %s %s %s
%s",snpri,snusr,snjob,sndat,snppr,snnps,sncod,snhos);
   if (nfc<0) break;
//     elimina righe "total"
   if(atoi(snppr)) prpag=atoi(snnps); else prpag=0;
   
   sprintf(prcmp,"%s,%s",snusr,snpri);
   
   if(prpag)
   {
//     printf("ora guardo mi=%i",mi);
     for(i=0;i<mi;i++)
     {
      if (strcmp(prusr[i],prcmp)==0)
      {
//    se ha trovato utente/stampante
      break;
      }
     } 
     if(mi==i)
     {
//    se non esisteva lo crea ex novo
     strcpy(prusr[i],prcmp);
     mi++; 
     }
     prct[i]+=prpag;
   }
 } while (nfc>-1);
 
// display risultati
 
 for(i=0;i<mi;i++)
 {
   printf("%s,%i\n",prusr[i],prct[i]);
 }
  
// end of program

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-k7
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages cupsys depends on:
ii  adduser             3.102                Add and remove users and groups
ii  cupsys-common       1.2.7-4etch3         Common UNIX Printing System(tm) - 
ii  debconf [debconf-2. 1.5.11etch1          Debian configuration management sy
ii  gs-esp              8.15.3.dfsg.1-1etch1 The Ghostscript PostScript interpr
ii  libc6               2.3.6.ds1-13etch5    GNU C Library: Shared libraries
ii  libcupsimage2       1.2.7-4etch3         Common UNIX Printing System(tm) - 
ii  libcupsys2          1.2.7-4etch3         Common UNIX Printing System(tm) - 
ii  libdbus-1-3         1.0.2-1+etch1        simple interprocess messaging syst
ii  libgnutls13         1.4.4-3+etch1        the GNU TLS library - runtime libr
ii  libldap2            2.1.30-13.3          OpenLDAP libraries
ii  libpam0g            0.79-5               Pluggable Authentication Modules l
ii  libpaper1           1.1.21               Library for handling paper charact
ii  libslp1             1.2.1-6.2            OpenSLP libraries
ii  lsb-base            3.1-23.2etch1        Linux Standard Base 3.1 init scrip
ii  patch               2.5.9-4              Apply a diff file to an original
ii  perl-modules        5.8.8-7etch3         Core Perl modules
ii  procps              1:3.2.7-3            /proc file system utilities
ii  xpdf-utils [poppler 3.01-9.1+etch4       Portable Document Format (PDF) sui
ii  zlib1g              1:1.2.3-13           compression library - runtime

Versions of packages cupsys recommends:
ii  cupsys-client         1.2.7-4etch3       Common UNIX Printing System(tm) - 
ii  foomatic-filters      3.0.2-20061031-1.2 linuxprinting.org printer support 
ii  smbclient             3.0.24-6etch10     a LanManager-like simple client fo

-- debconf information:
  cupsys/raw-print: true
  cupsys/backend: ipp, lpd, parallel, socket, usb





More information about the Pkg-cups-devel mailing list