dnaprint: be able to use VMS printers with your unix machine

Paul Traina pst at comdesign.cdi.com
Sun Nov 13 06:32:53 AEST 1988


I'd like to use the printers near my office.
Some of the printers I want to use are connected to our VAXen.
Our VAXen run VMS (sigh).
I have Sunlink/DNA running on at least one machine on my network.

Solution:	use this program -- it slides into the lpr spooler
		and moves files over to the VMS printer queues.


#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README dnaprint.8 COPYING Makefile dnaprint.c dnaerror.c
#   printcap otherprintcap remoteprint.com
# Wrapped by pst at comdesign on Sat Nov 12 12:31:56 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(236 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
XI'd like to use the printers near my office.
X
XSome of the printers I want to use are connected to our VAXen.
X
XOur VAXen run VMS (vomit).
X
XI do have Sunlink/DNA running on at least one machine on my network.
X
XSolution:	use this program
END_OF_FILE
if test 236 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'dnaprint.8' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dnaprint.8'\"
else
echo shar: Extracting \"'dnaprint.8'\" \(1717 characters\)
sed "s/^X//" >'dnaprint.8' <<'END_OF_FILE'
X.\" %Z%%M% %I% %E% CDI; UCB 4.2
X.TH DNAPRINT 8 "12 Nov 1988"
X.SH NAME
Xdnaprint \- output filter for utilizing remote decnet printers
X.SH SYNOPSIS
X\fB/usr/local/lib/dnaprint\fP
X.SH DESCRIPTION
X.IX  "dnaprint" "" "\fLdnaprint\fP \(em vms decnet printer interface"
X\fIDnaprint\fP is an interface which slides in as an output filter in
Xa printcap entry.  It is designed to work with Sun's Sunlink/DNA, and
Xis useless without it.
X.LP
X\fIDnaprint\fP will allow the use of printers connected to VMS machines
Xby using a DECNET task-to-task interface (which includes a small .COM
Xfile which must reside on the remote VMS system).
X.LP
X\fIDnaprint\fP is not intended as a user interface routine; it accepts
Xno commands and makes certain ugly assumptions.  Use lpr as the front end.
X.LP
X\fIDnaprint\fP
Xreads standard input up to an end-of-file, copies this into a temporary file
Xand then invokes dnacp to copy the file to the remote VAX.  Next, 
X\fIdnaprint\fP opens up the task-to-task link and instructs the remote
XVAX to print and delete the file.
X.LP
XTwo problems involved with this operation are the fact that UNIX printer
Xqueue names often do not match well with VMS queue names, and the fact
Xthat we just don't know enough to know where to send the print file.
XThis is solved by adding additional "pseudo-commands" to the
X.I /etc/printcap
Xfile (or if you need to use decnet passwords you may choose another file
Xwhich can be read protected).
X.SH FILES
X.PD 0
X.TP 25
X.I /usr/local/lib/dnaprint
Xthe executable
X.TP
X.I /etc/printcap
Xadditional pseudo-commands for dnaprint
X.SH SEE ALSO
Xlpr(1),
Xprintcap(5),
Xdnacp(1)
X.SH AUTHOR
XCopyright (c) 1988 by Paul Traina. 
X.LP
XPlease see the distributed file COPYING (the FSF Copyleft).
END_OF_FILE
if test 1717 -ne `wc -c <'dnaprint.8'`; then
    echo shar: \"'dnaprint.8'\" unpacked with wrong size!
fi
# end of 'dnaprint.8'
fi
if test -f 'COPYING' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'COPYING'\"
else
echo shar: Extracting \"'COPYING'\" \(6984 characters\)
sed "s/^X//" >'COPYING' <<'END_OF_FILE'
X
X		    DNAPRINT GENERAL PUBLIC LICENSE
X
X Copyright (C) 1988 Paul S. Traina
X Everyone is permitted to copy and distribute verbatim copies
X of this license, but changing it is not allowed.  You can also
X use this wording to make the terms for other programs.
X
X  The license agreements of most software companies keep you at the
Xmercy of those companies.  By contrast, our general public license is
Xintended to give everyone the right to share DNAPRINT.  To make sure that
Xyou get the rights we want you to have, we need to make restrictions
Xthat forbid anyone to deny you these rights or to ask you to surrender
Xthe rights.  Hence this license agreement.
X
X  Specifically, we want to make sure that you have the right to give
Xaway copies of DNAPRINT, that you receive source code or else can get it
Xif you want it, that you can change DNAPRINT or use pieces of it in new
Xfree programs, and that you know you can do these things.
X
X  To make sure that everyone has such rights, we have to forbid you to
Xdeprive anyone else of these rights.  For example, if you distribute
Xcopies of DNAPRINT, you must give the recipients all the rights that you
Xhave.  You must make sure that they, too, receive or can get the
Xsource code.  And you must tell them their rights.
X
X  Also, for our own protection, we must make certain that everyone
Xfinds out that there is no warranty for DNAPRINT.  If DNAPRINT is modified by
Xsomeone else and passed on, we want its recipients to know that what
Xthey have is not what we distributed, so that any problems introduced
Xby others will not reflect on our reputation.
X
X  Therefore we (Paul Traina and the Shockwave Engineering) make the following
Xterms which say what you must do to be allowed to distribute or change
XDNAPRINT.
X
X
X			COPYING POLICIES
X
X  1. You may copy and distribute verbatim copies of DNAPRINT source code
Xas you receive it, in any medium, provided that you conspicuously and
Xappropriately publish on each copy a valid copyright notice "Copyright
X(C) 1988 Paul Traina" (or with whatever year is appropriate); keep intact
Xthe notices on all files that refer to this License Agreement and to the
Xabsence of any warranty; and give any other recipients of the DNAPRINT program
Xa copy of this License Agreement along with the program.  You may charge a
Xdistribution fee for the physical act of transferring a copy.
X
X  2. You may modify your copy or copies of DNAPRINT or any portion of it,
Xand copy and distribute such modifications under the terms of
XParagraph 1 above, provided that you also do the following:
X
X    a) cause the modified files to carry prominent notices stating
X    that you changed the files and the date of any change; and
X
X    b) cause the whole of any work that you distribute or publish,
X    that in whole or in part contains or is a derivative of DNAPRINT or
X    any part thereof, to be licensed at no charge to all third
X    parties on terms identical to those contained in this License
X    Agreement (except that you may choose to grant more extensive
X    warranty protection to some or all third parties, at your option).
X
X    c) You may charge a distribution fee for the physical act of
X    transferring a copy, and you may at your option offer warranty
X    protection in exchange for a fee.
X
XMere aggregation of another unrelated program with this program (or its
Xderivative) on a volume of a storage or distribution medium does not bring
Xthe other program under the scope of these terms.
X
X  3. You may copy and distribute DNAPRINT (or a portion or derivative of it,
Xunder Paragraph 2) in object code or executable form under the terms of
XParagraphs 1 and 2 above provided that you also do one of the following:
X
X    a) accompany it with the complete corresponding machine-readable
X    source code, which must be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    b) accompany it with a written offer, valid for at least three
X    years, to give any third party free (except for a nominal
X    shipping charge) a complete machine-readable copy of the
X    corresponding source code, to be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    c) accompany it with the information you received as to where the
X    corresponding source code may be obtained.  (This alternative is
X    allowed only for noncommercial distribution and only if you
X    received the program in object code or executable form alone.)
X
XFor an executable file, complete source code means all the source code for
Xall modules it contains; but, as a special exception, it need not include
Xsource code for modules which are standard libraries that accompany the
Xoperating system on which the executable file runs.
X
X  4. You may not copy, sublicense, distribute or transfer DNAPRINT
Xexcept as expressly provided under this License Agreement.  Any attempt
Xotherwise to copy, sublicense, distribute or transfer DNAPRINT is void and
Xyour rights to use the program under this License agreement shall be
Xautomatically terminated.  However, parties who have received computer
Xsoftware programs from you with this License Agreement will not have
Xtheir licenses terminated so long as such parties remain in full compliance.
X
X  5. If you wish to incorporate parts of DNAPRINT into other free programs
Xwhose distribution conditions are different, write to the Shockwave Engineering
Xat 7632 Hollister Ave. Suite #349, Santa Barbara, CA  93117.)  We have not yet
Xworked out a simple rule that can be stated here, but we will often permit this.
XWe will be guided by the two goals of preserving the free status of all
Xderivatives of our free software and of promoting the sharing and reuse of
Xsoftware.
X
X		       NO WARRANTY
X
X  BECAUSE DNAPRINT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO
XWARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
XWHEN OTHERWISE STATED IN WRITING, SHOCKWAVE ENGINEERING, PAUL TRAINA
XAND/OR OTHER PARTIES PROVIDE DNAPRINT "AS IS" WITHOUT WARRANTY OF ANY KIND,
XEITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
XWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE
XENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF DNAPRINT IS WITH YOU.  SHOULD
XDNAPRINT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
XREPAIR OR CORRECTION.
X
X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL PAUL TRAINA, SHOCKWAVE
XENGINEERING, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE DNAPRINT
XAS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS,
XLOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT
XOF THE USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
XDATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
XFAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) DNAPRINT, EVEN
XIF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR
XANY CLAIM BY ANY OTHER PARTY.
X
X[With respect to Richard Stallman & the FSF (thank you) -- pst 11-12-88]
END_OF_FILE
if test 6984 -ne `wc -c <'COPYING'`; then
    echo shar: \"'COPYING'\" unpacked with wrong size!
fi
# end of 'COPYING'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(482 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X#
X#	Makefile for dnaprint
X#
X
XDISTRIB=	README dnaprint.8 COPYING Makefile dnaprint.c dnaerror.c \
X		printcap otherprintcap remoteprint.com
X
XDESTDIR=	/usr/local/lib
XMANDIR=		/usr/man/man8
X
Xall:		dnaprint
X
Xdnaprint:	dnaprint.o dnaerror.o
X		$(CC) -o dnaprint dnaprint.o dnaerror.o
X
Xinstall:	dnaprint dnaprint.8
X		install -o root -g bin -s dnaprint $(DESTDIR)
X		install -o root -g bin dnaprint.8 $(MANDIR)
X
Xshar:		$(DISTRIB)
X		shar $(DISTRIB) > dnaprint.shar
X
Xclean:		
X		rm *.o dnaprint
END_OF_FILE
if test 482 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'dnaprint.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dnaprint.c'\"
else
echo shar: Extracting \"'dnaprint.c'\" \(5238 characters\)
sed "s/^X//" >'dnaprint.c' <<'END_OF_FILE'
X/*
X *	DNAprint	- filter LPR output to a file, and then copy the file
X *			  to printer serving vax and execute remoteprint.com
X *			  on that vax.
X *
X * Copyright (c) 1988 Paul Traina -- All commercial rights reserved.
X *
X */
X
X/* file with unix queue -> vms queue information */
X
X#define	 TRANSLATE_FILE		"/etc/printcap"
X
X#include <stdio.h>
X#include <fcntl.h>
X#include <signal.h>
X#include <strings.h>
X#include <sys/ioctl.h>
X#include <sys/param.h>
X#include <netdna/dna.h>
X
Xtypedef struct {
X	char	machine[9];		/* decnet name of queue server */
X	char	name[30];		/* vms name of printer queue */
X	char	user[USER_LEN];		/* name of printer server user */
X	char	acct[ACCT_LEN];		/* printer server user account */
X	char	pass[PASS_LEN];		/* password (if any) for user */
X} QUEUEINFO;
X
X/*
X *	Open up the translation file, look for the proper printer queue
X *	match, and load in the vms queue information structure.
X */
X
X#define	CVTSTARTONULL(s)	s[0] = (s[0] == '*' ? '\0' : s[0])
X
Xint translate_queue(unixname, vq)
Xchar *unixname;
XQUEUEINFO *vq;
X{
X	FILE	*trans;
X	char	checkname[20];
X	char	line[255];
X
X	if ((trans = fopen(TRANSLATE_FILE, "r")) == NULL) {
X		perror("translate_open");
X		return -1;
X	}
X
X	fgets(line, sizeof(line), trans);
X
X	while (!feof(trans)) {
X		/* if we have a command line */
X		if (line[0] == '#' && line[1] == '%') {
X			sscanf(line, "%*s %s %s %s %s %s %s",
X				checkname, vq->machine, vq->name,
X				vq->user, vq->pass, vq->acct);
X
X			/* if '*' in translation file, make entry null */
X			CVTSTARTONULL(vq->user);
X			CVTSTARTONULL(vq->acct);
X			CVTSTARTONULL(vq->pass);			
X
Xfprintf(stderr, "line: name=<%s>, machine=<%s>, queue=<%s>, user=<%s>, pass=<%s>, acct=<%s>\n",
X	checkname, vq->machine, vq->name, vq->user, vq->pass, vq->acct);
X
X			if (strcmp(checkname, unixname) == 0) {
X				fclose(trans);
X				return 0;
X			}
X		}
X		fgets(line, sizeof(line), trans);
X	}
X	fclose(trans);
X	return -1;
X}
X
X/*
X *	Read standard input until we get no more (it is closed)
X *	and copy it out to a file.
X */
X
Xvoid save_stdin_to_file(name)
Xchar *name;
X{
X	int fd, size;
X	char buf[1024];				/* file buffer */
X
X	if ((fd = creat(name, 0600)) == -1) {
X		perror("tempfile open");
X		exit(1);
X	}
X	size = read(0, buf, sizeof(buf));	/* read from stdin */
X	while (size > 0) {
X		write(fd, buf, size);		/* write to file */
X		size = read(0, buf, sizeof(buf));
X	}
X	close(fd);
X}
X
X
X
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X	QUEUEINFO vmsqueue;			/* vms queue & decnet info */
X	OpenBlock ob;				/* access structure */
X	int  ll;				/* logical link handle */
X	char cwd[MAXPATHLEN],			/* current directory */
X	     queue[30],				/* unix queue name */
X	     *tempfile,				/* full path of temp file */
X	     *tempname,				/* just filename itself */
X	     cmd[256],				/* dnacp command buffer */
X	     access[100],			/* access control string */
X	     temp[40],
X	     status[30];			/* return status from vms */
X
X	/* get unix name of this printer queue */
X
X	if (getwd(cwd) == NULL) {		/* get current dir */
X		perror("getwd");
X		exit(1);
X	}
X	strcpy(queue, rindex(cwd, '/') + 1);	/* get basename of dir */
X
X	/* translate unix queue name into vms queue & decnet info */
X	if (translate_queue(queue, &vmsqueue) == -1) {
X		fprintf(stderr, "%s: unable to find queue information for %s\n",
X			argv[0], queue);
X		exit(1);
X	}
X
X	/* get print job text & put it in a temporary file */
X	tempfile = tempnam("/tmp", "dnapr");
X	tempname = tempfile + 5;
X	save_stdin_to_file(tempfile);
X
X	access[0] = '\0';			/* null access string */
X
X	if (strlen(vmsqueue.user)) {
X		sprintf(access, "-u %s", vmsqueue.user);
X		if (strlen(vmsqueue.pass)) {
X			sprintf(temp, " -p %s", vmsqueue.pass);
X			strcat(access, temp);
X			if (strlen(vmsqueue.acct)) {
X				sprintf(temp, " -a %s", vmsqueue.acct);
X				strcat(access, temp);
X			}
X		}
X	}
X
X	/* tell decnet to copy the file to the vms machine */
X
X	sprintf(cmd, "/usr/sunlink/dna/dnacp %s %s %s::%s",
X		access, tempfile, vmsqueue.machine, tempname);
X	system(cmd);
X	unlink(tempfile);		/* remove file on our side now */
X
X	/* request logical link to Sunlink/DNA */
X	if ((ll = open("/dev/dna", O_RDWR)) < 0) {
X		dnaerror("open");
X		exit(1);
X	}
X
X	/* set logical link */
X	if (ioctl(ll, SES_GET_LINK, 0) < 0) {
X		dnaerror("set/get logical link");
X		exit(1);
X	}
X
X	/* load decnet access structure with proper information from queue
X	   translation file */
X
X	strcpy(ob.op_node_name, vmsqueue.machine);
X	strcpy(ob.op_task_name, "REMOTEPRINT");
X	ob.op_object_nbr	= 0;
X	strcpy(ob.op_userid,	vmsqueue.user);
X	strcpy(ob.op_account,	vmsqueue.acct);
X	strcpy(ob.op_password,	vmsqueue.pass);
X	ob.op_opt_data.im_length = 0;
X
X	/* open actual logical link */
X	if (ioctl(ll, SES_LINK_ACCESS, &ob) == -1) {
X		dnaerror("ses link access");
X		exit(1);
X	}
X
X 	/* send out queue name */
X	if (write(ll, vmsqueue.name, strlen(vmsqueue.name)) < 0) {
X		dnaerror("queuename");
X		exit(1);
X	}
X
X	/* send out name of transferred tempfile */
X	if (write(ll, tempname, strlen(tempname)) < 0) {
X		dnaerror("tempname");
X		exit(1);
X	}
X
X	/* wait for status return from remote task */
X	if (read(ll, status, sizeof(status)) < 0) { /* error reading status */
X		dnaerror("status");
X		exit(1);
X	}
X
X	close(ll);	/* close logical link */
X
X	/* if status <> success, exit 1 */
X	exit(strcmp(status,"%X10000001") ? 1 : 0);
X}
END_OF_FILE
if test 5238 -ne `wc -c <'dnaprint.c'`; then
    echo shar: \"'dnaprint.c'\" unpacked with wrong size!
fi
# end of 'dnaprint.c'
fi
if test -f 'dnaerror.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dnaerror.c'\"
else
echo shar: Extracting \"'dnaerror.c'\" \(6291 characters\)
sed "s/^X//" >'dnaerror.c' <<'END_OF_FILE'
X#ifndef lint
Xstatic char sccsid[] = "@(#)dnaerror.c 1.6 87/07/27 Copyr 1986 Sun Micro";
X#endif
X
X/*
X * Copyright (c) 1986 by Sun Microsystems, Inc.
X */
X 
X/*   Module:	dnaerror.c  -  SunLink DNA Display Error Message Utility   
X  
X******************************************************************************
X*  COPYRIGHT (C)  1985, 1986 by TECHNOLOGY CONCEPTS INC.                     *
X*                         SUDBURY, MASSACHUSETTS 01776                       *
X*                         ---ALL RIGHTS RESERVED---                          *
X*                                                                            *
X*  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED     *
X*  ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION  *
X*  OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY OTHER COPIES THEREOF *
X*  MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.  NO  *
X*  TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.             *
X*                                                                            *
X*  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND  *
X*  SHOULD NOT BE CONSTRUED AS A COMMITMENT BY TECHNOLOGY CONCEPTS INC.       *
X******************************************************************************
X*
X*  Version 1  --  Revision 0
X*
X*  Facility:      SunLink DNA Display Error Message Utility
X*
X*  Product:       SunLink DNA
X*
X*  Module Abstract: dnaerror is an unsupported utility which displays
X*                   the status, or error, message corresponding to the status
X*                   code in the external variable errno.  
X*
X*                   dnaerror accepts as input a character string which will be
X*                   prepended onto the beginning of the status message. 
X*
X*                   The status codes accepted are those status codes 
X*                   defined in the dna.h header file and documented in the
X*                   SunLink DNA User's Manual.  If the status code in errno is
X*                   not a DNA status code, the operating system dependent
X*                   perror utility will be called to display an appropriate 
X*                   message.
X*/
X
X#include <stdio.h>
X#include <sys/ioctl.h>
X#include <netdna/dna.h>
X
X#define  MIN_ERR_NUM     NOT_CONNECTED	/* start of DNA error codes */
X#define  MAX_ERR_NUM     NOT_SUPPORTED	/* end of DNA error codes */
X
Xextern int errno;
X
X/*
X *  CommUnity Status Messages
X */
Xstatic char *status_msg[] = {
X  /*  70 */ "Specified logical link does not exist",
X  /*  71 */ "Network software processing error",
X  /*  72 */ "Data was truncated",
X  /*  73 */ "Logical link number specified is invalid",
X  /*  74 */ "Logical link normally closed or rejected",
X  /*  75 */ "Insufficient resources at remote node",
X  /*  76 */ "Unrecognized node name",
X  /*  77 */ "Remote node is not accepting new links",
X  /*  78 */ "Specified remote object does not exist",
X  /*  79 */ "Specified task name is invalid",
X  /*  80 */ "Insufficient resources at remote node",
X  /*  81 */ "Link disconnected by network",
X  /*  82 */ "Link aborted by remote program",
X  /*  83 */ "Specified node or device name is invalid",
X  /*  84 */ "Local node is not accepting new links",
X  /*  85 */ "Remote node rejected access information",
X  /*  86 */ "Insufficient resources at local node",
X  /*  87 */ "Remote node failed to respond",
X  /*  88 */ "Remote node is unreachable",
X  /*  89 */ "Logical link identifier already in use",
X  /*  90 */ "Network software is not initialized",
X  /*  91 */ "Controller didn't acknowledge message from driver",
X  /*  92 */ "Driver didn't receive expected message from controller",
X  /*  93 */ "Controller error on transmit",
X  /*  94 */ "Controller error on receive",
X  /*  95 */ "Program aborted by interactive user",
X  /*  96 */ "Invalid access attempt on read or write",
X  /*  97 */ "No data available",
X  /*  98 */ "Invalid value in SesRecord status field",
X  /*  99 */ "Size of transfer exceeds maximum allowed",
X  /* 100 */ "Out of space on controller",
X  /* 101 */ "Unidentified controller failure",
X  /* 102 */ "Invalid command or ioctl function",
X  /* 103 */ "Transmit failed, link is flow controlled",
X  /* 104 */ "Invalid error number 104",
X  /* 105 */ "Invalid error number 105",
X  /* 106 */ "Remote node closed link, data still available to read",
X  /* 107 */ "Buffer contains interrupt data",
X  /* 108 */ "Buffer contains the begining of message",
X  /* 109 */ "Buffer contains the middle of message",
X  /* 110 */ "Buffer contains the end of message",
X  /* 111 */ "Buffer contains a complete message",
X  /* 112 */ "Invalid error number 112 (not used)",
X  /* 113 */ "Invalid error number 113 (not used)",
X  /* 114 */ "Invalid error number 114 (not used)",
X  /* 115 */ "Unknown error received from remote node",
X  /* 116 */ "Duplicate node name detected",
X  /* 117 */ "Duplicate node number detected",
X  /* 118 */ "Node numbers are required for all nodes",
X  /* 119 */ "Function not yet supported"
X};
X
X/*  
X *  Routine:     dnaerror ( STRING ) 
X * 
X *  Abstract:    dnaerror is an unsupported status message utility. 
X *               It displays a status message corresponding to the status 
X *               code in the external variable errno, prepending the string
X *               passed to the beginning of the status message.
X *
X *               On each call, this routine determines if the status code 
X *               in the external variable errno is within the valid DNA 
X *               status code range.  If it is, the input string is displayed,
X *               followed by the corresponding DNA status message. 
X *               If the status code in errno is not a DNA status code,
X *               the PERROR utility is called to display an appropriate message.
X *
X *  Inputs:      string - character string to prepend onto error message
X *               errno  - CommUnity status code in the external variable errno 
X * 
X *  Outputs:     displayed message
X */
Xdnaerror(string)
X	register char *string;
X{
X	register short status_code;
X
X	status_code = errno;
X	if ((status_code > MAX_ERR_NUM) || (status_code < MIN_ERR_NUM))
X		perror(string);
X	else
X		fprintf(stderr, "%s: %s\n",
X			string, status_msg[status_code - MIN_ERR_NUM]);
X	return;
X}
END_OF_FILE
if test 6291 -ne `wc -c <'dnaerror.c'`; then
    echo shar: \"'dnaerror.c'\" unpacked with wrong size!
fi
# end of 'dnaerror.c'
fi
if test -f 'printcap' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'printcap'\"
else
echo shar: Extracting \"'printcap'\" \(2633 characters\)
sed "s/^X//" >'printcap' <<'END_OF_FILE'
X# Excerpt from the /etc/printcap file on the Sun that has the Sunlink/DNA
X# license....
X
X# All command lines to dnaprint start with a #%.  If there is an "*" in
X# one of the last three fields,  that field is replaced with a "null".
X
X# Now, in this example:
X#	newvax is run by the mis department.  I'm sick of dealing with
X#	the systems manager,  so I just copied the remoteprint.com file
X#	into their default decnet account by doing a:
X#		dnaprint -u decnet -p password remotprint.com newvax::
X#	so I have to use passwords & the decnet name.
X#
X#	goofy and mickey are my toys.  Since I get along with myself,
X#	I went into NCP and defined a remote print object on those
X#	two machines.  Therefore, I have the security of being able
X#	to avoid having the password for the not-so-default default
X#	decnet account in this file.  (At ComDesign, we put a password
X#	on our default decnet account, and don't define it in the EXEC
X#	as the nonpriv user et al.  Instead, we just told our MAIL and
X#	PHONE objects the DECNET name and DECNET password.  This way,
X#	other folk can send mail and phone us, but they can't invoke a
X#	FAL unless they know the DECNET password (which I do (smile)).
X
X#	for more info, see remoteprint.com
X
X#
X#------------------------------------------------------------------------
X#
X#	Remote VMS printers
X#
X#	UNIX	remote	vms		vms server  vms server	vms server
X#	queue	VAX	queue name	username    password 	account
X#-----------------------------------------------------------------------
X#%	sft	newvax	sft$print	decnet	    password	*
X#%	sls	newvax	sls$laser	decnet	    password	*
X#%	mail	newvax	cdi$print	decnet	    password	*
X#%	market	newvax	sys$laser	decnet	    password	*
X#%	goofy	goofy	sys$print	*	    *		*
X#%	mickey	mickey	sys$print	*	    *		*
X#
Xsft|lp|sftprint|Software area C-ITOH:\
X	:lp=/dev/null:of=/usr/local/lib/dnaprint:\
X	:sd=/usr/spool/vmsprinters/sft:lf=/usr/adm/lpd-errs:fo:
Xsls|slslaser|Sales area Apple Laserwriter in 630 mode:\
X	:lp=/dev/null:of=/usr/local/lib/dnaprint:\
X	:sd=/usr/spool/vmsprinters/sls:lf=/usr/adm/lpd-errs:fo:pw#80:sh:
Xmail|cdiprint|Mail Room C-ITOH:\
X	:lp=/dev/null:of=/usr/local/lib/dnaprint:\
X	:sd=/usr/spool/vmsprinters/mail:lf=/usr/adm/lpd-errs:fo:
Xmarket|syslaser|Marketing area Apple Laserwriter in 630 mode:\
X	:lp=/dev/null:of=/usr/local/lib/dnaprint:\
X	:sd=/usr/spool/vmsprinters/market:lf=/usr/adm/lpd-errs:fo:pw#80:
Xgoofy|Goofy's LA210:\
X	:lp=/dev/null:of=/usr/local/lib/dnaprint:\
X	:sd=/usr/spool/vmsprinters/goofy:lf=/usr/adm/lpd-errs:fo:
Xmickey|Mickey's LA210:\
X	:lp=/dev/null:of=/usr/local/lib/dnaprint:\
X	:sd=/usr/spool/vmsprinters/mickey:lf=/usr/adm/lpd-errs:fo:
END_OF_FILE
if test 2633 -ne `wc -c <'printcap'`; then
    echo shar: \"'printcap'\" unpacked with wrong size!
fi
# end of 'printcap'
fi
if test -f 'otherprintcap' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'otherprintcap'\"
else
echo shar: Extracting \"'otherprintcap'\" \(583 characters\)
sed "s/^X//" >'otherprintcap' <<'END_OF_FILE'
X
X#
X#	Now, all other bsd unix machines can access the printers (even if
X#	they don't run sunlink/dna) by using entries like this:
X#
X
Xsft|lp|sftprint|Software area C-ITOH:\
X	:lp=:rm=condor:rp=sft:sd=/usr/spool/sft:lf=/usr/adm/lpd-errs:
Xsls|slslaser|Sales area Apple Laserwriter in 630 mode:\
X	:lp=:rm=condor:rp=sft:sd=/usr/spool/sls:lf=/usr/adm/lpd-errs:
Xmail|cdiprint|Mail Room C-ITOH:\
X	:lp=:rm=condor:rp=mail:sd=/usr/spool/mailpr:lf=/usr/adm/lpd-errs:
Xmarket|syslaser|Marketing area Apple Laserwriter in 630 mode:\
X	:lp=:rm=condor:rp=market:sd=/usr/spool/mail:lf=/usr/adm/lpd-errs:
END_OF_FILE
if test 583 -ne `wc -c <'otherprintcap'`; then
    echo shar: \"'otherprintcap'\" unpacked with wrong size!
fi
# end of 'otherprintcap'
fi
if test -f 'remoteprint.com' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'remoteprint.com'\"
else
echo shar: Extracting \"'remoteprint.com'\" \(1254 characters\)
sed "s/^X//" >'remoteprint.com' <<'END_OF_FILE'
X$ !++
X$ !
X$ !  REMOTEPRINT.COM
X$ !
X$ !  ABSTRACT:  Command procedure to allow remote decnet systems to print
X$ !		to local printer queues.
X$ !
X$ !	Last edit:  11/12/88 pst
X$ !
X$ !	Paul Traina	- pst at condor.cdi.com
X$ !
X$ ! Either define a known object to point to this (call it remoteprint)
X$ ! or put this in your default decnet directory.
X$ !
X$ ! If you don't define a known object for this, make sure you use the
X$ ! username and password features in dnaprint's additions to /etc/printcap.
X$ !
X$ ! if you do define a known object, here's what you want to do:
X$ !	a) copy this file someplace like sys$manager:
X$ !	b) $ run sys$system:ncp
X$ !	   NCP> define object remoteprint number 0 -
X$ !	   _NCP>	file sys$manager:remoteprint.com -
X$ !	   _NCP>	user decnet password foobar account decnet -
X$ !	   _NCP>	proxy access none
X$ !	   NCP> set object remoteprint all
X$ !	   NCP> exit
X$ !
X$ !--
X
X$ if f$mode() .eqs. "NETWORK" then goto server_mode
X$	write sys$error "This is only meant to be run as a network task."
X$	exit
X
X$ server_mode:
X$  open /read /write host_task sys$net
X$  read host_task queue_name
X$  read host_task file_name
X$  print/queue='queue_name'/delete/noburst/nofeed/noflag/noident 'file_name'.
X$  write host_task $status
X$  close host_task
END_OF_FILE
if test 1254 -ne `wc -c <'remoteprint.com'`; then
    echo shar: \"'remoteprint.com'\" unpacked with wrong size!
fi
# end of 'remoteprint.com'
fi
echo shar: End of shell archive.
exit 0

------
Paul Traina				To believe that what is true for
{uunet|pyramid}!comdesign!pst		you in your private heart is true
pst at cdi.com				for all men, that is genius.



More information about the Alt.sources mailing list