home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Networking / SambaManager / samba-1.9.17p4 / source / testprns.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  1.9 KB  |  74 lines

  1. /* 
  2.    Unix SMB/Netbios implementation.
  3.    Version 1.9.
  4.    test printer setup
  5.    Copyright (C) Karl Auer 1993, 1994-1997
  6.    
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 2 of the License, or
  10.    (at your option) any later version.
  11.    
  12.    This program is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.    
  17.    You should have received a copy of the GNU General Public License
  18.    along with this program; if not, write to the Free Software
  19.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. /*
  23.  * Testbed for pcap.c
  24.  *
  25.  * This module simply checks a given printer name against the compiled-in
  26.  * printcap file.
  27.  *
  28.  * The operation is performed with DEBUGLEVEL at 3.
  29.  *
  30.  * Useful for a quick check of a printcap file.
  31.  *
  32.  */
  33.  
  34. #include "includes.h"
  35. #include "smb.h"
  36.  
  37. /* these live in util.c */
  38. extern FILE *dbf;
  39. extern int DEBUGLEVEL;
  40.  
  41.  
  42. int main(int argc, char *argv[])
  43. {
  44.    char *pszTemp;
  45.  
  46.    TimeInit();
  47.  
  48.    setup_logging(argv[0],True);
  49.  
  50.    charset_initialise();
  51.  
  52.    if (argc < 2 || argc > 3)
  53.       printf("Usage: testprns printername [printcapfile]\n");
  54.    else
  55.    {
  56.       dbf = fopen("test.log", "w");
  57.       if (dbf == NULL) {
  58.          printf("Unable to open logfile.\n");
  59.       } else {
  60.          DEBUGLEVEL = 3;
  61.          pszTemp = (argc < 3) ? PRINTCAP_NAME : argv[2];
  62.          printf("Looking for printer %s in printcap file %s\n", 
  63.                  argv[1], pszTemp);
  64.          if (!pcap_printername_ok(argv[1], pszTemp))
  65.             printf("Printer name %s is not valid.\n", argv[1]);
  66.          else
  67.             printf("Printer name %s is valid.\n", argv[1]);
  68.          fclose(dbf);
  69.       }
  70.    }
  71.    return (0);
  72. }
  73.  
  74.