sync getopt() args with 2.2
[Samba.git] / source / utils / testprns.c
blobc3aa25ada86cb1a043a29d81315c133810df3d9b
1 /*
2 Unix SMB/Netbios implementation.
3 Version 1.9.
4 test printer setup
5 Copyright (C) Karl Auer 1993, 1994-1998
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.
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.
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.
23 * Testbed for pcap.c
25 * This module simply checks a given printer name against the compiled-in
26 * printcap file.
28 * The operation is performed with DEBUGLEVEL at 3.
30 * Useful for a quick check of a printcap file.
34 #include "includes.h"
35 #include "smb.h"
37 int main(int argc, char *argv[])
39 char *pszTemp;
41 setup_logging(argv[0],True);
43 if (argc < 2 || argc > 3)
44 printf("Usage: testprns printername [printcapfile]\n");
45 else
47 dbf = x_fopen("test.log", O_WRONLY|O_CREAT|O_TRUNC, 0644);
48 if (dbf == NULL) {
49 printf("Unable to open logfile.\n");
50 } else {
51 DEBUGLEVEL = 3;
52 pszTemp = (argc < 3) ? PRINTCAP_NAME : argv[2];
53 printf("Looking for printer %s in printcap file %s\n",
54 argv[1], pszTemp);
55 if (!pcap_printername_ok(argv[1], pszTemp))
56 printf("Printer name %s is not valid.\n", argv[1]);
57 else
58 printf("Printer name %s is valid.\n", argv[1]);
59 x_fclose(dbf);
62 return (0);