/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <termio.h>
#include "ttymon.h"
#include "tmstruct.h"
#include "tmextern.h"
#include "stty.h"
static void insert_def();
static void zero();
int check_flags();
void mkargv();
extern int Ndefs;
char *strsave();
/*
* - if id is not NULL, only get entry with that id
* - if check is TRUE, print out the entries
*/
void
char *id;
int check;
{
register char *ptr;
int len;
char oldc;
static char *states[] = {
"","tty label","Initial flags","Final flags","Autobaud","Next label"
};
extern char *getword();
return;
}
if (check) {
}
/* Start searching for the line with the proper "id". */
do {
line[0] = '\0';
break;
}
*ptr = '\0';
/* skip rest of the line */
log("Entry too long.");
;
}
}
/* if empty line, skip */
;
if (*ptr == '\0') continue;
/* Now we have the complete line */
/* Initialize "def" and "gptr". */
state = T_TTYLABEL;
if (*ptr != ':') {
} else {
ptr++; /* Skip the ':' */
state++ ;
}
/* If "id" != NULL, and it does not match, go to next entry */
continue;
if (check) {
}
switch(state) {
case T_IFLAGS:
} else {
ptr++;
state++ ;
}
break;
case T_FFLAGS:
} else {
ptr++;
state++ ;
}
break;
case T_AUTOBAUD:
if (size > 1) {
break;
}
if (size == 1) {
if (*d_autobaud == 'A')
else {
break;
}
}
if (*ptr != ':') {
} else {
ptr++; /* Skip the ':' */
state++ ;
}
break;
case T_NEXTLABEL:
if (*ptr != '\0') {
break;
} /* end switch */
} /* end for loop */
if (check) {
log("autobaud:\tyes");
else
log("autobaud:\tno");
}
else {
log("can't add more entries to ttydefs table, "
" Maximum entries = %d", MAXDEFS);
return;
}
return;
}
}
else {
*++ptr = '\0';
log("Parsing failure in the \"%s\" field\n"
}
return;
}
/*
* zero - zero out the buffer
*/
static void
register char *adr;
register int size;
{
}
/*
* find_def(ttylabel)
* - scan Gdef table for an entry with requested "ttylabel".
* - return a Gdef ptr if entry with "ttylabel" is found
* - return NULL if no entry with matching "ttylabel"
*/
struct Gdef *
char *ttylabel;
{
int i;
return(tp);
}
}
return(NULL);
}
/*
* check_flags - check to see if the flags contains options that are
* recognizable by stty
* - return 0 if no error. Otherwise return -1
*/
int
char *flags;
{
int term;
extern char *sttyparse();
/* put flags into buf, because strtok will break up buffer */
/*
* because we don't know what type of terminal we have now,
* just set term = everything, so all possible stty options
* are accepted
*/
return(-1);
}
return(0);
}
/*
* insert_def - insert one entry into Gdef table
*/
static void
{
return;
}
Ndefs++;
return;
}
/*
* mkargv - parse the string into args, starting from args[cnt]
*/
void
{
register int i;
int qsize;
extern char quoted();
/* Skip excess white spaces between arguments. */
ptrin++;
ptrout++;
}
/* Save the address of argument if there is something there. */
if (*ptrin == '\0') break;
/* Span the argument itself. The '\' character causes quoting */
/* of the next character to take place (except for '\0'). */
while (*ptrin != '\0') {
if (*ptrin == '\\') {
/* Is this the end of the argument? If so quit loop. */
ptrin++;
break;
/* If this is a normal letter of the argument, save it, advancing */
/* the pointers at the same time. */
}
/* Null terminate the string. */
*ptrout++ = '\0';
}
(*cnt) += i;
}
#ifdef DEBUG
/*
* dump_ttydefs - dump Gdef table to log file
*/
void
{
int i;
log("********** dumping ttydefs table **********");
log(" ");
log("----------------------------------------");
log("autobaud:\tyes");
else
log("Autobaud:\tno");
log(" ");
}
log("********** end dumping ttydefs table **********");
return;
}
#endif
/*
* and is modified that if malloc fails, it will exit
*/
char *
register char *str;
{
register char *rval;
log("strsave: malloc failed");
exit(1);
}
*rval = '\0';
}
else {
log("strsave: malloc failed");
exit(1);
}
}
return(rval);
}