/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "termio.h"
#include "dial.h"
#include "unistd.h"
#include "lpsched.h"
static void sigalrm(int);
static int push_module(int, char *, char *);
static int SigAlrm;
/*
* open_dialup() - OPEN A PORT TO A ``DIAL-UP'' PRINTER
*/
int
{
static char *baud_table[] = {
0,
"50",
"75",
"110",
"134",
"150",
"200",
"300",
"600",
"1200",
"1800",
"2400",
"4800",
"9600",
"19200",
"38400",
"57600",
"76800",
"115200",
"153600",
"230400",
"307200",
"460800",
"921600"
};
char *sspeed;
speed = -1;
/*
* "dial()" doesn't guarantee which file descriptor
* it uses when it opens the port, so we probably have to
* move it.
*/
if (fd != 1) {
}
/*
* The "printermgmt()" routines move out of ".stty"
* anything that looks like a baud rate, and puts it
* in ".speed", if the printer port is dialed. Thus
* we are saved the task of cleaning out spurious
* baud rates from ".stty".
*
* However, we must determine the baud rate and
* concatenate it onto ".stty" so that that we can
* override the default in the interface progam.
* Putting the override in ".stty" allows the user
* to override us (although it would be probably be
* silly for him or her to do so.)
*/
}
{
/*
* We can trash "pp->stty" because
* the parent process has the good copy.
*/
}
}
return (0);
}
/*
* open_direct() - OPEN A PORT TO A DIRECTLY CONNECTED PRINTER
*/
int
{
char *device;
/*
* Set an alarm to wake us from trying to open the port.
* We'll try at least 60 seconds, or more if the printer
* has a huge buffer that, in the worst case, would take
* a long time to drain.
*/
if (newalarm < 60)
newalarm = 60;
if (is_printer_uri(device) == 0) {
/*
* if it's a device uri and the endpoint contains a valid
* the backend. If not, the uri isn't associated with a
*/
}
/*
* The following open must be interruptable.
* O_APPEND is set in case the ``port'' is a file.
* O_RDWR is set in case the interface program wants
* to get input from the printer. Don't fail, though,
* just because we can't get read access.
*/
SigAlrm = 0;
return (EXEC_EXIT_NPORT);
else if (SigAlrm)
return (EXEC_EXIT_TMOUT);
}
/*
* Lock the file in case two "printers" are defined on the
*/
return (EXEC_EXIT_NPORT);
}
/*
* We should get the correct channel number (1), but just
* in case....
*/
if (fd != 1) {
}
/*
* Handle streams modules:
*/
/*
* for some unknown reason, lpsched appears to pop the streams
* modules off the device and push back some "default" ones,
* unless a specific set were specified with the printer configuration.
* This behaviour causes problems with the ECPP port, so if we have
* an ECPP port, and nobody specified a set of modules to use, we
* should leave it alone. Normally, we would not bother to play with
* the streams modules, but it is possible that someone has come
* to rely on this behaviour for other devices.
*/
/* if "nopush" is supplied, leave the modules alone */
/*
* If we have a stream and a list of modules to use, then pop the old
* modules and push the new ones.
*/
/*
* First, pop all current modules off, unless
* instructed not to.
*/
;
/*
* Now push either the administrator specified modules
* or the standard modules, unless instructed to push
* nothing.
*/
return (0);
while (*modules)
return (EXEC_EXIT_NPUSH);
}
return (0);
}
/*
* sigalrm()
*/
static void
{
SigAlrm = 1;
}
/*
* push_module()
*/
static int
{
if (ret == -1)
return (ret);
}