1 | #!/bin/sh |
---|
2 | # |
---|
3 | # PyKota |
---|
4 | # |
---|
5 | # PyKota : Print Quotas for CUPS and LPRng |
---|
6 | # |
---|
7 | # (c) 2003, 2004, 2005, 2006 Jerome Alet <alet@librelogiciel.com> |
---|
8 | # This program is free software; you can redistribute it and/or modify |
---|
9 | # it under the terms of the GNU General Public License as published by |
---|
10 | # the Free Software Foundation; either version 2 of the License, or |
---|
11 | # (at your option) any later version. |
---|
12 | # |
---|
13 | # This program is distributed in the hope that it will be useful, |
---|
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | # GNU General Public License for more details. |
---|
17 | # |
---|
18 | # You should have received a copy of the GNU General Public License |
---|
19 | # along with this program; if not, write to the Free Software |
---|
20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | # |
---|
22 | # $Id$ |
---|
23 | # |
---|
24 | # |
---|
25 | # |
---|
26 | # This script was freely adapted and modified from the printquota project |
---|
27 | # http://printquota.sourceforge.net for inclusion into PyKota. |
---|
28 | # |
---|
29 | # printquota (c) 2002-2003 Ahmet Ozturk & Cagatay Koksoy |
---|
30 | # printquota is distributed under the GNU General Public License |
---|
31 | # |
---|
32 | # Usage : pagecount.sh <file.ps |
---|
33 | # |
---|
34 | ( |
---|
35 | (sed -n -e '/%!PS-Adobe-/,/\%\%EOF/p' | grep -E -v "/Duplex|PageSize") |
---|
36 | echo currentdevice /PageCount gsgetdeviceprop == flush |
---|
37 | ) | gs -q -sDEVICE=bit -sOutputFile=/dev/null -r5 - | tail -1 |
---|