#! /usr/bin/env python
# -*- coding: ISO-8859-15 -*-
#
# pkpgcounter : a generic Page Description Language parser
#
# (c) 2003, 2004, 2005 Jerome Alet <alet@librelogiciel.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# $Id: pkpgcounter 54 2005-07-09 08:46:59Z jerome $
#
#

import sys
from pkpgpdls.version import __version__, __author__, __authoremail__, \
                                __years__, __gplblurb__
from pkpgpdls import analyzer

__doc__ = """pkpgcounter v%(__version__)s (c) %(__years__)s %(__author__)s

pkpgcounter is a generic Page Description Language parser.

pkpgcounter parses any number of input files and/or its standard input
and outputs the number of pages needed to print these documents.

pkpgcounter currently recognizes the following document formats :

    * PostScript (both DSC compliant and binary)
    * PDF   
    * PCLXL (aka PCL6)
    * PCL3/4/5 (mostly)
    * DVI
    * TIFF
    * ESC/P2
    * OpenOffice.org Writer
    * OpenOffice.org Impress

command line usage :

  pkpgcounter [options] [files]

options :

  -v | --version       Prints pkpgcounter's version number then exits.
  -h | --help          Prints this message then exits.
  
  -d | --debug         Activate debug mode. 
  
examples :                              

  $ pkpgcounter file1.ps file2.escp2 file3.pclxl <file4.pcl345
  
  Will launch pkpgcounter and will output the total number of pages
  needed to print all the documents specified.
  
%(__gplblurb__)s  

Please e-mail bugs to: %(__authoremail__)s"""

if __name__ == "__main__" : 
    if (len(sys.argv) >= 2) and (sys.argv[1] in ("-h", "--help")) :
        print __doc__ % globals()
    elif (len(sys.argv) >= 2) and (sys.argv[1] in ("-v", "--version")) :
        print __version__
    else :    
        analyzer.main()

