source: trunk/third/moira/gen/sapprint.gen @ 23740

Revision 23740, 991 bytes checked in by broder, 16 years ago (diff)
In moira: * New CVS snapshot (Trac: #195) * Drop patches that have been incorporated upstream. * Update to build without krb4 on systems that no longer have it. This doesn't build yet on squeeze, which lacks a krb4 library, but I'm committing now before I start hacking away at a patch to fix that.
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2
3# $Id: sapprint.gen,v 1.3 2000-12-22 20:22:34 zacheiss Exp $
4
5# The following exit codes are defined and MUST BE CONSISTENT with the
6# error codes the library uses:
7$MR_DBMS_ERR = 47836421;
8$MR_OCONFIG = 47836460;
9
10$outfile = '/moira/dcm/sapprint.out';
11
12use DBI;
13
14$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
15  || exit $MR_DBMS_ERR;
16
17$sth = $dbh->prepare("SELECT p.name, p.hwtype, p.location, p.duplexname, p.rp, m.name ".
18                     "FROM printers p, machine m ".
19                     "WHERE p.rm=m.mach_id AND p.type='SAP'")
20  || exit $MR_DBMS_ERR;
21
22$sth->execute || exit $MR_DBMS_ERR;
23
24umask 022;
25open(OUT, ">$outfile") || exit $MR_OCONFIG;
26
27while (($name, $hwtype, $location, $duplexname, $rp, $rm) =
28       $sth->fetchrow_array) {
29  $row = "$name:$hwtype $location:$duplexname:rp=$rp:rm=$rm\n";
30  $row .= "$duplexname:$name duplex queue:$duplexname:rp=$duplexname:rm=$rm\n"
31    unless ($duplexname eq "\0");
32  $row =~ s/\0//g;
33  print OUT $row;
34}
35
36close OUT;
37exit 0;
Note: See TracBrowser for help on using the repository browser.