Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* laserjet 4, jetdirect card and ultrix
@ 1993-12-01 14:03 Andre Schroeter
  1993-12-02 14:24 ` Patrick J Bergan
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Schroeter @ 1993-12-01 14:03 UTC (permalink / raw)


hallo,
i'm searching for drivers to print to a lj4 with a jet direct card from
ultrix.

who can help me??

thank you
  andre schroeter 
-- 
--------------------------------------------------------------------------------
Andre Schroeter                         German Cancer Research Center
tel.: (+49) 6221 - 42 2382              Dept. Medical and Biological Informatics
fax.: (+49) 6221 - 42 2345              Im Neuenheimer Feld 280
e-mail: A.Schroeter@DKFZ-Heidelberg.de  D-69120 Heidelberg, Germany
--------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: laserjet 4, jetdirect card and ultrix
  1993-12-01 14:03 laserjet 4, jetdirect card and ultrix Andre Schroeter
@ 1993-12-02 14:24 ` Patrick J Bergan
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick J Bergan @ 1993-12-02 14:24 UTC (permalink / raw)


In <1993Dec1.150351.11039@roxi.rz.fht-mannheim.de> andre@borneo.dkfz-heidelberg.de (Andre Schroeter) writes:

>i'm searching for drivers to print to a lj4 with a jet direct card from
>ultrix.

>who can help me??


Here you go.

-----------------------------------------------------------
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * by the University of California, Berkeley.  The name of the
 * University may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)hplaserf.c    5.3 (Berkeley) 6/30/88";
#endif /* not lint */

/*
 *      Filter that prints on a network print server.
 *      The account file name is actually the hostname for the printer
 *      It expects a line like:
 *              hplaser          9100/tcp
 *      in the /etc/services file
 *      and an entry as follows in /etc/printcap
	hp|hp laserjetIII:\
		:lp=/dev/null:sd=/usr/spool/hplaserd:lf=/var/log/lpd-errs:\
		:if=/usr/libexec/lpr/hplaserf:\
		:cf=/usr/libexec/lpr/hpsinglef:\
		:vf=/usr/libexec/lpr/hpreversef:\
		:mx#10000:
 *	where hplaserf, hpsinglef and hpreversef are all links to the a.out
 *	for this program.
 *	This overloads the lpr command options such that:
 *		-v	prints in landscape
 *	and	-c	prints single sided (the default is duplex)
 */

#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <signal.h>
#include <syslog.h>
#include <sys/errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

#define LINSIZ  2048

#define	RETRYIT 1
#define notyet

extern int errno;
char    buf[LINSIZ+1];
char    *name;          /* user's login name */
char    *host;          /* user's machine name */
char    *acctfile=NULL;      /* accounting information file */

main(argc, argv)
        int argc;
        char *argv[];
{
        register FILE *p = stdin, *sof;
        register int i, so;
        register char *cp;
        struct sockaddr_in saddr;
        struct hostent *hp;
        struct servent *sp;
        long timev;
        struct tm *tp;
	int tryagain;
	char *initstr;

	/*
	 * The process name determines the printer configuration:
	 * hplaserf - both sides, long bind (same way up)
	 * hpsinglef - single sided
	 * hpreversef - both sides, short bind (back page upside down)
	 */
	if (strcmp(*argv, "hpsinglef") == 0)
		initstr = "statusdict begin\nfalse setduplexmode\n";
	else if (strcmp(*argv, "hpreversef") == 0)
		initstr = "statusdict begin\ntrue settumble\n";
	else
		initstr = (char *)0;
        while (--argc) {
                if (*(cp = *++argv) == '-') {
                        switch (cp[1]) {
                        case 'n':
                                argc--;
                                name = *++argv;
                                break;

                        case 'h':
                                argc--;
                                host = *++argv;
                                break;

                        case 'w':
                                break;

                        case 'l':
                                break;

                        case 'i':
                                break;

                        case 'c':       /* Print control chars */
                                break;
                        }
                } else if (acctfile == NULL) /* first non-switched arg only */
                        acctfile = cp;
        }

        openlog("Hplaser: ", LOG_PID, LOG_ERR);
        /* Set up the socket */
    do {
        if ((so = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
                syslog(LOG_ERR, "Can't create socket");
                exit(RETRYIT);
        }
#ifdef notyet
        if ((hp = gethostbyname(acctfile)) == NULL) {
                syslog(LOG_ERR, "Can't get hostname '%s'",acctfile);
                exit(RETRYIT);
        }
#else
        saddr.sin_addr.s_addr = inet_addr("129.186.2.132");
#endif
        if ((sp = getservbyname("hplaser", "tcp")) == NULL) {
                syslog(LOG_ERR, "Can't find portnum");
                exit(RETRYIT);
        }
        saddr.sin_family = AF_INET;
#ifdef notyet
        bcopy(hp->h_addr, &saddr.sin_addr, hp->h_length);
#endif
        saddr.sin_port = sp->s_port;

        /*
	 * Try to connect:
	 * - if the connection fails loop so that lpd will try again
         */
        if (connect(so, &saddr, sizeof(saddr)) < 0) {
		shutdown(so, 2);
		close(so);
		tryagain = 1;
	} else
		tryagain = 0;
    } while (tryagain);

        /*
	 * Send initialization string, if any
         */
        if (initstr && write(so, initstr, strlen(initstr)) < 0) {
                syslog(LOG_ERR, "Can't write to socket");
                exit(RETRYIT);
        }

        /*
         * Send the file
         */
        while ((i = fread(buf, sizeof(char), LINSIZ, p)) > 0) {
                if (write(so, buf, i) < 0) {
                        syslog(LOG_ERR, "Write failed");
                        exit(RETRYIT);
                }
        }
        close(so);
        exit(0);
}

---------------------------------------------------------------
pbergan@iastate.edu

-- 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1993-12-02 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-12-01 14:03 laserjet 4, jetdirect card and ultrix Andre Schroeter
1993-12-02 14:24 ` Patrick J Bergan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox