root / pykota / trunk / bin / pkpgcounter @ 1482

Revision 1482, 2.3 kB (checked in by jalet, 20 years ago)

pkpgcounter is now just a wrapper around the PDLAnalyzer class

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#! /usr/bin/env python
2# -*- coding: ISO-8859-15 -*-
3
4# pkpgcounter, a smart software page counter
5#
6# PyKota - Print Quotas for CUPS and LPRng
7#
8# (c) 2003-2004 Jerome Alet <alet@librelogiciel.com>
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22#
23# $Id$
24#
25# $Log$
26# Revision 1.10  2004/05/18 09:59:54  jalet
27# pkpgcounter is now just a wrapper around the PDLAnalyzer class
28#
29# Revision 1.9  2004/05/10 07:23:21  jalet
30# pykotme now uses pkpgcounter to compute the job's size.
31#
32# Revision 1.8  2004/05/08 15:12:23  jalet
33# Improved PCL6 support
34#
35# Revision 1.7  2004/05/07 23:08:21  jalet
36# Skeleton for PCLXL aka PCL6
37# Added the "potential" fix for rastertoprinter's output
38#
39# Revision 1.6  2004/05/06 21:19:27  jalet
40# Doesn't exit anymore on the first nul byte
41#
42# Revision 1.5  2004/05/06 12:37:29  jalet
43# pkpgcounter : comments
44# pkprinters : when --add is used, existing printers are now skipped.
45#
46# Revision 1.4  2004/05/04 12:21:55  jalet
47# Now uses mmap in PCL mode
48#
49# Revision 1.3  2004/05/04 04:39:26  jalet
50# Better PCL support
51#
52# Revision 1.2  2004/05/04 03:14:26  jalet
53# fixed copy&paste problem in pkpgcounter
54#
55# Revision 1.1  2004/04/08 17:07:42  jalet
56# pkpgcounter added
57#
58#
59
60import sys
61from pykota import pdlanalyzer
62   
63if __name__ == "__main__" :   
64    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
65        sys.argv.append("-")
66       
67    totalsize = 0   
68    for arg in sys.argv[1:] :
69        try :
70            parser = pdlanalyzer.PDLAnalyzer(arg)
71            totalsize += parser.getJobSize()
72        except TypeError, msg :   
73            sys.stderr.write("%s\n" % msg)
74            sys.stderr.flush()
75    print "%s" % totalsize
Note: See TracBrowser for help on using the browser.