TARGET= boot.gen hesiod.gen nfs.gen mailhub.gen pobox.gen hosts.gen \
print.gen printng.gen network.gen directory.gen ndb.gen @GDSS_TARGET@
-SCRIPTS=boot.sh hesiod.sh mailhub.sh nfs.sh null.sh print.sh warehouse.sh
+SCRIPTS=boot.sh hesiod.sh mailhub.sh nfs.sh null.sh print.sh \
+ sapprint.gen sapprint.sh warehouse.sh
.SUFFIXES: .pc
--- /dev/null
+#!/moira/bin/perl -Tw
+
+# $Id$
+
+# The following exit codes are defined and MUST BE CONSISTENT with the
+# error codes the library uses:
+$MR_DBMS_ERR = 47836421;
+$MR_OCONFIG = 47836460;
+
+$outfile = '/moira/dcm/sapprint.out';
+
+use DBI;
+
+$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
+ || exit $MR_DBMS_ERR;
+
+$sth = $dbh->prepare("SELECT p.name, p.hwtype, p.location, p.duplexname, p.rp, m.name ".
+ "FROM printers p, machine m ".
+ "WHERE p.rm=m.mach_id AND p.type='SAP'")
+ || exit $MR_DBMS_ERR;
+
+$sth->execute || exit $MR_DBMS_ERR;
+
+umask 022;
+open(OUT, ">$outfile") || exit $MR_OCONFIG;
+
+while (($name, $hwtype, $location, $duplexname, $rp, $rm) =
+ $sth->fetchrow_array) {
+ $row = "$name:$hwtype $location:$duplexname:rp=$rp:rm=$rm\n";
+ $row .= "$duplexname:$name duplex queue:$duplexname:rp=$duplexname:rm=$rm\n"
+ unless ($duplexname eq "\0");
+ $row =~ s/\0//g;
+ print OUT $row;
+}
+
+close OUT;
+exit 0;
--- /dev/null
+#! /bin/sh
+# $Id$
+
+# The following exit codes are defined and MUST BE CONSISTENT with the
+# error codes the library uses:
+MR_MISSINGFILE=47836473
+
+PATH=/bin
+OUTFILE=/var/tmp/sapprint.out
+
+# Alert if the output file doesn't exist
+test -r $OUTFILE || exit $MR_MISSINGFILE
+
+# Set the perms usefully
+chown root $OUTFILE
+chgrp 0 $OUTFILE
+chmod 644 $OUTFILE
+
+# cleanup
+test -f $0 && rm -f $0
+
+exit 0