|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* sysdep.h Header file for the really system dependant routines
|
|
Packit |
15a96c |
* in sysdep1.c and sysdep2.c. Because of this, the
|
|
Packit |
15a96c |
* header file "port.h" is not used when "sysdep.h" is
|
|
Packit |
15a96c |
* included. This file is only included from sysdep[12].c
|
|
Packit |
15a96c |
* anyway!
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* $Id: sysdep.h,v 1.6 2008-03-21 20:27:56 al-guest Exp $
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* This file is part of the minicom communications package,
|
|
Packit |
15a96c |
* Copyright 1991-1995 Miquel van Smoorenburg.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* This program is free software; you can redistribute it and/or
|
|
Packit |
15a96c |
* modify it under the terms of the GNU General Public License
|
|
Packit |
15a96c |
* as published by the Free Software Foundation; either version
|
|
Packit |
15a96c |
* 2 of the License, or (at your option) any later version.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* You should have received a copy of the GNU General Public License along
|
|
Packit |
15a96c |
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit |
15a96c |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#ifdef HAVE_FEATURES_H
|
|
Packit |
15a96c |
#include <features.h>
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#include <sys/types.h>
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Include standard Posix header files. */
|
|
Packit |
15a96c |
#ifdef HAVE_UNISTD_H
|
|
Packit |
15a96c |
# include <stdlib.h>
|
|
Packit |
15a96c |
# include <unistd.h>
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifdef HAVE_SYS_WAIT_H /* coherent 3 doesn't have it ? */
|
|
Packit |
15a96c |
# include <sys/wait.h>
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
/* Now see if we need to use sgtty, termio or termios. */
|
|
Packit |
15a96c |
#ifdef _SCO
|
|
Packit |
15a96c |
# define _IBCS2 /* So we get struct winsize :-) */
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifdef POSIX_TERMIOS
|
|
Packit |
15a96c |
# include <termios.h>
|
|
Packit |
15a96c |
#else
|
|
Packit |
15a96c |
# ifdef HAVE_TERMIO_H
|
|
Packit |
15a96c |
# include <termios.h>
|
|
Packit |
15a96c |
# else
|
|
Packit |
15a96c |
# define _V7
|
|
Packit |
15a96c |
# ifdef HAVE_SGTTY_H
|
|
Packit |
15a96c |
# include <sgtty.h>
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifdef HAVE_SYS_IOCTL_H
|
|
Packit |
15a96c |
# include <sys/ioctl.h>
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* And more "standard" include files. */
|
|
Packit |
15a96c |
#include <stdio.h>
|
|
Packit |
15a96c |
#include <setjmp.h>
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Be sure we know WEXITSTATUS and WTERMSIG */
|
|
Packit |
15a96c |
#if !defined(_BSD43)
|
|
Packit |
15a96c |
# ifndef WEXITSTATUS
|
|
Packit |
15a96c |
# define WEXITSTATUS(s) (((s) >> 8) & 0377)
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
# ifndef WTERMSIG
|
|
Packit |
15a96c |
# define WTERMSIG(s) ((s) & 0177)
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Some ancient SysV systems don't define these */
|
|
Packit |
15a96c |
#ifndef VMIN
|
|
Packit |
15a96c |
# define VMIN 4
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifndef VTIME
|
|
Packit |
15a96c |
# define VTIME 5
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifndef IUCLC
|
|
Packit |
15a96c |
# define IUCLC 0
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifndef IXANY
|
|
Packit |
15a96c |
# define IXANY 0
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Different names for the same beast. */
|
|
Packit |
15a96c |
#ifndef TIOCMODG /* BSD 4.3 */
|
|
Packit |
15a96c |
# ifdef TIOCMGET
|
|
Packit |
15a96c |
# define TIOCMODG TIOCMGET /* Posix */
|
|
Packit |
15a96c |
# else
|
|
Packit |
15a96c |
# ifdef MCGETA
|
|
Packit |
15a96c |
# define TIOCMODG MCGETA /* HP/UX */
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#ifndef TIOCMODS
|
|
Packit |
15a96c |
# ifdef TIOCMSET
|
|
Packit |
15a96c |
# define TIOCMODS TIOCMSET
|
|
Packit |
15a96c |
# else
|
|
Packit |
15a96c |
# ifdef MCSETA
|
|
Packit |
15a96c |
# define TIOCMODS MCSETA
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#ifndef TIOCM_CAR /* BSD + Posix */
|
|
Packit |
15a96c |
# ifdef MDCD
|
|
Packit |
15a96c |
# define TIOCM_CAR MDCD /* HP/UX */
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Define some thing that might not be there */
|
|
Packit |
15a96c |
#ifndef TANDEM
|
|
Packit |
15a96c |
# define TANDEM 0
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifndef BITS8
|
|
Packit |
15a96c |
# define BITS8 0
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifndef PASS8
|
|
Packit |
15a96c |
# ifdef LLITOUT
|
|
Packit |
15a96c |
# define PASS8 LLITOUT
|
|
Packit |
15a96c |
# else
|
|
Packit |
15a96c |
# define PASS8 0
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#ifndef CRTSCTS
|
|
Packit |
15a96c |
# define CRTSCTS 0
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* If this is SysV without Posix, emulate Posix. */
|
|
Packit |
15a96c |
#if defined(_SYSV)
|
|
Packit |
15a96c |
#if !defined(_POSIX) || !defined(HAVE_TERMIOS_H)
|
|
Packit |
15a96c |
# define termios termio
|
|
Packit |
15a96c |
# ifndef TCSANOW
|
|
Packit |
15a96c |
# define TCSANOW 0
|
|
Packit |
15a96c |
# endif
|
|
Packit |
15a96c |
# define tcgetattr(fd, tty) ioctl(fd, TCGETA, tty)
|
|
Packit |
15a96c |
# define tcsetattr(fd, flags, tty) ioctl(fd, TCSETA, tty)
|
|
Packit |
15a96c |
# define tcsendbreak(fd, len) ioctl(fd, TCSBRK, 0)
|
|
Packit |
15a96c |
# define speed_t int
|
|
Packit |
15a96c |
# define cfsetispeed(xtty, xspd) \
|
|
Packit |
15a96c |
((xtty)->c_cflag = ((xtty)->c_cflag & ~CBAUD) | (xspd))
|
|
Packit |
15a96c |
# define cfsetospeed(tty, spd)
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Redefine cfset{i,o}speed for Linux > 1.1.68 && libc < 4.5.21 */
|
|
Packit |
15a96c |
#if defined (__GLIBC__) && defined(CBAUDEX)
|
|
Packit |
15a96c |
# undef cfsetispeed
|
|
Packit |
15a96c |
# undef cfsetospeed
|
|
Packit |
15a96c |
# define cfsetispeed(xtty, xspd) \
|
|
Packit |
15a96c |
((xtty)->c_cflag = ((xtty)->c_cflag & ~CBAUD) | (xspd))
|
|
Packit |
15a96c |
# define cfsetospeed(tty, spd)
|
|
Packit |
15a96c |
#endif
|