cyclades-serial-client-0.93ubuntu1/ 0000775 0000000 0000000 00000000000 13032075072 014200 5 ustar cyclades-serial-client-0.93ubuntu1/config.sub 0000775 0000000 0000000 00000106477 13032075072 016202 0 ustar #! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2016-03-30'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to .
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help"
exit 1 ;;
*local*)
# First pass through any local machine types.
echo $1
exit ;;
* )
break ;;
esac
done
case $# in
0) echo "$me: missing argument$help" >&2
exit 1;;
1) ;;
*) echo "$me: too many arguments$help" >&2
exit 1;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
-mint | -mint[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | j90)
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
decsystem10* | dec10*)
basic_machine=pdp10-dec
os=-tops10
;;
decsystem20* | dec20*)
basic_machine=pdp10-dec
os=-tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32)
basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe)
basic_machine=m68000-convergent
;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i686-pc
os=-msys
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
nonstopux)
basic_machine=mips-compaq
os=-nonstopux
;;
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
openrisc | openrisc-*)
basic_machine=or32-unknown
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
;;
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
pw32)
basic_machine=i586-unknown
os=-pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
basic_machine=sv1-cray
os=-unicos
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
;;
t90)
basic_machine=t90-cray
os=-unicos
;;
tile*)
basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
toad1)
basic_machine=pdp10-xkl
os=-tops20
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
v810 | necv810)
basic_machine=v810-nec
os=-none
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp10)
# there are many clones, so DEC is not a safe bet
basic_machine=pdp10-unknown
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
x86-* | i*86-*)
;;
*)
os=-nto$os
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*)
os=-sysv
;;
-nova*)
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
;;
-nsk*)
os=-nsk
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-ios)
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn)
os=-riscix1.2
;;
arm*-rebel)
os=-linux
;;
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
c8051-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
;;
m68*-cisco)
os=-aout
;;
mep-*)
os=-elf
;;
mips*-cisco)
os=-elf
;;
mips*-*)
os=-elf
;;
or32-*)
os=-coff
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
*-winbond)
os=-proelf
;;
*-oki)
os=-proelf
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigaos
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f30[01]-fujitsu | f700-fujitsu)
os=-uxpv
;;
*-rom68k)
os=-coff
;;
*-*bug)
os=-coff
;;
*-apple)
os=-macos
;;
*-atari*)
os=-mint
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-cnk*|-aix*)
vendor=ibm
;;
-beos*)
vendor=be
;;
-hpux*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
-hms*)
vendor=hitachi
;;
-mpw* | -macos*)
vendor=apple
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari
;;
-vos*)
vendor=stratus
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
cyclades-serial-client-0.93ubuntu1/cyclades-devices 0000664 0000000 0000000 00000002031 07700721252 017331 0 ustar #
# TSRDEV - Serial Port Interface for Cyclades Terminal Servers
# tsrdevices - Device to serial port mapping
#
# Entry Syntax:
#
# devname:rastype:rasname:physport:type:options
#
# where :
# devname -> Device full pathname
# rastype -> Terminal server type (path or prts)
# rasname -> Terminal server host name
# physport -> Physical port (0 => rasname = IP-based addressing)
# type -> Server type : rtelnet or socket
# opts -> per-port interface options (optional)
#
# Ex1 : Device on a PR3020 Terminal Server pr3k Port 1, accessed through
# /dev/ctty01 device, using telnet protocol (remote telnet server)
#
#/dev/ctty01:prts:pr3k:1:rtelnet:
#
# Ex2 : The same device, but with an IP address pr3k_port1 associated to the
# serial port
#
#/dev/ctty01:prts:pr3k_port1:0:rtelnet:
#
# Ex3 : Device on a PathRAS Terminal Server pras Port 2, accessed through
# /dev/ctty02 device, using socket protocol (socket server)
#
#/dev/ctty02:path:pras:2:socket:
# for Linux
/dev/modem:path:localhost:1:socket:
#
# for AIX
#/dev/prt1:pr:1:rtelnet:
cyclades-serial-client-0.93ubuntu1/measure.c 0000664 0000000 0000000 00000003553 07707263606 016031 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* measure.c
* Activity measure
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
# include
# include
# include
# define _TSR_MEASURE_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrmeasure.h"
# ifdef TSR_MEASURE
/*
* Internal Variables
*/
static int progst;
static int progend;
void
start_measure(void)
{
struct tms ts;
progst = times(&ts);
}
void
cpu_measure(int all)
{
struct tms ts;
int usr, sys, tot, pru, prs, prt, msecu, msecs, msect, secs;
progend = times(&ts);
usr = (int) ts.tms_utime;
sys = (int) ts.tms_stime;
tot = progend - progst;
pru = usr * 100 / tot;
prs = sys * 100 / tot;
prt = pru + prs;
msecu = 1000 * usr / HZ;
msecs = 1000 * sys / HZ;
msect = msecu + msecs;
printf ("%s: \n\
%5d ms (%2d%%) user, %5d ms (%2d%%) sys, %5d ms (%3d%%) total\n",
Idmsg, msecu, pru, msecs, prs, msect, prt);
if (all) {
secs = tot / HZ;
if (secs == 0) secs = 1;
if (devreads == 0) devreads = 1;
if (devwrites == 0) devwrites = 1;
if (netreads == 0) netreads = 1;
if (netwrites == 0) netwrites = 1;
printf ( "%s:\n\
devrds : %6d (%6d null) , %3d reads/sec, %.2f bytes/read)\n\
devwrs : %6d (%6d null) , %3d writes/sec, %.2f bytes/write)\n",
Idmsg,
devreads, devnreads, devreads/secs, (double) devrbytes/devreads,
devwrites, devnwrites, devwrites/secs, (double) devwbytes/devwrites);
printf ( "%s:\n\
netrds : %6d (%6d null) , %3d reads/sec, %.2f bytes/read)\n\
netwrs : %6d (%6d null) , %3d writes/sec, %.2f bytes/write)\n",
Idmsg,
netreads, netnreads, netreads/secs, (double) netrbytes/netreads,
netwrites, netnwrites, netwrites/secs, (double) netwbytes/netwrites);
printf ( "%s:\n\
scheds : %6d (%3d scheds/sec)\n",Idmsg,
ioscheds, ioscheds/secs);
}
}
# endif
cyclades-serial-client-0.93ubuntu1/aix-dev.c 0000664 0000000 0000000 00000052706 07713631527 015727 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* dev.c
* Unix Pty Device routines
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* 05/09/2002 V.1.0.1
* More debug info on dev_getdata
* Correct handling of large messages (Atacacao)
*/
/* Open / stat includes */
# include
# include
# include
/* Errno */
# include
# include
# include
/* Termio */
# ifdef USE_TERMIO
# include
# endif
/* Termios */
# ifdef USE_TERMIOS
# include
# endif
/* STREAMS ioctl */
# include
# include
# include
# undef _KERNEL
/* Tiocsignal */
# include
# define _TSR_DEV_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/dev.h"
#include "inc/port_speed.h"
#ifdef TSR_MEASURE
#include "inc/tsrmeasure.h"
#endif
/*
* Packet mode routines
*/
void parse_message (unsigned char type, char *buf, int size);
void parse_packet (int type);
/*
* Termio / Termios routines
*/
void parse_ioctl(int ioctype, void *iocdata);
void parse_termios(int mode, struct termios *tp);
void parse_termio(int mode, struct termio *tp);
void parse_break(int *interval);
void parse_iocflush(int *queues);
int termio_to_portmodes(struct termio *tp);
void termio_to_portconfig(struct termio *tp, struct portconfig *pcp);
int termios_to_portmodes(struct termios *tp);
void termios_to_portconfig(struct termios *tp, struct portconfig *pcp);
void portconfig_to_termios (struct portconfig *pcp, struct termios *tp);
/*
* Debug routines
*/
void print_msg(int type, unsigned char *buf, int size);
char * ioctl_name (int type, void *arg);
/*
* Internal Variables
*/
char P_sname[NAMESIZE];
int Lasttype = -1;
char Ctlbuf[16], Databuf[DEV_MAXIOSZ];
struct strpeek Message;
/*
* STREAMS Pseudo-TTY Device Stuff
*/
# define PTY_DEVICE "/dev/ptc"
int
dev_getaddr(char *dname)
{
int fd;
int mode;
char * stty;
int found;
struct stat statb;
if(lstat(dname, &statb) >= 0)
{ /* File exists */
if(S_ISLNK(statb.st_mode))
{
sysmessage(MSG_WARNING, "Removing old sym-link \"%s\".\n", dname);
unlink(dname);
}
else if(!S_ISCHR(statb.st_mode))
{
sysmessage (MSG_ERR, "%s already exists\n",
dname);
return (E_PARMINVAL);
}
} else if (errno != ENOENT) { /* generic stat error */
sysmessage (MSG_ERR, "Can't lstat %s : %s\n",
dname, strerror (errno));
return (E_FILEIO);
}
mode = O_RDWR;
# ifdef USE_POSIX_NONBLOCK
mode |= O_NONBLOCK;
# elif defined USE_STD_NDELAY
mode |= O_NDELAY;
# endif
/*
* Warning: most PTY implementation puts master side as controlling terminal if
* O_NOCTTY is not set !!!
*/
mode |= O_NOCTTY;
if ((fd = open (PTY_DEVICE, mode)) < 0) {
sysmessage (MSG_ERR, "Can't open ptc : %s\n",
strerror (errno));
return (E_FILEIO);
}
# ifdef USE_FIONBIO
mode = 1;
if (ioctl (fd, FIONBIO, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't set non-block on master pty : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# endif
mode = 1;
if (ioctl (fd, TIOCPKT, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't put master pty in packet mode: %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
found = FALSE;
if ((stty = ttyname(fd)) != (char *) NULL) {
if (unlockpt(fd) >= 0) {
if (link(stty, dname) == 0) {
found = TRUE;
sysmessage(MSG_NOTICE,
"Using %s pseudo-tty \n",
stty);
} else {
sysmessage (MSG_ERR,
"Can't link dev : %s\n",
strerror (errno));
}
} else {
sysmessage (MSG_ERR,
"Can't unlock ptc : %s\n",
strerror (errno));
}
} else {
sysmessage (MSG_ERR, "Can't get ptc ttyname\n");
}
if (found == FALSE) {
(void) close(fd);
return (E_FILEIO);
}
P_mfd = fd;
strcpy (P_sname, stty);
strcpy (P_devname, dname);
return (E_NORMAL);
}
void
dev_free(void)
{
(void) close (P_sfd);
P_sfd = -1;
return;
}
int
dev_init(int iosize, int devmodem, int closemode, struct buffer *ibp,
struct buffer *obp, struct comport *cp)
{
int ret;
Pty.portmodes = 0;
if (devmodem == DEV_LOCAL) {
Pty.portmodes = PORT_CLOCAL;
}
if (closemode == CLOSE_HANG) {
Pty.portmodes |= PORT_HUPCL;
}
Pty.portmodes |= PORT_IGNBRK | PORT_IGNPAR;
Pty.iosize = iosize;
Pty.inbuff = ibp;
Pty.outbuff = obp;
Pty.comport = cp;
return (E_NORMAL);
}
int
dev_config (void)
{
int sfd;
struct termios tios;
struct portconfig * pcp = &Pty.comport->portconfig;
int modes = Pty.portmodes;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
int flags = 0;
sysmessage(MSG_NOTICE,"Opening %s pseudo-tty\n", P_sname);
if ((sfd = open (P_sname, O_RDWR|O_NOCTTY)) == -1) {
sysmessage (MSG_ERR, "Can't open slave device : %s\n",
strerror (errno));
return (E_FILEIO);
}
memset ((void *) &tios, 0, sizeof (struct termios));
portconfig_to_termios (pcp, &tios);
tios.c_cflag |= CREAD;
tios.c_lflag |= NOFLSH;
/* PTY modes */
if (modes & PORT_HUPCL) {
tios.c_cflag |= HUPCL;
}
if (modes & PORT_CLOCAL) {
tios.c_cflag |= CLOCAL;
}
if (modes & PORT_IGNBRK) {
tios.c_iflag |= IGNBRK;
}
if (modes & PORT_IGNPAR) {
tios.c_iflag |= IGNPAR;
}
if (tcsetattr (sfd, TCSANOW, &tios) == -1) {
sysmessage (MSG_ERR, "Can't set termios : %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
P_sfd = sfd;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 1;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
(void) getmsg (P_mfd, ctlmsg, datamsg, &flags);
return (E_NORMAL);
}
int
dev_closeslave(void)
{
if (Pty.state == PTY_OPER && P_sfd != -1) {
sysmessage(MSG_NOTICE,"Closing %s pseudo-tty \n",
P_sname);
(void) close (P_sfd);
P_sfd = -1;
}
return (E_NORMAL);
}
int
dev_probe(void)
{
int ctllen, datalen;
int retc;
int clocal = 0;
int retmsg;
unsigned char type;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
struct termio * tio;
struct termios * tios;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 1;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
Message.flags = 0;
if ((retc = ioctl (P_mfd, I_PEEK, (void *) &Message)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
if (ctllen == 1) {
type = ctlmsg->buf[0];
} else if (datalen > 0) {
type = datamsg->buf[0];
} else {
type = TIOCPKT_DATA;
}
if (Debug > 2) {
sysmessage (MSG_DEBUG,
"PROBE: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X, rt %d\n",
ctllen, type, datalen, Message.flags, retc);
}
retmsg = PROBE_GENERIC;
if (type == TIOCPKT_DATA) {
if (datalen != 0) {
retmsg = PROBE_DATA;
} else {
retmsg = PROBE_EOF;
}
} else {
if (type & (TIOCPKT_FLUSHREAD|TIOCPKT_FLUSHWRITE)) {
retmsg = PROBE_FLUSH;
} else {
retmsg = PROBE_GENERIC;
}
}
if (Debug > 1) {
sysmessage (MSG_DEBUG, "PROBE: msg %d\n", retmsg);
}
return (retmsg);
}
int
dev_getdata(void)
{
int ctllen, datalen;
int retc;
int flags = 0;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
unsigned char type;
char * dbuf;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 1;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
if ((retc = getmsg (P_mfd, ctlmsg, datamsg, &flags)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
# ifdef TSR_MEASURE
devnreads++;
# endif
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
dbuf = datamsg->buf;
if (Debug > 2) {
sysmessage (MSG_DEBUG,
" DATA: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X, rt %d\n",
ctllen, type, datalen, flags, retc);
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "CTL: ");
for (i = 0; i < ctllen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) ctlmsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
sprintf(debbuf, "DAT: ");
for (i = 0; i < datalen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) datamsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
}
if (ctllen == 1) {
type = ctlmsg->buf[0];
} else if (datalen > 0) {
if (Lasttype != -1) {
type = Lasttype;
} else {
type = datamsg->buf[0];
dbuf++;
datalen--;
}
if (retc & MOREDATA) {
sysmessage (MSG_DEBUG,
"dev_getdata: A truncated message was received\n");
Lasttype = type;
} else {
Lasttype = -1;
}
} else {
type = TIOCPKT_DATA;
}
parse_message (type, dbuf, datalen);
return (0);
}
int
dev_putdata(struct buffer *bp)
{
struct pty * pty = &Pty;
int ret;
int size;
int frombuf;
while (bp->b_hold) {
size = min (bp->b_hold, pty->iosize);
if ((ret = write (P_mfd, bp->b_rem, size)) == -1) {
if (errno == EAGAIN) {
ret = 0;
} else {
sysmessage(MSG_ERR,
"Can't write on master pty: %s\n",
strerror(errno));
}
# ifdef TSR_MEASURE
devnwrites++;
# endif
return (ret);
}
# ifdef TSR_MEASURE
devwrites++;
devwbytes += ret;
# endif
FORWARD_BUFFER(bp, ret);
}
if (bp->b_hold == 0) {
RESET_BUFFER(bp);
}
return (0);
}
void
dev_interrupt(void)
{
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
ctlmsg->len = 1;
ctlmsg->buf[0] = M_SIG;
datamsg->len = 1;
datamsg->buf[0] = SIGINT;
if (putmsg (P_mfd, ctlmsg, datamsg, RS_HIPRI) == -1) {
sysmessage (MSG_ERR,
"Can't send SIGINT to slave device : %s\n",
strerror (errno));
}
}
void
dev_hangup(void)
{
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
ctlmsg->len = 1;
ctlmsg->buf[0] = M_SIG;
datamsg->len = 1;
datamsg->buf[0] = SIGHUP;
if (putmsg (P_mfd, ctlmsg, datamsg, RS_HIPRI) == -1) {
sysmessage (MSG_ERR,
"Can't send SIGHUP to slave device : %s\n",
strerror (errno));
}
}
/*
* Packet mode routines
*/
void
parse_message (unsigned char type, char *buf, int size)
{
char * msgt;
int i;
struct iocblk * iocp;
struct buffer * bp = Pty.inbuff;
if (size != 0) {
switch (Pty.state) {
case PTY_CLOSED:
case PTY_OPERRONLY:
SET_EVENT(EV_UP, EV_UPOPEN, 0, 0);
break;
}
}
if (type == TIOCPKT_DATA) {
# ifdef TSR_MEASURE
devreads++;
devrbytes += size;
# endif
if (size == 0) {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
} else {
COPY_TO_BUFFER(bp, buf, size);
SET_EVENT(EV_UP, EV_UPDATA, 0, 0);
}
} else {
parse_packet((int) type);
}
}
void
parse_packet (int type)
{
int flushbits;
int flushmode;
flushbits = type & (TIOCPKT_FLUSHREAD|TIOCPKT_FLUSHWRITE);
if (flushbits) {
switch (flushbits) {
case TIOCPKT_FLUSHREAD:
flushmode = OPFLUSH_IN;
break;
case TIOCPKT_FLUSHWRITE:
flushmode = OPFLUSH_OUT;
break;
default:
flushmode = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPFLUSH, (void *) &flushmode, sizeof(int));
}
}
/*
* Termio / Termios routines
*/
void
parse_ioctl (int ioctype, void *iocdata)
{
switch (ioctype) {
case TCSETA:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAW:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAF:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSBRK:
parse_break((int *) iocdata);
break;
case TCFLSH:
parse_iocflush((int *) iocdata);
break;
case TCSETS:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSW:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSF:
parse_termios(ioctype, (struct termios *) iocdata);
break;
default:
sysmessage(MSG_WARNING, "Unsupported ioctl: %c %d\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF);
}
}
void
parse_termio(int mode, struct termio *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETA:
iocp->io_oper = OP_SETNOW;
break;
case TCSETAW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETAF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termio_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termio_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_termios(int mode, struct termios *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETS:
iocp->io_oper = OP_SETNOW;
break;
case TCSETSW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETSF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termios_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termios_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_break(int *interval)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_SENDBREAK;
iocp->io_arg = *interval;
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_iocflush(int *queues)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_FLUSH;
switch (*queues) {
case TCIFLUSH:
iocp->io_arg = OPFLUSH_IN;
break;
case TCOFLUSH:
iocp->io_arg = OPFLUSH_OUT;
break;
case TCIOFLUSH:
iocp->io_arg = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
int
termio_to_portmodes(struct termio *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termio_to_portconfig(struct termio *tp, struct portconfig *pcp)
{
/* Speed */
pcp->speed = baud_index_to_int(tp->c_cflag & CBAUD);
if(pcp->speed == -1)
pcp->speed = 38400;
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
int
termios_to_portmodes(struct termios *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termios_to_portconfig(struct termios *tp, struct portconfig *pcp)
{
/* Speed */
speed_t speed = cfgetospeed(tp);
pcp->speed = baud_index_to_int(speed);
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
/* Termios must be clean */
void
portconfig_to_termios (struct portconfig *pcp, struct termios *tp)
{
/* Speed */
speed_t speed = int_to_baud_index(pcp->speed);
cfsetospeed (tp, (speed_t) speed);
cfsetispeed (tp, (speed_t) B0);
/* Datasize */
switch (pcp->datasize) {
case 5:
tp->c_cflag |= CS5;
break;
case 6:
tp->c_cflag |= CS6;
break;
case 7:
tp->c_cflag |= CS7;
break;
case 8:
tp->c_cflag |= CS8;
break;
}
/* Stopsize */
if (pcp->stopsize == COM_SSIZE_TWO) {
tp->c_cflag |= CSTOPB;
} /* else one stop bit */
/* Parity */
switch (pcp->parity) {
case COM_PARITY_EVEN:
tp->c_cflag |= PARENB;
break;
case COM_PARITY_ODD:
tp->c_cflag |= PARENB|PARODD;
break;
case COM_PARITY_NONE:
default:
break;
}
/* Flow Control */
switch (pcp->flowc) {
case COM_FLOW_SOFT:
tp->c_iflag |= IXON;
break;
default:
break;
}
}
/*
* Debug routines
*/
void
print_msg(int type, unsigned char *buf, int size)
{
char *msgt;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
char dbuf[64];
if (Debug > 2) {
switch (type) {
case M_IOCTL:
iocp = (struct iocblk *) &buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
sprintf(dbuf, "M_IOCTL (Ioctl %c %d), %d bytes: %s\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF,
iocp->ioc_count, ioctl_name(ioctype, iocdata));
break;
case M_DATA:
msgt = "M_DATA (Regular data): ";
sprintf(dbuf, "%s, %d bytes\n", msgt, size);
break;
case M_FLUSH:
msgt = "M_FLUSH (flush your queues)";
sprintf(dbuf, "%s: queue %d", msgt, buf[0]);
break;
case M_PROTO :
msgt = "M_PROTO (protocol control)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_BREAK :
msgt = "M_BREAK (line break)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PASSFP:
msgt = "M_PASSFP (pass file pointer)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SIG :
msgt = "M_SIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_DELAY :
msgt = "M_DELAY (real-time xmit delay (1 param))";
sprintf(dbuf, "%s\n", msgt);
break;
case M_CTL :
msgt = "M_CTL (device-specific control message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SETOPTS:
msgt = "M_SETOPT S(set various stream head options)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_RSE :
msgt = "M_RSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
# ifdef M_TRAIL
case M_TRAIL :
msgt = "M_TRAIL (data trailer)";
sprintf(dbuf, "%s\n", msgt);
break;
# endif
case M_IOCACK:
msgt = "M_IOCACK (acknowledge ioctl)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCNAK:
msgt = "M_IOCNAK (negative ioctl acknowledge)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCPROTO:
msgt = "M_PCPROTO (priority proto message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCSIG :
msgt = "M_PCSIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_READ :
msgt = "M_READ (generate read notification)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOP :
msgt = "M_STOP (stop transmission immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_START :
msgt = "M_START (restart transmission after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_HANGUP:
msgt = "M_HANGUP (line disconnect)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_ERROR :
msgt = "M_ERROR (fatal error used to set u.u_error)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYIN:
msgt = "M_COPYIN (request to copyin data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYOUT:
msgt = "M_COPYOUT (request to copyout data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCDATA:
msgt = "M_IOCDATA (response to M_COPYIN and M_COPYOUT)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCRSE :
msgt = "M_PCRSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOPI :
msgt = "M_STOPI (stop reception immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STARTI:
msgt = "M_STARTI (restart reception after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
# ifdef M_PCCTL
case M_PCCTL :
msgt = "M_PCCTL (priority control message)";
sprintf(dbuf, "%s\n", msgt);
break;
# endif
# ifdef M_PCCTL
case M_PCSETOPTS:
msgt = "M_PCSETOPTS (priority set stream head options)";
sprintf(dbuf, "%s\n", msgt);
break;
# endif
}
sysmessage (MSG_DEBUG, "%s", dbuf);
}
}
char ioctlbuf[32];
char *
ioctl_name (int type, void *arg)
{
char * msgt;
if (Debug > 2) {
switch (type) {
case TCGETA:
msgt = "TCGETA";
break;
case TCSETA:
msgt = "TCSETA";
break;
case TCSETAW:
msgt = "TCSETAW";
break;
case TCSETAF:
msgt = "TCSETAF";
break;
case TCSBRK:
msgt = "TCSBRK";
break;
case TCXONC:
msgt = "TCXONC";
break;
case TCFLSH:
msgt = "TCFLSH";
break;
case TCGETS:
msgt = "TCGETS";
break;
case TCSETS:
msgt = "TCSETS";
break;
case TCSETSW:
msgt = "TCSETSW";
break;
case TCSETSF:
msgt = "TCSETSF";
break;
default:
msgt = "UNKNOWN";
break;
}
sprintf(ioctlbuf, "%s", msgt);
return (ioctlbuf);
} else {
return ((char *) 0);
}
}
cyclades-serial-client-0.93ubuntu1/tbr1.c 0000664 0000000 0000000 00000000642 07333050332 015215 0 ustar # include
main (argc, argv)
int argc;
char **argv;
{
int interval = atoi (argv[1]);
char buf[128];
int i, j;
for (i = 1 ; i ; i++) {
for (j = 0; j < 20; j++) {
sprintf(buf, "%4d: AAAAAAAAAAAAAAAAAAAAAAAAAAA\n", j);
write (1, buf, strlen(buf));
}
if (tcsendbreak (1, interval) == -1) {
perror ("tcsendbreak");
}
if (!(i % 5)) printf("Delay %d, pass %d\n", interval, i);
}
}
cyclades-serial-client-0.93ubuntu1/debian/ 0000775 0000000 0000000 00000000000 13032075072 015422 5 ustar cyclades-serial-client-0.93ubuntu1/debian/dirs 0000664 0000000 0000000 00000000025 07705372776 016330 0 ustar etc
usr/sbin
usr/lib
cyclades-serial-client-0.93ubuntu1/debian/changelog 0000664 0000000 0000000 00000005530 13032075072 017277 0 ustar cyclades-serial-client (0.93ubuntu1) zesty; urgency=medium
* Restore Ilya Barygin's patch to configure and configure.in that adds
-fno-stack-protector to CCFLAGS and fixes FTBFS on i386 and powerpc.
-- Logan Rosen Sat, 31 Dec 2016 22:40:42 -0500
cyclades-serial-client (0.93) unstable; urgency=medium
* Fix debhelper compatability level Closes: #800212
Closes: #817327
-- Russell Coker Sat, 31 Dec 2016 16:37:21 +1100
cyclades-serial-client (0.92) unstable; urgency=low
* Fixed some Solaris bugs.
* Made it remove the control socket on close.
-- Russell Coker Tue, 23 Sep 2003 17:38:00 +1000
cyclades-serial-client (0.91) unstable; urgency=low
* Fixed a couple of minor Solaris bugs.
-- Russell Coker Fri, 1 Aug 2003 21:26:00 +1000
cyclades-serial-client (0.90) unstable; urgency=low
* Name change.
* Improved build scripts, especially dependencies.
* Fixed the -s option.
-- Russell Coker Fri, 25 Jul 2003 08:28:00 -0400
tsrdev (1.3.3) unstable; urgency=low
* Added support for setting 1 or 2 stop bits in libtsrdev.so.
* Added support for changing RTS/CTS and XON/XOFF settings, although the Linux
stty program doesn't like the way I do it and gives an error the first
time RTS/CTS settings are changes - have to look at the stty source.
* Removed the "-t" option from tsrsock as it's dead code.
* Changed the "-s" option for tsrsock to mean Socket Server mode, so the
absense of this option means RFC2217 mode.
* Made the options for baseport work in an order-independent fashion, the
first priority goes to the -b option, then to the default for the protocol
in use.
* Added a "-f" option to tsrsock to specify running in the foreground, this
can be used if running from init, and can be used by programmers when
tracing tsrsock.
-- Russell Coker Fri, 18 Jul 2003 19:04:00 +1000
tsrdev (1.3.2) unstable; urgency=low
* Better support for Solaris, including support for making Sun packages.
* Support for changing port speed, sending breaks, and changing the number of
data bits over the network via libtsrdev.so.
-- Russell Coker Thu, 17 Jul 2003 11:10:00 +1000
tsrdev (1.3.1) unstable; urgency=low
* Added support for AIX, SCO, and Unixware to the code tree.
* Removed HP-UX man pages.
* Added a patch to sock.c for when Solaris headers don't define INADDR_NONE.
* In telnet.c made handle_com_port_command() only take one parameter as the
second is ignored anyway.
* Fixed many compiler warnings.
-- Russell Coker Fri, 4 Jul 2003 17:00:00 +1000
tsrdev (1.3) unstable; urgency=low
* Initial Release.
-- Russell Coker Tue, 29 Oct 2002 20:23:35 +0100
cyclades-serial-client-0.93ubuntu1/debian/control 0000664 0000000 0000000 00000001402 13032075072 017022 0 ustar Source: cyclades-serial-client
Section: comm
Priority: optional
Maintainer: Ubuntu Developers
XSBC-Original-Maintainer: Russell Coker
Build-Depends: debhelper (>= 9)
Standards-Version: 3.5.2
Package: cyclades-serial-client
Architecture: any
Depends: ${shlibs:Depends}
Suggests: sredird
Conflicts: tsrdev
Description: Network Serial port client software for Cyclades terminal servers
This is the client for network serial port emulation via the RFC 2217
protocol as used by Cyclades terminal servers and other products. It
consists of a daemon that manages a pseudo-tty and a shared object to take
over the tcsetattr() and tcsendbreak() library calls to redirect their
functionality over the network.
cyclades-serial-client-0.93ubuntu1/debian/rules 0000775 0000000 0000000 00000004206 13031642021 016475 0 ustar #!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
config.status: configure
dh_testdir
# Add here commands to configure the package.
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/ --mandir=\$${prefix}/usr/share/man
build: build-stamp
build-stamp: config.status
dh_testdir
# Add here commands to compile the package.
$(MAKE)
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
-$(MAKE) distclean
-test -r /usr/share/misc/config.sub && \
cp -f /usr/share/misc/config.sub config.sub
-test -r /usr/share/misc/config.guess && \
cp -f /usr/share/misc/config.guess config.guess
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/cyclades-serial-client.
$(MAKE) install prefix=$(CURDIR)/debian/cyclades-serial-client
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
# dh_installdebconf
dh_installdocs
dh_installexamples
dh_installmenu
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
dh_installcron
dh_installman man/*
dh_installinfo
# dh_undocumented
dh_installchangelogs
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_makeshlibs
dh_installdeb
# dh_perl
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
cyclades-serial-client-0.93ubuntu1/debian/compat 0000664 0000000 0000000 00000000002 13031642021 016611 0 ustar 9
cyclades-serial-client-0.93ubuntu1/debian/copyright 0000664 0000000 0000000 00000000321 07712447115 017362 0 ustar This package was debianized by Russell Coker on
Tue, 29 Oct 2002 20:23:35 +0100.
Upstream Author(s): Cyclades and Russell Coker.
Copyright: GPLv2, see /usr/share/common-licenses/GPL-2
cyclades-serial-client-0.93ubuntu1/libcsc/ 0000775 0000000 0000000 00000000000 07713640127 015447 5 ustar cyclades-serial-client-0.93ubuntu1/libcsc/depends 0000664 0000000 0000000 00000000202 07710174322 017002 0 ustar # DO NOT DELETE
libcyclades-ser-cli.o: ../inc/control.h ../inc/misc.h ../inc/telnet.h
libcyclades-ser-cli.o: ../inc/port_speed.h
cyclades-serial-client-0.93ubuntu1/libcsc/Makefile.in 0000664 0000000 0000000 00000000635 07710250612 017511 0 ustar
CC=@CC@
CCFLAGS=@CCFLAGS@ @SOCFLAGS@
SOLFLAGS=@SOLFLAGS@ @LIBS@
all: libcyclades-ser-cli.so
libcyclades-ser-cli.so: libcyclades-ser-cli.c
$(CC) -c $(CCFLAGS) libcyclades-ser-cli.c -o libcyclades-ser-cli.o
ld libcyclades-ser-cli.o $(SOLFLAGS) -o libcyclades-ser-cli.so
clean:
rm -f libcyclades-ser-cli.so libcyclades-ser-cli.o depends.bak
dep:
-makedepend -Y -f depends *.c 2> /dev/null
include depends
cyclades-serial-client-0.93ubuntu1/libcsc/libcyclades-ser-cli.c 0000664 0000000 0000000 00000021660 07710173106 021425 0 ustar #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "../inc/control.h"
#include "../inc/misc.h"
#include "../inc/telnet.h"
#define SHARED_OBJECT
#include "../inc/port_speed.h"
#include
#include
#define MAX_PORTS 32
static void *libc = NULL;
static int (*real_tcsetattr)(int fd, int optional_actions, const struct termios *termios_p) = NULL;
static int (*real_tcsendbreak)(int fd, int duration);
static char *cyclades_devices[MAX_PORTS];
static int num_devices;
static int socket_fd = -1;
static int socket_ind = -1;
void libcsc_init()
{
FILE *fp;
libc = dlopen(LIBC, RTLD_LAZY | RTLD_GLOBAL);
if(!libc)
{
printf("Can't map " LIBC "\n");
exit(1);
}
real_tcsetattr = (int (*)(int, int, const struct termios *))dlsym(libc, "tcsetattr");
real_tcsendbreak = (int (*)(int, int))dlsym(libc, "tcsendbreak");
num_devices = 0;
fp = fopen("/etc/cyclades-devices", "r");
if(fp)
{
char str[1024];
while(num_devices < MAX_PORTS && fgets(str, sizeof(str), fp))
{
if(str[0] == '/')
{
strtok(str, ":\r\n");
cyclades_devices[num_devices] = strdup(str);
num_devices++;
}
}
fclose(fp);
}
}
void libcsc_fini()
{
dlclose(libc);
libc = NULL;
}
static void close_socket()
{
close(socket_fd);
socket_fd = -1;
socket_ind = -1;
}
static int open_socket(int ind)
{
struct sockaddr_un addr;
if(socket_ind == ind)
return 0;
if(socket_fd >= 0)
close(socket_fd);
socket_fd = socket(PF_UNIX, SOCK_STREAM, 0);
if(socket_fd == -1)
return -1;
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s.control", cyclades_devices[ind]);
addr.sun_path[sizeof(addr.sun_path) - 1] = '\0';
socket_ind = ind;
if(connect(socket_fd, (const struct sockaddr *)&addr, sizeof(addr)))
{
close(socket_fd);
socket_fd = -1;
socket_ind = -1;
return -1;
}
return 0;
}
static int get_device_ind(int fd)
{
struct stat device_stat, fd_stat;
int i;
if(fstat(fd, &fd_stat))
return -1;
for(i = 0; i < num_devices; i++)
{
if(!stat(cyclades_devices[i], &device_stat))
{
if(device_stat.st_dev == fd_stat.st_dev
&& device_stat.st_ino == fd_stat.st_ino)
return i;
}
}
return -1;
}
static int send_data(int port_ind, e_operation oper, int val, int extra_timeout)
{
fd_set readfds, exceptfds;
struct timeval timeout;
s_control s;
struct sigaction act, oldact;
int rc;
int no_ign_pipe = 0;
if(open_socket(port_ind) == -1)
return -1;
act.sa_handler = SIG_IGN;
if(sigaction(SIGPIPE, &act, &oldact))
{
syslog(LOG_WARNING, "libcyclades-ser-cli: Can't ignore SIGPIPE.");
no_ign_pipe = 1;
}
s.oper = oper;
s.val = val;
s.size = sizeof(s_control);
if(send(socket_fd, &s, sizeof(s_control), 0) != sizeof(s_control))
{
if(!no_ign_pipe)
{
if(sigaction(SIGPIPE, &oldact, NULL))
syslog(LOG_ERR, "libcyclades-ser-cli: Can't reset SIGPIPE handler.");
}
close_socket();
return -1;
}
FD_ZERO(&readfds);
FD_SET(socket_fd, &readfds);
FD_ZERO(&exceptfds);
FD_SET(socket_fd, &exceptfds);
timeout.tv_sec = extra_timeout + 2;
timeout.tv_usec = 0;
if(select(socket_fd + 1, &readfds, NULL, &exceptfds, &timeout) != 1
|| FD_ISSET(socket_fd, &exceptfds) )
{
if(!no_ign_pipe)
{
if(sigaction(SIGPIPE, &oldact, NULL))
syslog(LOG_ERR, "libcyclades-ser-cli: Can't reset SIGPIPE handler.");
}
close_socket();
return -1;
}
rc = recv(socket_fd, &s, sizeof(s), MSG_WAITALL);
if(!no_ign_pipe)
{
if(sigaction(SIGPIPE, &oldact, NULL))
syslog(LOG_ERR, "libcyclades-ser-cli: Can't reset SIGPIPE handler.");
}
if(rc != sizeof(s) || s.val != val || s.oper != oper || s.size != sizeof(s) )
{
close_socket();
return -1;
}
return 0;
}
static void do_xon_xoff(int ind, int *a_success, int *a_fail
, struct termios *term, const struct termios *termios_p)
{
/* first do XON/XOFF for outbound/both */
if( (term->c_iflag & IXON) != (termios_p->c_iflag & IXON) )
{
int xon = COM_OFLOW_NONE;
if(termios_p->c_iflag & IXON)
xon = COM_OFLOW_SOFT;
if(!send_data(ind, eSET_CONTROL, xon, 0) )
{
/* if we set outbound XON/XOFF we set inbound as well and we need to
* turn it off next */
term->c_iflag &= !(IXON | IXOFF);
#ifdef CRTSCTS
term->c_cflag &= !CRTSCTS;
#endif
if(termios_p->c_iflag & IXON)
term->c_iflag |= (IXON | IXOFF);
*a_success++;
}
else
*a_fail++;
}
if( (term->c_iflag & IXOFF) != (termios_p->c_iflag & IXOFF) )
{
int xon = COM_IFLOW_NONE;
if(termios_p->c_iflag & IXOFF)
xon = COM_IFLOW_SOFT;
if(!send_data(ind, eSET_CONTROL, xon, 0) )
{
term->c_iflag &= !IXOFF;
#ifdef CRTSCTS
term->c_cflag &= !CRTSCTS;
#endif
term->c_iflag |= termios_p->c_iflag & IXON;
*a_success++;
}
else
*a_fail++;
}
}
int tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
{
int ind = get_device_ind(fd);
struct termios term;
int a_fail = 0, a_success = 0;
speed_t i_sp, o_sp, term_sp;
if(ind == -1)
return real_tcsetattr(fd, optional_actions, termios_p);
if(tcgetattr(fd, &term))
return -1;
if(!memcmp(&term, termios_p, sizeof(struct termios)))
return 0;
if( (term.c_cflag & HUPCL) != (termios_p->c_cflag & HUPCL) )
{
term.c_cflag &= !HUPCL;
term.c_cflag |= termios_p->c_cflag & HUPCL;
a_success++;
}
/* Some really ugly code because termios supports split baud rates while
* RFC 2217 does not. */
i_sp = cfgetispeed(termios_p);
o_sp = cfgetospeed(termios_p);
term_sp = cfgetispeed(&term);
if(i_sp != term_sp || o_sp != term_sp )
{
if(i_sp != o_sp)
{
if(i_sp != term_sp)
term_sp = i_sp;
else
term_sp = o_sp;
}
else
{
term_sp = i_sp;
}
if(!send_data(ind, eSET_SPEED, baud_index_to_int(term_sp), 0) )
{
cfsetispeed(&term, term_sp);
cfsetospeed(&term, term_sp);
a_success++;
}
else
a_fail++;
}
if( (term.c_cflag & CSIZE) != (termios_p->c_cflag & CSIZE) )
{
int csize;
switch(termios_p->c_cflag & CSIZE)
{
case CS5:
csize = 5;
break;
case CS6:
csize = 6;
break;
case CS7:
csize = 7;
break;
case CS8:
csize = 8;
break;
default:
csize = 0;
}
if(csize == 0)
{
a_fail++;
}
else
{
if(!send_data(ind, eSET_CSIZE, csize, 0) )
{
a_success++;
term.c_cflag = (term.c_cflag & (!CSIZE)) | csize;
}
else
a_fail++;
}
}
if( (term.c_iflag & INPCK) != (termios_p->c_iflag & INPCK)
|| (term.c_cflag & (PARENB|PARODD)) != (termios_p->c_cflag & (PARENB|PARODD)) )
{
int parity;
if( termios_p->c_cflag & PARENB )
{
if(termios_p->c_cflag & PARODD)
parity = 2; /* parity Odd */
else
parity = 3; /* parity Even */
}
else
parity = 1; /* parity None */
if(!send_data(ind, eSET_PARITY, parity, 0) )
{
term.c_cflag &= !(PARENB|PARODD);
term.c_cflag |= termios_p->c_cflag & (PARENB|PARODD);
a_success++;
}
else
a_fail++;
}
if( (term.c_cflag & CSTOPB) != (termios_p->c_cflag & CSTOPB) )
{
int stop = 1;
if(termios_p->c_cflag & CSTOPB)
stop = 2;
if(!send_data(ind, eSET_STOPSIZE, stop, 0) )
{
term.c_cflag &= !CSTOPB;
term.c_cflag |= termios_p->c_cflag & CSTOPB;
a_success++;
}
else
a_fail++;
}
do_xon_xoff(ind, &a_success, &a_fail, &term, termios_p);
#ifdef CRTSCTS
/* CRTSCTS is not in POSIX */
if( (term.c_cflag & CRTSCTS) != (termios_p->c_cflag & CRTSCTS) )
{
int rtscts = COM_OFLOW_NONE;
if(termios_p->c_cflag & CRTSCTS)
rtscts = COM_OFLOW_HARD;
if(!send_data(ind, eSET_CONTROL, rtscts, 0) )
{
term.c_cflag &= !CRTSCTS;
term.c_cflag |= termios_p->c_cflag & CRTSCTS;
a_success++;
if(rtscts == COM_OFLOW_NONE)
{
/* if we turn off RTSCTS then it also turns off xon/xof and we need
* to turn it back on. RFC2217 sucks in this regard */
term.c_iflag &= !(IXON | IXOFF);
do_xon_xoff(ind, &a_success, &a_fail, &term, termios_p);
}
}
else
a_fail++;
}
#endif
if(memcmp(&term.c_cc, &termios_p->c_cc, sizeof(term.c_cc)))
{
memcpy(&term.c_cc, &termios_p->c_cc, sizeof(term.c_cc));
a_success++;
}
if(a_success)
real_tcsetattr(fd, optional_actions, &term);
if(a_success || !a_fail)
return 0;
return -1;
}
int tcsendbreak(int fd, int duration)
{
int ind = get_device_ind(fd);
if(ind == -1)
return real_tcsendbreak(fd, duration);
return send_data(ind, eSEND_BREAK, duration, duration % 4 + 1);
}
cyclades-serial-client-0.93ubuntu1/libcsc/Makefile 0000664 0000000 0000000 00000001015 07713353274 017110 0 ustar
CC=i386-linux-gcc
CCFLAGS=-O2 -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -shared -fpic
SOLFLAGS=-shared -init libcsc_init -fini libcsc_fini -fpic -ldl -lutil
all: libcyclades-ser-cli.so
libcyclades-ser-cli.so: libcyclades-ser-cli.c
$(CC) -c $(CCFLAGS) libcyclades-ser-cli.c -o libcyclades-ser-cli.o
ld libcyclades-ser-cli.o $(SOLFLAGS) -o libcyclades-ser-cli.so
clean:
rm -f libcyclades-ser-cli.so libcyclades-ser-cli.o depends.bak
dep:
-makedepend -Y -f depends *.c 2> /dev/null
include depends
cyclades-serial-client-0.93ubuntu1/man/ 0000775 0000000 0000000 00000000000 07710212612 014752 5 ustar cyclades-serial-client-0.93ubuntu1/man/cyclades-serial-client.8 0000664 0000000 0000000 00000004257 07710213501 021371 0 ustar .TH "cyclades-serial-client" "8" "" "" ""
.SH "NAME"
.BR cyclades-serial-client
Serial Port Interface for Cyclades Terminal Servers
.SH "SYNOPSIS"
.B cyclades-serial-client
.I (start | stop | restart | status) [devname]
.SH "DESCRIPTION"
For each physical port listed in cyclades-devices file,
cyclades-serial-client controls the status of the corresponding
cyclades-ser-cli interface.
.SH "OPTIONS"
cyclades-serial-client must be invoked with one of the (start, stop, restart
or status), and optionaly with a argument associated to a specific device.
In this case, the action spedified as the option will be performed only for
this device.
If this argument was not supplied, the action will be performed for all
devices listed in cyclades-devices file. The mandatory options are:
.TP
.B start
\- Starts the cyclades-ser-cli program, using parameters supplied
in the cyclades-devices file. If this program is already
running, a message will be displayed, and no additional copy
will be started.
.TP
.B stop
\- Stops the cyclades-ser-cli program(s), by issuing a SIGTERM signal.
.TP
.B restart
\- Simulates a hangup to cyclades-ser-cli program(s), by issuing a SIGUSR1
signal.
.TP
.B status
\- Checks the status of cyclades-ser-cli programs(s).
.SH "EXAMPLES"
Assuming the the following cyclades-devices file configuration:
/dev/ctty01:pr3k:1:rtelnet:
/dev/ctty02:pr3k:2:socket:
1 . Start all devices:
cyclades-serial-client start
Messages:
"Starting /dev/ctty01 <==> pr3k:1 interface"
"Starting /dev/ctty02 <==> pr3k:2 interface"
2 . Try to start them again:
cyclades-serial-client start
Messages:
"cyclades-serial-client : /dev/ctty01 already active"
"cyclades-serial-client : /dev/ctty02 already active"
3 . Stop only /dev/ctty01 device:
cyclades-serial-client stop /dev/ctty01
Messages:
"Stopping /dev/ctty01 <==> pr3k:2 interface"
4 . Checking status:
cyclades-serial-client status
Messages:
"/dev/ctty01 (rtelnet at pr3k:1) is inactive"
"/dev/ctty02 ( socket at pr3k:2) active, pid 2983"
5 . Start a non\-valid device
cyclades-serial-client start /dev/xtty01
Messages:
"cyclades-serial-client : device /dev/xtty01 does not exist"
.SH "SEE ALSO"
.BR cyclades-ser-cli (1),
.BR cyclades-devices (5)
cyclades-serial-client-0.93ubuntu1/man/cyclades-devices.5 0000664 0000000 0000000 00000004315 07710212757 020264 0 ustar .TH "cyclades-devices" "5" "" "" ""
.SH "NAME"
cyclades-devices \- tables for driving cyclades-serial-client
.SH "DESCRIPTION"
The cyclades-devices file supplies all mapping between Unix device
files (/dev/*) and the addresses of serial ports of
Cyclades Terminal Servers. It contains one entry for each serial
port, with the following format:
device:rastype:rasname:physport:type:options
Note: A # character at beginning of line indicates a comment
The entry fields are:
.TP
.B devname
\- A full pathname of the file that will be associated to
the serial port. It must start with a "/dev/" preffix.
Two naming schemes may be used here:
\- devname does not exist, and will be linked to
a free pseudo\-tty. This is the default behavior of
cyclades-ser-cli.
\- devname is the name of a valid slave pseudo\-tty.
In this case, the '\-t 1' option must be assigned
in options field.
(Note: this option is not supported by this release).
.TP
.B rastype
\- Terminal Server type:
\- prts, for Cyclades Pr302X/TS Terminal Servers.
\- path, for Cyclades PathRAS Terminal Server.
.TP
.B rasname
\- Host Name or IP Address of the Terminal Server where
the serial port resides.
.TP
.B physport
\- Number of physical port in the Terminal Server. If
'physport' is assigned to zero, 'rasname' will be
treated as the IP address associated with this port,
in a IP\-based addressing scheme.
.TP
.B type
\- Server type that will be contacted to handle the
serial port:
\- rtelnet, for Remote Telnet Server
\- socket, for Socket Server
.TP
.B options
\- Per\-port specific options, passed to cyclades-ser-cli program.
.SH "EXAMPLES"
1. Device on a PR3020/TS Terminal Server pr3k Port 1, accessed
through /dev/ctty01 device file name, using telnet protocol
(remote telnet server)
/dev/ctty01:prts:pr3k:1:rtelnet:
2. The same device, but with an IP address pr3k_port1
associated to the serial port (IP\-based port addressing)
/dev/ctty01:prts:pr3k_port1:0:rtelnet:
3. Device on a PathRAS Terminal Server pr3k Port 2, accessed
through /dev/ctty02 device file name, using socket protocol
(socket server)
/dev/ctty02:path:pr3k:2:socket:
.SH "FILES"
/etc/cyclades-devices This file
.SH "SEE ALSO"
.BR cyclades-serial-client (1),
.BR cyclades-ser-cli (1)
cyclades-serial-client-0.93ubuntu1/man/cyclades-ser-cli.8 0000664 0000000 0000000 00000010134 07710213272 020170 0 ustar .TH "cyclades-ser-cli" "8" "" "" ""
.SH "NAME"
.BR cyclades-ser-cli
Serial Port Interface for Cyclades Terminal Servers
.SH "SYNOPSIS"
.B cyclades-ser-cli
.I [options] devname rasname physport
.SH "DESCRIPTION"
The cyclades-ser-cli program connects a Unix device file 'devname' to a
physical port 'physport' of a Cyclades Terminal Server 'rasname'.
cyclades-ser-cli provides the I/O interface between the device file and
the physical port, running as an 'user\-mode device driver'.
If 'physport' is assigned to 0, then 'rasname' is used as the IP
address on an IP\-based serial port addressing.
.SH "OPTIONS"
cyclades-ser-cli may be started with the following options:
.TP
.B \-u ptyiosize
Sets the internal device I/O size to ptyiosize (maximum 4096 bytes, default
1024 bytes)
.TP
.B \-n netiosize
Sets the internal socket I/O size to netiosize (maximum 512 bytes, default
128 bytes)
.TP
.B \-i retrydelay
Delay in seconds between connection requests (default: 60)
.TP
.B \-r retries
Number of connection request retries before exiting. (default: infinity)
.TP
.B \-s
Use the Socket Server protocol for talking to the server, this means just
piping all the data down a TCP connection with no control information, so it's
impossible to change the port speed etc. The default is to use the RFC2217
protocol.
.TP
.B \-m modem handling
The default is 0 which means to check DCD state, 1 means to ignore DCD.
.TP
.B \-c close mode
Last close handling; the default is 0 which means to hangup the modem, 1 means
not to hangup.
.TP
.B \-p start port
TCP base port of servers at terminal server side (defaults: 31000 for Socket
server, 30000 for Remote Telnet Server). Note: if 'physport' is assigned to
zero, this option has no effect, the Telnet Server standard port (23) is used.
.TP
.B \-d debug level
The default is debug level 0 (little debugging), level 1 debugs internal state
changes, level 2 debugs events, and level 3 debugs IO calls.
.TP
.B \-f
Run in foreground, this is suitable for running from init.
.TP
.B \-x
Console mode: normally all messages are sent to syslogd (using local2
facility). With this option, all messages will be sent to stdout and
cyclades-ser-cli runs in the foreground. This implies
.B \-f
.SH "USE"
Every instance of cyclades-ser-cli will have a virtual serial device which is
a sym-link to a pseudo-tty. A terminal program can then talk to the virtual
serial device and it's data transfers will be redirected across the network.
Each virtual serial device will be accompanied by a Unix domain socket with
the same name with the addition of ".control". So if cyclades-ser-cli
provides the virtual device named "/dev/modem" then it will have a control
socket named "/dev/modem.control". There is a shared object named
.B libcyclades-ser-cli.so
which intercepts calls to the tcsetattr() and tcsendbreak(). This shared
object then sends the relevant data to the cyclades-ser-cli server via the
control socket. To recognise a virtual modem device it has to read
/etc/cyclades-devices.
.P
The libcyclades-ser-cli.so shared object can be loaded per-application
through the
.B LD_PRELOAD
environment variable, or for the entire system through the system shared
object configuration (see the OS documentation). Note that the LD_PRELOAD
environment variable has to have the fully qualified path of the object,
otherwise an application which changes it's current directory may fail.
.SH "BUGS"
In Solaris libcyclades-ser-cli.so does not work with the stty program. stty
uses a different interface to this and requires some extra coding.
In Solaris libcyclades-ser-cli.so conflicts with some system programs such as
.B ps
for unknown reasons. Just don't load it for those programs, it has no such
problems with any serial comms programs.
.SH "EXAMPLES"
Start an interface between /dev/prt1 device and a serial
port number 10 of a Terminal Server named pr01, without
hangup at last close:
cyclades-ser-cli \-c 1 /dev/prt1 pr01 10
In general use do not start cyclades-ser-cli from the command line, start it
through the cyclades-serial-client script or from init.
.SH "SEE ALSO"
.BR cyclades-serial-client (1),
.BR cyclades-devices (5)
cyclades-serial-client-0.93ubuntu1/depends 0000664 0000000 0000000 00000002746 07710174231 015561 0 ustar # DO NOT DELETE
aix-dev.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
aix-dev.o: inc/telnet.h inc/dev.h inc/port_speed.h
cyclades-ser-cli.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h
cyclades-ser-cli.o: inc/tsrio.h inc/sock.h inc/dev.h inc/misc.h
hpux-dev.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
hpux-dev.o: inc/telnet.h inc/dev.h inc/port_speed.h
linux-dev.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
linux-dev.o: inc/telnet.h inc/dev.h inc/misc.h inc/port_speed.h
measure.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrmeasure.h
misc.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
misc.o: inc/telnet.h inc/sock.h inc/dev.h inc/control.h
sco-dev.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
sco-dev.o: inc/telnet.h inc/dev.h inc/port_speed.h
sock.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h inc/sock.h
solaris-dev.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
solaris-dev.o: inc/telnet.h inc/dev.h inc/misc.h inc/port_speed.h
system.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
system.o: inc/sock.h inc/dev.h
telnet.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
telnet.o: inc/telnet.h inc/sock.h
tsrio.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
tsrio.o: inc/telnet.h inc/misc.h inc/dev.h
unixware-dev.o: inc/cyclades-ser-cli.h inc/conf.h inc/system.h inc/tsrio.h
unixware-dev.o: inc/telnet.h inc/dev.h inc/port_speed.h
cyclades-serial-client-0.93ubuntu1/Makefile.in 0000664 0000000 0000000 00000002616 07713333126 016260 0 ustar #
# Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
#
OFLAGS=@OFLAGS@
CC=@CC@
#
# Debug and additional options
#
#DFLAGS=-DTSR_MEASURE
DFLAGS=
#
# Compiler flags
#
CCFLAGS=@CCFLAGS@
#
# cyclades-ser-cli program flags
#
SOCKFLAGS=$(OFLAGS) $(DFLAGS) $(CCFLAGS)
#
# Link-editor flags
#
LDFLAGS=-s
#
# Standard libraries
#
LDLIBS=@LIBS@
#
# Object files
#
SOCKOBJS=cyclades-ser-cli.o tsrio.o telnet.o sock.o @DEV_OBJ@ misc.o system.o measure.o
#
# Programs for terminal server interface
#
PROGS=cyclades-ser-cli
all: $(PROGS) libcsc/libcyclades-ser-cli.so
clean:
rm -f $(PROGS) *.o depends.bak
( cd libcsc ; $(MAKE) clean )
libcsc/libcyclades-ser-cli.so:
( cd libcsc ; $(MAKE) )
distclean: clean
rm -f config.status
cyclades-ser-cli: $(SOCKOBJS)
$(CC) $(LDFLAGS) -o cyclades-ser-cli $(SOCKOBJS) $(AUXLIBS) $(LDLIBS)
install: cyclades-ser-cli libcsc/libcyclades-ser-cli.so
mkdir -p $(prefix)/usr/lib $(prefix)/usr/sbin $(prefix)/etc
cp cyclades-serial-client cyclades-ser-cli $(prefix)/usr/sbin
cp libcsc/libcyclades-ser-cli.so $(prefix)/usr/lib
cp -i cyclades-devices $(prefix)/etc
mkdir -p $(prefix)/usr/share/man/man5
mkdir -p $(prefix)/usr/share/man/man8
cp man/*.5 $(prefix)/usr/share/man/man5
cp man/*.8 $(prefix)/usr/share/man/man8
%.o: %.c
$(CC) $(SOCKFLAGS) -c $<
dep:
-makedepend -Y -f depends *.c 2> /dev/null
( cd libcsc ; $(MAKE) dep )
include depends
cyclades-serial-client-0.93ubuntu1/system.c 0000664 0000000 0000000 00000011045 07713631134 015677 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* system.c
* Unix system-dependent routines
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* Oct-27-2001 V.1.0.1
* Debug messages are only sent if debug is on
* SIGCLD may occur when syslogd is too busy
*/
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# define _TSR_SYSTEM_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/sock.h"
#include "inc/dev.h"
/*
* Internal Variables
*/
static int Start_time;
static int End_time;
static struct tms Timest;
/*
* Internal Functions
*/
static void sysc_tout(int sig);
static void rot(int sig);
static void user_hangup(int sig);
static void sys_times(char * buf);
void
init_system(void)
{
int sig ;
(void) setpgrp(); /* Detach from tty */
(void) umask(0); /* File creation mask */
Start_time = times (&Timest);
openlog (Pgname, LOG_PID | LOG_CONS, LOG_LOCAL2);
# ifdef TSR_MEASURE
start_measure();
# endif
(void) setbuf (stdout, NULL); /* Real time messages */
(void) setbuf (stderr, NULL);
for (sig = 1; sig < NSIG ; sig++) {
switch (sig) {
case SIGPIPE :
case SIGCONT : /* Close pty bug */
case SIGHUP :
(void) signal (sig, SIG_IGN);
break;
case SIGBUS :
case SIGSEGV :
break;
case SIGALRM :
(void) signal (sig, sysc_tout);
break;
case SIGUSR1 :
(void) signal (sig, user_hangup);
break;
default :
(void) signal (sig, rot);
break;
}
}
}
void
sysdelay(int msecs)
{
struct timeval tv;
tv.tv_sec = msecs / 1000;
tv.tv_usec = (msecs % 1000) * 1000;
(void) select (0,0,0,0,&tv);
}
void
sysmessage(int type, const char * const format, ...)
{
char buf[512];
va_list args;
const char * pritext;
int priority;
va_start(args, format);
vsprintf(buf, format, args);
if (Console) {
switch (type) {
case MSG_DEBUG:
pritext = "DEBUG";
break;
case MSG_INFO:
pritext = "INFO";
break;
case MSG_NOTICE:
pritext = "NOTICE";
break;
case MSG_WARNING:
pritext = "WARNING";
break;
case MSG_ERR:
default:
pritext = "ERR";
break;
}
fprintf (stderr, "%s: %s: %s", Idmsg, pritext, buf);
} else {
switch (type) {
case MSG_DEBUG:
priority = LOG_DEBUG;
break;
case MSG_INFO:
priority = LOG_INFO;
break;
case MSG_NOTICE:
priority = LOG_NOTICE;
break;
case MSG_WARNING:
priority = LOG_WARNING;
break;
case MSG_ERR:
default:
priority = LOG_ERR;
break;
}
if (priority != LOG_DEBUG || Debug > 0)
syslog (priority, "%s: %s", Idmsg, buf);
}
va_end(args);
}
void
mindelay(void)
{
struct timeval tv;
int usecs;
usecs = 1000000 / HZ; /* one CPU tick */
tv.tv_sec = 0;
tv.tv_usec = usecs;
(void) select (0,0,0,0,&tv);
}
void
doexit (int val)
{
char timbuf[64];
# ifdef TSR_MEASURE
cpu_measure();
# endif
dev_unlink();
sock_unlink();
End_time = times (&Timest);
sys_times(timbuf);
if (val) {
sysmessage (MSG_ERR,"Exiting with %d code (%s)\n",
val, timbuf);
} else {
sysmessage (MSG_NOTICE,"Exiting with %d code (%s)\n",
val, timbuf);
}
exit(val);
}
void
dev_unlink(void)
{
close(P_sfd);
P_sfd = -1;
close(P_mfd);
P_mfd = -1;
unlink(P_devname); /* remove old link */
if(P_contrname[0])
unlink(P_contrname); /* remove old control socket */
}
static void
rot (int sig)
{
char timbuf[64];
# ifdef TSR_MEASURE
cpu_measure(1);
# endif
dev_unlink();
sock_unlink();
End_time = times (&Timest);
sys_times(timbuf);
if ( sig == SIGTERM ) {
sysmessage (MSG_INFO,"Normal shutdown (SIGTERM) (%s)\n",
timbuf);
exit(E_NORMAL);
} else {
sysmessage (MSG_ERR, "signal %d received (%s)\n\n",
sig, timbuf);
exit (E_SIGNAL);
}
}
unsigned char *
mem_get (int size)
{
return ((unsigned char *) malloc (size));
}
void
mem_free (void * ptr)
{
free (ptr);
}
static void
sysc_tout(int sig)
{
alarm(0);
(void) signal (sig, sysc_tout);
}
static void
user_hangup(int sig)
{
Hang_up = TRUE;
(void) signal (sig, user_hangup);
}
static void
sys_times(char *buf)
{
int usr, sys, tot, pru, prs, prt, secs;
tot = End_time - Start_time;
usr = (int) Timest.tms_utime;
sys = (int) Timest.tms_stime;
if (tot == 0) tot = 1;
pru = usr * 100 / tot;
prs = sys * 100 / tot;
prt = pru + prs;
secs = tot / HZ;
sprintf(buf, "%6d, %3d%%, %3d%%, %3d%%", secs, pru, prs, prt);
}
cyclades-serial-client-0.93ubuntu1/misc.c 0000664 0000000 0000000 00000014462 07710217065 015314 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* misc.c
* Miscelaneous system-dependent routines
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* Oct-27-2001 V.1.0.1 Hangup messages now are of Warning type
*/
#include
#include
#include
#ifndef HPUX
#include
#endif
#define _TSR_MISC_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/sock.h"
#include "inc/dev.h"
#include
#include
#include
#include
#ifdef TSR_MEASURE
#include
#endif
#include
#include "inc/control.h"
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
int
external_poll (int eventmask, int timeout)
{
fd_set readmask, writemask, exceptmask;
struct timeval tv;
int ret, maxfd, msgtype, i, j;
FD_ZERO (&readmask);
FD_ZERO (&writemask);
FD_ZERO (&exceptmask);
maxfd = MAX(S_fd, P_mfd);
if(Nvt.servertype == SRV_RTELNET)
{
for(i = 0; i < MAX_CONTROL_SOCKS && P_contr[i] != -1; i++)
{
maxfd = MAX(maxfd, P_contr[i]);
FD_SET(P_contr[i], &readmask);
}
maxfd = MAX(maxfd, P_contr_listen);
FD_SET(P_contr_listen, &readmask);
}
maxfd++;
if(eventmask & (DEV_READ|DEV_PROBE))
FD_SET (P_mfd, &readmask);
if(eventmask & (DEV_EXCEPT))
FD_SET (P_mfd, &exceptmask);
if(eventmask & DEV_WRITE)
FD_SET (P_mfd, &writemask);
if(eventmask & (SOCK_READ|SOCK_PROBE))
FD_SET (S_fd, &readmask);
if(eventmask & SOCK_WRITE)
FD_SET (S_fd, &writemask);
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
ret = select (maxfd, &readmask , &writemask, &exceptmask, &tv);
if(Nvt.servertype == SRV_RTELNET && FD_ISSET(P_contr_listen, &readmask))
{
int flags;
sysmessage(MSG_WARNING, "Receiving control connection from FD %d\n", P_contr_listen);
if(P_contr[MAX_CONTROL_SOCKS - 1] != -1)
{
close(P_contr[0]);
FD_CLR(P_contr[0], &readmask); /* just in case */
for(i = 0; i < (MAX_CONTROL_SOCKS - 1); i++)
P_contr[i] = P_contr[i + 1];
P_contr[MAX_CONTROL_SOCKS - 1] = -1;
}
for(i = 0; P_contr[i] != -1; i++)
;
if(fcntl(P_contr_listen, F_SETFL, O_NONBLOCK) == -1)
{
sysmessage(MSG_ERR, "Can't set non-blocking IO.\n");
_exit(1);
}
P_contr[i] = accept(P_contr_listen, NULL, NULL);
if(P_contr[i] == -1)
{
sysmessage(MSG_ERR, "Error in accept on control socket.\n");
}
else
{
if( ((flags = fcntl(P_contr[i], F_GETFL)) == -1)
|| fcntl(P_contr[i], F_SETFL, flags & O_NONBLOCK))
sysmessage(MSG_ERR, "Can't set non-blocking IO on control socket!\n");
else
sysmessage(MSG_WARNING, "New control socket FD=%d\n", P_contr[i]);
}
}
if(FD_ISSET(P_mfd, &readmask) || FD_ISSET(P_mfd, &exceptmask))
{
if(Debug > 2)
{
if(FD_ISSET(P_mfd, &exceptmask))
sysmessage (MSG_WARNING, "Pty exception\n");
}
if(eventmask & DEV_PROBE)
{
if((msgtype = dev_probe()) == -1)
{
sysmessage(MSG_WARNING, "Hang up PTY PROBE\n");
Hang_up = TRUE;
return -1;
}
imminent_event(msgtype);
}
else
{
if(dev_getdata() == -1)
{
sysmessage (MSG_WARNING, "Hang up PTY GETDATA\n");
Hang_up = TRUE;
return(-1);
}
}
}
else
{
if(eventmask & DEV_READ)
{ /* pause, check slave status */
dev_closeslave();
}
}
if(FD_ISSET (P_mfd, &writemask))
{
SET_EVENT(EV_UP, EV_UPWROK, 0, 0);
}
if(FD_ISSET (S_fd, &readmask))
{
if(tel_getdata() == -1)
{
sysmessage(MSG_WARNING, "Hang up NVT GETDATA\n");
Hang_up = TRUE;
return -1;
}
}
if(FD_ISSET (S_fd, &writemask))
{
SET_EVENT(EV_RN, EV_RNWROK, 0, 0);
}
if(Nvt.servertype == SRV_RTELNET)
{
for(i = 0; i < MAX_CONTROL_SOCKS && P_contr[i] != -1; i++)
{
if(FD_ISSET(P_contr[i], &readmask))
{
s_control s;
if(recv(P_contr[i], &s, sizeof(s), MSG_WAITALL) != sizeof(s)
|| s.size != sizeof(s))
{
sysmessage(MSG_WARNING, "Closing control connection.\n");
close(P_contr[i]);
for(j = i; j < (MAX_CONTROL_SOCKS - 1); j++)
P_contr[j] = P_contr[j + 1];
P_contr[MAX_CONTROL_SOCKS - 1] = -1;
}
else
{
switch(s.oper)
{
case eSET_SPEED:
sync_comport_command(USR_COM_SET_BAUDRATE, s.val);
s.val = Comport.portconfig.speed;
break;
case eSEND_BREAK:
if(s.val == 0)
{
tv.tv_sec = 0;
tv.tv_usec = 250000;
}
else
{
tv.tv_sec = s.val / 4;
tv.tv_usec = (s.val % 4) * 250000;
}
sync_comport_command(USR_COM_SET_CONTROL, COM_BREAK_ON);
select(0, NULL, NULL, NULL, &tv);
sync_comport_command(USR_COM_SET_CONTROL, COM_BREAK_OFF);
break;
case eSET_CSIZE:
sync_comport_command(USR_COM_SET_DATASIZE, s.val);
s.val = Comport.portconfig.datasize;
break;
case eSET_PARITY:
sync_comport_command(USR_COM_SET_PARITY, s.val);
s.val = Comport.portconfig.parity;
break;
case eSET_STOPSIZE:
sync_comport_command(USR_COM_SET_STOPSIZE, s.val);
s.val = Comport.portconfig.stopsize;
break;
case eSET_CONTROL:
sync_comport_command(USR_COM_SET_CONTROL, s.val);
/* BUG we need to maintain com port state here as well because one field is
* used for several things in the protocol
* s.val = Comport.portconfig.flowc; */
break;
} /* end switch */
if(send(P_contr[i], &s, sizeof(s), 0) != sizeof(s))
{
sysmessage(MSG_WARNING, "Lost control connection to client.\n");
close(P_contr[i]);
for(j = i ; j < (MAX_CONTROL_SOCKS - 1); j++)
P_contr[j] = P_contr[j + 1];
P_contr[MAX_CONTROL_SOCKS - 1] = -1;
i--;
}
}
}
}
}
# ifdef TSR_MEASURE
ioscheds++;
# endif
return (ret);
}
cyclades-serial-client-0.93ubuntu1/tbr.c 0000664 0000000 0000000 00000000422 07333043460 015134 0 ustar # include
main (argc, argv)
int argc;
char **argv;
{
int interval = atoi (argv[1]);
int i;
for (i = 1 ; i ; i++) {
if (tcsendbreak (1, interval) == -1) {
perror ("tcsendbreak");
}
if (!(i % 10)) printf("Delay %d, pass %d\n", interval, i);
}
}
cyclades-serial-client-0.93ubuntu1/unixware-dev.c 0000664 0000000 0000000 00000052455 07713627752 017016 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* dev.c
* Unix Pty Device routines
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
/*
* Argh => sys/stream.h needs this # define, and it nust be before types.h,
* and undefined before signal.h
*/
# define _KERNEL
/* Open / stat includes */
# include
# include
# include
/* Errno */
# include
# include
# include
/* ptsname */
# include
# include
/* Termio */
# ifdef USE_TERMIO
# include
# endif
/* Termios */
# ifdef USE_TERMIOS
# include
# endif
/* STREAMS ioctl */
# include
# include
# include
# undef _KERNEL
/* Tiocsignal */
# include
# define _TSR_DEV_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/dev.h"
#include "inc/port_speed.h"
#ifdef TSR_MEASURE
#include "inc/tsrmeasure.h"
#endif
/*
* Streams message routines
*/
void parse_message (unsigned char type, char *buf, int size);
void parse_msgflush (int queues);
/*
* Termio / Termios routines
*/
void parse_ioctl(int ioctype, void *iocdata);
void parse_termios(int mode, struct termios *tp);
void parse_termio(int mode, struct termio *tp);
void parse_break(int *interval);
void parse_iocflush(int *queues);
int termio_to_portmodes(struct termio *tp);
void termio_to_portconfig(struct termio *tp, struct portconfig *pcp);
int termios_to_portmodes(struct termios *tp);
void termios_to_portconfig(struct termios *tp, struct portconfig *pcp);
void portconfig_to_termios (struct portconfig *pcp, struct termios *tp);
/*
* Debug routines
*/
void print_msg(int type, unsigned char *buf, int size);
char * ioctl_name (int type, void *arg);
/*
* Internal Variables
*/
char P_sname[NAMESIZE];
int Lasttype;
char Ctlbuf[16], Databuf[DEV_MAXIOSZ];
struct strpeek Message;
/*
* STREAMS Pseudo-TTY Device Stuff
*/
# define PTY_DEVICE "/dev/ptmx"
int
dev_getaddr(char *dname)
{
int fd;
int mode;
char * stty;
int found;
struct stat statb;
if(lstat(dname, &statb) >= 0)
{ /* File exists */
if(S_ISLNK(statb.st_mode))
{
sysmessage(MSG_WARNING, "Removing old sym-link \"%s\".\n", dname);
unlink(dname);
}
else if(!S_ISCHR(statb.st_mode))
{
sysmessage (MSG_ERR, "%s already exists\n",
dname);
return (E_PARMINVAL);
}
} else if (errno != ENOENT) { /* generic stat error */
sysmessage (MSG_ERR, "Can't lstat %s : %s\n",
dname, strerror (errno));
return (E_FILEIO);
}
mode = O_RDWR;
# ifdef USE_POSIX_NONBLOCK
mode |= O_NONBLOCK;
# elif defined USE_STD_NDELAY
mode |= O_NDELAY;
# endif
/*
* Warning: most PTY implementation puts master side as controlling terminal if
* O_NOCTTY is not set !!!
*/
mode |= O_NOCTTY;
if ((fd = open (PTY_DEVICE, mode)) < 0) {
sysmessage (MSG_ERR, "Can't open ptmx : %s\n",
strerror (errno));
return (E_FILEIO);
}
# ifdef USE_FIONBIO
mode = 1;
if (ioctl (fd, FIONBIO, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't set non-block on maste: pty : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# endif
if (ioctl (fd, I_PUSH, "pckt") == -1) {
sysmessage (MSG_ERR, "Can't push module: %s\n",
strerror (errno));
(void) close(fd);
return (E_FILEIO);
}
found = FALSE;
if ((stty = ptsname(fd)) != (char *) NULL) {
if (unlockpt(fd) >= 0) {
if (link(stty, dname) == 0) {
found = TRUE;
sysmessage(MSG_NOTICE,
"Using %s pseudo-tty \n",
stty);
} else {
sysmessage (MSG_ERR,
"Can't link dev : %s\n",
strerror (errno));
}
} else {
sysmessage (MSG_ERR,
"Can't unlock ptmx : %s\n",
strerror (errno));
}
} else {
sysmessage (MSG_ERR, "Can't get ptmx ptsname\n");
}
if (found == FALSE) {
(void) close(fd);
return (E_FILEIO);
}
P_mfd = fd;
strcpy (P_sname, stty);
strcpy (P_devname, dname);
return (E_NORMAL);
}
void
dev_free(void)
{
(void) close (P_sfd);
P_sfd = -1;
return;
}
int
dev_init(int iosize, int devmodem, int closemode, struct buffer *ibp,
struct buffer *obp, struct comport *cp)
{
int ret;
Pty.portmodes = 0;
if (devmodem == DEV_LOCAL) {
Pty.portmodes = PORT_CLOCAL;
}
if (closemode == CLOSE_HANG) {
Pty.portmodes |= PORT_HUPCL;
}
Pty.portmodes |= PORT_IGNBRK | PORT_IGNPAR;
Pty.iosize = iosize;
Pty.inbuff = ibp;
Pty.outbuff = obp;
Pty.comport = cp;
return (E_NORMAL);
}
int
dev_config (void)
{
int sfd;
struct termios tios;
struct portconfig * pcp = &Pty.comport->portconfig;
int modes = Pty.portmodes;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
int flags = 0;
sysmessage(MSG_NOTICE,"Opening %s pseudo-tty \n", P_sname);
if ((sfd = open (P_sname, O_RDWR|O_NOCTTY)) == -1) {
sysmessage (MSG_ERR, "Can't open slave device : %s\n",
strerror (errno));
return (E_FILEIO);
}
if (ioctl (sfd, I_PUSH, "ptem") == -1) {
sysmessage (MSG_ERR, "Can't ioctl tcgeta: %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
if (ioctl (sfd, I_PUSH, "ldterm") == -1) {
sysmessage (MSG_ERR, "Can't push ldterm : %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
memset ((void *) &tios, 0, sizeof (struct termios));
portconfig_to_termios (pcp, &tios);
tios.c_cflag |= CREAD;
tios.c_lflag |= NOFLSH;
/* PTY modes */
if (modes & PORT_HUPCL) {
tios.c_cflag |= HUPCL;
}
if (modes & PORT_CLOCAL) {
tios.c_cflag |= CLOCAL;
}
if (modes & PORT_IGNBRK) {
tios.c_iflag |= IGNBRK;
}
if (modes & PORT_IGNPAR) {
tios.c_iflag |= IGNPAR;
}
if (tcsetattr (sfd, TCSANOW, &tios) == -1) {
sysmessage (MSG_ERR, "Can't set termios : %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
P_sfd = sfd;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 1;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
(void) getmsg (P_mfd, ctlmsg, datamsg, &flags);
return (E_NORMAL);
}
int
dev_closeslave(void)
{
if (Pty.state == PTY_OPER && P_sfd != -1) {
sysmessage(MSG_NOTICE,"Closing %s pseudo-tty \n",
P_sname);
(void) close (P_sfd);
P_sfd = -1;
}
return (E_NORMAL);
}
int
dev_probe(void)
{
int ctllen, datalen;
int retc;
int clocal = 0;
int retmsg;
unsigned char type;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
struct termio * tio;
struct termios * tios;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 1;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
Message.flags = 0;
if ((retc = ioctl (P_mfd, I_PEEK, (void *) &Message)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
type = (unsigned char) ctlmsg->buf[0];
if (Debug > 2) {
sysmessage (MSG_DEBUG,
"PROBE: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctllen, type, datalen, Message.flags);
}
switch (type) {
case M_DATA:
if (datalen != 0) {
retmsg = PROBE_DATA; /* M_DATA > 0 */
} else {
retmsg = PROBE_EOF; /* M_DATA == 0 */
}
break;
case M_FLUSH:
retmsg = PROBE_FLUSH; /* M_FLUSH */
break;
case M_IOCTL:
retmsg = PROBE_GENERIC; /* Generic M_IOCTL */
iocp = (struct iocblk *) &datamsg->buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
switch (ioctype) {
case TCSETA:
case TCSETAW:
case TCSETAF:
tio = (struct termio *) iocdata;
if (tio->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
case TCSETS:
case TCSETSW:
case TCSETSF:
tios = (struct termios *) iocdata;
if (tios->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
default:
break;
}
}
if (Debug > 1) {
sysmessage (MSG_DEBUG, "PROBE: msg %d\n", retmsg);
}
return (retmsg);
}
int
dev_getdata(void)
{
int ctllen, datalen;
int retc;
int flags = 0;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
unsigned char type;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 1;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
if ((retc = getmsg (P_mfd, ctlmsg, datamsg, &flags)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
# ifdef TSR_MEASURE
devnreads++;
# endif
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
if (ctllen == -1) {
type = Lasttype;
} else {
Lasttype = type = (unsigned char) ctlmsg->buf[0];
}
if (Debug > 2) {
sysmessage (MSG_DEBUG,
" DATA: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctllen, type, datalen, flags);
}
parse_message (type, datamsg->buf, datalen);
return (0);
}
int
dev_putdata(struct buffer *bp)
{
struct pty * pty = &Pty;
int ret;
int size;
int frombuf;
while (bp->b_hold) {
size = min (bp->b_hold, pty->iosize);
if ((ret = write (P_mfd, bp->b_rem, size)) == -1) {
if (errno == EAGAIN) {
ret = 0;
} else {
sysmessage(MSG_ERR,
"Can't write on master pty: %s\n",
strerror(errno));
}
# ifdef TSR_MEASURE
devnwrites++;
# endif
return (ret);
}
# ifdef TSR_MEASURE
devwrites++;
devwbytes += ret;
# endif
FORWARD_BUFFER(bp, ret);
}
if (bp->b_hold == 0) {
RESET_BUFFER(bp);
}
return (0);
}
void
dev_interrupt(void)
{
if (ioctl (P_mfd, TIOCSIGNAL, SIGINT) == -1) {
sysmessage (MSG_ERR,
"Can't send SIGINT to slave device : %s\n",
strerror (errno));
}
}
void
dev_hangup(void)
{
if (ioctl (P_mfd, TIOCSIGNAL, SIGHUP) == -1) {
sysmessage (MSG_ERR,
"Can't send SIGHUP to slave device : %s\n",
strerror (errno));
}
}
/*
* Streams message routines
*/
void
parse_message (unsigned char type, char *buf, int size)
{
char * msgt;
int i;
struct iocblk * iocp;
struct buffer * bp = Pty.inbuff;
print_msg(type, (unsigned char *) buf, size);
if (size != 0) {
switch (Pty.state) {
case PTY_CLOSED:
case PTY_OPERRONLY:
SET_EVENT(EV_UP, EV_UPOPEN, 0, 0);
break;
}
}
switch (type) {
case M_DATA:
# ifdef TSR_MEASURE
devreads++;
devrbytes += size;
# endif
if (size == 0) {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
} else {
COPY_TO_BUFFER(bp, buf, size);
SET_EVENT(EV_UP, EV_UPDATA, 0, 0);
}
break;
case M_IOCTL :
iocp = (struct iocblk *) &buf[0];
parse_ioctl(iocp->ioc_cmd,
(void *) &buf[sizeof (struct iocblk)]);
break;
case M_FLUSH :
parse_msgflush((int) buf[0]);
break;
default:
sysmessage(MSG_WARNING, "Unsupported stream message: %d\n",
type);
print_msg(type, (unsigned char *)buf, size);
break;
}
}
void
parse_msgflush (int queues)
{
int mode;
switch (queues) {
case FLUSHR:
mode = OPFLUSH_IN;
break;
case FLUSHW:
mode = OPFLUSH_OUT;
break;
case FLUSHRW:
default:
mode = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPFLUSH, (void *) &mode, sizeof (int));
}
/*
* Termio / Termios routines
*/
void
parse_ioctl (int ioctype, void *iocdata)
{
switch (ioctype) {
case TCSETA:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAW:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAF:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSBRK:
parse_break((int *) iocdata);
break;
case TCFLSH:
parse_iocflush((int *) iocdata);
break;
case TCSETS:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSW:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSF:
parse_termios(ioctype, (struct termios *) iocdata);
break;
default:
sysmessage(MSG_WARNING, "Unsupported ioctl: %c %d\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF);
}
}
void
parse_termio(int mode, struct termio *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETA:
iocp->io_oper = OP_SETNOW;
break;
case TCSETAW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETAF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termio_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termio_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_termios(int mode, struct termios *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETS:
iocp->io_oper = OP_SETNOW;
break;
case TCSETSW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETSF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termios_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termios_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_break(int *interval)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_SENDBREAK;
iocp->io_arg = *interval;
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_iocflush(int *queues)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_FLUSH;
switch (*queues) {
case TCIFLUSH:
iocp->io_arg = OPFLUSH_IN;
break;
case TCOFLUSH:
iocp->io_arg = OPFLUSH_OUT;
break;
case TCIOFLUSH:
iocp->io_arg = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
int
termio_to_portmodes(struct termio *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termio_to_portconfig(struct termio *tp, struct portconfig *pcp)
{
/* Speed */
pcp->speed = baud_index_to_int(tp->c_cflag & CBAUD);
if(pcp->speed == -1)
pcp->speed = 38400;
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
int
termios_to_portmodes(struct termios *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termios_to_portconfig(struct termios *tp, struct portconfig *pcp)
{
/* Speed */
speed_t speed = cfgetospeed(tp);
pcp->speed = baud_index_to_int(speed);
if(pcp->speed == -1)
pcp->speed = 38400;
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
/* Termios must be clean */
void
portconfig_to_termios (struct portconfig *pcp, struct termios *tp)
{
/* Speed */
speed_t speed = int_to_baud_index(pcp->speed);
cfsetospeed (tp, (speed_t) speed);
cfsetispeed (tp, (speed_t) B0);
/* Datasize */
switch (pcp->datasize) {
case 5:
tp->c_cflag |= CS5;
break;
case 6:
tp->c_cflag |= CS6;
break;
case 7:
tp->c_cflag |= CS7;
break;
case 8:
tp->c_cflag |= CS8;
break;
}
/* Stopsize */
if (pcp->stopsize == COM_SSIZE_TWO) {
tp->c_cflag |= CSTOPB;
} /* else one stop bit */
/* Parity */
switch (pcp->parity) {
case COM_PARITY_EVEN:
tp->c_cflag |= PARENB;
break;
case COM_PARITY_ODD:
tp->c_cflag |= PARENB|PARODD;
break;
case COM_PARITY_NONE:
default:
break;
}
/* Flow Control */
switch (pcp->flowc) {
case COM_FLOW_SOFT:
tp->c_iflag |= IXON;
break;
default:
break;
}
}
/*
* Debug routines
*/
void
print_msg(int type, unsigned char *buf, int size)
{
char *msgt;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
char dbuf[64];
if (Debug > 2) {
switch (type) {
case M_IOCTL:
iocp = (struct iocblk *) &buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
sprintf(dbuf, "M_IOCTL (Ioctl %c %d), %d bytes: %s\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF,
iocp->ioc_count, ioctl_name(ioctype, iocdata));
break;
case M_DATA:
msgt = "M_DATA (Regular data): ";
sprintf(dbuf, "%s, %d bytes\n", msgt, size);
break;
case M_FLUSH:
msgt = "M_FLUSH (flush your queues)";
sprintf(dbuf, "%s: queue %d", msgt, buf[0]);
break;
case M_PROTO :
msgt = "M_PROTO (protocol control)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_BREAK :
msgt = "M_BREAK (line break)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PASSFP:
msgt = "M_PASSFP (pass file pointer)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SIG :
msgt = "M_SIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_DELAY :
msgt = "M_DELAY (real-time xmit delay (1 param))";
sprintf(dbuf, "%s\n", msgt);
break;
case M_CTL :
msgt = "M_CTL (device-specific control message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SETOPTS:
msgt = "M_SETOPT S(set various stream head options)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_RSE :
msgt = "M_RSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_TRAIL :
msgt = "M_TRAIL (data trailer)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCACK:
msgt = "M_IOCACK (acknowledge ioctl)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCNAK:
msgt = "M_IOCNAK (negative ioctl acknowledge)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCPROTO:
msgt = "M_PCPROTO (priority proto message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCSIG :
msgt = "M_PCSIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_READ :
msgt = "M_READ (generate read notification)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOP :
msgt = "M_STOP (stop transmission immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_START :
msgt = "M_START (restart transmission after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_HANGUP:
msgt = "M_HANGUP (line disconnect)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_ERROR :
msgt = "M_ERROR (fatal error used to set u.u_error)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYIN:
msgt = "M_COPYIN (request to copyin data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYOUT:
msgt = "M_COPYOUT (request to copyout data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCDATA:
msgt = "M_IOCDATA (response to M_COPYIN and M_COPYOUT)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCRSE :
msgt = "M_PCRSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOPI :
msgt = "M_STOPI (stop reception immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STARTI:
msgt = "M_STARTI (restart reception after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCCTL :
msgt = "M_PCCTL (priority control message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCSETOPTS:
msgt = "M_PCSETOPTS (priority set stream head options)";
sprintf(dbuf, "%s\n", msgt);
break;
}
sysmessage (MSG_DEBUG, "%s", dbuf);
}
}
char ioctlbuf[32];
char *
ioctl_name (int type, void *arg)
{
char * msgt;
if (Debug > 2) {
switch (type) {
case TCGETA:
msgt = "TCGETA";
break;
case TCSETA:
msgt = "TCSETA";
break;
case TCSETAW:
msgt = "TCSETAW";
break;
case TCSETAF:
msgt = "TCSETAF";
break;
case TCSBRK:
msgt = "TCSBRK";
break;
case TCXONC:
msgt = "TCXONC";
break;
case TCFLSH:
msgt = "TCFLSH";
break;
case TCGETS:
msgt = "TCGETS";
break;
case TCSETS:
msgt = "TCSETS";
break;
case TCSETSW:
msgt = "TCSETSW";
break;
case TCSETSF:
msgt = "TCSETSF";
break;
default:
msgt = "UNKNOWN";
break;
}
sprintf(ioctlbuf, "%s", msgt);
return (ioctlbuf);
} else {
return ((char *) 0);
}
}
cyclades-serial-client-0.93ubuntu1/install.sh 0000775 0000000 0000000 00000010675 07553613315 016227 0 ustar ##
## install -- Install a program, script or datafile
## Copyright (c) 1997-2000 Ralf S. Engelschall
## Originally written for shtool
##
## This file is part of shtool and free software; you can redistribute
## it and/or modify it under the terms of the GNU General Public
## License as published by the Free Software Foundation; either version
## 2 of the License, or (at your option) any later version.
##
## This file is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA, or contact Ralf S. Engelschall .
##
str_tool="install"
str_usage="[-v] [-t] [-c] [-C] [-s] [-m] [-o] [-g] [-e] [ ...] "
arg_spec="2+"
opt_spec="v.t.c.C.s.m:o:g:e:"
opt_v=no
opt_t=no
opt_c=no
opt_C=no
opt_s=no
opt_m=""
opt_o=""
opt_g=""
opt_e=""
. ./sh.common
# determine source(s) and destination
argc=$#
srcs=""
while [ $# -gt 1 ]; do
srcs="$srcs $1"
shift
done
dstpath="$1"
# type check for destination
dstisdir=0
if [ -d $dstpath ]; then
dstpath=`echo "$dstpath" | sed -e 's:/$::'`
dstisdir=1
fi
# consistency check for destination
if [ $argc -gt 2 -a $dstisdir = 0 ]; then
echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
exit 1
fi
# iterate over all source(s)
for src in $srcs; do
dst=$dstpath
# If destination is a directory, append the input filename
if [ $dstisdir = 1 ]; then
dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
dst="$dst/$dstfile"
fi
# Add a possible extension to src and dst
if [ ".$opt_e" != . ]; then
src="$src$opt_e"
dst="$dst$opt_e"
fi
# Check for correct arguments
if [ ".$src" = ".$dst" ]; then
echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
continue
fi
if [ -d "$src" ]; then
echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
continue
fi
# Make a temp file name in the destination directory
dsttmp=`echo $dst |\
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
-e "s;\$;/#INST@$$#;"`
# Verbosity
if [ ".$opt_v" = .yes ]; then
echo "$src -> $dst" 1>&2
fi
# Copy or move the file name to the temp name
# (because we might be not allowed to change the source)
if [ ".$opt_C" = .yes ]; then
opt_c=yes
fi
if [ ".$opt_c" = .yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "cp $src $dsttmp" 1>&2
fi
cp $src $dsttmp || exit $?
else
if [ ".$opt_t" = .yes ]; then
echo "mv $src $dsttmp" 1>&2
fi
mv $src $dsttmp || exit $?
fi
# Adjust the target file
# (we do chmod last to preserve setuid bits)
if [ ".$opt_s" = .yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "strip $dsttmp" 1>&2
fi
strip $dsttmp || exit $?
fi
if [ ".$opt_o" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chown $opt_o $dsttmp" 1>&2
fi
chown $opt_o $dsttmp || exit $?
fi
if [ ".$opt_g" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chgrp $opt_g $dsttmp" 1>&2
fi
chgrp $opt_g $dsttmp || exit $?
fi
if [ ".$opt_m" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chmod $opt_m $dsttmp" 1>&2
fi
chmod $opt_m $dsttmp || exit $?
fi
# Determine whether to do a quick install
# (has to be done _after_ the strip was already done)
quick=no
if [ ".$opt_C" = .yes ]; then
if [ -r $dst ]; then
if cmp -s $src $dst; then
quick=yes
fi
fi
fi
# Finally install the file to the real destination
if [ $quick = yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "rm -f $dsttmp" 1>&2
fi
rm -f $dsttmp
else
if [ ".$opt_t" = .yes ]; then
echo "rm -f $dst && mv $dsttmp $dst" 1>&2
fi
rm -f $dst && mv $dsttmp $dst
fi
done
cyclades-serial-client-0.93ubuntu1/solaris-dev.c 0000664 0000000 0000000 00000101535 07733772006 016615 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* dev.c
* Unix Pty Device routines
*
* History
* 12/22/1999 V.1.0.0 Initial revision
*
*/
/* Open / stat includes */
# include
# include
# include
# include
/* Errno */
# include
# include
# include
/* ptsname */
# include
/* Termio */
# ifdef USE_TERMIO
# include
# endif
/* Termios */
# ifdef USE_TERMIOS
# include
# endif
/* STREAMS ioctl */
# include
# include
/* Get process group id of controlling pty */
# include
/* Signalling slave (kill) */
# include
# define _TSR_DEV_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/dev.h"
#include "inc/misc.h"
#include "inc/port_speed.h"
#ifdef TSR_MEASURE
#include "inc/tsrmeasure.h"
#endif
#ifndef TIOCPKT_DATA
#define TIOCPKT_DATA 0
#endif
#ifndef TIOCPKT_FLUSHREAD
#define TIOCPKT_FLUSHREAD 1
#endif
#ifndef TIOCPKT_FLUSHWRITE
#define TIOCPKT_FLUSHWRITE 2
#endif
/*
* Argh => Get the process group id associated with slave pty
*/
int get_slave_controlling (dev_t device);
/*
* Streams message routines
*/
void parse_message (unsigned char type, char *buf, int size);
void parse_packet (int type);
void parse_msgflush(int queues);
/*
* Termio / Termios routines
*/
void parse_ioctl(int ioctype, void *iocdata);
void parse_break(int *interval);
void parse_iocflush(int *queues);
void parse_termios(int mode, struct termios *tp);
int termios_to_portmodes(struct termios *tp);
void termios_to_portconfig(struct termios *tp, struct portconfig *pcp);
void portconfig_to_termios (struct portconfig *pcp, struct termios *tp);
# ifdef USE_TERMIO
void parse_termio(int mode, struct termio *tp);
int termio_to_portmodes(struct termio *tp);
void termio_to_portconfig(struct termio *tp, struct portconfig *pcp);
#endif
/*
* Debug routines
*/
void print_msg(int type, unsigned char *buf, int size);
char * ioctl_name (int type, void *arg);
/*
* Internal Variables
*/
char P_sname[NAMESIZE];
dev_t P_devnumber;
char Databuf[DEV_MAXIOSZ];
static struct strpeek Message;
int Lasttype;
char Ctlbuf[16], Databuf[DEV_MAXIOSZ];
int
dev_getaddr(char *dname)
{
int fd = -1;
int slave_fd;
int mode;
char *pts;
struct stat statb;
if(lstat(dname, &statb) >= 0)
{ /* File exists */
if(S_ISLNK(statb.st_mode))
{
sysmessage(MSG_WARNING, "Removing old sym-link \"%s\".\n", dname);
unlink(dname);
}
else if(!S_ISCHR(statb.st_mode))
{
sysmessage (MSG_ERR, "%s already exists\n",
dname);
return (E_PARMINVAL);
}
}
else if(errno != ENOENT)
{ /* generic stat error */
sysmessage (MSG_ERR, "Can't lstat %s : %s\n", dname, strerror (errno));
return (E_FILEIO);
}
mode = O_RDWR;
# ifdef USE_POSIX_NONBLOCK
mode |= O_NONBLOCK;
# elif defined USE_STD_NDELAY
mode |= O_NDELAY;
# endif
/*
* Warning: most PTY implementation puts master side as controlling terminal if
* O_NOCTTY is not set !!!
*/
fd = open("/dev/ptmx", mode | O_NOCTTY);
if(fd < 0)
{
sysmessage(MSG_ERR, "/dev/ptmx: %s", strerror(errno));
return (E_FILEIO);
}
if (ioctl (fd, I_PUSH, "pckt") == -1)
{
sysmessage (MSG_ERR, "Can't push module: %s\n", strerror (errno));
close(fd);
return E_FILEIO;
}
if(grantpt(fd) < 0)
{
sysmessage(MSG_WARNING, "grantpt failed: %s\n", strerror(errno));
return (E_FILEIO);
}
if(unlockpt(fd) < 0)
{
sysmessage(MSG_ERR, "unlockpt: %s", strerror(errno));
return (E_FILEIO);
}
if( (pts = ptsname(fd)) == NULL)
{
sysmessage(MSG_ERR, "Slave pty could not be obtained");
return (E_FILEIO);
}
/* Open the slave side. */
if( (slave_fd = open(pts, O_RDWR | O_NOCTTY)) < 0)
{
sysmessage(MSG_ERR, "Could not open slave: %s", strerror(errno));
close(slave_fd);
return 0;
}
# ifdef USE_FIONBIO
mode = 1;
if(ioctl (fd, FIONBIO, &mode) == -1)
{
sysmessage (MSG_ERR, "Can't set non-block on master pty : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# endif
if(lstat(pts, &statb) == -1)
{ /* File does not exists */
sysmessage (MSG_ERR, "Can't stat slave pty: %s\n", strerror(errno));
close(fd);
return (E_FILEIO);
}
P_devnumber = statb.st_rdev;
if(symlink(pts, dname) == -1)
{
sysmessage (MSG_ERR, "Can't link dev : %s\n",
strerror(errno));
return (E_FILEIO);
} else
{
sysmessage (MSG_NOTICE, "Using %s pseudo-tty\n", pts);
}
P_mfd = fd;
strcpy (P_sname, pts);
strcpy (P_devname, dname);
return (E_NORMAL);
}
void
dev_free(void)
{
(void) close (P_sfd);
P_sfd = -1;
return;
}
int
dev_init(int iosize, int devmodem, int closemode, struct buffer *ibp,
struct buffer *obp, struct comport *cp)
{
Pty.portmodes = 0;
if (devmodem == DEV_LOCAL) {
Pty.portmodes = PORT_CLOCAL;
}
if (closemode == CLOSE_HANG) {
Pty.portmodes |= PORT_HUPCL;
}
Pty.portmodes |= PORT_IGNBRK | PORT_IGNPAR;
Pty.iosize = iosize;
Pty.inbuff = ibp;
Pty.outbuff = obp;
Pty.comport = cp;
return (E_NORMAL);
}
int find_load(int fd, const char *name)
{
int ret;
ret = ioctl(fd, I_FIND, name);
if(ret == -1)
{
sysmessage (MSG_ERR, "Can't check %s: %s\n", name, strerror (errno));
return 1;
}
if(ret == 0)
{
if(ioctl(fd, I_PUSH, name) == -1)
{
sysmessage(MSG_ERR, "Can't push %s: %s\n", name, strerror(errno));
return 1;
}
}
return 0;
}
int
dev_config (void)
{
int sfd;
struct termios tios;
struct portconfig * pcp = &Pty.comport->portconfig;
int modes = Pty.portmodes;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
int flags = 0;
sysmessage(MSG_NOTICE,"Opening %s pseudo-tty\n", P_sname);
if ((sfd = open (P_sname, O_RDWR|O_NOCTTY)) == -1) {
sysmessage (MSG_ERR, "Can't open slave device : %s\n",
strerror (errno));
return (E_FILEIO);
}
if(find_load(sfd, "ptem") || find_load(sfd, "ldterm") )
{
close(sfd);
return E_FILEIO;
}
memset ((void *) &tios, 0, sizeof (struct termios));
portconfig_to_termios (pcp, &tios);
tios.c_cflag |= CREAD;
tios.c_lflag |= NOFLSH;
/* PTY modes */
if(modes & PORT_HUPCL)
tios.c_cflag |= HUPCL;
if(modes & PORT_CLOCAL)
tios.c_cflag |= CLOCAL;
if(modes & PORT_IGNBRK)
tios.c_iflag |= IGNBRK;
if(modes & PORT_IGNPAR)
tios.c_iflag |= IGNPAR;
tios.c_cc[VMIN] = 1;
if (tcsetattr (sfd, TCSANOW, &tios) == -1) {
sysmessage (MSG_ERR, "Can't set termios : %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
P_sfd = sfd;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 16;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
(void) getmsg (P_mfd, ctlmsg, datamsg, &flags);
if (Debug > 2) {
sysmessage (MSG_DEBUG,
" CFG: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctlmsg->len, Ctlbuf[ctlmsg->len > 0 ? ctlmsg->len -1 : 0],
datamsg->len, flags);
}
return (E_NORMAL);
}
int
dev_closeslave(void)
{
if (Pty.state == PTY_OPER && P_sfd != -1) {
if (Debug > 1) {
sysmessage (MSG_DEBUG, "Closing %s pseudo-tty \n",
P_sname);
}
sysmessage(MSG_NOTICE,"Closing %s pseudo-tty \n",
P_sname);
(void) close (P_sfd);
P_sfd = -1;
}
return (E_NORMAL);
}
unsigned char Holdbuf[4];
int Hold = FALSE;
#if 0
int
dev_probe(void)
{
int retc;
int retmsg;
unsigned char type;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
#if 0
if ((retc = read (P_mfd, Holdbuf, 1)) == -1) {
if (errno == EIO) { /* PTY WAS CLOSED */
retc = 0;
} else {
sysmessage(MSG_ERR,
"Can't read from master pty: %s\n",
strerror(errno));
return (retc);
}
}
if (Debug > 2) {
sysmessage (MSG_DEBUG, "PROBE: %d bytes: %d", retc, Holdbuf[0]);
}
if (retc != 0) {
type = Holdbuf[0];
if (type == TIOCPKT_DATA) {
retmsg = PROBE_DATA;
} else if (type & (TIOCPKT_FLUSHREAD|TIOCPKT_FLUSHWRITE)){
retmsg = PROBE_FLUSH;
} else {
retmsg = PROBE_GENERIC;
}
Hold = TRUE;
} else {
retmsg = PROBE_EOF;
}
if (Debug > 1) {
sysmessage (MSG_DEBUG, "PROBE: msg %d\n", retmsg);
}
#endif
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 16;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
Message.flags = 0;
if ((retc = ioctl (P_mfd, I_PEEK, (void *) &Message)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
if (ctllen == 1) {
type = GET_VALUE_1(&ctlmsg->buf[0]);
} else {
sysmessage(MSG_ERR,
"PROBE: Undesired control message size: %d\n",
ctllen);
return;
}
if (Debug > 2) {
sysmessage (MSG_DEBUG,
"PROBE: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctllen, type, datalen, Message.flags);
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "CTL: ");
for (i = 0; i < ctllen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) ctlmsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
sprintf(debbuf, "DAT: ");
for (i = 0; i < datalen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) datamsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
}
if (datalen == -1) {
sysmessage (MSG_ERR,
"PROBE: Undesired data message size: %d\n", datalen);
return;
}
switch (type) {
case M_DATA:
if (datalen > 0) {
retmsg = PROBE_DATA; /* M_DATA > 0 */
} else {
retmsg = PROBE_EOF; /* M_DATA == 0 */
}
break;
case M_FLUSH:
retmsg = PROBE_FLUSH; /* M_FLUSH */
break;
case M_IOCTL:
retmsg = PROBE_GENERIC; /* Generic M_IOCTL */
iocp = (struct iocblk *) &datamsg->buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
switch (ioctype) {
# ifdef USE_TERMIO
case TCSETA:
case TCSETAW:
case TCSETAF:
tio = (struct termio *) iocdata;
if (tio->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
# endif
case TCSETS:
case TCSETSW:
case TCSETSF:
tios = (struct termios *) iocdata;
if (tios->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
default:
break;
}
}
if (Debug > 1) {
sysmessage (MSG_DEBUG, "PROBE: msg %d\n", retmsg);
}
return (retmsg);
}
int
dev_getdata(void)
{
int retc;
int size;
unsigned char type;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
size = Pty.iosize;
if (Hold == TRUE) {
Hold = FALSE;
retc = 1;
Databuf[0] = Holdbuf[0];
} else {
if ((retc = read (P_mfd, Databuf, size)) == -1) {
if (errno == EIO) { /* PTY WAS CLOSED */
retc = 0;
} else {
sysmessage(MSG_ERR,
"Can't read from master pty: %s\n",
strerror(errno));
# ifdef TSR_MEASURE
devnreads++;
# endif
return (retc);
}
}
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "DATA: ");
for (i = 0; i < retc && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) Databuf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "From User: %d bytes: %s\n", retc, debbuf);
}
type = Databuf[0];
parse_message (type, Databuf, retc);
return (0);
}
#endif
int
dev_probe(void)
{
int ctllen, datalen;
int retc;
int clocal = 0;
int retmsg;
int type;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
struct termio * tio;
struct termios * tios;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 16;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
Message.flags = 0;
if ((retc = ioctl (P_mfd, I_PEEK, (void *) &Message)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
if (ctllen == 1) {
type = GET_VALUE_1(&ctlmsg->buf[0]);
} else {
sysmessage(MSG_ERR,
"PROBE: Undesired control message size: %d\n",
ctllen);
return;
}
if (Debug > 2) {
sysmessage (MSG_DEBUG,
"PROBE: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctllen, type, datalen, Message.flags);
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "CTL: ");
for (i = 0; i < ctllen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) ctlmsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
sprintf(debbuf, "DAT: ");
for (i = 0; i < datalen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) datamsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
}
if (datalen == -1) {
sysmessage (MSG_ERR,
"PROBE: Undesired data message size: %d\n", datalen);
return;
}
switch (type) {
case M_DATA:
if (datalen > 0) {
retmsg = PROBE_DATA; /* M_DATA > 0 */
} else {
retmsg = PROBE_EOF; /* M_DATA == 0 */
}
break;
case M_FLUSH:
retmsg = PROBE_FLUSH; /* M_FLUSH */
break;
case M_IOCTL:
retmsg = PROBE_GENERIC; /* Generic M_IOCTL */
iocp = (struct iocblk *) &datamsg->buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
switch (ioctype) {
# ifdef USE_TERMIO
case TCSETA:
case TCSETAW:
case TCSETAF:
tio = (struct termio *) iocdata;
if (tio->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
# endif
case TCSETS:
case TCSETSW:
case TCSETSF:
tios = (struct termios *) iocdata;
if (tios->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
default:
break;
}
}
if (Debug > 1) {
sysmessage (MSG_DEBUG, "PROBE: msg %d\n", retmsg);
}
return (retmsg);
}
int
dev_getdata(void)
{
int ctllen, datalen;
int retc;
int flags = 0;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
unsigned char type;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 16;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
if ((retc = getmsg (P_mfd, ctlmsg, datamsg, &flags)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
# ifdef TSR_MEASURE
devnreads++;
# endif
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
if (ctllen == -1) {
type = Lasttype;
} else if (ctllen == 1) {
type = GET_VALUE_1(&ctlmsg->buf[0]);
Lasttype = type;
} else {
sysmessage(MSG_ERR, "Undesired control message size: %d\n",
ctllen);
return (-1);
}
if (datalen == -1) {
sysmessage (MSG_ERR,
" DATA: Undesired data message size: %d\n", datalen);
return (-1);
}
if (Debug > 2) {
sysmessage (MSG_DEBUG,
" DATA: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctllen, type, datalen, flags);
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "CTL: ");
for (i = 0; i < ctllen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) ctlmsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
sprintf(debbuf, "DAT: ");
for (i = 0; i < datalen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) datamsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
}
parse_message (type, datamsg->buf, datalen);
return (0);
}
/*
* Packet mode routines
*/
#if 0
void
parse_message (unsigned char type, char *buf, int size)
{
struct buffer * bp = Pty.inbuff;
if (size != 0) {
switch (Pty.state) {
case PTY_CLOSED:
case PTY_OPERRONLY:
SET_EVENT(EV_UP, EV_UPOPEN, 0, 0);
break;
}
} else {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
return;
}
# ifdef TSR_MEASURE
devreads++;
devrbytes += retc;
# endif
if (type == TIOCPKT_DATA) {
if (size == 0) {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
} else {
buf++;
size--;
/* V.1.0.1 fix: use buf instead of Dataptr */
COPY_TO_BUFFER(bp, buf, size);
SET_EVENT(EV_UP, EV_UPDATA, 0, 0);
}
} else {
parse_packet((int) type);
}
}
int
dev_putdata(struct buffer *bp)
{
struct pty * pty = &Pty;
int ret;
int size;
/* XXXX TSR_MEASURES */
while (bp->b_hold) {
size = min (bp->b_hold, pty->iosize);
if ((ret = write (P_mfd, bp->b_rem, size)) == -1) {
if (errno == EAGAIN) {
ret = 0;
} else {
sysmessage(MSG_ERR,
"Can't write on master pty: %s\n",
strerror(errno));
}
# ifdef TSR_MEASURE
devnwrites++;
# endif
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "DAT: ");
for (i = 0; i < size && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) bp->b_rem[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "To User: %d bytes: %s\n", size, debbuf);
}
return (ret);
}
# ifdef TSR_MEASURE
devwrites++;
devwbytes += ret;
# endif
FORWARD_BUFFER(bp, ret);
}
if (bp->b_hold == 0) {
RESET_BUFFER(bp);
}
return (0);
}
#endif
void
parse_message (unsigned char type, char *buf, int size)
{
char * msgt;
int i;
struct iocblk * iocp;
struct buffer * bp = Pty.inbuff;
print_msg(type, (unsigned char *) buf, size);
if (size > 0) {
switch (Pty.state) {
case PTY_CLOSED:
case PTY_OPERRONLY:
SET_EVENT(EV_UP, EV_UPOPEN, 0, 0);
break;
}
} else if (size == -1) {
sysmessage (MSG_WARNING, "PARSE: Message data size == -1 \n");
return;
}
switch (type) {
case M_DATA:
# ifdef TSR_MEASURE
devreads++;
devrbytes += size;
# endif
if (size == 0) {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
} else {
COPY_TO_BUFFER(bp, buf, size);
SET_EVENT(EV_UP, EV_UPDATA, 0, 0);
}
break;
case M_IOCTL :
iocp = (struct iocblk *) &buf[0];
parse_ioctl(iocp->ioc_cmd,
(void *) &buf[sizeof (struct iocblk)]);
break;
case M_FLUSH :
parse_msgflush((int) buf[0]);
break;
default:
sysmessage(MSG_NOTICE, "Unsupported stream message: %d\n",
type);
print_msg(type, (unsigned char *)buf, size);
break;
}
}
int
dev_putdata(struct buffer *bp)
{
struct pty * pty = &Pty;
int ret;
int size;
int frombuf;
while (bp->b_hold) {
size = min (bp->b_hold, pty->iosize);
if ((ret = write (P_mfd, bp->b_rem, size)) == -1) {
if (errno == EAGAIN) {
ret = 0;
} else {
sysmessage(MSG_ERR,
"Can't write on master pty: %s\n",
strerror(errno));
}
# ifdef TSR_MEASURE
devnwrites++;
# endif
return (ret);
}
# ifdef TSR_MEASURE
devwrites++;
devwbytes += ret;
# endif
FORWARD_BUFFER(bp, ret);
}
if (bp->b_hold == 0) {
RESET_BUFFER(bp);
}
return (0);
}
void
dev_interrupt(void)
{
int procid;
if ((procid = get_slave_controlling(P_devnumber)) > 0) {
(void) kill ((pid_t) - procid, SIGINT);
}
}
void
dev_hangup(void)
{
int procid;
if ((procid = get_slave_controlling(P_devnumber)) > 0) {
(void) kill ((pid_t) - procid, SIGHUP);
}
}
void
parse_packet (int type)
{
int flushbits;
int flushmode;
flushbits = type & (TIOCPKT_FLUSHREAD|TIOCPKT_FLUSHWRITE);
if (flushbits) {
switch (flushbits) {
case TIOCPKT_FLUSHREAD:
flushmode = OPFLUSH_IN;
break;
case TIOCPKT_FLUSHWRITE:
flushmode = OPFLUSH_OUT;
break;
default:
flushmode = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPFLUSH, (void *) &flushmode, sizeof(int));
}
}
/*
* Termio / Termios routines
*/
/* Termios must be clean */
void
portconfig_to_termios (struct portconfig *pcp, struct termios *tp)
{
/* Speed */
speed_t speed = int_to_baud_index(pcp->speed);
if(speed == B0 && pcp->speed != 0)
speed = B115200;
cfsetospeed (tp, (speed_t) speed);
cfsetispeed (tp, (speed_t) B0);
/* Datasize */
switch (pcp->datasize) {
case 5:
tp->c_cflag |= CS5;
break;
case 6:
tp->c_cflag |= CS6;
break;
case 7:
tp->c_cflag |= CS7;
break;
case 8:
tp->c_cflag |= CS8;
break;
}
/* Stopsize */
if (pcp->stopsize == COM_SSIZE_TWO) {
tp->c_cflag |= CSTOPB;
} /* else one stop bit */
/* Parity */
switch (pcp->parity) {
case COM_PARITY_EVEN:
tp->c_cflag |= PARENB;
break;
case COM_PARITY_ODD:
tp->c_cflag |= PARENB|PARODD;
break;
case COM_PARITY_NONE:
default:
break;
}
/* Flow Control */
switch (pcp->flowc) {
case COM_FLOW_SOFT:
tp->c_iflag |= IXON;
break;
default:
break;
}
}
/*
* Argh => Get the process group id associated with slave pty
*/
int
get_slave_controlling (dev_t device)
{
DIR *dip;
struct dirent *dep;
int process;
char procfile[128];
char procbuf[512];
int procfd;
char dummybuf[512];
int dummyint;
int tty;
gid_t tpgid;
if ((dip = opendir ("/proc")) == (DIR *) 0) {
sysmessage(MSG_ERR, "Can't open /proc: %s",
strerror(errno));
exit (1);
}
while ((dep = readdir (dip)) != (struct dirent *)0) {
process = atoi (dep->d_name);
if (process > 0) {
sprintf(procfile, "/proc/%d/stat", process);
if ((procfd = open (procfile, 0)) == -1) {
sysmessage(MSG_ERR, "Can't open %s:%s\n",
procfile,
strerror(errno));
break;
}
if (read (procfd, procbuf, 512) <= 0) {
sysmessage(MSG_ERR, "Can't read %s:%s",
procfile,
strerror(errno));
break;
}
(void) close(procfd);
if (sscanf (procbuf, "%d %s %c %d %d %d %d %u %s",
&dummyint, &dummybuf[0], (char *)&dummyint, &dummyint,
&dummyint, &dummyint, &tty, (unsigned int *)&tpgid,
&dummybuf[0])!= 0) {
if ((dev_t) tty == device) {
break;
}
}
tpgid = 0; /* not found */
}
}
(void) closedir (dip);
return (tpgid);
}
/*
* Debug routines
*/
char ioctlbuf[32];
char *
ioctl_name (int type, void *unused)
{
const char * msgt;
if (Debug > 2) {
switch (type) {
case TCGETA:
msgt = "TCGETA";
break;
case TCSETA:
msgt = "TCSETA";
break;
case TCSETAW:
msgt = "TCSETAW";
break;
case TCSETAF:
msgt = "TCSETAF";
break;
case TCSBRK:
msgt = "TCSBRK";
break;
case TCXONC:
msgt = "TCXONC";
break;
case TCFLSH:
msgt = "TCFLSH";
break;
case TCGETS:
msgt = "TCGETS";
break;
case TCSETS:
msgt = "TCSETS";
break;
case TCSETSW:
msgt = "TCSETSW";
break;
case TCSETSF:
msgt = "TCSETSF";
break;
default:
msgt = "UNKNOWN";
break;
}
sprintf(ioctlbuf, "%s", msgt);
return (ioctlbuf);
} else {
return ((char *) 0);
}
}
void
print_msg(int type, unsigned char *buf, int size)
{
char *msgt;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
char dbuf[64];
if (Debug > 2) {
switch (type) {
case M_IOCTL:
iocp = (struct iocblk *) &buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
sprintf(dbuf, "M_IOCTL (Ioctl %c %d), %d bytes: %s\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF,
iocp->ioc_count, ioctl_name(ioctype, iocdata));
break;
case M_DATA:
msgt = "M_DATA (Regular data): ";
sprintf(dbuf, "%s, %d bytes\n", msgt, size);
break;
case M_FLUSH:
msgt = "M_FLUSH (flush your queues)";
sprintf(dbuf, "%s: queue %d", msgt, buf[0]);
break;
case M_PROTO :
msgt = "M_PROTO (protocol control)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_BREAK :
msgt = "M_BREAK (line break)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PASSFP:
msgt = "M_PASSFP (pass file pointer)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SIG :
msgt = "M_SIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_DELAY :
msgt = "M_DELAY (real-time xmit delay (1 param))";
sprintf(dbuf, "%s\n", msgt);
break;
case M_CTL :
msgt = "M_CTL (device-specific control message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SETOPTS:
msgt = "M_SETOPT S(set various stream head options)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_RSE :
msgt = "M_RSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCACK:
msgt = "M_IOCACK (acknowledge ioctl)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCNAK:
msgt = "M_IOCNAK (negative ioctl acknowledge)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCPROTO:
msgt = "M_PCPROTO (priority proto message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCSIG :
msgt = "M_PCSIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_READ :
msgt = "M_READ (generate read notification)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOP :
msgt = "M_STOP (stop transmission immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_START :
msgt = "M_START (restart transmission after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_HANGUP:
msgt = "M_HANGUP (line disconnect)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_ERROR :
msgt = "M_ERROR (fatal error used to set u.u_error)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYIN:
msgt = "M_COPYIN (request to copyin data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYOUT:
msgt = "M_COPYOUT (request to copyout data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCDATA:
msgt = "M_IOCDATA (response to M_COPYIN and M_COPYOUT)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCRSE :
msgt = "M_PCRSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOPI :
msgt = "M_STOPI (stop reception immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STARTI:
msgt = "M_STARTI (restart reception after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
}
sysmessage (MSG_DEBUG, "%s", dbuf);
}
}
void
parse_msgflush (int queues)
{
int mode;
switch (queues) {
case FLUSHR:
mode = OPFLUSH_IN;
break;
case FLUSHW:
mode = OPFLUSH_OUT;
break;
case FLUSHRW:
default:
mode = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPFLUSH, (void *) &mode, sizeof (int));
}
/*
* Termio / Termios routines
*/
void
parse_ioctl (int ioctype, void *iocdata)
{
switch (ioctype) {
# ifdef USE_TERMIO
case TCSETA:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAW:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAF:
parse_termio(ioctype, (struct termio *) iocdata);
break;
# endif
case TCSBRK:
parse_break((int *) iocdata);
break;
case TCFLSH:
parse_iocflush((int *) iocdata);
break;
case TCSETS:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSW:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSF:
parse_termios(ioctype, (struct termios *) iocdata);
break;
default:
sysmessage(MSG_NOTICE, "Unsupported ioctl: %c %d\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF);
}
}
void
parse_iocflush(int *queues)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_FLUSH;
switch (*queues) {
case TCIFLUSH:
iocp->io_arg = OPFLUSH_IN;
break;
case TCOFLUSH:
iocp->io_arg = OPFLUSH_OUT;
break;
case TCIOFLUSH:
iocp->io_arg = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_termios(int mode, struct termios *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETS:
iocp->io_oper = OP_SETNOW;
break;
case TCSETSW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETSF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termios_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termios_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_break(int *interval)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_SENDBREAK;
iocp->io_arg = *interval;
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
# ifdef USE_TERMIO
void
parse_termio(int mode, struct termio *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETA:
iocp->io_oper = OP_SETNOW;
break;
case TCSETAW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETAF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termio_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termio_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
# endif
# ifdef USE_TERMIO
int
termio_to_portmodes(struct termio *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termio_to_portconfig(struct termio *tp, struct portconfig *pcp)
{
/* Speed */
switch (tp->c_cflag & CBAUD) {
case B0:
pcp->speed = 0;
break;
case B1200:
pcp->speed = 1200;
break;
case B2400:
pcp->speed = 2400;
break;
case B4800:
pcp->speed = 4800;
break;
case B9600:
pcp->speed = 9600;
break;
case B19200:
pcp->speed = 19200;
break;
case B38400:
default:
pcp->speed = 38400;
break;
}
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
# endif
int
termios_to_portmodes(struct termios *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termios_to_portconfig(struct termios *tp, struct portconfig *pcp)
{
/* Speed */
speed_t speed = cfgetospeed(tp);
switch (speed) {
case B0:
pcp->speed = 0;
break;
case B1200:
pcp->speed = 1200;
break;
case B2400:
pcp->speed = 2400;
break;
case B4800:
pcp->speed = 4800;
break;
case B9600:
pcp->speed = 9600;
break;
case B19200:
pcp->speed = 19200;
break;
case B38400:
pcp->speed = 38400;
break;
case B57600:
pcp->speed = 57600;
break;
case B115200:
pcp->speed = 115200;
break;
case B230400:
pcp->speed = 230400;
break;
case B460800:
pcp->speed = 460800;
break;
default:
sysmessage(MSG_NOTICE, "Unsupported speed: %d\n", speed);
pcp->speed = 115200;
break;
}
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
cyclades-serial-client-0.93ubuntu1/BUGS 0000664 0000000 0000000 00000000455 07705723217 014702 0 ustar Solaris doesn't seem to like my grantpt() call and returns -1. I've made
it flag a warning on this, but we need to debug the code.
Solaris stty does not work, have to get it working, this means taking over
the ioctl() entry point in libc. Also kermit does not work on Solaris for
unknown reasons.
cyclades-serial-client-0.93ubuntu1/config.cache 0000664 0000000 0000000 00000002671 07553616374 016461 0 ustar # This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
ac_cv_c_const=${ac_cv_c_const=no}
ac_cv_header_stdc=${ac_cv_header_stdc=yes}
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -nologo -E'}
ac_cv_prog_CXX=${ac_cv_prog_CXX=c++}
ac_cv_prog_CXXCPP=${ac_cv_prog_CXXCPP='c++ -E'}
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
ac_cv_prog_cxx_cross=${ac_cv_prog_cxx_cross=no}
ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g=yes}
ac_cv_prog_cxx_works=${ac_cv_prog_cxx_works=yes}
ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}
ac_cv_prog_gxx=${ac_cv_prog_gxx=yes}
ac_cv_type_size_t=${ac_cv_type_size_t=yes}
cyclades-serial-client-0.93ubuntu1/sock.c 0000664 0000000 0000000 00000010545 07707263471 015326 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* sock.c
* Unix socket routines
*
* History
* 08/16/1999 V.1.0.0 Initial revision
*
*/
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# define _TSR_SOCK_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/sock.h"
#ifdef TSR_MEASURE
#include "inc/tsrmeasure.h"
#endif
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif
/*
* Internal Variables
*/
struct sockaddr_in S_inaddr;
int
sock_getaddr (char *host, int base, int physport)
{
struct sockaddr_in * sp = &S_inaddr;
struct hostent * hp;
int tcpport;
if ((hp = gethostbyname (host)) != (struct hostent *) NULL) {
memcpy ((char *) &sp->sin_addr, hp->h_addr, hp->h_length);
sp->sin_family = hp->h_addrtype;
} else if ((sp->sin_addr.s_addr = inet_addr (host)) != INADDR_NONE) {
sp->sin_family = AF_INET;
} else {
sysmessage (MSG_ERR, "%s: No such host\n",
host);
return (E_PARMINVAL);
}
tcpport = base + physport;
sp->sin_port = htons(tcpport);
sysmessage(MSG_NOTICE,"Using %s:%d socket\n",
inet_ntoa (sp->sin_addr),
tcpport);
return (E_NORMAL);
}
int
sock_link(int iosize)
{
int fd;
struct sockaddr_in * sp = &S_inaddr;
int flag;
char dummy[4];
int bufsize;
if ((fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
sysmessage (MSG_ERR,
"Can't create a socket for communication : %s\n",
strerror(errno));
return (E_FILEIO);
}
bufsize = 2 * iosize;
if (setsockopt (fd, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(int))
== -1) {
sysmessage (MSG_ERR, "Can't set socket buffer size : %s\n",
strerror(errno));
return (E_FILEIO);
}
if (connect (fd, (struct sockaddr *) sp, sizeof (struct sockaddr_in))
== -1) {
sysmessage (MSG_WARNING,
"Can't initiate connection on a socket : %s\n",
strerror(errno));
close(fd);
return (E_CONNECT);
}
# ifdef USE_FIONBIO
flag = 1;
if (ioctl (fd, FIONBIO, &flag) == -1) {
sysmessage (MSG_ERR,
"Can't set non-block on a socket : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# else
if ((flag = fcntl (fd, F_GETFL, 0)) == -1) {
sysmessage (MSG_ERR,
"Can't get file flags of a socket : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# ifdef USE_STD_NDELAY
flag |= O_NDELAY;
# elif defined USE_POSIX_NONBLOCK
flag |= O_NONBLOCK;
# else
close(fd);
return (E_PARMINVAL); /* Socket must be in non_blockin mode */
# endif
if (fcntl (fd, F_SETFL, flag) == -1) {
sysmessage (MSG_ERR,
"Can't set file flags of a socket : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# endif
sysdelay(SERVER_DELAY); /* Wait server startup */
if (recv (fd, dummy, 0, 0) == -1) {
if (errno != EAGAIN && errno != EWOULDBLOCK) {
sysmessage (MSG_WARNING,
"Can't initiate connection on a socket : (recv) %s\n",
strerror(errno));
close(fd);
return (E_CONNECT);
}
}
S_fd = fd;
return (E_NORMAL);
}
int
sock_unlink(void)
{
(void) close (S_fd);
return (E_NORMAL);
}
/*
* Network routines using BSD socket interface
*/
int
sock_write (unsigned char *buf, int n)
{
int ret;
if ((ret = send (S_fd, buf, n, 0)) < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
ret = 0;
} else {
sysmessage (MSG_ERR,"send : %s\n",
strerror (errno));
}
}
# ifdef TSR_MEASURE
if (ret > 0) {
netwrites++;
netwbytes += ret;
} else {
netnwrites++;
}
# endif
return (ret);
}
int
sock_read(unsigned char *buf, int n)
{
register int ret;
int tot;
int rcnt;
tot = rcnt = 0;
do {
if ((ret = recv (S_fd, buf, n, 0)) > 0) {
tot += ret;
buf += ret;
n -= ret;
# ifdef TSR_MEASURE
netreads++;
netrbytes += ret;
# endif
# ifdef BRAKES_ON
/* Delays to avoid system overload on small reads */
mindelay();
if (rcnt++) {
if (n > 0) {
rcnt = 0;
delay(100);
}
}
# endif
} else if (ret < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
ret = 0;
} else {
sysmessage (MSG_ERR,"recv : %s\n",
strerror (errno));
}
}
# ifdef TSR_MEASURE
if (ret == 0) {
netnreads++;
}
# endif
} while (n > 0 && ret > 0);
if (ret >= 0) {
ret = tot;
}
return (ret);
}
cyclades-serial-client-0.93ubuntu1/config.guess 0000775 0000000 0000000 00000125364 13032075072 016533 0 ustar #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2016-04-02'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches to .
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
UNAME_MACHINE=alpha ;;
"EV5 (21164)")
UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH=x86_64
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c &&
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`$dummy $dummyarg` &&
{ echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
then
echo "$SYSTEM_NAME"
else
echo rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = hppa2.0w ]
then
eval $set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH=hppa2.0w
else
HP_ARCH=hppa64
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
paragon:*:*:*)
echo i860-intel-osf1
exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos
exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
eval $set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = 386; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;;
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
esac
cat >&2 < in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
cyclades-serial-client-0.93ubuntu1/inc/ 0000775 0000000 0000000 00000000000 07713353274 014765 5 ustar cyclades-serial-client-0.93ubuntu1/inc/conf.h.in 0000664 0000000 0000000 00000000125 07704416422 016461 0 ustar #ifndef CONF_H
#define CONF_H
#undef HAVE_UTILITY_H
#undef HAVE_SYS_PARAM_H
#endif
cyclades-serial-client-0.93ubuntu1/inc/system.h 0000664 0000000 0000000 00000001115 07557602454 016463 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* system.h
* Unix system-dependent definitions
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
# ifdef _TSR_SYSTEM_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN void mindelay(void);
EXTERN void sysdelay(int msecs);
EXTERN void sysmessage(int type, const char * const format, ...);
EXTERN void doexit(int val);
EXTERN void init_system(void);
EXTERN unsigned char * mem_get(int size);
EXTERN void mem_free(void * ptr);
EXTERN char Idmsg[128];
# undef EXTERN
cyclades-serial-client-0.93ubuntu1/inc/tsrmeasure.h 0000664 0000000 0000000 00000001232 07117756141 017324 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* measure.h
* Activity measure definitions
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
# ifdef _TSR_MEASURE_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN void start_measure(void);
EXTERN void cpu_measure(int all);
EXTERN int devreads;
EXTERN int devnreads;
EXTERN int devwrites;
EXTERN int devnwrites;
EXTERN int netreads;
EXTERN int netnreads;
EXTERN int netwrites;
EXTERN int netnwrites;
EXTERN int devrbytes;
EXTERN int devwbytes;
EXTERN int netrbytes;
EXTERN int netwbytes;
EXTERN int ioscheds;
# undef EXTERN
cyclades-serial-client-0.93ubuntu1/inc/cyclades-ser-cli.h 0000664 0000000 0000000 00000004236 07705732033 020261 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* tsrsock.h
* Tsrsock main definitions
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* 05/09/2002 V.1.0.1
* Increase buffer sizes
*/
#include "conf.h"
/*
* PTY and Network I/O sizes
*/
# define DEV_MAXIOSZ 32768
# define DEV_DEFIOSZ 1024
# define SOCK_MAXIOSZ 16384
# define SOCK_DEFIOSZ 128
/* Delays (in miliseconds) */
# define RETRY_DELAY 15000
# define SCHED_DELAY 1000
# define SERVER_DELAY 1000
# define NOTIFY_DELAY 1000
# define OPTION_DELAY 200
# define ROOM_DELAY 200
# define COMPORT_DELAY 200
/* Error recovery retries */
# define BIGNUM 0x7fffffff
# define NUM_RETRIES BIGNUM
/* modem control for the device */
# define DEV_MODEM 0 /* Check modem control lines */
# define DEV_LOCAL 1 /* Don't check them */
/* last tty close behavior */
# define CLOSE_HANG 0 /* Do hangup on last close */
# define CLOSE_NOHANG 1 /* Don't do it */
/* Socket / Rtelnet ports */
# define SOCKET_BASE 31000
# define RTELNET_BASE 30000
# define RTELNET_STD 23
/* server type */
# define SRV_RTELNET 0 /* Reverse telnet */
# define SRV_SOCKET 1 /* Raw socket */
/* Exit/return error codes */
# define E_NORMAL 0 /* Normal exit/return */
# define E_FILEIO 1 /* File access error */
# define E_PARMINVAL 2 /* Invalid parameter */
# define E_SIGNAL 3 /* Signal received */
# define E_CONNECT 4 /* Connection side error */
# define E_RETRYEND 5 /* Retries exausted */
# define E_BLOCKED 6 /* A write was blocked */
# define E_SYSTEM 7 /* A write was blocked */
/* Log Messages */
# define MSG_DEBUG 0
# define MSG_INFO 1
# define MSG_NOTICE 2
# define MSG_WARNING 3
# define MSG_ERR 4
/* Miscelaneous */
# define NAMESIZE 64
# ifndef TRUE
# define TRUE 1
# define FALSE 0
# endif
# ifndef NULL
# define NULL 0
# endif
# ifndef min
# define min(a,b) ((a) < (b) ? (a) : (b))
# endif
# ifndef max
# define max(a,b) ((a) > (b) ? (a) : (b))
# endif
typedef int (*PFI)();
typedef void (*PFV)();
# ifdef _TSR_TSRSOCK_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN char * Pgname;
EXTERN int Debug;
EXTERN int Console;
EXTERN int Foreground;
# undef EXTERN
cyclades-serial-client-0.93ubuntu1/inc/control.h 0000664 0000000 0000000 00000000307 07705651173 016616 0 ustar
typedef enum
{
eSET_SPEED = 0,
eSEND_BREAK,
eSET_CSIZE,
eSET_PARITY,
eSET_STOPSIZE,
eSET_CONTROL
} e_operation;
typedef struct
{
int size;
e_operation oper;
int val;
} s_control;
cyclades-serial-client-0.93ubuntu1/inc/conf.h 0000664 0000000 0000000 00000000215 07704423225 016053 0 ustar /* inc/conf.h. Generated by configure. */
#ifndef CONF_H
#define CONF_H
/* #undef HAVE_UTILITY_H */
/* #undef HAVE_SYS_PARAM_H */
#endif
cyclades-serial-client-0.93ubuntu1/inc/port_speed.h 0000664 0000000 0000000 00000003440 07705161524 017277 0 ustar #ifdef SHARED_OBJECT
#define FUNC_TYPE static
#else
#define FUNC_TYPE
#endif
FUNC_TYPE int baud_index_to_int(speed_t baud_index)
{
switch(baud_index)
{
case B0:
return 0;
case B50:
return 50;
case B75:
return 75;
case B110:
return 110;
case B134:
return 134;
case B150:
return 150;
case B200:
return 200;
case B300:
return 300;
case B600:
return 600;
case B1200:
return 1200;
case B1800:
return 1800;
case B2400:
return 2400;
case B4800:
return 4800;
case B9600:
return 9600;
case B19200:
return 19200;
case B38400:
return 38400;
#ifdef B57600
case B57600:
return 57600;
#endif
#ifdef B115200
case B115200:
return 115200;
#endif
#ifdef B230400
case B230400:
return 230400;
#endif
#ifdef B460800
case B460800:
return 460800;
#endif
}
return -1;
}
FUNC_TYPE speed_t int_to_baud_index(int speed)
{
switch(speed)
{
case 0:
return B0;
case 50:
return B50;
case 75:
return B75;
case 110:
return B110;
case 134:
return B134;
case 150:
return B150;
case 200:
return B200;
case 300:
return B300;
case 600:
return B600;
case 1200:
return B1200;
case 1800:
return B1800;
case 2400:
return B2400;
case 4800:
return B4800;
case 9600:
return B9600;
case 19200:
return B19200;
case 38400:
return B38400;
#ifdef B57600
case 57600:
return B57600;
#endif
#ifdef B115200
case 115200:
return B115200;
#endif
#ifdef B230400
case 230400:
return B230400;
#endif
#ifdef B460800
case 460800:
return B460800;
#endif
}
return B0;
}
cyclades-serial-client-0.93ubuntu1/inc/misc.h 0000664 0000000 0000000 00000000747 07713353274 016101 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* misc.h
* Miscelaneous system-dependent definition
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
# ifdef _TSR_MISC_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN int external_poll (int eventmask, int timeout);
# undef EXTERN
#define TSRDEV_VERSION "0.92"
#define TSRDEV_DATE "Mon Aug 4 13:44:49 EST 2003"
#define UNIX98
#define HAVE_DAEMON
#define LIBC "libc.so.6"
cyclades-serial-client-0.93ubuntu1/inc/telnet.h 0000664 0000000 0000000 00000015210 07710220645 016420 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* telnet.h
* Telnet Network Virtual Terminal definitions
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
/* Some Telnet Special chars */
# define IAC 255
# define WILL 251
# define WONT 252
# define DO 253
# define DONT 254
# define SE 240
# define SB 250
/* Telnet receiver substates */
# define S_DATA 0
# define S_IAC 1
# define S_WILL 2
# define S_WONT 3
# define S_DO 4
# define S_DONT 5
# define S_SB 6
# define S_SE 7
/* Telnet Options stuff */
# define NVT_BINARY 0
# define NVT_ECHO 1
# define NVT_SUPP_GO_AHEAD 3
# define NVT_COM_PORT_OPTION 44
# define NVT_NUMOPTS 256
int NvtOptions[NVT_NUMOPTS];
# define I_WILL 0x01 /* I desire to support it */
# define I_DO 0x02 /* I do support it */
# define I_SENT 0x04 /* I desire and already sent it */
# define HE_WILL 0x10 /* I want he supports it */
# define HE_DOES 0x20 /* He supports it */
# define HE_RECV 0x40 /* He recv my response */
# define I_WANT_TO_SUPPORT(opt) (NvtOptions[(opt)] & I_WILL)
# define I_DO_SUPPORT(opt) (NvtOptions[(opt)] & I_DO)
# define I_SENT_IT(opt) (NvtOptions[(opt)] & I_SENT)
# define HE_MAY_SUPPORT(opt) (NvtOptions[(opt)] & HE_WILL)
# define HE_DOES_SUPPORT(opt) (NvtOptions[(opt)] & HE_DOES)
# define HE_RECV_IT(opt) (NvtOptions[(opt)] & HE_RECV)
# define SET_I_WANT_TO_SUPPORT(opt) (NvtOptions[(opt)] |= I_WILL)
# define SET_I_DO_SUPPORT(opt) (NvtOptions[(opt)] |= I_DO)
# define SET_I_SENT_IT(opt) (NvtOptions[(opt)] |= I_SENT)
# define SET_HE_MAY_SUPPORT(opt) (NvtOptions[(opt)] |= HE_WILL)
# define SET_HE_DOES_SUPPORT(opt) (NvtOptions[(opt)] |= HE_DOES)
# define SET_HE_RECV_IT(opt) (NvtOptions[(opt)] |= HE_RECV)
# define CLR_I_WANT_TO_SUPPORT(opt) (NvtOptions[(opt)] &= ~I_WILL)
# define CLR_I_DO_SUPPORT(opt) (NvtOptions[(opt)] &= ~I_DO)
# define CLR_I_SENT_IT(opt) (NvtOptions[(opt)] &= ~I_SENT)
# define CLR_HE_MAY_SUPPORT(opt) (NvtOptions[(opt)] &= ~HE_WILL)
# define CLR_HE_DOES_SUPPORT(opt) (NvtOptions[(opt)] &= ~HE_DOES)
# define CLR_HE_RECV_IT(opt) (NvtOptions[(opt)] &= ~HE_RECV)
# define SEND_DO(opt) (send_option(DO, (opt)))
# define SEND_DONT(opt) (send_option(DONT, (opt)))
# define SEND_WILL(opt) (send_option(WILL, (opt)))
# define SEND_WONT(opt) (send_option(WONT, (opt)))
/* RFC2217 Stuff */
# define GET_VALUE_4(p) ( ((int) (*((p) )) << 24) + ((int) (*((p)+1)) << 16) \
+ ((int) (*((p)+2)) << 8) + ((int) (*((p)+3))) )
# define GET_VALUE_1(p) (*(p))
# define SET_VALUE_4(p, val) { \
*((p)) = (val >> 24) & 0xff; \
*((p)+1) = (val >> 16) & 0xff; \
*((p)+2) = (val >> 8) & 0xff; \
*((p)+3) = val & 0xff; \
}
# define SET_VALUE_1(p, val) { \
*((p)) = val & 0xff; \
}
/* Com port commands and notifications */
/* Client codes */
# define USR_COM_SIGNATURE 0 /* none, RFC2217 says */
# define USR_COM_SET_BAUDRATE 1
# define USR_COM_SET_DATASIZE 2
# define USR_COM_SET_PARITY 3
# define USR_COM_SET_STOPSIZE 4
# define USR_COM_SET_CONTROL 5
# define USR_COM_NOTIFY_LINESTATE 6
# define USR_COM_NOTIFY_MODEMSTATE 7
# define USR_COM_FLOWCONTROL_SUSPEND 8
# define USR_COM_FLOWCONTROL_RESUME 9
# define USR_COM_SET_LINESTATE_MASK 10
# define USR_COM_SET_MODEMSTATE_MASK 11
# define USR_COM_PURGE_DATA 12
# define NUM_COMCMDS USR_COM_PURGE_DATA + 1
/*
* State control of NVT Com Port Commands
*/
int CmdState[NUM_COMCMDS];
# define CMD_INACTIVE 0
# define CMD_ACTIVE 1
# define SET_CMD_ACTIVE(cmd) (CmdState[(cmd)] = CMD_ACTIVE)
# define CLR_CMD_ACTIVE(cmd) (CmdState[(cmd)] = CMD_INACTIVE)
# define IS_CMD_ACTIVE(cmd) (CmdState[(cmd)] == CMD_ACTIVE)
/* Access Server codes */
# define RAS_COM_SIGNATURE 100 /* none, RFC2217 says */
# define RAS_COM_SET_BAUDRATE 101
# define RAS_COM_SET_DATASIZE 102
# define RAS_COM_SET_PARITY 103
# define RAS_COM_SET_STOPSIZE 104
# define RAS_COM_SET_CONTROL 105
# define RAS_COM_NOTIFY_LINESTATE 106
# define RAS_COM_NOTIFY_MODEMSTATE 107
# define RAS_COM_FLOWCONTROL_SUSPEND 108
# define RAS_COM_FLOWCONTROL_RESUME 109
# define RAS_COM_SET_LINESTATE_MASK 110
# define RAS_COM_SET_MODEMSTATE_MASK 111
# define RAS_COM_PURGE_DATA 112
# define RAS_COM_START RAS_COM_SIGNATURE
# define RAS_COM_END RAS_COM_PURGE_DATA
/* SET-BAUDRATE Stuff */
# define COM_BAUD_REQ 0
# define COM_BAUD(x) x
/* SET-DATASIZE Stuff */
# define COM_DSIZE_REQ 0
# define COM_DSIZE(x) x
/* SET-PARITY Stuff */
# define COM_PARITY_REQ 0
# define COM_PARITY_NONE 1
# define COM_PARITY_ODD 2
# define COM_PARITY_EVEN 3
# define COM_PARITY_MARK 4
# define COM_PARITY_SPACE 5
/* COM-STOPSIZE Stuff */
# define COM_SSIZE_REQ 0
# define COM_SSIZE_ONE 1
# define COM_SSIZE_TWO 2
# define COM_SSIZE_1DOT5 3
/* SET-CONTROL Stuff */
# define COM_OFLOW_REQ 0
# define COM_OFLOW_NONE 1
# define COM_OFLOW_SOFT 2
# define COM_OFLOW_HARD 3
# define COM_BREAK_REQ 4
# define COM_BREAK_ON 5
# define COM_BREAK_OFF 6
# define COM_DTR_REQ 7
# define COM_DTR_ON 8
# define COM_DTR_OFF 9
# define COM_RTS_REQ 10
# define COM_RTS_ON 11
# define COM_RTS_OFF 12
# define COM_IFLOW_REQ 13
# define COM_IFLOW_NONE 14
# define COM_IFLOW_SOFT 15
# define COM_IFLOW_HARD 16
# define COM_DCD_FLOW 17
# define COM_DTR_FLOW 18
# define COM_DSR_FLOW 19
# define COM_FLOW_REQ COM_OFLOW_REQ
# define COM_FLOW_NONE COM_OFLOW_NONE
# define COM_FLOW_SOFT COM_OFLOW_SOFT
# define COM_FLOW_HARD COM_OFLOW_HARD
/* LINESTATE MASK (COM-LINESTATE-MASK command / NOTIFY-LINESTATE notification*/
# define LINE_TIMEOUT_ERROR 128
# define LINE_SHIFTREG_EMPTY 64
# define LINE_HOLDREG_EMPTY 32
# define LINE_BREAK_ERROR 16
# define LINE_FRAME_ERROR 8
# define LINE_PARITY_ERROR 4
# define LINE_OVERRUN_ERROR 2
# define LINE_DATA_READY 1
/* MODEMSTATE MASK (SET-MODEMSTATE-MASK / NOTIFY-MODEMSTATE */
# define MODEM_DCD 128
# define MODEM_RI 64
# define MODEM_DSR 32
# define MODEM_CTS 16
# define MODEM_DELTA_DCD 8
# define MODEM_TRAIL_RI 4
# define MODEM_DELTA_DSR 2
# define MODEM_DELTA_CTS 1
/* PURGE-DATA Stuff */
# define COM_PURGE_RECV 1
# define COM_PURGE_XMIT 2
# define COM_PURGE_BOTH 3
/*
* External accessible routines
*/
# ifdef _TSR_TELNET_
# define EXTERN
# else
# define EXTERN extern
# endif
#ifdef INIT_BUFFER
EXTERN int tel_init(int netsize, struct buffer *ibp, struct buffer *obp);
EXTERN int tel_putdata (struct buffer *bp);
#endif
EXTERN int tel_getdata (void);
EXTERN int tel_putcmd (int command, int arg);
EXTERN void tel_free (void);
EXTERN int sync_comport_command (int command, int arg);
EXTERN struct nvt Nvt;
# undef EXTERN
cyclades-serial-client-0.93ubuntu1/inc/daemon.h 0000664 0000000 0000000 00000004725 07714046256 016411 0 ustar /*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include
#include
#include
static int
daemon(nochdir, noclose)
int nochdir, noclose;
{
int fd;
switch (fork()) {
case -1:
return (-1);
case 0:
break;
default:
_exit(0);
}
if (setsid() == -1)
return (-1);
if (!nochdir)
(void)chdir("/");
if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) {
struct stat st;
if ((fstat (fd, &st), 0) == 0
&& S_ISCHR (st.st_mode) != 0
#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
&& st.st_rdev == makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)
#endif
) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
if (fd > 2)
(void)close (fd);
} else {
(void)close (fd);
return -1;
}
}
return (0);
}
cyclades-serial-client-0.93ubuntu1/inc/tsrio.h 0000664 0000000 0000000 00000020135 07710220605 016263 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* tsrio.h
* Tsrsock I/O Scheduler definitions
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* 01/21/2001 V.1.0.1 Debug messages are sent only if debug is on
*/
/*
* Simple buffer managment (for delayed writes and/or on NONBLOCK devices)
*/
struct buffer {
unsigned char * b_base; /* Area */
unsigned char * b_ins; /* Insert data ptr */
unsigned char * b_rem; /* Remove data ptr */
int b_hold; /* Valid data bytes */
int b_size; /* Buffer size */
};
# define INIT_BUFFER(buf, size) \
if ((buf.b_base = mem_get (size)) == NULL) { \
sysmessage (MSG_ERR,"%s: out of memory\n", Idmsg); \
return (E_SYSTEM); \
} \
buf.b_ins = buf.b_rem = buf.b_base; \
buf.b_size = size; \
buf.b_hold = 0;
# define FREE_BUFFER(buf) mem_free(buf.b_base);
# define COPY_TO_BUFFER(b, p, nn) \
{ \
int XXi = (b)->b_size - (b)->b_hold; \
if (nn > XXi) { \
sysmessage (MSG_ERR, "%s: Buffer overflow\n", Idmsg); \
nn = XXi; \
} \
memcpy ((b)->b_ins, p, nn); \
(b)->b_ins += nn; \
(b)->b_hold += nn; \
}
# define PUT_BUFFER(b, c) \
{ \
if ((b)->b_hold < (b)->b_size) { \
*(b)->b_ins++ = (c); (b)->b_hold++; \
} else { \
sysmessage (MSG_ERR, "%s: Buffer overflow\n", Idmsg); \
} \
}
# define GET_BUFFER(b) (b)->b_hold ? *(b)->b_rem++ : 0; \
if ((b)->b_hold) (b)->b_hold--;
# define COPY_FROM_BUFFER(b, p, nn) \
memcpy (p, (b)->b_rem, nn); \
(b)->b_rem += nn; \
(b)->b_hold -= nn;
# define REWIND_BUFFER(b, n) (b)->b_rem -= n; (b)->b_hold += n;
# define FORWARD_BUFFER(b, n) (b)->b_rem += n; (b)->b_hold -= n;
# define RESET_BUFFER(b) (b)->b_rem = (b)->b_ins = (b)->b_base; \
(b)->b_hold = 0;
struct portconfig {
int speed;
int datasize;
int stopsize;
int parity;
int flowc;
};
struct portstate {
int modemstate;
int linestate;
};
struct comport {
int support;
struct portconfig portconfig;
struct portstate portstate;
};
struct nvt {
int state;
int substate;
int servertype;
int iosize;
struct comport * comport;
struct buffer * inbuff;
struct buffer * outbuff;
};
struct iocontrol {
int io_oper;
union {
struct portconfig portconfig;
int arg;
} io_param;
};
# define io_portconfig io_param.portconfig
# define io_arg io_param.arg
struct pty {
int state;
int substate;
int iosize;
int portmodes;
struct iocontrol iocontrol;
struct comport * comport;
struct buffer * inbuff;
struct buffer * outbuff;
};
/* Bits for portmodes */
# define PORT_HUPCL 0x00000001
# define PORT_CLOCAL 0x00000002
# define PORT_IGNBRK 0x00000004
# define PORT_BRKINT 0x00000008
# define PORT_IGNPAR 0x00000010
# define PORT_PARMRK 0x00000020
/* State values */
/* PTY States */
# define PTY_INITIAL 0
# define PTY_CLOSING 1
# define PTY_CLOSED 2
# define PTY_OPENING 3
# define PTY_WAITDCD 4
# define PTY_OPER 5
# define PTY_CONFIG 6
# define PTY_WAITNVTWR 7
# define PTY_WAITUSRWR 8
# define PTY_WAITNWUW 9 /* Wait both */
# define PTY_WAITNVTCM 10
# define PTY_WAITCLOCAL 11 /* Pseudo-states */
# define PTY_WAITCLOSE 12
# define PTY_OPERRONLY 13
# define PTY_WAITUSRWR0 14
# define PTY_WAITUSRWR2 15
# define PTY_STATES PTY_WAITUSRWR2 + 1
/* NVT States */
# define NVT_INITIAL 0
# define NVT_OPER 1
# define NVT_WAITPTYWR 2
# define NVT_WAITRASWR 3
# define NVT_WAITRWPW 4
# define NVT_WAITRASCM 5
# define NVT_WAITRCPW 6
# define NVT_STATES NVT_WAITRCPW + 1
/*
* State macros
*/
# define PTY_SETSTATE(routine, newstate) \
Pty.state = newstate; \
print_ptystate(routine);
# define NVT_SETSTATE(routine, newstate) \
Nvt.state = newstate; \
print_nvtstate(routine);
/* External polling */
# define DEV_READ 0x01
# define DEV_WRITE 0x02
# define DEV_EXCEPT 0x04
# define DEV_PROBE 0x08
# define SOCK_READ 0x10
# define SOCK_WRITE 0x20
# define SOCK_EXCEPT 0x40
# define SOCK_PROBE 0x40
struct event {
int ev_type;
int ev_code;
void * ev_param;
int ev_size;
struct event * ev_next;
struct event * ev_last;
};
/* External event types */
# define EV_NONE 0 /* Free event entry */
# define EV_UP 1 /* USR => PTY events */
# define EV_RN 2 /* RAS => NVT events */
# define EV_NP 3 /* NVT => PTY events */
# define EV_PN 4 /* PTY => NVT events */
/* event codes */
/* User => PTY events */
# define EV_UPOPEN 0 /* First open */
# define EV_UPCLOSE 1 /* Last close */
# define EV_UPDATA 2 /* Valid data on pty read */
# define EV_UPCONTROL 3 /* Pty ioctl */
# define EV_UPFLUSH 4 /* Flush buffers */
# define EV_UPWROK 5 /* Data was written on pty */
# define EV_UPEVENTS EV_UPWROK + 1
/* EV_UPCONTROL Parameters */
# define OP_NONE 0
# define OP_SETNOW 1
# define OP_SETWAIT 2
# define OP_SETFLUSH 3
# define OP_SENDBREAK 4
# define OP_SETLINES 5
# define OP_FLUSH 6
/* OP_FLUSH modes */
# define OPFLUSH_IN 0
# define OPFLUSH_OUT 1
# define OPFLUSH_IO 2
/* RAS => NVT events */
# define EV_RNNTFY 0
# define EV_RNDATA 1
# define EV_RNHANG 2
# define EV_RNCMDOK 3
# define EV_RNWROK 4
# define EV_RNEVENTS EV_RNWROK + 1
/* EV_RNNTFY Notifications */
# define NT_DCDON 0
# define NT_DCDOFF 1
# define NT_BREAK 2
# define NT_PARITY 3
/* NVT => PTY internal events */
# define EV_NPWROK 0
# define EV_NPCMDOK 1
# define EV_NPDCDON 2
# define EV_NPDCDOFF 3
# define EV_NPPARITY 4
# define EV_NPBREAK 5
# define EV_NPEVENTS EV_NPBREAK + 1
/* PTY => NVT Internal events */
# define EV_PNWROK 0
# define EV_PNEVENTS EV_PNWROK + 1
# define MAX_EVENTS 20
# define EVENT_PARAMSZ 128
struct event Eventpoll[MAX_EVENTS];
struct event Evhead;
# define INIT_EVENTS() Evhead.ev_last = Evhead.ev_next = &Evhead;
# define FREE_EVENTS() \
{ \
struct event *evp; \
int i; \
for (i = 0, evp = &Eventpoll[0]; i < MAX_EVENTS; i++, evp++) { \
evp->ev_type = EV_NONE; \
} \
Evhead.ev_last = Evhead.ev_next = &Evhead; \
}
# define SET_EVENT(evtype, evcode, evparam, evsize) \
{ \
struct event *evp; \
void * memptr; \
int XXi; \
for(XXi = 0, evp = &Eventpoll[0]; XXi < MAX_EVENTS; XXi++, evp++) { \
if(evp->ev_type == EV_NONE) { \
break; \
} \
} \
if(XXi == MAX_EVENTS) { \
sysmessage (MSG_ERR, "%s: Too many events", Idmsg); \
} else { \
evp->ev_type = evtype; \
evp->ev_code = evcode; \
if (evparam) { \
if ((memptr = mem_get (EVENT_PARAMSZ)) \
== (void *)0) { \
sysmessage (MSG_ERR, \
"%s: No memory", Idmsg); \
} \
memcpy (memptr, evparam, evsize); \
evp->ev_param = (void *) memptr; \
evp->ev_size = evsize; \
} else { \
evp->ev_param = (void *) evparam; \
evp->ev_size = 0; \
} \
evp->ev_next = &Evhead; \
evp->ev_last = Evhead.ev_last; \
Evhead.ev_last->ev_next = evp; \
Evhead.ev_last = evp; \
} \
}
# define SET_HIPRI_EVENT(evtype, evcode, evparam, evsize) \
{ \
struct event *evp; \
int i; \
for (i = 0, evp = &Eventpoll[i]; i < MAX_EVENTS; i++, evp++) { \
if (evp->ev_type == EV_NONE) { \
break; \
} \
} \
if (i == MAX_EVENTS) { \
sysmessage (MSG_ERR, "%s: Too many events", Idmsg; \
} else { \
evp->ev_type = evtype; \
evp->ev_code = evcode; \
if (evparam) { \
if ((memptr = mem_get (EVENT_PARAMSZ)) \
== (void *)0) { \
sysmessage (MSG_ERR, \
"%s: No memory", Idmsg); \
} \
memcpy (memptr, evparam, evsize); \
evp->ev_param = (void *) memptr; \
evp->ev_size = evsize; \
} else { \
evp->ev_param = (void *) 0; \
evp->ev_size = 0; \
} \
evp->ev_last = &Evhead; \
evp->ev_next = Evhead.ev_next; \
Evhead.ev_next->ev_last = evp; \
Evhead.ev_next = evp; \
} \
}
# define GET_EVENT() \
Evhead.ev_next == &Evhead ? 0 : Evhead.ev_next;
# define CLR_EVENT(evp) \
{ \
evp->ev_last->ev_next = evp->ev_next; \
evp->ev_next->ev_last = evp->ev_last; \
evp->ev_type = EV_NONE; \
if (evp->ev_param) { \
(void) mem_free (evp->ev_param); \
} \
}
/*
* External accessible routines
*/
# ifdef _TSR_TSRIO_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN int tsr_init(int netsize, int devsize, int devmodem, int closemode);
EXTERN void tsr_io(void);
EXTERN void imminent_event(int msgtype);
EXTERN int Hang_up;
# undef EXTERN
cyclades-serial-client-0.93ubuntu1/inc/dev.h 0000664 0000000 0000000 00000002515 07713630647 015721 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* dev.h
* Unix Pty Device definitions
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
/*
* Message types (returned by dev_probe())
*/
# define PROBE_DATA 1
# define PROBE_EOF 2
# define PROBE_FLUSH 3
# define PROBE_CLOCAL 4
# define PROBE_GENERIC 5
# ifdef _TSR_DEV_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN int dev_getaddr(char *dname);
EXTERN void dev_free(void);
EXTERN void dev_unlink(void);
EXTERN int dev_init(int iosize, int devmodem, int closemode,
struct buffer *ibp, struct buffer *obp, struct comport *cp);
EXTERN int dev_config (void);
EXTERN int dev_closeslave(void);
EXTERN int dev_probe(void);
EXTERN int dev_getdata(void);
EXTERN int dev_putdata(struct buffer *bp);
EXTERN void dev_interrupt(void);
EXTERN void dev_hangup(void);
EXTERN struct pty Pty;
/* handle for pty master */
EXTERN int P_mfd;
/* handle for pty slave */
EXTERN int P_sfd;
/* handle for control socket listener */
EXTERN int P_contr_listen;
/* handle for control socket */
#define MAX_CONTROL_SOCKS 32
EXTERN int P_contr[MAX_CONTROL_SOCKS];
/* struct for port information */
EXTERN struct comport Comport;
/* device name */
EXTERN char P_devname[NAMESIZE];
/* control socket name */
EXTERN char P_contrname[108];
# undef EXTERN
cyclades-serial-client-0.93ubuntu1/inc/misc.h.in 0000664 0000000 0000000 00000000702 07705150126 016465 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* misc.h
* Miscelaneous system-dependent definition
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
*/
# ifdef _TSR_MISC_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN int external_poll (int eventmask, int timeout);
# undef EXTERN
#define TSRDEV_VERSION "@version@"
#define TSRDEV_DATE "@date@"
@UNIX98@
@daemon@
#define LIBC "@LIBC@"
cyclades-serial-client-0.93ubuntu1/inc/sock.h 0000664 0000000 0000000 00000001005 07117756144 016072 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* sock.h
* Unix socket definitions
*
* History
* 08/16/1999 V.1.0.0 Initial revision
*
*/
# ifdef _TSR_SOCK_
# define EXTERN
# else
# define EXTERN extern
# endif
EXTERN int sock_getaddr (char *host, int base, int physport);
EXTERN int sock_link(int iosize);
EXTERN int sock_unlink(void);
EXTERN int sock_write (unsigned char *buf, int n);
EXTERN int sock_read(unsigned char *buf, int n);
EXTERN int S_fd;
# undef EXTERN
cyclades-serial-client-0.93ubuntu1/cyclades-serial-client.spec 0000664 0000000 0000000 00000002712 07713353274 021412 0 ustar Summary: Serial Port Interface for Cyclades Terminal Servers
Name: cyclades-serial-client
Version: 0.92
Release: 1
Copyright: GPL
Group: Network
#URL:
#Source:
BuildRoot: /tmp/%{name}-buildroot
Prefixes: %{_prefix} %{_datadir}
Requires: glibc >= 2.1
Requires: perl >= 5.0
BuildRequires: glibc-devel >= 2.1
source0: cyclades-serial-client_0.92.tar.gz
%description
This package connects a pseudo-tty on a local system to a remote serial port.
%prep
%setup -q
%build
./configure --prefix=$RPM_BUILD_ROOT%{_prefix} --mandir=$RPM_BUILD_ROOT%{_mandir}
make
%install
DESTDIR=$RPM_BUILD_ROOT; export DESTDIR
[ -n "`echo $DESTDIR | sed -n 's:^/tmp/[^.].*$:OK:p'`" ] && rm -rf $DESTDIR ||
(echo "Invalid BuildRoot: '$DESTDIR'! Check the spec ..."; exit 1) || exit 1
mkdir -p $DESTDIR/usr/sbin
mkdir -p $DESTDIR%{_mandir}/man{5,8}
mkdir -p $DESTDIR/etc
install -c -m 644 cyclades-devices $DESTDIR/etc
install -c -m 755 cyclades-ser-cli cyclades-serial-client $DESTDIR/usr/sbin
install -c -m 644 man/cyclades-ser-cli.8 man/cyclades-serial-client.8 $DESTDIR%{_mandir}/man8
install -c -m 644 man/cyclades-devices.5 $DESTDIR%{_mandir}/man5
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/etc/cyclades-devices
/usr/sbin/cyclades-ser-cli
/usr/sbin/cyclades-serial-client
%{_mandir}/man8/cyclades-ser-cli.8.gz
%{_mandir}/man8/cyclades-serial-client.8.gz
%{_mandir}/man5/cyclades-devices.5.gz
%changelog
* Wed Oct 30 2002 Russell Coker
- first packaging
cyclades-serial-client-0.93ubuntu1/config.log 0000664 0000000 0000000 00000036525 07713353275 016200 0 ustar This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ ./configure --host=i386-linux --build=i386-linux --prefix=/ --mandir=${prefix}/usr/share/man
## --------- ##
## Platform. ##
## --------- ##
hostname = lyta
uname -m = i686
uname -r = 2.4.21-se2-pcmcia
uname -s = Linux
uname -v = #1 Mon Jul 21 14:27:09 EDT 2003
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = i686
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/X11R6/bin
PATH: /usr/games
PATH: /home/rjc/bin
PATH: /usr/local/sbin
PATH: /sbin
PATH: /usr/sbin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:1327: checking for i386-linux-gcc
configure:1343: found /usr/bin/i386-linux-gcc
configure:1353: result: i386-linux-gcc
configure:1635: checking for C compiler version
configure:1638: i386-linux-gcc --version &5
i386-linux-gcc (GCC) 3.3.1 20030728 (Debian prerelease)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:1641: $? = 0
configure:1643: i386-linux-gcc -v &5
Reading specs from /usr/lib/gcc-lib/i386-linux/3.3.1/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.3.1 20030728 (Debian prerelease)
configure:1646: $? = 0
configure:1648: i386-linux-gcc -V &5
i386-linux-gcc: `-V' option must have argument
configure:1651: $? = 1
configure:1675: checking for C compiler default output
configure:1678: i386-linux-gcc conftest.c >&5
configure:1681: $? = 0
configure:1727: result: a.out
configure:1732: checking whether the C compiler works
configure:1738: ./a.out
configure:1741: $? = 0
configure:1758: result: yes
configure:1765: checking whether we are cross compiling
configure:1767: result: no
configure:1770: checking for suffix of executables
configure:1772: i386-linux-gcc -o conftest conftest.c >&5
configure:1775: $? = 0
configure:1800: result:
configure:1806: checking for suffix of object files
configure:1828: i386-linux-gcc -c conftest.c >&5
configure:1831: $? = 0
configure:1853: result: o
configure:1857: checking whether we are using the GNU C compiler
configure:1882: i386-linux-gcc -c conftest.c >&5
configure:1885: $? = 0
configure:1888: test -s conftest.o
configure:1891: $? = 0
configure:1904: result: yes
configure:1910: checking whether i386-linux-gcc accepts -g
configure:1932: i386-linux-gcc -c -g conftest.c >&5
configure:1935: $? = 0
configure:1938: test -s conftest.o
configure:1941: $? = 0
configure:1952: result: yes
configure:1969: checking for i386-linux-gcc option to accept ANSI C
configure:2030: i386-linux-gcc -c -g -O2 conftest.c >&5
configure:2033: $? = 0
configure:2036: test -s conftest.o
configure:2039: $? = 0
configure:2057: result: none needed
configure:2075: i386-linux-gcc -c -g -O2 conftest.c >&5
conftest.c:2: error: syntax error before "me"
configure:2078: $? = 1
configure: failed program was:
| #ifndef __cplusplus
| choke me
| #endif
configure:2191: checking how to run the C preprocessor
configure:2227: i386-linux-gcc -E conftest.c
configure:2233: $? = 0
configure:2265: i386-linux-gcc -E conftest.c
configure:2264:28: ac_nonexistent.h: No such file or directory
configure:2271: $? = 1
configure: failed program was:
| #line 2256 "configure"
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
| #include
configure:2309: result: i386-linux-gcc -E
configure:2334: i386-linux-gcc -E conftest.c
configure:2340: $? = 0
configure:2372: i386-linux-gcc -E conftest.c
configure:2371:28: ac_nonexistent.h: No such file or directory
configure:2378: $? = 1
configure: failed program was:
| #line 2363 "configure"
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
| #include
configure:2457: checking for a BSD-compatible install
configure:2511: result: /usr/bin/install -c
configure:2533: checking for i386-linux-g++
configure:2549: found /usr/bin/i386-linux-g++
configure:2559: result: i386-linux-g++
configure:2617: checking for C++ compiler version
configure:2620: i386-linux-g++ --version &5
i386-linux-g++ (GCC) 3.3.1 20030728 (Debian prerelease)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:2623: $? = 0
configure:2625: i386-linux-g++ -v &5
Reading specs from /usr/lib/gcc-lib/i386-linux/3.3.1/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.3.1 20030728 (Debian prerelease)
configure:2628: $? = 0
configure:2630: i386-linux-g++ -V &5
i386-linux-g++: `-V' option must have argument
configure:2633: $? = 1
configure:2636: checking whether we are using the GNU C++ compiler
configure:2661: i386-linux-g++ -c conftest.cc >&5
configure:2664: $? = 0
configure:2667: test -s conftest.o
configure:2670: $? = 0
configure:2683: result: yes
configure:2689: checking whether i386-linux-g++ accepts -g
configure:2711: i386-linux-g++ -c -g conftest.cc >&5
configure:2714: $? = 0
configure:2717: test -s conftest.o
configure:2720: $? = 0
configure:2731: result: yes
configure:2774: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:2777: $? = 0
configure:2780: test -s conftest.o
configure:2783: $? = 0
configure:2810: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure: In function `int main()':
configure:2805: error: `exit' undeclared (first use this function)
configure:2805: error: (Each undeclared identifier is reported only once for
each function it appears in.)
configure:2813: $? = 1
configure: failed program was:
| #line 2793 "configure"
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
|
| int
| main ()
| {
| exit (42);
| ;
| return 0;
| }
configure:2774: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:2777: $? = 0
configure:2780: test -s conftest.o
configure:2783: $? = 0
configure:2810: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:2813: $? = 0
configure:2816: test -s conftest.o
configure:2819: $? = 0
configure:2843: checking for an ANSI C-conforming const
configure:2911: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:2914: $? = 0
configure:2917: test -s conftest.o
configure:2920: $? = 0
configure:2931: result: yes
configure:2946: checking how to run the C++ preprocessor
configure:2978: i386-linux-g++ -E conftest.cc
configure:2984: $? = 0
configure:3016: i386-linux-g++ -E conftest.cc
configure:3018:28: ac_nonexistent.h: No such file or directory
configure:3022: $? = 1
configure: failed program was:
| #line 3007 "configure"
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #ifdef __cplusplus
| extern "C" void std::exit (int) throw (); using std::exit;
| #endif
| /* end confdefs.h. */
| #include
configure:3060: result: i386-linux-g++ -E
configure:3085: i386-linux-g++ -E conftest.cc
configure:3091: $? = 0
configure:3123: i386-linux-g++ -E conftest.cc
configure:3125:28: ac_nonexistent.h: No such file or directory
configure:3129: $? = 1
configure: failed program was:
| #line 3114 "configure"
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #ifdef __cplusplus
| extern "C" void std::exit (int) throw (); using std::exit;
| #endif
| /* end confdefs.h. */
| #include
configure:3172: checking for egrep
configure:3182: result: grep -E
configure:3187: checking for ANSI C header files
configure:3213: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3216: $? = 0
configure:3219: test -s conftest.o
configure:3222: $? = 0
configure:3311: i386-linux-g++ -o conftest -g -O2 conftest.cc >&5
configure:3314: $? = 0
configure:3316: ./conftest
configure:3319: $? = 0
configure:3334: result: yes
configure:3358: checking for sys/types.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for sys/stat.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for stdlib.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for string.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for memory.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for strings.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for inttypes.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for stdint.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3358: checking for unistd.h
configure:3375: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3378: $? = 0
configure:3381: test -s conftest.o
configure:3384: $? = 0
configure:3395: result: yes
configure:3407: checking for size_t
configure:3432: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3435: $? = 0
configure:3438: test -s conftest.o
configure:3441: $? = 0
configure:3452: result: yes
configure:3484: i386-linux-g++ -c -g -O2 conftest.cc >&5
configure:3487: $? = 0
configure:3490: test -s conftest.o
configure:3493: $? = 0
configure:3662: creating ./config.status
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by config.status, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status
on lyta
config.status:635: creating Makefile
config.status:635: creating libcsc/Makefile
config.status:635: creating inc/misc.h
config.status:635: creating cyclades-serial-client.spec
config.status:635: creating sun/pkginfo
config.status:739: creating inc/conf.h
config.status:840: inc/conf.h is unchanged
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_c_compiler_gnu=yes
ac_cv_c_const=yes
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=i386-linux
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=i386-linux
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=
ac_cv_header_inttypes_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_stdc=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_unistd_h=yes
ac_cv_objext=o
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_CC=i386-linux-gcc
ac_cv_prog_CPP='i386-linux-gcc -E'
ac_cv_prog_CXX=i386-linux-g++
ac_cv_prog_CXXCPP='i386-linux-g++ -E'
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_cxx_g=yes
ac_cv_prog_egrep='grep -E'
ac_cv_type_size_t=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
CC='i386-linux-gcc'
CCFLAGS='-O2 -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic'
CFLAGS='-g -O2'
CPP='i386-linux-gcc -E'
CPPFLAGS=''
CXX='i386-linux-g++'
CXXCPP='i386-linux-g++ -E'
CXXFLAGS='-g -O2'
DEFS='-DHAVE_CONFIG_H'
DEV_OBJ='linux-dev.o'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='grep -E'
EXEEXT=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
LDFLAGS=''
LIBC='libc.so.6'
LIBOBJS=''
LIBS=' -lutil'
LTLIBOBJS=''
OBJEXT='o'
OFLAGS='-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK'
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
SHELL='/bin/sh'
SOCFLAGS='-shared -fpic'
SOLFLAGS='-shared -init libcsc_init -fini libcsc_fini -fpic -ldl'
UNIX98='#define UNIX98'
ac_ct_CC=''
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build_alias='i386-linux'
daemon='#define HAVE_DAEMON'
datadir='${prefix}/share'
date='Mon Aug 4 13:44:49 EST 2003'
debug=''
exec_prefix='${prefix}'
host_alias='i386-linux'
includedir='${prefix}/include'
infodir='${prefix}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/usr/share/man'
oldincludedir='/usr/include'
prefix='/'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
stripping='-s'
sysconfdir='${prefix}/etc'
target_alias=''
version='0.92'
## ----------- ##
## confdefs.h. ##
## ----------- ##
#define HAVE_INTTYPES_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define STDC_HEADERS 1
#endif
#ifdef __cplusplus
extern "C" void std::exit (int) throw (); using std::exit;
configure: exit 0
cyclades-serial-client-0.93ubuntu1/Makefile 0000664 0000000 0000000 00000002770 07713353274 015662 0 ustar #
# Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
#
OFLAGS=-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK
CC=i386-linux-gcc
#
# Debug and additional options
#
#DFLAGS=-DTSR_MEASURE
DFLAGS=
#
# Compiler flags
#
CCFLAGS=-O2 -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic
#
# cyclades-ser-cli program flags
#
SOCKFLAGS=$(OFLAGS) $(DFLAGS) $(CCFLAGS)
#
# Link-editor flags
#
LDFLAGS=-s
#
# Standard libraries
#
LDLIBS= -lutil
#
# Object files
#
SOCKOBJS=cyclades-ser-cli.o tsrio.o telnet.o sock.o linux-dev.o misc.o system.o measure.o
#
# Programs for terminal server interface
#
PROGS=cyclades-ser-cli
all: $(PROGS) libcsc/libcyclades-ser-cli.so
clean:
rm -f $(PROGS) *.o depends.bak
( cd libcsc ; $(MAKE) clean )
libcsc/libcyclades-ser-cli.so:
( cd libcsc ; $(MAKE) )
distclean: clean
rm -f config.status
cyclades-ser-cli: $(SOCKOBJS)
$(CC) $(LDFLAGS) -o cyclades-ser-cli $(SOCKOBJS) $(AUXLIBS) $(LDLIBS)
install: cyclades-ser-cli libcsc/libcyclades-ser-cli.so
mkdir -p $(prefix)/usr/lib $(prefix)/usr/sbin $(prefix)/etc
cp cyclades-serial-client cyclades-ser-cli $(prefix)/usr/sbin
cp libcsc/libcyclades-ser-cli.so $(prefix)/usr/lib
cp -i cyclades-devices $(prefix)/etc
mkdir -p $(prefix)/usr/share/man/man5
mkdir -p $(prefix)/usr/share/man/man8
cp man/*.5 $(prefix)/usr/share/man/man5
cp man/*.8 $(prefix)/usr/share/man/man8
%.o: %.c
$(CC) $(SOCKFLAGS) -c $<
dep:
-makedepend -Y -f depends *.c 2> /dev/null
( cd libcsc ; $(MAKE) dep )
include depends
cyclades-serial-client-0.93ubuntu1/configure.in 0000664 0000000 0000000 00000005617 13032075067 016526 0 ustar dnl Process this file with autoconf to produce a configure script.
AC_INIT(cyclades-serial-client)
AC_CONFIG_HEADER(inc/conf.h)
AC_SUBST(version)
version="0.92"
AC_SUBST(date)
date=`date`
AC_SUBST(stripping)
AC_ARG_ENABLE(stripping,
[ --disable-stripping disables stripping of installed binaries],
STRIPPING=$strippingval, STRIPPING=no)
if [[ ! "$STRIPPING" = "no" ]]; then
stripping=""
else
stripping="-s"
fi
echo $DEB_BUILD_OPTIONS | grep -q nostrip
if [[ "$?" = "0" ]]; then
stripping=""
fi
AC_SUBST(debug)
AC_ARG_ENABLE(debug,
[ --with-debug enables debug code generation for binaries],
debug=-g, debug="")
echo $DEB_BUILD_OPTIONS | grep -q debug
if [[ "$?" = "0" ]]; then
debug=-g
fi
dnl Checks for programs.
AC_LANG_CPLUSPLUS
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_SUBST(daemon)
AC_TRY_COMPILE(#include
, daemon(0, 0); , daemon="yes")
if [[ -n "$daemon" ]]; then
daemon="#define HAVE_DAEMON"
fi
AC_SUBST(LIBC)
LIBC=l`ldd /bin/ls | grep libc | head -1 | cut -f2 -dl | cut -f1 "-d "`
AC_SUBST(OFLAGS)
AC_SUBST(CCFLAGS)
AC_SUBST(DEV_OBJ)
AC_SUBST(SOLFLAGS)
AC_SUBST(SOCFLAGS)
if [[ `uname` = "Linux" ]]; then
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
CCFLAGS="-O2 -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -fno-stack-protector"
SOCFLAGS="-shared -fpic"
SOLFLAGS="-shared -init libcsc_init -fini libcsc_fini -fpic -ldl"
DEV_OBJ=linux-dev.o
else
if [[ `uname` = "AIX" ]]; then
#AIX - never tested
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
CCFLAGS=-O2
DEV_OBJ=aix-dev.o
else
if [[ `uname` = "SCO" ]]; then
DEV_OBJ=sco-dev.o
OFLAGS="-DUSE_POSIX_NONBLOCK"
CCFLAGS=-O -b elf
LIBS=-lsocket
else
if [[ `uname` = "Unixware" ]]; then
DEV_OBJ=unixware-dev.o
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
LIBS="-lsocket -lnsl"
else
if [[ `uname` = "SunOS" ]]; then
DEV_OBJ=solaris-dev.o
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
LIBS="-lsocket -lnsl"
SOLFLAGS="$stripping -r -zinitarray=libcsc_init -zfiniarray=libcsc_fini -lc"
if [[ "$CC" = "gcc" ]]; then
CCFLAGS="-O2 -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic"
SOCFLAGS="-shared -fpic"
else
CCFLAGS="-O"
SOCFLAGS="-Kpic"
fi
else
#HPUX - never tested
OFLAGS="-DHPUX -DUSE_POSIX_NONBLOCK"
CCFLAGS="+DAportable -Ae"
DEV_OBJ=hpux-dev.o
fi
fi
fi
fi
fi
AC_SUBST(UNIX98)
AC_SUBST(LIBS)
if [[ -e /dev/pts ]]; then
if [[ `uname` != "SunOS" ]]; then
UNIX98="#define UNIX98"
LIBS="$LIBS -lutil"
fi
fi
AC_OUTPUT(Makefile libcsc/Makefile inc/misc.h cyclades-serial-client.spec sun/pkginfo)
cyclades-serial-client-0.93ubuntu1/configure 0000775 0000000 0000000 00000412440 13032075072 016114 0 ustar #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57.
#
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
/^X\/\(\/\/\)$/{ s//\1/; q; }
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" || {
# Find who we are. Look in the path if we contain no path at all
# relative or not.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
{ echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
{ (exit 1); exit 1; }; }
fi
case $CONFIG_SHELL in
'')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for as_base in sh bash ksh sh5; do
case $as_dir in
/*)
if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
fi;;
esac
done
done
;;
esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line before each line; the second 'sed' does the real
# work. The second script uses 'N' to pair each line-number line
# with the numbered line, and appends trailing '-' during
# substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
sed '=' <$as_myself |
sed '
N
s,$,-,
: loop
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
s,-$,,
s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensible to this).
. ./$as_me.lineno
# Exit status is that of the last command.
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
exec 6>&1
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_config_libobj_dir=.
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
# This variable seems obsolete. It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}
# Identity of this package.
PACKAGE_NAME=
PACKAGE_TARNAME=
PACKAGE_VERSION=
PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_unique_file="cyclades-serial-client"
# Factoring default headers for most tests.
ac_includes_default="\
#include
#if HAVE_SYS_TYPES_H
# include
#endif
#if HAVE_SYS_STAT_H
# include
#endif
#if STDC_HEADERS
# include
# include
#else
# if HAVE_STDLIB_H
# include
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include
# endif
# include
#endif
#if HAVE_STRINGS_H
# include
#endif
#if HAVE_INTTYPES_H
# include
#else
# if HAVE_STDINT_H
# include
# endif
#endif
#if HAVE_UNISTD_H
# include
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS version date stripping debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX CXXFLAGS ac_ct_CXX CXXCPP EGREP daemon LIBC OFLAGS CCFLAGS DEV_OBJ SOLFLAGS SOCFLAGS UNIX98 LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir=$ac_optarg ;;
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/-/_/g'`
eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ echo "$as_me: error: missing argument to $ac_option" >&2
{ (exit 1); exit 1; }; }
fi
# Be sure to have absolute paths.
for ac_var in exec_prefix prefix
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* | NONE | '' ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
else
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
fi
fi
(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
{ echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
ac_env_build_alias_set=${build_alias+set}
ac_env_build_alias_value=$build_alias
ac_cv_env_build_alias_set=${build_alias+set}
ac_cv_env_build_alias_value=$build_alias
ac_env_host_alias_set=${host_alias+set}
ac_env_host_alias_value=$host_alias
ac_cv_env_host_alias_set=${host_alias+set}
ac_cv_env_host_alias_value=$host_alias
ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
ac_env_CC_set=${CC+set}
ac_env_CC_value=$CC
ac_cv_env_CC_set=${CC+set}
ac_cv_env_CC_value=$CC
ac_env_CFLAGS_set=${CFLAGS+set}
ac_env_CFLAGS_value=$CFLAGS
ac_cv_env_CFLAGS_set=${CFLAGS+set}
ac_cv_env_CFLAGS_value=$CFLAGS
ac_env_LDFLAGS_set=${LDFLAGS+set}
ac_env_LDFLAGS_value=$LDFLAGS
ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
ac_cv_env_LDFLAGS_value=$LDFLAGS
ac_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_env_CPPFLAGS_value=$CPPFLAGS
ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_cv_env_CPPFLAGS_value=$CPPFLAGS
ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
ac_cv_env_CPP_value=$CPP
ac_env_CXX_set=${CXX+set}
ac_env_CXX_value=$CXX
ac_cv_env_CXX_set=${CXX+set}
ac_cv_env_CXX_value=$CXX
ac_env_CXXFLAGS_set=${CXXFLAGS+set}
ac_env_CXXFLAGS_value=$CXXFLAGS
ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
ac_cv_env_CXXFLAGS_value=$CXXFLAGS
ac_env_CXXCPP_set=${CXXCPP+set}
ac_env_CXXCPP_value=$CXXCPP
ac_cv_env_CXXCPP_set=${CXXCPP+set}
ac_cv_env_CXXCPP_value=$CXXCPP
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures this package to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
_ACEOF
cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]
_ACEOF
cat <<\_ACEOF
_ACEOF
fi
if test -n "$ac_init_help"; then
cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-stripping disables stripping of installed binaries
--with-debug enables debug code generation for binaries
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have
headers in a nonstandard directory
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
_ACEOF
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d $ac_dir || continue
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
cd $ac_dir
# Check for guested configure; otherwise get Cygnus style configure.
if test -f $ac_srcdir/configure.gnu; then
echo
$SHELL $ac_srcdir/configure.gnu --help=recursive
elif test -f $ac_srcdir/configure; then
echo
$SHELL $ac_srcdir/configure --help=recursive
elif test -f $ac_srcdir/configure.ac ||
test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
cd $ac_popdir
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit 0
fi
exec 5>config.log
cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ $0 $@
_ACEOF
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
# Get rid of the leading space.
ac_sep=" "
;;
esac
done
done
$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Be sure not to use single quotes in there, as some shells,
# such as our DU 5.0 friend, will then `close' the trap.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
cat <<\_ASBOX
## ---------------- ##
## Cache variables. ##
## ---------------- ##
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
{
(set) 2>&1 |
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
;;
*)
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
}
echo
cat <<\_ASBOX
## ----------------- ##
## Output variables. ##
## ----------------- ##
_ASBOX
echo
for ac_var in $ac_subst_vars
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
## ------------- ##
## Output files. ##
## ------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
fi
if test -s confdefs.h; then
cat <<\_ASBOX
## ----------- ##
## confdefs.h. ##
## ----------- ##
_ASBOX
echo
sed "/^$/d" confdefs.h | sort
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo >confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special
# files actually), so we avoid doing that.
if test -f "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . $cache_file;;
*) . ./$cache_file;;
esac
fi
else
{ echo "$as_me:$LINENO: creating cache $cache_file" >&5
echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val="\$ac_cv_env_${ac_var}_value"
eval ac_new_val="\$ac_env_${ac_var}_value"
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
echo "$as_me: error: changes in the environment can compromise the build" >&2;}
{ { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers inc/conf.h"
version="0.92"
date=`date`
# Check whether --enable-stripping or --disable-stripping was given.
if test "${enable_stripping+set}" = set; then
enableval="$enable_stripping"
STRIPPING=$strippingval
else
STRIPPING=no
fi;
if [ ! "$STRIPPING" = "no" ]; then
stripping=""
else
stripping="-s"
fi
echo $DEB_BUILD_OPTIONS | grep -q nostrip
if [ "$?" = "0" ]; then
stripping=""
fi
# Check whether --enable-debug or --disable-debug was given.
if test "${enable_debug+set}" = set; then
enableval="$enable_debug"
debug=-g
else
debug=""
fi;
echo $DEB_BUILD_OPTIONS | grep -q debug
if [ "$?" = "0" ]; then
debug=-g
fi
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$ac_ct_CC" && break
done
CC=$ac_ct_CC
fi
fi
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&5
echo "$as_me: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
echo "$as_me:$LINENO:" \
"checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5
(eval $ac_compiler --version &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5
(eval $ac_compiler -v &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5
(eval $ac_compiler -V &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
echo "$as_me:$LINENO: checking for C compiler default output" >&5
echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
(eval $ac_link_default) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
# Find the output, starting from the most likely. This scheme is
# not robust to junk in `.', hence go to wildcards (a.*) only as a last
# resort.
# Be careful to initialize this variable, since it used to be cached.
# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
ac_cv_exeext=
# b.out is created by i960 compilers.
for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
;;
conftest.$ac_ext )
# This is the source file.
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
# FIXME: I believe we export ac_cv_exeext for Libtool,
# but it would be cool to find out if it's true. Does anybody
# maintain Libtool? --akim.
export ac_cv_exeext
break;;
* )
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
See \`config.log' for more details." >&5
echo "$as_me: error: C compiler cannot create executables
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }
fi
ac_exeext=$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_file" >&5
echo "${ECHO_T}$ac_file" >&6
# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether the C compiler works" >&5
echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&5
echo "$as_me: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
fi
fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $cross_compiling" >&5
echo "${ECHO_T}$cross_compiling" >&6
echo "$as_me:$LINENO: checking for suffix of executables" >&5
echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
export ac_cv_exeext
break;;
* ) break;;
esac
done
else
{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
echo "${ECHO_T}$ac_cv_exeext" >&6
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
echo "${ECHO_T}$ac_cv_objext" >&6
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cc_g=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
if test "${ac_cv_prog_cc_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX 10.20 and later -Ae
# HP-UX older versions -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_stdc=$ac_arg
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
fi
case "x$ac_cv_prog_cc_stdc" in
x|xno)
echo "$as_me:$LINENO: result: none needed" >&5
echo "${ECHO_T}none needed" >&6 ;;
*)
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
CC="$CC $ac_cv_prog_cc_stdc" ;;
esac
# Some people use a C++ compiler to compile C. Since we use `exit',
# in C++ we need to declare it. In case someone uses the same compiler
# for both compiling C and C++ we need to have the C++ compiler decide
# the declaration of exit, since it's the most demanding environment.
cat >conftest.$ac_ext <<_ACEOF
#ifndef __cplusplus
choke me
#endif
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
'' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
#include
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
continue
fi
rm -f conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
echo '#ifdef __cplusplus' >>confdefs.h
echo $ac_declaration >>confdefs.h
echo '#endif' >>confdefs.h
fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if test "${ac_cv_prog_CPP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
echo "$as_me:$LINENO: result: $CPP" >&5
echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&5
echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f $ac_dir/install.sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f $ac_dir/shtool; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
{ { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_config_guess="$SHELL $ac_aux_dir/config.guess"
ac_config_sub="$SHELL $ac_aux_dir/config.sub"
ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in
./ | .// | /cC/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
done
done
;;
esac
done
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. We don't cache a
# path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the path is relative.
INSTALL=$ac_install_sh
fi
fi
echo "$as_me:$LINENO: result: $INSTALL" >&5
echo "${ECHO_T}$INSTALL" >&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test -n "$ac_tool_prefix"; then
for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CXX=$ac_cv_prog_CXX
if test -n "$CXX"; then
echo "$as_me:$LINENO: result: $CXX" >&5
echo "${ECHO_T}$CXX" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$CXX" && break
done
fi
if test -z "$CXX"; then
ac_ct_CXX=$CXX
for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CXX"; then
ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
echo "${ECHO_T}$ac_ct_CXX" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$ac_ct_CXX" && break
done
test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
CXX=$ac_ct_CXX
fi
# Provide some information about the compiler.
echo "$as_me:$LINENO:" \
"checking for C++ compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5
(eval $ac_compiler --version &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5
(eval $ac_compiler -v &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5
(eval $ac_compiler -V &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
fi
echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
GXX=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cxx_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cxx_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cxx_g=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-g"
fi
else
if test "$GXX" = yes; then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
for ac_declaration in \
'' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
#include
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
continue
fi
rm -f conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
echo '#ifdef __cplusplus' >>confdefs.h
echo $ac_declaration >>confdefs.h
echo '#endif' >>confdefs.h
fi
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
if test "${ac_cv_c_const+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
typedef int charset[2];
const charset x;
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
/* NEC SVR4.0.2 mips cc rejects this. */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
It does not let you subtract one const X* pointer from another in
an arm of an if-expression whose if-part is not a constant
expression */
const char *g = "string";
ccp = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++ccp;
p = (char**) ccp;
ccp = (char const *const *) p;
{ /* SCO 3.2v4 cc rejects this. */
char *t;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
const int *foo = &x[0];
++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
typedef const int *iptr;
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
}
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_const=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_const=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
echo "${ECHO_T}$ac_cv_c_const" >&6
if test $ac_cv_c_const = no; then
cat >>confdefs.h <<\_ACEOF
#define const
_ACEOF
fi
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
if test -z "$CXXCPP"; then
if test "${ac_cv_prog_CXXCPP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CXXCPP needs to be expanded
for CXXCPP in "$CXX -E" "/lib/cpp"
do
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
break
fi
done
ac_cv_prog_CXXCPP=$CXXCPP
fi
CXXCPP=$ac_cv_prog_CXXCPP
else
ac_cv_prog_CXXCPP=$CXXCPP
fi
echo "$as_me:$LINENO: result: $CXXCPP" >&5
echo "${ECHO_T}$CXXCPP" >&6
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
{ { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
See \`config.log' for more details." >&5
echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
echo "$as_me:$LINENO: checking for egrep" >&5
echo $ECHO_N "checking for egrep... $ECHO_C" >&6
if test "${ac_cv_prog_egrep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if echo a | (grep -E '(a|b)') >/dev/null 2>&1
then ac_cv_prog_egrep='grep -E'
else ac_cv_prog_egrep='egrep'
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
echo "${ECHO_T}$ac_cv_prog_egrep" >&6
EGREP=$ac_cv_prog_egrep
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_stdc=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
#define STDC_HEADERS 1
_ACEOF
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
echo "$as_me:$LINENO: checking for size_t" >&5
echo $ECHO_N "checking for size_t... $ECHO_C" >&6
if test "${ac_cv_type_size_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((size_t *) 0)
return 0;
if (sizeof (size_t))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_size_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_size_t=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
echo "${ECHO_T}$ac_cv_type_size_t" >&6
if test $ac_cv_type_size_t = yes; then
:
else
cat >>confdefs.h <<_ACEOF
#define size_t unsigned
_ACEOF
fi
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
int
main ()
{
daemon(0, 0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
daemon="yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
if [ -n "$daemon" ]; then
daemon="#define HAVE_DAEMON"
fi
LIBC=l`ldd /bin/ls | grep libc | head -1 | cut -f2 -dl | cut -f1 "-d "`
if [ `uname` = "Linux" ]; then
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
CCFLAGS="-O2 -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -fno-stack-protector"
SOCFLAGS="-shared -fpic"
SOLFLAGS="-shared -init libcsc_init -fini libcsc_fini -fpic -ldl"
DEV_OBJ=linux-dev.o
else
if [ `uname` = "AIX" ]; then
#AIX - never tested
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
CCFLAGS=-O2
DEV_OBJ=aix-dev.o
else
if [ `uname` = "SCO" ]; then
DEV_OBJ=sco-dev.o
OFLAGS="-DUSE_POSIX_NONBLOCK"
CCFLAGS=-O -b elf
LIBS=-lsocket
else
if [ `uname` = "Unixware" ]; then
DEV_OBJ=unixware-dev.o
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
LIBS="-lsocket -lnsl"
else
if [ `uname` = "SunOS" ]; then
DEV_OBJ=solaris-dev.o
OFLAGS="-DUSE_TERMIO -DUSE_TERMIOS -DUSE_POSIX_NONBLOCK"
LIBS="-lsocket -lnsl"
SOLFLAGS="$stripping -r -zinitarray=libcsc_init -zfiniarray=libcsc_fini -lc"
if [ "$CC" = "gcc" ]; then
CCFLAGS="-O2 -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic"
SOCFLAGS="-shared -fpic"
else
CCFLAGS="-O"
SOCFLAGS="-Kpic"
fi
else
#HPUX - never tested
OFLAGS="-DHPUX -DUSE_POSIX_NONBLOCK"
CCFLAGS="+DAportable -Ae"
DEV_OBJ=hpux-dev.o
fi
fi
fi
fi
fi
if [ -e /dev/pts ]; then
if [ `uname` != "SunOS" ]; then
UNIX98="#define UNIX98"
LIBS="$LIBS -lutil"
fi
fi
ac_config_files="$ac_config_files Makefile libcsc/Makefile inc/misc.h cyclades-serial-client.spec sun/pkginfo"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
{
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} |
sed '
t clear
: clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
/^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
: end' >>confcache
if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
s/^\([^=]*=[ ]*\):*/\1/;
s/:*$//;
s/^[^=]*=[ ]*$//;
}'
fi
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_i=`echo "$ac_i" |
sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
# 2. Add them.
ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
/^X\/\(\/\/\)$/{ s//\1/; q; }
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" || {
# Find who we are. Look in the path if we contain no path at all
# relative or not.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
{ { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
{ (exit 1); exit 1; }; }
fi
case $CONFIG_SHELL in
'')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for as_base in sh bash ksh sh5; do
case $as_dir in
/*)
if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
fi;;
esac
done
done
;;
esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line before each line; the second 'sed' does the real
# work. The second script uses 'N' to pair each line-number line
# with the numbered line, and appends trailing '-' during
# substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
sed '=' <$as_myself |
sed '
N
s,$,-,
: loop
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
s,-$,,
s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
{ { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensible to this).
. ./$as_me.lineno
# Exit status is that of the last command.
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH
exec 6>&1
# Open the log real soon, to keep \$[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. Logging --version etc. is OK.
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by $as_me, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
_CSEOF
echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
echo >&5
_ACEOF
# Files that config.status was made for.
if test -n "$ac_config_files"; then
echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_headers"; then
echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_links"; then
echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_commands"; then
echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
fi
cat >>$CONFIG_STATUS <<\_ACEOF
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Report bugs to ."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
config.status
configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir
INSTALL="$INSTALL"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If no file are specified by the user, then we need to provide default
# value. By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=*)
ac_option=`expr "x$1" : 'x\([^=]*\)='`
ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
ac_shift=:
;;
-*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
*) # This is not an option, so the user has probably given explicit
# arguments.
ac_option=$1
ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --vers* | -V )
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
# Conflict between --help and --header
{ { echo "$as_me:$LINENO: error: ambiguous option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; };;
--help | --hel | -h )
echo "$ac_cs_usage"; exit 0 ;;
--debug | --d* | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; } ;;
*) ac_config_targets="$ac_config_targets $1" ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
case "$ac_config_target" in
# Handling of arguments.
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"libcsc/Makefile" ) CONFIG_FILES="$CONFIG_FILES libcsc/Makefile" ;;
"inc/misc.h" ) CONFIG_FILES="$CONFIG_FILES inc/misc.h" ;;
"cyclades-serial-client.spec" ) CONFIG_FILES="$CONFIG_FILES cyclades-serial-client.spec" ;;
"sun/pkginfo" ) CONFIG_FILES="$CONFIG_FILES sun/pkginfo" ;;
"inc/conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS inc/conf.h" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason to put it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=./confstat$$-$RANDOM
(umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
# CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
if test -n "\$CONFIG_FILES"; then
# Protect against being on the right side of a sed subst in config.status.
sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
s,@SHELL@,$SHELL,;t t
s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
s,@exec_prefix@,$exec_prefix,;t t
s,@prefix@,$prefix,;t t
s,@program_transform_name@,$program_transform_name,;t t
s,@bindir@,$bindir,;t t
s,@sbindir@,$sbindir,;t t
s,@libexecdir@,$libexecdir,;t t
s,@datadir@,$datadir,;t t
s,@sysconfdir@,$sysconfdir,;t t
s,@sharedstatedir@,$sharedstatedir,;t t
s,@localstatedir@,$localstatedir,;t t
s,@libdir@,$libdir,;t t
s,@includedir@,$includedir,;t t
s,@oldincludedir@,$oldincludedir,;t t
s,@infodir@,$infodir,;t t
s,@mandir@,$mandir,;t t
s,@build_alias@,$build_alias,;t t
s,@host_alias@,$host_alias,;t t
s,@target_alias@,$target_alias,;t t
s,@DEFS@,$DEFS,;t t
s,@ECHO_C@,$ECHO_C,;t t
s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t
s,@version@,$version,;t t
s,@date@,$date,;t t
s,@stripping@,$stripping,;t t
s,@debug@,$debug,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t
s,@CPPFLAGS@,$CPPFLAGS,;t t
s,@ac_ct_CC@,$ac_ct_CC,;t t
s,@EXEEXT@,$EXEEXT,;t t
s,@OBJEXT@,$OBJEXT,;t t
s,@CPP@,$CPP,;t t
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
s,@INSTALL_DATA@,$INSTALL_DATA,;t t
s,@CXX@,$CXX,;t t
s,@CXXFLAGS@,$CXXFLAGS,;t t
s,@ac_ct_CXX@,$ac_ct_CXX,;t t
s,@CXXCPP@,$CXXCPP,;t t
s,@EGREP@,$EGREP,;t t
s,@daemon@,$daemon,;t t
s,@LIBC@,$LIBC,;t t
s,@OFLAGS@,$OFLAGS,;t t
s,@CCFLAGS@,$CCFLAGS,;t t
s,@DEV_OBJ@,$DEV_OBJ,;t t
s,@SOLFLAGS@,$SOLFLAGS,;t t
s,@SOCFLAGS@,$SOCFLAGS,;t t
s,@UNIX98@,$UNIX98,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_lines=48
ac_sed_frag=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_lines # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
else
sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
fi
if test ! -s $tmp/subs.frag; then
ac_more_lines=false
else
# The purpose of the label and of the branching condition is to
# speed up the sed processing (if there are no `@' at all, there
# is no need to browse any of the substitutions).
# These are the two extra sed commands mentioned above.
(echo ':t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
else
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
fi
ac_sed_frag=`expr $ac_sed_frag + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_lines`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
fi # test -n "$CONFIG_FILES"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
if test x"$ac_file" != x-; then
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
if test x"$ac_file" = x-; then
configure_input=
else
configure_input="$ac_file. "
fi
configure_input=$configure_input"Generated from `echo $ac_file_in |
sed 's,.*/,,'` by configure."
# First look for the input files in the build tree, otherwise in the
# src tree.
ac_file_inputs=`IFS=:
for f in $ac_file_in; do
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
*) # Relative
if test -f "$f"; then
# Build tree
echo $f
elif test -f "$srcdir/$f"; then
# Source tree
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s,@configure_input@,$configure_input,;t t
s,@srcdir@,$ac_srcdir,;t t
s,@abs_srcdir@,$ac_abs_srcdir,;t t
s,@top_srcdir@,$ac_top_srcdir,;t t
s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
s,@builddir@,$ac_builddir,;t t
s,@abs_builddir@,$ac_abs_builddir,;t t
s,@top_builddir@,$ac_top_builddir,;t t
s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
s,@INSTALL@,$ac_INSTALL,;t t
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
rm -f $tmp/stdin
if test x"$ac_file" != x-; then
mv $tmp/out $ac_file
else
cat $tmp/out
rm -f $tmp/out
fi
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
#
# CONFIG_HEADER section.
#
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='[ ].*$,\1#\2'
ac_dC=' '
ac_dD=',;t'
# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='$,\1#\2define\3'
ac_uC=' '
ac_uD=',;t'
for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
# First look for the input files in the build tree, otherwise in the
# src tree.
ac_file_inputs=`IFS=:
for f in $ac_file_in; do
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
*) # Relative
if test -f "$f"; then
# Build tree
echo $f
elif test -f "$srcdir/$f"; then
# Source tree
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
# Remove the trailing spaces.
sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
_ACEOF
# Transform confdefs.h into two sed scripts, `conftest.defines' and
# `conftest.undefs', that substitutes the proper values into
# config.h.in to produce config.h. The first handles `#define'
# templates, and the second `#undef' templates.
# And first: Protect against being on the right side of a sed subst in
# config.status. Protect against being in an unquoted here document
# in config.status.
rm -f conftest.defines conftest.undefs
# Using a here document instead of a string reduces the quoting nightmare.
# Putting comments in sed scripts is not portable.
#
# `end' is used to avoid that the second main sed command (meant for
# 0-ary CPP macros) applies to n-ary macro definitions.
# See the Autoconf documentation for `clear'.
cat >confdef2sed.sed <<\_ACEOF
s/[\\&,]/\\&/g
s,[\\$`],\\&,g
t clear
: clear
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
t end
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
: end
_ACEOF
# If some macros were called several times there might be several times
# the same #defines, which is useless. Nevertheless, we may not want to
# sort them, since we want the *last* AC-DEFINE to be honored.
uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
rm -f confdef2sed.sed
# This sed command replaces #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >>conftest.undefs <<\_ACEOF
s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
_ACEOF
# Break up conftest.defines because some shells have a limit on the size
# of here documents, and old seds have small limits too (100 cmds).
echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
echo ' :' >>$CONFIG_STATUS
rm -f conftest.tail
while grep . conftest.defines >/dev/null
do
# Write a limited-size here document to $tmp/defines.sed.
echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS
# Speed up: don't consider the non `#define' lines.
echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
# Work around the forget-to-reset-the-flag bug.
echo 't clr' >>$CONFIG_STATUS
echo ': clr' >>$CONFIG_STATUS
sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
echo 'CEOF
sed -f $tmp/defines.sed $tmp/in >$tmp/out
rm -f $tmp/in
mv $tmp/out $tmp/in
' >>$CONFIG_STATUS
sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
rm -f conftest.defines
mv conftest.tail conftest.defines
done
rm -f conftest.defines
echo ' fi # grep' >>$CONFIG_STATUS
echo >>$CONFIG_STATUS
# Break up conftest.undefs because some shells have a limit on the size
# of here documents, and old seds have small limits too (100 cmds).
echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
rm -f conftest.tail
while grep . conftest.undefs >/dev/null
do
# Write a limited-size here document to $tmp/undefs.sed.
echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS
# Speed up: don't consider the non `#undef'
echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
# Work around the forget-to-reset-the-flag bug.
echo 't clr' >>$CONFIG_STATUS
echo ': clr' >>$CONFIG_STATUS
sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
echo 'CEOF
sed -f $tmp/undefs.sed $tmp/in >$tmp/out
rm -f $tmp/in
mv $tmp/out $tmp/in
' >>$CONFIG_STATUS
sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
rm -f conftest.undefs
mv conftest.tail conftest.undefs
done
rm -f conftest.undefs
cat >>$CONFIG_STATUS <<\_ACEOF
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
if test x"$ac_file" = x-; then
echo "/* Generated by configure. */" >$tmp/config.h
else
echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
fi
cat $tmp/in >>$tmp/config.h
rm -f $tmp/in
if test x"$ac_file" != x-; then
if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
{ echo "$as_me:$LINENO: $ac_file is unchanged" >&5
echo "$as_me: $ac_file is unchanged" >&6;}
else
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
rm -f $ac_file
mv $tmp/config.h $ac_file
fi
else
cat $tmp/config.h
rm -f $tmp/config.h
fi
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || { (exit 1); exit 1; }
fi
cyclades-serial-client-0.93ubuntu1/install 0000775 0000000 0000000 00000010675 07557562060 015622 0 ustar ##
## install -- Install a program, script or datafile
## Copyright (c) 1997-2000 Ralf S. Engelschall
## Originally written for shtool
##
## This file is part of shtool and free software; you can redistribute
## it and/or modify it under the terms of the GNU General Public
## License as published by the Free Software Foundation; either version
## 2 of the License, or (at your option) any later version.
##
## This file is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA, or contact Ralf S. Engelschall .
##
str_tool="install"
str_usage="[-v] [-t] [-c] [-C] [-s] [-m] [-o] [-g] [-e] [ ...] "
arg_spec="2+"
opt_spec="v.t.c.C.s.m:o:g:e:"
opt_v=no
opt_t=no
opt_c=no
opt_C=no
opt_s=no
opt_m=""
opt_o=""
opt_g=""
opt_e=""
. ./sh.common
# determine source(s) and destination
argc=$#
srcs=""
while [ $# -gt 1 ]; do
srcs="$srcs $1"
shift
done
dstpath="$1"
# type check for destination
dstisdir=0
if [ -d $dstpath ]; then
dstpath=`echo "$dstpath" | sed -e 's:/$::'`
dstisdir=1
fi
# consistency check for destination
if [ $argc -gt 2 -a $dstisdir = 0 ]; then
echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
exit 1
fi
# iterate over all source(s)
for src in $srcs; do
dst=$dstpath
# If destination is a directory, append the input filename
if [ $dstisdir = 1 ]; then
dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
dst="$dst/$dstfile"
fi
# Add a possible extension to src and dst
if [ ".$opt_e" != . ]; then
src="$src$opt_e"
dst="$dst$opt_e"
fi
# Check for correct arguments
if [ ".$src" = ".$dst" ]; then
echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
continue
fi
if [ -d "$src" ]; then
echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
continue
fi
# Make a temp file name in the destination directory
dsttmp=`echo $dst |\
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
-e "s;\$;/#INST@$$#;"`
# Verbosity
if [ ".$opt_v" = .yes ]; then
echo "$src -> $dst" 1>&2
fi
# Copy or move the file name to the temp name
# (because we might be not allowed to change the source)
if [ ".$opt_C" = .yes ]; then
opt_c=yes
fi
if [ ".$opt_c" = .yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "cp $src $dsttmp" 1>&2
fi
cp $src $dsttmp || exit $?
else
if [ ".$opt_t" = .yes ]; then
echo "mv $src $dsttmp" 1>&2
fi
mv $src $dsttmp || exit $?
fi
# Adjust the target file
# (we do chmod last to preserve setuid bits)
if [ ".$opt_s" = .yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "strip $dsttmp" 1>&2
fi
strip $dsttmp || exit $?
fi
if [ ".$opt_o" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chown $opt_o $dsttmp" 1>&2
fi
chown $opt_o $dsttmp || exit $?
fi
if [ ".$opt_g" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chgrp $opt_g $dsttmp" 1>&2
fi
chgrp $opt_g $dsttmp || exit $?
fi
if [ ".$opt_m" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chmod $opt_m $dsttmp" 1>&2
fi
chmod $opt_m $dsttmp || exit $?
fi
# Determine whether to do a quick install
# (has to be done _after_ the strip was already done)
quick=no
if [ ".$opt_C" = .yes ]; then
if [ -r $dst ]; then
if cmp -s $src $dst; then
quick=yes
fi
fi
fi
# Finally install the file to the real destination
if [ $quick = yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "rm -f $dsttmp" 1>&2
fi
rm -f $dsttmp
else
if [ ".$opt_t" = .yes ]; then
echo "rm -f $dst && mv $dsttmp $dst" 1>&2
fi
rm -f $dst && mv $dsttmp $dst
fi
done
cyclades-serial-client-0.93ubuntu1/linux-dev.c 0000664 0000000 0000000 00000032250 07713631536 016275 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* dev.c
* Unix Pty Device routines
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* 12/17/1999 V.1.0.1
* Fixes: a copy in parse_message () now uses the correct data pointer
*
*/
/* Open / stat includes */
# include
# include
# include
# include
# include
/* Errno */
# include
# include
# include
/* Termio */
# ifdef USE_TERMIO
# include
# endif
/* Termios */
# ifdef USE_TERMIOS
# include
# endif
/* Get process group id of controlling pty */
# include
/* Signalling slave (kill) */
# include
# define _TSR_DEV_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/dev.h"
#include "inc/misc.h"
#include "inc/port_speed.h"
#ifdef UNIX98
#include /* for openpty and forkpty */
#include
#endif
#ifdef TSR_MEASURE
#include "inc/tsrmeasure.h"
#endif
/*
* Packet mode routines
*/
void parse_message (unsigned char type, char *buf, int size);
void parse_packet (int type);
/*
* Termio / Termios routines
*/
void portconfig_to_termios (struct portconfig *pcp, struct termios *tp);
/*
* Argh => Get the process group id associated with slave pty
*/
int get_slave_controlling (dev_t device);
/*
* Debug routines
*/
void print_msg(int type, unsigned char *buf, int size);
#if 0
char * ioctl_name (int type, void *unused);
#endif
/*
* Internal Variables
*/
char P_sname[NAMESIZE];
dev_t P_devnumber;
char Databuf[DEV_MAXIOSZ];
# define NTRIES 10
# define PTYDELAY 600 /* one minute */
#ifndef UNIX98
# define CONTROL_PREFIX "/dev/pty"
# define SLAVE_PREFIX "/dev/tty"
const char * const letters = "pqrstuvwxyzabcde";
const char * const ports = "0123456789abcdef";
#endif
int
dev_getaddr(char *dname)
{
int fd = -1;
#ifndef UNIX98
int found;
char ctty[16];
int i, j;
int tries;
#else
int slave_fd;
#endif
int mode;
char stty[16];
struct stat statb;
if(lstat(dname, &statb) >= 0)
{ /* File exists */
if(S_ISLNK(statb.st_mode))
{
sysmessage(MSG_WARNING, "Removing old sym-link \"%s\".\n", dname);
unlink(dname);
}
else if(!S_ISCHR(statb.st_mode))
{
sysmessage (MSG_ERR, "%s already exists\n",
dname);
return (E_PARMINVAL);
}
}
else if(errno != ENOENT)
{ /* generic stat error */
sysmessage (MSG_ERR, "Can't lstat %s : %s\n",
dname, strerror (errno));
return (E_FILEIO);
}
#ifndef UNIX98
mode = O_RDWR;
# ifdef USE_POSIX_NONBLOCK
mode |= O_NONBLOCK;
# elif defined USE_STD_NDELAY
mode |= O_NDELAY;
# endif
/*
* Warning: most PTY implementation puts master side as controlling terminal if
* O_NOCTTY is not set !!!
*/
mode |= O_NOCTTY;
found = FALSE;
for (tries = 0; tries < NTRIES; tries++) {
for (i = 0 ; i < 16 ; i++ ) {
for (j = 0 ; j < 16 ; j++) {
sprintf(ctty, "%s%c%c",
CONTROL_PREFIX, letters[i], ports[j]);
if ((fd = open (ctty, mode)) >= 0) {
sysmessage (MSG_NOTICE,
"open %s pseudo-tty\n", ctty);
found = TRUE;
goto out;
}
}
}
sysdelay (PTYDELAY);
}
out:
if (found == FALSE) {
sysmessage (MSG_ERR,
"Can't get a free pseudo-tty :\n");
(void) close(fd);
return (E_FILEIO);
}
#else
if(openpty(&fd, &slave_fd, stty, NULL, NULL))
{
sysmessage (MSG_ERR,
"Can't get a free pseudo-tty :\n");
return (E_FILEIO);
}
#endif
# ifdef USE_FIONBIO
mode = 1;
if (ioctl (fd, FIONBIO, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't set non-block on master pty : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# endif
mode = 1;
if (ioctl (fd, TIOCPKT, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't put master pty in packet mode: %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
#ifndef UNIX98
sprintf(stty, "%s%c%c", SLAVE_PREFIX,letters[i], ports[j]);
#endif
if (lstat (stty, &statb) == -1) { /* File does not exists */
sysmessage (MSG_ERR,
"Can't stat slave pty: %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
P_devnumber = statb.st_rdev;
if (symlink(stty, dname) == -1) {
sysmessage (MSG_ERR, "Can't link dev : %s\n",
strerror(errno));
return (E_FILEIO);
} else {
sysmessage (MSG_NOTICE, "Using %s pseudo-tty\n",
stty);
}
P_mfd = fd;
strcpy (P_sname, stty);
strcpy (P_devname, dname);
return (E_NORMAL);
}
void
dev_free(void)
{
(void) close (P_sfd);
P_sfd = -1;
return;
}
int
dev_init(int iosize, int devmodem, int closemode, struct buffer *ibp,
struct buffer *obp, struct comport *cp)
{
Pty.portmodes = 0;
if (devmodem == DEV_LOCAL) {
Pty.portmodes = PORT_CLOCAL;
}
if (closemode == CLOSE_HANG) {
Pty.portmodes |= PORT_HUPCL;
}
Pty.portmodes |= PORT_IGNBRK | PORT_IGNPAR;
Pty.iosize = iosize;
Pty.inbuff = ibp;
Pty.outbuff = obp;
Pty.comport = cp;
return (E_NORMAL);
}
int
dev_config (void)
{
int sfd;
struct termios tios;
struct portconfig * pcp = &Pty.comport->portconfig;
int modes = Pty.portmodes;
sysmessage(MSG_NOTICE,"Opening %s pseudo-tty\n", P_sname);
if ((sfd = open (P_sname, O_RDWR|O_NOCTTY)) == -1) {
sysmessage (MSG_ERR, "Can't open slave device : %s\n",
strerror (errno));
return (E_FILEIO);
}
memset ((void *) &tios, 0, sizeof (struct termios));
portconfig_to_termios (pcp, &tios);
tios.c_cflag |= CREAD;
tios.c_lflag |= NOFLSH;
/* PTY modes */
if(modes & PORT_HUPCL)
tios.c_cflag |= HUPCL;
if(modes & PORT_CLOCAL)
tios.c_cflag |= CLOCAL;
if(modes & PORT_IGNBRK)
tios.c_iflag |= IGNBRK;
if(modes & PORT_IGNPAR)
tios.c_iflag |= IGNPAR;
tios.c_iflag &= !IXOFF; /* turn off ixon */
tios.c_cc[VMIN] = 1;
if (tcsetattr (sfd, TCSANOW, &tios) == -1) {
sysmessage (MSG_ERR, "Can't set termios : %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
P_sfd = sfd;
return (E_NORMAL);
}
int
dev_closeslave(void)
{
int mode;
if (Pty.state == PTY_OPER && P_sfd != -1) {
if (Debug > 1) {
sysmessage (MSG_DEBUG, "Closing %s pseudo-tty \n",
P_sname);
}
sysmessage(MSG_NOTICE,"Closing %s pseudo-tty \n",
P_sname);
(void) close (P_sfd);
P_sfd = -1;
mode = 1;
if (ioctl (P_mfd, TIOCPKT, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't put master pty in packet mode: %s\n",
strerror(errno));
return (E_FILEIO);
}
}
return (E_NORMAL);
}
unsigned char Holdbuf[4];
int Hold = FALSE;
int
dev_probe(void)
{
int retc;
int retmsg;
unsigned char type;
if ((retc = read (P_mfd, Holdbuf, 1)) == -1) {
if (errno == EIO) { /* PTY WAS CLOSED */
retc = 0;
} else {
sysmessage(MSG_ERR,
"Can't read from master pty: %s\n",
strerror(errno));
return (retc);
}
}
if (Debug > 2) {
sysmessage (MSG_DEBUG, "PROBE: %d bytes: %d", retc, Holdbuf[0]);
}
if (retc != 0) {
type = Holdbuf[0];
if (type == TIOCPKT_DATA) {
retmsg = PROBE_DATA;
} else if (type & (TIOCPKT_FLUSHREAD|TIOCPKT_FLUSHWRITE)){
retmsg = PROBE_FLUSH;
} else {
retmsg = PROBE_GENERIC;
}
Hold = TRUE;
} else {
retmsg = PROBE_EOF;
}
if (Debug > 1) {
sysmessage (MSG_DEBUG, "PROBE: msg %d\n", retmsg);
}
return (retmsg);
}
int
dev_getdata(void)
{
int retc;
int size;
int mode;
unsigned char type;
size = Pty.iosize;
if (Hold == TRUE) {
Hold = FALSE;
retc = 1;
Databuf[0] = Holdbuf[0];
} else {
if ((retc = read (P_mfd, Databuf, size)) == -1) {
if (errno == EIO) { /* PTY WAS CLOSED */
retc = 0;
} else {
sysmessage(MSG_ERR,
"Can't read from master pty: %s\n",
strerror(errno));
# ifdef TSR_MEASURE
devnreads++;
# endif
return (retc);
}
}
}
if (Debug > 2) {
sysmessage (MSG_DEBUG, " DATA: %d bytes: ", retc);
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "DAT: ");
for (i = 0; i < retc && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) Databuf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
}
/*
* Kernel 2.2.x => Closing slave also disables packet mode.
* Not all closes are detected, thus I restore packet mode at all events
*/
mode = 1;
if (ioctl (P_mfd, TIOCPKT, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't put master pty in packet mode: %s\n",
strerror(errno));
return (-1);
}
type = Databuf[0];
parse_message (type, Databuf, retc);
return (0);
}
/*
* Packet mode routines
*/
void
parse_message (unsigned char type, char *buf, int size)
{
struct buffer * bp = Pty.inbuff;
if (size != 0) {
switch (Pty.state) {
case PTY_CLOSED:
case PTY_OPERRONLY:
SET_EVENT(EV_UP, EV_UPOPEN, 0, 0);
break;
}
} else {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
return;
}
# ifdef TSR_MEASURE
devreads++;
devrbytes += retc;
# endif
if (type == TIOCPKT_DATA) {
if (size == 0) {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
} else {
buf++;
size--;
/* V.1.0.1 fix: use buf instead of Dataptr */
COPY_TO_BUFFER(bp, buf, size);
SET_EVENT(EV_UP, EV_UPDATA, 0, 0);
}
} else {
parse_packet((int) type);
}
}
int
dev_putdata(struct buffer *bp)
{
struct pty * pty = &Pty;
int ret;
int size;
/* XXXX TSR_MEASURES */
while (bp->b_hold) {
size = min (bp->b_hold, pty->iosize);
if ((ret = write (P_mfd, bp->b_rem, size)) == -1) {
if (errno == EAGAIN) {
ret = 0;
} else {
sysmessage(MSG_ERR,
"Can't write on master pty: %s\n",
strerror(errno));
}
# ifdef TSR_MEASURE
devnwrites++;
# endif
return (ret);
}
# ifdef TSR_MEASURE
devwrites++;
devwbytes += ret;
# endif
FORWARD_BUFFER(bp, ret);
}
if (bp->b_hold == 0) {
RESET_BUFFER(bp);
}
return (0);
}
void
dev_interrupt(void)
{
int procid;
if ((procid = get_slave_controlling(P_devnumber)) > 0) {
(void) kill ((pid_t) - procid, SIGINT);
}
}
void
dev_hangup(void)
{
int procid;
if ((procid = get_slave_controlling(P_devnumber)) > 0) {
(void) kill ((pid_t) - procid, SIGHUP);
}
}
void
parse_packet (int type)
{
int flushbits;
int flushmode;
flushbits = type & (TIOCPKT_FLUSHREAD|TIOCPKT_FLUSHWRITE);
if (flushbits) {
switch (flushbits) {
case TIOCPKT_FLUSHREAD:
flushmode = OPFLUSH_IN;
break;
case TIOCPKT_FLUSHWRITE:
flushmode = OPFLUSH_OUT;
break;
default:
flushmode = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPFLUSH, (void *) &flushmode, sizeof(int));
}
}
/*
* Termio / Termios routines
*/
/* Termios must be clean */
void
portconfig_to_termios (struct portconfig *pcp, struct termios *tp)
{
/* Speed */
speed_t speed;
speed = int_to_baud_index(pcp->speed);
if(speed == B0)
speed = B115200;
cfsetospeed (tp, (speed_t) speed);
cfsetispeed (tp, (speed_t) B0);
/* Datasize */
switch (pcp->datasize) {
case 5:
tp->c_cflag |= CS5;
break;
case 6:
tp->c_cflag |= CS6;
break;
case 7:
tp->c_cflag |= CS7;
break;
case 8:
tp->c_cflag |= CS8;
break;
}
/* Stopsize */
if (pcp->stopsize == COM_SSIZE_TWO) {
tp->c_cflag |= CSTOPB;
} /* else one stop bit */
/* Parity */
switch (pcp->parity) {
case COM_PARITY_EVEN:
tp->c_cflag |= PARENB;
break;
case COM_PARITY_ODD:
tp->c_cflag |= PARENB|PARODD;
break;
case COM_PARITY_NONE:
default:
break;
}
/* Flow Control */
switch (pcp->flowc) {
case COM_FLOW_SOFT:
tp->c_iflag |= IXON;
break;
default:
break;
}
}
/*
* Argh => Get the process group id associated with slave pty
*/
int
get_slave_controlling (dev_t device)
{
DIR *dip;
struct dirent *dep;
int process;
char procfile[128];
char procbuf[512];
int procfd;
char dummybuf[512];
int dummyint;
int tty;
gid_t tpgid;
if ((dip = opendir ("/proc")) == (DIR *) 0) {
sysmessage(MSG_ERR, "Can't open /proc: %s",
strerror(errno));
exit (1);
}
while ((dep = readdir (dip)) != (struct dirent *)0) {
process = atoi (dep->d_name);
if (process > 0) {
sprintf(procfile, "/proc/%d/stat", process);
if ((procfd = open (procfile, 0)) == -1) {
sysmessage(MSG_ERR, "Can't open %s:%s\n",
procfile,
strerror(errno));
break;
}
if (read (procfd, procbuf, 512) <= 0) {
sysmessage(MSG_ERR, "Can't read %s:%s",
procfile,
strerror(errno));
break;
}
(void) close(procfd);
if (sscanf (procbuf, "%d %s %c %d %d %d %d %u %s",
&dummyint, &dummybuf[0], (char *)&dummyint, &dummyint,
&dummyint, &dummyint, &tty, &tpgid,
&dummybuf[0])!= 0) {
if ((dev_t) tty == device) {
break;
}
}
tpgid = 0; /* not found */
}
}
(void) closedir (dip);
return (tpgid);
}
/*
* Debug routines
*/
char ioctlbuf[32];
#if 0
char *
ioctl_name (int type, void *unused)
{
const char * msgt;
if (Debug > 2) {
switch (type) {
case TCGETA:
msgt = "TCGETA";
break;
case TCSETA:
msgt = "TCSETA";
break;
case TCSETAW:
msgt = "TCSETAW";
break;
case TCSETAF:
msgt = "TCSETAF";
break;
case TCSBRK:
msgt = "TCSBRK";
break;
case TCXONC:
msgt = "TCXONC";
break;
case TCFLSH:
msgt = "TCFLSH";
break;
case TCGETS:
msgt = "TCGETS";
break;
case TCSETS:
msgt = "TCSETS";
break;
case TCSETSW:
msgt = "TCSETSW";
break;
case TCSETSF:
msgt = "TCSETSF";
break;
default:
msgt = "UNKNOWN";
break;
}
sprintf(ioctlbuf, "%s", msgt);
return (ioctlbuf);
} else {
return ((char *) 0);
}
}
#endif
cyclades-serial-client-0.93ubuntu1/sun/ 0000775 0000000 0000000 00000000000 07713353275 015022 5 ustar cyclades-serial-client-0.93ubuntu1/sun/pkginfo.in 0000664 0000000 0000000 00000000260 07710213703 016771 0 ustar PKG=cyclades-ser-cli
ARCH=sparc
VERSION=@version@
CATEGORY=comms
NAME=cyclades-ser-cli
DESC=Serial Port Network Redirector
VENDOR=Cyclades
EMAIL=russell@coker.com.au
MAXINST=1
cyclades-serial-client-0.93ubuntu1/sun/pkginfo 0000664 0000000 0000000 00000000253 07713353275 016402 0 ustar PKG=cyclades-ser-cli
ARCH=sparc
VERSION=0.92
CATEGORY=comms
NAME=cyclades-ser-cli
DESC=Serial Port Network Redirector
VENDOR=Cyclades
EMAIL=russell@coker.com.au
MAXINST=1
cyclades-serial-client-0.93ubuntu1/sun/Makefile 0000664 0000000 0000000 00000000517 07713332663 016463 0 ustar
all: pkg
INSTROOT=`pwd`/tmp
PKGNAME=cyclades-ser-cli
pkg:
rm -rf ../tmp
( cd .. ; ./configure --prefix=${INSTROOT} --mandir=`pwd`/sun/tmp/usr/share/man )
( cd .. ; make )
( cd .. ; make prefix=${INSTROOT} install )
pkgmk -o -r ../tmp
pkgtrans -s spool ${PKGNAME}.pkg ${PKGNAME}
echo "/var/spool/pkg/${PKGNAME}.pkg complete!"
cyclades-serial-client-0.93ubuntu1/sun/prototype 0000664 0000000 0000000 00000001225 07713335645 017013 0 ustar i pkginfo
d none /etc 0755 root sys
f none /etc/cyclades-devices 0755 root root
d none /usr 0755 root sys
d none /usr/sbin 0755 root bin
f none /usr/sbin/cyclades-ser-cli 0755 root root
f none /usr/sbin/cyclades-serial-client 0755 root root
d none /usr/lib 0755 root bin
f none /usr/lib/libcyclades-ser-cli.so 0755 root bin
d none /usr/share 0755 root sys
d none /usr/share/man 0755 root bin
d none /usr/share/man/man5 0755 bin bin
f none /usr/share/man/man5/cyclades-devices.5 0644 root root
d none /usr/share/man/man8 0755 bin bin
f none /usr/share/man/man8/cyclades-ser-cli.8 0644 root root
f none /usr/share/man/man8/cyclades-serial-client.8 0644 root root
cyclades-serial-client-0.93ubuntu1/tsrio.c 0000664 0000000 0000000 00000071157 07710220550 015516 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* tsrio.c
* Tsrsock I/O Scheduler
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* Oct-27-2001 V.1.0.1
* Read is now allowed when PTY is on WAITUSRWR* states
* Less syslog activity on unexpected events
* Hangup message is now of Warning type
*/
#include
#include
#define _TSR_TSRIO_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/misc.h"
#include "inc/dev.h"
#include
/*
* Internal Variables
*/
struct buffer Inbuf; /* Buffer RAS => USER */
struct buffer Outbuf; /* Buffer USER => RAS */
int Hang_up = FALSE;
struct statenames {
const char * const stname;
char ** subnames;
};
struct statenames Pty_states[] = {
{"PTY_INITIAL", 0},
{"PTY_CLOSING", 0},
{"PTY_CLOSED", 0},
{"PTY_OPENING", 0},
{"PTY_WAITDCD", 0},
{"PTY_OPER", 0},
{"PTY_CONFIG", 0},
{"PTY_WAITNVTWR", 0},
{"PTY_WAITUSRWR", 0},
{"PTY_WAITNRUW", 0},
{"PTY_WAITNVTCM", 0},
{"PTY_WAITCLOCAL", 0},
{"PTY_WAITCLOSE", 0},
{"PTY_OPERRONLY", 0},
{"PTY_WAITUSRWR0", 0},
{"PTY_WAITUSRWR2", 0},
};
struct statenames Nvt_states[] = {
{"NVT_INITIAL", 0},
{"NVT_OPER", 0},
{"NVT_WAITPTYWR", 0},
{"NVT_WAITRASWR", 0},
{"NVT_WAITRWPW", 0},
{"NVT_WAITRASCM", 0},
{"NVT_WAITRCPW", 0},
};
const char * const Pty_events[] = {
"EV_UPOPEN",
"EV_UPCLOSE",
"EV_UPDATA",
"EV_UPCONTROL",
"EV_UPFLUSH",
"EV_UPWROK",
};
const char * const Nvt_events[] = {
"EV_RNDNTFY",
"EV_RNDATA",
"EV_RNHANG",
"EV_RNCMOK",
"EV_RNWROK",
};
/*
* Main Scheduler Routines
*/
void all_hangup();
int check_states (void);
void all_wakeup(void);
void all_readonly(void);
/*
* PTY External events handlers (up_*)
*/
void up_nop(struct event *evp);
void up_open(struct event *unused);
void up_op01(struct event *unused);
void up_close(struct event *unused);
void up_data(struct event *evp);
void up_ioctl(struct event *unused);
void up_flush(struct event *evp);
void up_wrok(struct event *unused);
/*
* PTY Internal events handlers (np_*)
*/
void np_nop(const char * const hand);
void np_wrok (void);
void np_wok01 (void);
void np_wok02 (void);
void np_woker (void);
void np_cmdok (void);
void np_cok01 (void);
void np_cok02 (void);
void np_cok03 (void);
void np_cok04 (void);
void np_coker (void);
void np_dcdon (void);
void np_don01 (void);
void np_don02 (void);
void np_doner (void);
void np_dcdoff (void);
void np_dof01 (void);
void np_dof02 (void);
void np_dofer (void);
void np_parity (void);
void np_par01 (void);
void np_parer (void);
void np_break (void);
void np_brk01 (void);
void np_brker (void);
/*
* PTY Operations (do_pty*)
*/
void do_ptyerr (char *action);
int do_ptydata (void);
void do_ptyopen (void);
void do_ptyopen1 (void);
void do_ptyclose (void);
void do_ptyclose1 (void);
void do_ptywrite (void);
void do_ptyioctl (void);
void do_ptyconfig (int mode, struct portconfig *pcp);
void do_ptyconfig1 (void);
void do_ptysendbreak (int interval);
void do_ptyflush (int mode);
void do_ptyhangup (void);
void do_ptyinterrupt (void);
/*
* NVT External events handlers (rn_*)
*/
void rn_nop(struct event *evp);
void rn_ntfy(struct event *evp);
void rn_data(struct event *unused);
void rn_cmdok(struct event *unused);
void rn_wrok(struct event *unused);
/*
* NVT Internal events handlers (pn_*)
*/
void pn_nop(const char * const hand);
void pn_wrok (void);
void pn_wok01 (void);
void pn_wok02 (void);
void pn_woker (void);
/*
* NVT Operations (do_nvt*)
*/
void do_nvterror(const char * const action);
int do_nvtdata (void);
void do_nvtdtron (void);
void do_nvtdtroff (void);
void do_nvtconfig (struct portconfig *pcp);
void do_nvtsendbreak (int interval);
void do_nvtflush (int mode);
/*
* Debug routines
*/
char * tsr_states(const char * const unused);
void print_ptystate(const char * const hand);
void print_nvtstate(const char * const hand);
void print_action(const char * const hand);
void print_event (struct event *evp);
/*
* Matrix for PTY External events
*/
void (*(Pty_upevents[PTY_STATES][EV_UPEVENTS]))(struct event *evp) = {
/*{UPOPEN ,UPCLOSE ,UPDATA ,UPCONTROL,UPFLUSH ,UPWROK } */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* INITIAL */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* CLOSING */
{up_open ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* CLOSED */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* OPENING */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* WAITDCD */
{up_nop ,up_close,up_data ,up_ioctl ,up_flush,up_nop }, /* OPER */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* CONFIG */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* WAITNVTWR */
{up_nop ,up_close,up_data ,up_nop ,up_nop ,up_wrok }, /* WAITUSRWR */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_wrok }, /* WAITNWUW */
{up_nop ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* WAITNVTCM */
{up_nop ,up_close,up_nop ,up_nop ,up_nop ,up_nop }, /* WAITCLOCAL */
{up_nop ,up_close,up_nop ,up_nop ,up_nop ,up_nop }, /* WAITCLOSE */
{up_op01 ,up_nop ,up_nop ,up_nop ,up_nop ,up_nop }, /* OPERRONLY */
{up_nop ,up_close,up_nop ,up_nop ,up_nop ,up_wrok }, /* WAITUSRWR0 */
{up_nop ,up_close,up_nop ,up_nop ,up_nop ,up_wrok }, /* WAITUSRWR2 */
};
/*
* Matrix for PTY Internal events
*/
void (*(Pty_npevents[PTY_STATES][EV_NPEVENTS]))(void) = {
/*{NPWROK ,NPCMDOK ,NPDCDON ,NPDCDOFF,NPPARITY,NPBREAK } */
{np_woker,np_coker,np_doner,np_dofer,np_parer,np_brker}, /* INITIAL */
{np_woker,np_cok01,np_doner,np_dofer,np_parer,np_brker}, /* CLOSING */
{np_woker,np_coker,np_doner,np_dofer,np_parer,np_brker}, /* CLOSED */
{np_woker,np_cok02,np_doner,np_dofer,np_parer,np_brker}, /* OPENING */
{np_woker,np_coker,np_don01,np_dofer,np_parer,np_brker}, /* WAITDCD */
{np_woker,np_coker,np_doner,np_dof01,np_par01,np_brk01}, /* OPER */
{np_woker,np_cok03,np_doner,np_dofer,np_parer,np_brker}, /* CONFIG */
{np_wok01,np_coker,np_doner,np_dofer,np_par01,np_brk01}, /* WAITNVTWR */
{np_woker,np_coker,np_doner,np_dofer,np_parer,np_brker}, /* WAITUSRWR */
{np_wok02,np_coker,np_doner,np_dofer,np_parer,np_brker}, /* WAITNWUW */
{np_woker,np_cok04,np_doner,np_dofer,np_parer,np_brker}, /* WAITNVTCM */
{np_woker,np_coker,np_don02,np_dofer,np_parer,np_brker}, /* WAITCLOCAL */
{np_woker,np_coker,np_don01,np_dofer,np_parer,np_brker}, /* WAITCLOSE */
{np_woker,np_coker,np_doner,np_dof02,np_parer,np_brk01}, /* OPERRONLY */
{np_woker,np_coker,np_doner,np_dofer,np_parer,np_brker}, /* WAITUSRWR0 */
{np_woker,np_coker,np_doner,np_dofer,np_parer,np_brker}, /* WAITUSRWR2 */
};
/*
* Matrix for NVT External events
*/
void (*(Nvt_rnevents[NVT_STATES][EV_RNEVENTS]))(struct event *evp) = {
/*{RNNTFY ,RNDATA ,RNHANG ,RNCMDOK ,RNWROK } */
{rn_ntfy ,rn_nop ,rn_nop ,rn_nop ,rn_nop }, /* INITIAL */
{rn_ntfy ,rn_data ,rn_nop ,rn_nop ,rn_nop }, /* OPER */
{rn_nop ,rn_nop ,rn_nop ,rn_nop ,rn_nop }, /* WAITPTYWR */
{rn_ntfy ,rn_data ,rn_nop ,rn_nop ,rn_wrok }, /* WAITRASWR */
{rn_nop ,rn_nop ,rn_nop ,rn_nop ,rn_wrok }, /* WAITRWPW */
{rn_ntfy ,rn_nop ,rn_nop ,rn_cmdok,rn_nop }, /* WAITRASCM */
{rn_nop ,rn_nop ,rn_nop ,rn_cmdok,rn_nop }, /* WAITRCPW */
};
/*
* Matrix for NVT Internal events
*/
void (*(Nvt_pnevents[NVT_STATES][EV_PNEVENTS]))(void) = {
/*{PNWROK } */
{pn_woker }, /* INITIAL */
{pn_woker }, /* OPER */
{pn_wok01 }, /* WAITPTYWR */
{pn_woker }, /* WAITRASWR */
{pn_wok02 }, /* WAITRWPW */
{pn_woker }, /* WAITRASCM */
{pn_woker }, /* WAITRCPW */
};
/*
* Startup
*/
int
tsr_init(int netsize, int devsize, int devmodem, int closemode)
{
int ret;
/* Initialize buffers (warn: these macros can return) */
INIT_BUFFER(Inbuf, 2 * netsize);
INIT_BUFFER(Outbuf, 2 * devsize);
/* Initialize event queue */
INIT_EVENTS();
/* Connection status */
Hang_up = FALSE;
/* Initialize NVT */
if((ret = tel_init(netsize, &Inbuf, &Outbuf)) != E_NORMAL)
return (ret);
NVT_SETSTATE("tsr_init", NVT_OPER); /* NVT starts at operational state */
/* Initialize PTY */
if (
(ret = dev_init (devsize, devmodem, closemode, &Outbuf, &Inbuf,
Nvt.comport)) == E_NORMAL) {
PTY_SETSTATE("tsr_init", PTY_INITIAL);
do_ptyclose (); /* PTY starts at closed state */
}
return (ret);
}
/*
* Main Scheduler Routines
*/
void
tsr_io(void)
{
struct event *ev;
int mask;
while (Hang_up == FALSE) {
mask = check_states();
external_poll(mask, SCHED_DELAY);
while (Hang_up == FALSE) {
ev = GET_EVENT();
if (!ev) break;
print_event(ev);
switch (ev->ev_type) {
case EV_UP:
(*Pty_upevents[Pty.state][ev->ev_code])(ev);
break;
case EV_RN:
(*Nvt_rnevents[Nvt.state][ev->ev_code])(ev);
break;
}
CLR_EVENT(ev);
}
}
all_hangup();
}
void
all_hangup()
{
dev_hangup();
tel_free();
dev_free();
FREE_BUFFER(Inbuf);
FREE_BUFFER(Outbuf);
FREE_EVENTS();
Hang_up = FALSE;
}
int
check_states (void)
{
int mask = 0;
switch (Pty.state) {
case PTY_OPER:
case PTY_OPERRONLY:
mask = DEV_READ|DEV_EXCEPT;
break;
case PTY_WAITCLOCAL:
case PTY_WAITCLOSE:
mask = DEV_PROBE|DEV_EXCEPT;
break;
case PTY_WAITUSRWR0:
mask = DEV_READ|DEV_EXCEPT|DEV_WRITE;
break;
case PTY_WAITUSRWR:
mask = DEV_READ|DEV_EXCEPT|DEV_WRITE;
break;
case PTY_WAITNWUW: /* don't read pty */
case PTY_WAITUSRWR2:
mask = DEV_WRITE;
break;
}
switch (Nvt.state) {
case NVT_OPER:
case NVT_WAITRASCM:
case NVT_WAITRCPW: /*WARN Pty Blocked, buffer may overrun */
mask |= SOCK_READ;
break;
case NVT_WAITRASWR:
mask |= SOCK_READ|SOCK_WRITE;
break;
case NVT_WAITRWPW: /* don't read socket */
mask |= SOCK_WRITE;
break;
}
return (mask);
}
void
imminent_event(int msgtype)
{
switch (Pty.state) {
case PTY_WAITCLOSE:
if (msgtype != PROBE_EOF) { /* ! MDATA == 0 =>any except CLOSE, BLOCK */
PTY_SETSTATE("probe", PTY_WAITDCD);
} else {
dev_getdata(); /* CLOSE, GET IT */
}
break;
case PTY_WAITUSRWR0:
PTY_SETSTATE("probe", PTY_WAITUSRWR);
if (msgtype != PROBE_EOF && msgtype != PROBE_DATA) { /* ! MDATA, BLOCK */
PTY_SETSTATE("probe", PTY_WAITUSRWR2);
} else { /* MDATA/CLOSE => GET IT */
dev_getdata();
}
break;
case PTY_WAITUSRWR:
if (msgtype != PROBE_EOF && msgtype != PROBE_DATA) { /* ! MDATA, BLOCK */
PTY_SETSTATE("probe", PTY_WAITUSRWR2);
} else { /* MDATA/CLOSE => GET IT */
dev_getdata();
}
break;
case PTY_WAITCLOCAL:
if (msgtype == PROBE_CLOCAL) {
PTY_SETSTATE("probe", PTY_OPER);
Pty.portmodes |= PORT_CLOCAL;
dev_getdata();
} else if (msgtype == PROBE_EOF) { /* CLOSE ?? */
PTY_SETSTATE("probe", PTY_OPER);
dev_getdata();
} else {
PTY_SETSTATE("probe", PTY_WAITDCD);
}
break;
}
}
/* GAMB => Invoked in Pty.state == OPER, check for missed events */
void
all_wakeup(void)
{
/* First check for NP_DCDOFF */
if (!(Pty.portmodes & PORT_CLOCAL) &&
!(Pty.comport->portstate.modemstate & MODEM_DCD)) {
PTY_SETSTATE("all_wakeup", PTY_WAITCLOSE);
do_ptyhangup();
return;
}
/* Check for NVT data */
if (Pty.outbuff->b_hold) {
if (do_ptydata() != E_NORMAL) { /* local action */
return;
}
pn_wrok(); /* Notify NVT */
}
/* Finally, check for user data */
if (Pty.inbuff->b_hold) {
do_ptywrite();
}
}
void
all_readonly(void)
{
/* First check for NP_DCDOFF */
if (!(Pty.portmodes & PORT_CLOCAL) &&
!(Pty.comport->portstate.modemstate & MODEM_DCD)) {
PTY_SETSTATE("all_readonly", PTY_WAITCLOCAL);
do_ptyhangup();
return;
}
/* Check for NVT data */
if (Pty.outbuff->b_hold) {
if (do_ptydata() != E_NORMAL) { /* local action */
return;
}
pn_wrok(); /* Notify NVT */
}
}
/*
* PTY External events handlers (up_*)
*/
void
up_nop (struct event *evp)
{
const char * const event = Pty_events[evp->ev_code];
sysmessage (MSG_DEBUG, "PTY state (EVENT %s): %s\n", event,
tsr_states(event));
}
void
up_open(struct event *unused)
{
unused = unused;
do_ptyopen();
}
void
up_op01(struct event *unused)
{
unused = unused;
/* Port already open (read_only) => only change to read-write states */
switch (Pty.state) {
case PTY_OPERRONLY:
PTY_SETSTATE("up_op01", PTY_OPER);
all_wakeup(); /* XXXX */
break;
case PTY_WAITUSRWR0:
PTY_SETSTATE("up_op01", PTY_WAITUSRWR);
break;
}
}
void
up_close(struct event *unused)
{
unused = unused;
do_ptyclose();
}
void
up_ioctl(struct event *unused)
{
unused = unused;
do_ptyioctl();
}
void
up_flush(struct event *evp)
{
int mode = *(int *) evp->ev_param;
do_ptyflush(mode);
}
void
up_data(struct event *unused)
{
unused = unused;
do_ptywrite();
}
void
up_wrok(struct event *unused)
{
unused = unused;
switch (Pty.state) {
case PTY_WAITUSRWR0:
PTY_SETSTATE("up_wrok", PTY_OPERRONLY);
break;
case PTY_WAITUSRWR:
case PTY_WAITUSRWR2:
PTY_SETSTATE("up_wrok", PTY_OPER);
break;
case PTY_WAITNWUW:
PTY_SETSTATE("up_wrok", PTY_WAITNVTWR);
break;
}
if (do_ptydata() == E_NORMAL) { /* XXXX local action */
pn_wrok();
}
}
/*
* PTY Internal events handlers (np_*)
*/
void
np_nop(const char * const evhand)
{
sysmessage (MSG_DEBUG, "PTY state (INT EVENT %s): %s\n", evhand,
tsr_states(evhand));
}
/* EV_NPWROK */
void
np_wrok(void)
{
(*Pty_npevents[Pty.state][EV_NPWROK])();
}
void
np_wok01(void)
{
PTY_SETSTATE("np_wrok", PTY_OPER);
all_wakeup(); /* XXXX */
}
void
np_wok02(void)
{
PTY_SETSTATE("np_wrok", PTY_WAITUSRWR);
}
void
np_woker(void)
{
np_nop ("np_wrok");
}
/* EV_NPCMDOK */
void
np_cmdok(void)
{
(*Pty_npevents[Pty.state][EV_NPCMDOK])();
}
void
np_cok01(void)
{
do_ptyclose1();
}
void
np_cok02(void)
{
do_ptyopen1();
}
void
np_cok03(void)
{
do_ptyconfig1();
}
void
np_cok04(void)
{
PTY_SETSTATE("np_cmdok", PTY_OPER);
all_wakeup(); /* XXXX */
}
void
np_coker(void)
{
np_nop ("np_cmdok");
}
/* EV_NPDCDON */
void
np_dcdon(void)
{
(*Pty_npevents[Pty.state][EV_NPDCDON])();
}
void
np_don01(void)
{
PTY_SETSTATE("np_dcdon", PTY_OPER);
all_wakeup(); /* XXXX */
}
void
np_don02(void)
{
PTY_SETSTATE("np_dcdon", PTY_OPERRONLY);
all_readonly();
}
void
np_doner(void)
{
np_nop ("ev_npdcdon");
}
/* EV_NPDCDOFF */
void
np_dcdoff(void)
{
(*Pty_npevents[Pty.state][EV_NPDCDOFF])();
}
void
np_dof01(void)
{
if (!(Pty.portmodes & PORT_CLOCAL)) {
PTY_SETSTATE("np_dcdoff", PTY_WAITCLOSE);
do_ptyhangup();
}
}
void
np_dof02(void)
{
if (!(Pty.portmodes & PORT_CLOCAL)) {
PTY_SETSTATE("np_dcdoff", PTY_WAITCLOCAL);
do_ptyhangup();
}
}
void
np_dofer(void)
{
np_nop ("np_dcdoff");
}
/* EV_NPPARITY */
void
np_parity(void)
{
(*Pty_npevents[Pty.state][EV_NPPARITY])();
}
void
np_par01(void)
{
int portmodes;
struct buffer *bp;
portmodes = Pty.portmodes;
bp = Pty.outbuff;
if (!(portmodes & PORT_IGNPAR)) {
if (portmodes & PORT_PARMRK) {
PUT_BUFFER(bp, 0xff);
PUT_BUFFER(bp, 0x00);
} else {
PUT_BUFFER(bp, 0x00);
}
}
}
void
np_parer(void)
{
np_nop ("np_parity");
}
/* EV_NPBREAK */
void
np_break(void)
{
(*Pty_npevents[Pty.state][EV_NPBREAK])();
}
void
np_brk01(void)
{
int portmodes;
struct buffer *bp1, *bp2;
portmodes = Pty.portmodes;
bp1 = Pty.outbuff;
bp2 = Pty.inbuff;
if (!(portmodes & PORT_IGNBRK)) {
if (portmodes & PORT_BRKINT) {
RESET_BUFFER(bp1);
RESET_BUFFER(bp2);
do_ptyinterrupt();
} else if (portmodes & PORT_PARMRK) {
PUT_BUFFER(bp1, 0xff);
PUT_BUFFER(bp1, 0x00);
} else {
PUT_BUFFER(bp1, 0x00);
}
}
}
void
np_brker(void)
{
np_nop ("np_break");
}
/*
* PTY Operations (do_pty*)
*/
void
do_ptyerror(const char * const action)
{
sysmessage (MSG_ERR, "Undesirable PTY state for ACTION %s: %s\n",
action, tsr_states(action));
}
int
do_ptydata()
{
int ret;
struct buffer * bp = Pty.outbuff;
print_action("do_ptydata");
switch (Pty.state) {
case PTY_OPER:
case PTY_OPERRONLY:
case PTY_WAITNVTWR:
if ((ret = dev_putdata(bp)) == 0) {
if (bp->b_hold != 0) {
switch (Pty.state) {
case PTY_OPER:
PTY_SETSTATE("do_ptydata",PTY_WAITUSRWR);
break;
case PTY_WAITNVTWR:
PTY_SETSTATE("do_ptydata", PTY_WAITNWUW);
break;
case PTY_OPERRONLY:
PTY_SETSTATE("do_ptydata", PTY_WAITUSRWR0);
break;
}
ret = E_BLOCKED;
} else {
ret = E_NORMAL;
}
} else {
Hang_up = TRUE;
if (Debug > 0) {
sysmessage (MSG_DEBUG, "HANGUP DO_PTYDATA\n");
}
ret = E_FILEIO;
}
break;
case PTY_WAITCLOSE:
case PTY_CLOSING:
case PTY_CLOSED:
case PTY_OPENING:
case PTY_WAITCLOCAL:
case PTY_WAITDCD:
RESET_BUFFER(Pty.outbuff); /* Discard it */
pn_wrok(); /* Notify NVT */
ret = E_NORMAL;
break;
default:
do_ptyerror("do_ptydata");
ret = E_BLOCKED; /* Transition to PTY_OPER must wakeup NVT */
break;
}
return (ret);
}
void
do_ptyclose(void)
{
print_action("do_ptyclose");
/* Wait output data to drain */
if (Pty.inbuff->b_hold) {
if (do_nvtdata() != E_NORMAL) {
sysmessage (MSG_WARNING,
"Can't flush output buffer before close\n");
}
}
/* Flush input data */
if (Pty.outbuff->b_hold) {
RESET_BUFFER(Pty.outbuff);
pn_wrok(); /* Notify NVT */
}
/* Set DTR off if applicable */
if (Pty.portmodes & PORT_HUPCL) {
PTY_SETSTATE("do_ptyclose", PTY_CLOSING);
do_nvtdtroff(); /* Sched */
} else {
do_ptyclose1();
}
}
void
do_ptyclose1(void)
{
print_action("do_ptyclose1");
dev_config();
PTY_SETSTATE("do_ptyclose1", PTY_CLOSED);
/* Simulate a user open */
/* DO a DTR OFF->ON delay */
sysdelay(1000);
do_ptyopen();
}
void
do_ptyopen(void)
{
print_action("do_ptyopen");
PTY_SETSTATE("do_ptyopen", PTY_OPENING);
do_nvtdtron(); /* Sched */
}
void
do_ptyopen1(void)
{
print_action("do_ptyopen1");
if (!(Pty.portmodes & PORT_CLOCAL) &&
!(Pty.comport->portstate.modemstate & MODEM_DCD)) {
/* Ignore input data */
if (Pty.outbuff->b_hold) {
RESET_BUFFER(Pty.outbuff);
pn_wrok(); /* Notify NVT */
}
PTY_SETSTATE("do_ptyopen1", PTY_WAITCLOCAL);
} else {
PTY_SETSTATE("do_ptyopen1", PTY_OPERRONLY);
all_readonly(); /* XXXX */
}
}
void
do_ptywrite()
{
int ret;
print_action("do_ptywrite");
if ((ret = do_nvtdata()) != E_NORMAL) {
if (ret == E_BLOCKED) {
switch (Pty.state) {
case PTY_OPER:
PTY_SETSTATE("do_ptywrite", PTY_WAITNVTWR);
break;
case PTY_WAITUSRWR:
PTY_SETSTATE("do_ptywrite", PTY_WAITNWUW);
break;
}
} /* ELSE ERROR */
}
}
void
do_ptyioctl(void)
{
struct iocontrol * iocp = &Pty.iocontrol;
int oper = iocp->io_oper;
struct portconfig * pconfig;
int param;
print_action("do_ptyioctl");
switch (oper) {
case OP_SETNOW:
case OP_SETWAIT:
case OP_SETFLUSH:
pconfig = &iocp->io_portconfig;
do_ptyconfig(oper, pconfig); /* Activity */
break;
case OP_SENDBREAK:
param = iocp->io_arg;
do_ptysendbreak(param);
break;
case OP_FLUSH:
param = iocp->io_arg;
do_ptyflush(param);
break;
}
iocp->io_oper = OP_NONE; /* cleanup */
}
void
do_ptyconfig (int mode, struct portconfig *pcp)
{
struct portconfig *cur;
print_action("do_ptyconfig");
if (mode != OP_SETNOW) { /* Wait output to drain */
if (do_nvtdata() != E_NORMAL) {
sysmessage (MSG_WARNING,
"Can't flush output buffer before configure\n");
}
}
if (mode == OP_SETFLUSH) {
/* Flush input data */
if (Pty.outbuff->b_hold) {
RESET_BUFFER(Pty.outbuff);
pn_wrok(); /* Notify NVT */
}
}
/* Send config */
cur = &Pty.comport->portconfig;
if (memcmp ((void *) cur, (void *) pcp, sizeof (struct portconfig))
!= 0) {
if (!pcp->speed) { /* HANG UP */
PTY_SETSTATE("do_ptyconfig", PTY_WAITNVTCM);
do_nvtdtroff(); /* Sched */
} else {
PTY_SETSTATE("do_ptyconfig", PTY_CONFIG);
do_nvtconfig(pcp); /* Sched */
}
} else {
do_ptyconfig1();
}
}
void
do_ptyconfig1()
{
/* Only check for EVENT CLOCALOFF */
print_action("do_ptyconfig1");
if (!(Pty.portmodes & PORT_CLOCAL) &&
!(Pty.comport->portstate.modemstate & MODEM_DCD)) {
PTY_SETSTATE("do_ptyconfig1", PTY_WAITDCD);
} else {
PTY_SETSTATE("do_ptyconfig1", PTY_OPER);
all_wakeup(); /* XXXX */
}
}
void
do_ptysendbreak (int interval)
{
/* Wait output to drain */
print_action("do_ptysendbreak");
if (do_nvtdata() != E_NORMAL) {
sysmessage (MSG_WARNING,
"Can't flush output buffer before send break\n");
}
PTY_SETSTATE("do_ptysendbreak", PTY_WAITNVTCM);
do_nvtsendbreak(interval);
}
void
do_ptyflush (int mode)
{
print_action("do_ptyflush");
switch (mode) {
case OPFLUSH_IN:
if (Pty.outbuff->b_hold) {
RESET_BUFFER(Pty.outbuff);
pn_wrok(); /* Notify NVT */
}
break;
case OPFLUSH_OUT:
RESET_BUFFER(Pty.inbuff);
break;
case OPFLUSH_IO:
RESET_BUFFER(Pty.inbuff);
if (Pty.outbuff->b_hold) {
RESET_BUFFER(Pty.outbuff);
pn_wrok(); /* Notify NVT */
}
break;
}
PTY_SETSTATE("do_ptyflush",PTY_WAITNVTCM);
do_nvtflush(mode);
}
void
do_ptyhangup(void)
{
print_action("do_ptyhangup");
RESET_BUFFER(Pty.inbuff);
if (Pty.outbuff->b_hold) {
RESET_BUFFER(Pty.outbuff);
pn_wrok(); /* Notify NVT */
}
dev_hangup();
}
void
do_ptyinterrupt(void)
{
print_action("do_ptyinterrupt");
dev_interrupt();
}
/*
* NVT External events handlers (rn_*)
*/
void
rn_nop (struct event *evp)
{
const char * const event = Nvt_events[evp->ev_code];
sysmessage (MSG_DEBUG, "NVT state (EVENT %s): %s\n", event,
tsr_states (event));
}
void
rn_cmdok(struct event *unused)
{
/* VALID STATES => NVT_WAITRCPW || NVT_WAITRASC */
int state = Nvt.state;
unused = unused;
switch (state) {
case NVT_WAITRASCM:
NVT_SETSTATE("rn_cmdok", NVT_OPER);
break;
case NVT_WAITRCPW:
NVT_SETSTATE("rn_cmdok", NVT_WAITPTYWR);
break;
}
np_cmdok(); /* Passes control to PTY object */
}
void
rn_wrok(struct event *unused)
{
/* VALID STATES => NVT_WAITRASWR || NVT_WAITRWPW */
int state = Nvt.state;
unused = unused;
switch (state) {
case NVT_WAITRASWR:
NVT_SETSTATE("rn_wrok", NVT_OPER);
break;
case NVT_WAITRWPW:
NVT_SETSTATE("rn_wrok", NVT_WAITPTYWR);
break;
}
if (do_nvtdata() == E_NORMAL) {
np_wrok(); /* Passes control to PTY object */
}
}
void
rn_ntfy(struct event *evp)
{
int notify;
notify = *(int *) evp->ev_param;
switch (notify) {
case NT_DCDON:
np_dcdon();
break;
case NT_DCDOFF:
np_dcdoff();
break;
case NT_BREAK:
np_break();
break;
case NT_PARITY:
np_parity();
break;
}
}
void
rn_data(struct event *unused)
{
int ret;
unused = unused;
if ((ret = do_ptydata()) != E_NORMAL) {
if (ret == E_BLOCKED) {
switch (Nvt.state) {
case NVT_OPER:
NVT_SETSTATE("rn_data", NVT_WAITPTYWR);
break;
case NVT_WAITRASWR:
NVT_SETSTATE("rn_data", NVT_WAITRWPW);
break;
case NVT_WAITRASCM:
NVT_SETSTATE("rn_data", NVT_WAITRCPW);
break;
}
} /* else ERROR */
}
}
/*
* NVT Internal events handlers (pn_*)
*/
void
pn_nop(const char * const evhand)
{
sysmessage (MSG_DEBUG, "NVT state (INT EVENT %s): %s\n", evhand,
tsr_states (evhand));
}
void
pn_wrok(void)
{
(*Nvt_pnevents[Nvt.state][EV_PNWROK])();
}
void
pn_wok01(void)
{
NVT_SETSTATE("pn_wrok", NVT_OPER);
}
void
pn_wok02(void)
{
NVT_SETSTATE("pn_wrok", NVT_WAITRASWR);
}
void
pn_woker(void)
{
pn_nop ("ev_pnwrok");
}
/*
* NVT Operations (do_nvt*)
*/
void
do_nvterror(const char * const action)
{
sysmessage (MSG_ERR, "Undesirable NVT state for ACTION %s: %s\n",
action, tsr_states(action));
}
int
do_nvtdata(void)
{
int ret;
struct buffer * bp = Nvt.outbuff;
print_action("do_nvtdata");
if (!bp->b_hold) {
return (E_NORMAL);
}
switch (Nvt.state) {
case NVT_OPER:
case NVT_WAITPTYWR:
if ((ret = tel_putdata(bp)) == 0) {
if (bp->b_hold != 0) {
if (Nvt.state == NVT_OPER) {
NVT_SETSTATE("do_nvtdata", NVT_WAITRASWR);
} else {
NVT_SETSTATE("do_nvtdata", NVT_WAITRWPW);
}
ret = E_BLOCKED;
} else {
ret = E_NORMAL;
}
} else {
Hang_up = TRUE;
if (Debug > 0) {
sysmessage (MSG_DEBUG, "HANGUP DO_NVTDATA\n");
}
ret = E_FILEIO;
}
break;
default:
do_nvterror("do_nvtdata");
ret = E_BLOCKED; /* Transition to NVT_OPER must wakeup PTY */
break;
}
return (ret);
}
void
do_nvtdtron(void)
{
print_action("do_nvtdtron");
switch (Nvt.state) {
case NVT_OPER:
case NVT_WAITPTYWR:
tel_putcmd(USR_COM_SET_CONTROL, COM_DTR_ON);
if (Nvt.state == NVT_OPER) {
NVT_SETSTATE("do_nvtdtron", NVT_WAITRASCM);
} else {
NVT_SETSTATE("do_nvtdtron", NVT_WAITRCPW);
}
break;
default:
do_nvterror("do_nvtdtron");
break;
}
}
void
do_nvtdtroff(void)
{
print_action("do_nvtdtroff");
switch (Nvt.state) {
case NVT_OPER:
case NVT_WAITPTYWR:
tel_putcmd(USR_COM_SET_CONTROL, COM_DTR_OFF);
if (Nvt.state == NVT_OPER) {
NVT_SETSTATE("do_nvtdtroff", NVT_WAITRASCM);
} else {
NVT_SETSTATE("do_nvtdtroff", NVT_WAITRCPW);
}
break;
default:
do_nvterror("do_nvtdtroff");
break;
}
}
void
do_nvtconfig (struct portconfig *pcp)
{
struct portconfig *cur = &Nvt.comport->portconfig;
int cmds = 0;
print_action("do_nvtconfig");
switch (Nvt.state) {
case NVT_OPER:
case NVT_WAITPTYWR:
if (pcp->speed != cur->speed) {
tel_putcmd(USR_COM_SET_BAUDRATE, pcp->speed);
cmds++;
}
if (pcp->datasize != cur->datasize) {
tel_putcmd(USR_COM_SET_DATASIZE, pcp->datasize);
cmds++;
}
if (pcp->stopsize != cur->stopsize) {
tel_putcmd(USR_COM_SET_STOPSIZE, pcp->stopsize);
cmds++;
}
if (pcp->parity != cur->parity) {
tel_putcmd(USR_COM_SET_PARITY, pcp->stopsize);
cmds++;
}
if (pcp->flowc != cur->flowc) {
tel_putcmd(USR_COM_SET_CONTROL, pcp->flowc);
cmds++;
}
if (cmds) {
if (Nvt.state == NVT_OPER) {
NVT_SETSTATE("do_nvtconfig", NVT_WAITRASCM);
} else {
NVT_SETSTATE("do_nvtconfig", NVT_WAITRCPW);
}
} else {
np_cmdok(); /* Wakeup PTY */
}
break;
default:
do_nvterror("do_nvtconfig");
break;
}
}
void
do_nvtsendbreak(int interval)
{
print_action("do_nvtsendbreak");
switch (Nvt.state) {
case NVT_OPER:
case NVT_WAITPTYWR:
tel_putcmd(USR_COM_SET_CONTROL, COM_BREAK_ON);
# ifdef ACCEPT_BREAK_INTERVAL
if (interval) {
interval *= 250;
} else {
interval = 250;
}
# else
interval = 250;
# endif
sysdelay(interval);
tel_putcmd(USR_COM_SET_CONTROL, COM_BREAK_OFF);
if (Nvt.state == NVT_OPER) {
NVT_SETSTATE("do_nvtsendbreak", NVT_WAITRASCM);
} else {
NVT_SETSTATE("do_nvtsendbreak", NVT_WAITRCPW);
}
break;
default:
do_nvterror("do_nvtsendbreak");
break;
}
}
void
do_nvtflush(int mode)
{
int purgemode;
print_action("do_nvtflush");
switch (Nvt.state) {
case NVT_OPER:
case NVT_WAITPTYWR:
switch (mode) {
case OPFLUSH_IN:
purgemode = COM_PURGE_RECV;
break;
case OPFLUSH_OUT:
purgemode = COM_PURGE_XMIT;
break;
case OPFLUSH_IO:
default:
purgemode = COM_PURGE_BOTH;
break;
}
tel_putcmd(USR_COM_PURGE_DATA, purgemode);
if (Nvt.state == NVT_OPER) {
NVT_SETSTATE("do_nvtflush", NVT_WAITRASCM);
} else {
NVT_SETSTATE("do_nvtflush", NVT_WAITRCPW);
}
break;
default:
do_nvterror("do_nvtflush");
break;
}
}
/*
* Debug routines
*/
char debugbuf[128];
char *
tsr_states(const char * const unused)
{
const char *pstate, *psubstate;
const char *nstate, *nsubstate;
pstate = Pty_states[Pty.state].stname;
if (Pty_states[Pty.state].subnames) {
psubstate = Pty_states[Pty.state].subnames[Pty.substate];
} else {
psubstate = "NONE";
}
nstate = Nvt_states[Nvt.state].stname;
if (Nvt_states[Nvt.state].subnames) {
nsubstate = Nvt_states[Nvt.state].subnames[Nvt.substate];
} else {
nsubstate = "NONE";
}
sprintf(debugbuf, "%s %s -- %s %s\n", pstate, psubstate,
nstate, nsubstate);
return (debugbuf);
}
void
print_ptystate(const char * const hand)
{
const char *state, *substate;
if (Debug > 0) {
state = Pty_states[Pty.state].stname;
if (Pty_states[Pty.state].subnames) {
substate = Pty_states[Pty.state].subnames[Pty.substate];
} else {
substate = "NONE";
}
sysmessage (MSG_DEBUG, "PTYSTATE (%s): %s %s\n", hand, state, substate);
}
}
void
print_nvtstate(const char * const hand)
{
const char *state, *substate;
if (Debug > 0) {
state = Nvt_states[Nvt.state].stname;
if (Nvt_states[Nvt.state].subnames) {
substate = Nvt_states[Nvt.state].subnames[Nvt.substate];
} else {
substate = "NONE";
}
sysmessage (MSG_DEBUG, "NVTSTATE (%s): %s %s\n", hand, state, substate);
}
}
void
print_action(const char * const hand)
{
if(Debug > 1)
sysmessage (MSG_DEBUG, "ACTION %s\n", hand);
}
void
print_event (struct event *evp)
{
unsigned char * cp;
const char *type;
const char *name;
if(Debug > 1)
{
switch (evp->ev_type)
{
case EV_UP:
type = "EV_UP";
name = Pty_events[evp->ev_code];
break;
case EV_RN:
type = "EV_RN";
name = Nvt_events[evp->ev_code];
break;
default:
type = "EV_UNK";
name = "UNKNOWN";
break;
}
if(evp->ev_param)
{
cp = (unsigned char *) evp->ev_param;
sprintf(debugbuf, "%02X %02X %02X %02X", *cp, *(cp+1)
, *(cp+2), *(cp+3));
sysmessage(MSG_DEBUG, "EVENT %s %s, size %d: %s\n"
, type, name, evp->ev_size, debugbuf);
}
else
{
sysmessage (MSG_DEBUG, "EVENT %s %s\n", type, name);
}
}
}
cyclades-serial-client-0.93ubuntu1/cyclades-serial-client 0000775 0000000 0000000 00000006613 07713353236 020466 0 ustar #!/bin/sh
# chkconfig: 235 55 45
# description:
# description: cyclades-serial-client script controls the interfaces of \
# the physical ports of Cyclades Terminal Servers
BASE=/etc
DEVS=${BASE}/cyclades-devices
BACKVARS=${BASE}/backvars$$
FOUND=0
BACKEXIT=0
DEV=all
GLOBALOPTS=""
export DEV DEVS FOUND BACKEXIT BACKVARS PATH
clean()
{
if [ -f ${BACKVARS} ]
then
rm -f ${BACKVARS}
fi
}
if [ $# -lt 1 -o $# -gt 2 ]
then
echo "Usage : cyclades-serial-client (start|stop|restart|status) [device]"
exit 2
fi
OPTION=$1
if [ $# -eq 2 ]
then
DEV=$2
fi
case $OPTION in
start_msg)
echo "Starting Cyclades Terminal Servers Interface"
exit 0
;;
stop_msg)
echo "Stopping Cyclades Terminal Servers Interface"
exit 0
;;
esac
if [ ! -f ${DEVS} ]
then
echo "cyclades-serial-client : device table not found"
exit 1
fi
clean
trap 'clean' 1 2 3 15
cat ${DEVS} | grep -v "#" | while read line
do
if [ -z "${line}" ]
then
continue
fi
devc=`echo ${line} | cut -f1 -d:`
serv=`echo ${line} | cut -f2 -d:`
host=`echo ${line} | cut -f3 -d:`
port=`echo ${line} | cut -f4 -d:`
type=`echo ${line} | cut -f5 -d:`
opts=`echo ${line} | cut -f6 -d:`
opts="$GLOBALOPTS $opts"
if [ -z "${devc}" -o -z "${serv}" -o -z "${host}" -o -z "${port}" ]
then
echo "cyclades-serial-client : Bad device table line"
BACKEXIT=3
echo "BACKEXIT=${BACKEXIT}" >> ${BACKVARS}
exit ${BACKEXIT}
fi
if [ "${DEV}" != "all" ]
then
if [ "${DEV}" != "${devc}" ]
then
continue
else
FOUND=1
echo "FOUND=${FOUND}" >> ${BACKVARS}
fi
fi
case ${type} in
rtelnet)
devst="${devc} (rtelnet at ${host}:${port})"
if [ "${serv}" = "path" ]
then
opts="-p 28672 $opts"
fi
;;
socket)
devst="${devc} ( socket at ${host}:${port})"
if [ "${serv}" = "path" ]
then
opts="-p 32768 $opts"
fi
opts="-s $opts"
;;
*)
echo "tsrport : Bad device table line"
BACKEXIT=2
echo "BACKEXIT=${BACKEXIT}" >> ${BACKVARS}
exit ${BACKEXIT}
;;
esac
if [ `uname` = "Linux" ]; then
ppid=`ps ax | grep tsrsock | grep "${devc} " | awk '{print $1}'`
else
ppid=`ps -ef | grep tsrsock | grep "${devc} " | awk '{print $2}'`
fi
case ${OPTION} in
"start")
if [ -n "${ppid}" ]
then
echo "cyclades-serial-client : ${devc} already active"
continue
fi
echo "Starting ${devc} <<==>> ${host}:${port} interface"
tsrsock ${opts} ${devc} ${host} ${port}
sleep 1
;;
"stop")
if [ -z "${ppid}" ]
then
echo "cyclades-serial-client : ${devc} already inactive"
continue
fi
echo "Stopping ${devc} <<==>> ${host}:${port} interface"
kill ${ppid}
;;
"restart")
if [ -z "${ppid}" ]
then
echo "cyclades-serial-client : ${devc} is inactive"
echo "Starting ${devc} <<==>> ${host}:${port} interface"
tsrsock ${opts} ${devc} ${host} ${port}
sleep 1
else
echo \
"Restarting ${devc} <<==>> ${host}:${port} interface"
kill -s USR1 ${ppid}
fi
;;
"status")
if [ -n "${ppid}" ]
then
devst="${devst} active, pid ${ppid}"
else
devst="${devst} inactive"
fi
echo ${devst}
;;
*)
echo "Usage : cyclades-serial-client (start|stop|restart|status) [device]"
BACKEXIT=2
echo "BACKEXIT=${BACKEXIT}" >> ${BACKVARS}
exit ${BACKEXIT}
;;
esac
done
if [ -s ${BACKVARS} ]
then
. ${BACKVARS}
fi
clean
if [ ${BACKEXIT} -ne 0 ]
then
exit ${BACKEXIT}
fi
if [ "${DEV}" != "all" -a $FOUND -eq 0 ]
then
echo "cyclades-serial-client : device ${DEV} does not exist"
exit 3
fi
exit 0
cyclades-serial-client-0.93ubuntu1/hpux-dev.c 0000664 0000000 0000000 00000056611 07713631533 016126 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* dev.c
* Unix Pty Device routines
*
* History
* 12/22/1999 V.1.0.0 Initial revision
*
*/
/* Open / stat includes */
# include
# include
# include
/* Errno */
# include
/* ptsname */
# include
/* Termio */
# ifdef USE_TERMIO
# include
# endif
/* Termios */
# include
/* STREAMS ioctl */
# include
# include
# include
/* Tiocsignal */
# include
# define _TSR_DEV_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/dev.h"
#include "inc/port_speed.h"
#ifdef TSR_MEASURE
#include "inc/tsrmeasure.h"
#endif
/*
* Streams message routines
*/
void parse_message (unsigned char type, char *buf, int size);
void parse_msgflush (int queues);
/*
* Termio / Termios routines
*/
void parse_ioctl(int ioctype, void *iocdata);
void parse_break(int *interval);
void parse_iocflush(int *queues);
void parse_termios(int mode, struct termios *tp);
int termios_to_portmodes(struct termios *tp);
void termios_to_portconfig(struct termios *tp, struct portconfig *pcp);
void portconfig_to_termios (struct portconfig *pcp, struct termios *tp);
# ifdef USE_TERMIO
void parse_termio(int mode, struct termio *tp);
int termio_to_portmodes(struct termio *tp);
void termio_to_portconfig(struct termio *tp, struct portconfig *pcp);
# endif
/*
* Debug routines
*/
void print_msg(int type, unsigned char *buf, int size);
char * ioctl_name (int type, void *arg);
/*
* Internal Variables
*/
char P_sname[NAMESIZE];
int Lasttype;
char Ctlbuf[16], Databuf[DEV_MAXIOSZ];
struct strpeek Message;
/*
* STREAMS Pseudo-TTY Device Stuff
*/
# define PTY_DEVICE "/dev/ptmx"
int
dev_getaddr(char *dname)
{
int fd;
int mode;
char * stty;
int found;
struct stat statb;
if(lstat(dname, &statb) >= 0)
{ /* File exists */
if(S_ISLNK(statb.st_mode))
{
sysmessage(MSG_WARNING, "Removing old sym-link \"%s\".\n", dname);
unlink(dname);
}
else if(!S_ISCHR(statb.st_mode))
{
sysmessage (MSG_ERR, "%s already exists\n",
dname);
return (E_PARMINVAL);
}
} else if (errno != ENOENT) { /* generic stat error */
sysmessage (MSG_ERR, "Can't lstat %s : %s\n",
dname, strerror (errno));
return (E_FILEIO);
}
mode = O_RDWR;
# ifdef USE_POSIX_NONBLOCK
mode |= O_NONBLOCK;
# elif defined USE_STD_NDELAY
mode |= O_NDELAY;
# endif
/*
* Warning: most PTY implementation puts master side as controlling terminal if
* O_NOCTTY is not set !!!
*/
mode |= O_NOCTTY;
if ((fd = open (PTY_DEVICE, mode)) < 0) {
sysmessage (MSG_ERR, "Can't open ptmx : %s\n",
strerror (errno));
return (E_FILEIO);
}
# ifdef USE_FIONBIO
mode = 1;
if (ioctl (fd, FIONBIO, &mode) == -1) {
sysmessage (MSG_ERR,
"Can't set non-block on maste: pty : %s\n",
strerror(errno));
close(fd);
return (E_FILEIO);
}
# endif
if (ioctl (fd, I_PUSH, "pckt") == -1) {
sysmessage (MSG_ERR, "Can't push module: %s\n",
strerror (errno));
(void) close(fd);
return (E_FILEIO);
}
found = FALSE;
if ((stty = ptsname(fd)) != (char *) NULL) {
if (unlockpt(fd) >= 0) {
if (link(stty, dname) == 0) {
found = TRUE;
sysmessage(MSG_NOTICE,
"Using %s pseudo-tty \n",
stty);
} else {
sysmessage (MSG_ERR,
"Can't link dev : %s\n",
strerror (errno));
}
} else {
sysmessage (MSG_ERR,
"Can't unlock ptmx : %s\n",
strerror (errno));
}
} else {
sysmessage (MSG_ERR, "Can't get ptmx ptsname\n");
}
if (found == FALSE) {
(void) close(fd);
return (E_FILEIO);
}
P_mfd = fd;
strcpy (P_sname, stty);
strcpy (P_devname, dname);
return (E_NORMAL);
}
void
dev_free(void)
{
(void) close (P_sfd);
P_sfd = -1;
return;
}
int
dev_init(int iosize, int devmodem, int closemode, struct buffer *ibp,
struct buffer *obp, struct comport *cp)
{
int ret;
Pty.portmodes = 0;
if (devmodem == DEV_LOCAL) {
Pty.portmodes = PORT_CLOCAL;
}
if (closemode == CLOSE_HANG) {
Pty.portmodes |= PORT_HUPCL;
}
Pty.portmodes |= PORT_IGNBRK | PORT_IGNPAR;
Pty.iosize = iosize;
Pty.inbuff = ibp;
Pty.outbuff = obp;
Pty.comport = cp;
return (E_NORMAL);
}
int
dev_config (void)
{
int sfd;
struct termios tios;
struct portconfig * pcp = &Pty.comport->portconfig;
int modes = Pty.portmodes;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
int flags = 0;
sysmessage(MSG_NOTICE,"Opening %s pseudo-tty\n", P_sname);
if ((sfd = open (P_sname, O_RDWR|O_NOCTTY)) == -1) {
sysmessage (MSG_ERR, "Can't open slave device : %s\n",
strerror (errno));
return (E_FILEIO);
}
if (ioctl (sfd, I_PUSH, "ptem") == -1) {
sysmessage (MSG_ERR, "Can't ioctl tcgeta: %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
if (ioctl (sfd, I_PUSH, "ldterm") == -1) {
sysmessage (MSG_ERR, "Can't push ldterm : %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
memset ((void *) &tios, 0, sizeof (struct termios));
portconfig_to_termios (pcp, &tios);
tios.c_cflag |= CREAD;
tios.c_lflag |= NOFLSH;
/* PTY modes */
if (modes & PORT_HUPCL) {
tios.c_cflag |= HUPCL;
}
if (modes & PORT_CLOCAL) {
tios.c_cflag |= CLOCAL;
}
if (modes & PORT_IGNBRK) {
tios.c_iflag |= IGNBRK;
}
if (modes & PORT_IGNPAR) {
tios.c_iflag |= IGNPAR;
}
if (tcsetattr (sfd, TCSANOW, &tios) == -1) {
sysmessage (MSG_ERR, "Can't set termios : %s\n",
strerror (errno));
(void) close(sfd);
return (E_FILEIO);
}
P_sfd = sfd;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 16;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
(void) getmsg (P_mfd, ctlmsg, datamsg, &flags);
if (Debug > 2) {
sysmessage (MSG_DEBUG,
" CFG: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctlmsg->len, Ctlbuf[ctlmsg->len > 0 ? ctlmsg->len -1 : 0],
datamsg->len, flags);
}
return (E_NORMAL);
}
int
dev_closeslave(void)
{
if (Pty.state == PTY_OPER && P_sfd != -1) {
sysmessage(MSG_NOTICE,"Closing %s pseudo-tty \n",
P_sname);
(void) close (P_sfd);
P_sfd = -1;
}
return (E_NORMAL);
}
int
dev_probe(void)
{
int ctllen, datalen;
int retc;
int clocal = 0;
int retmsg;
int type;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
struct termio * tio;
struct termios * tios;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 16;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
Message.flags = 0;
if ((retc = ioctl (P_mfd, I_PEEK, (void *) &Message)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
if (ctllen == 4) {
type = GET_VALUE_4(&ctlmsg->buf[0]);
} else {
sysmessage(MSG_ERR,
"PROBE: Undesired control message size: %d\n",
ctllen);
return;
}
if (Debug > 2) {
sysmessage (MSG_DEBUG,
"PROBE: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctllen, type, datalen, Message.flags);
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "CTL: ");
for (i = 0; i < ctllen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) ctlmsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
sprintf(debbuf, "DAT: ");
for (i = 0; i < datalen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) datamsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
}
if (datalen == -1) {
sysmessage (MSG_ERR,
"PROBE: Undesired data message size: %d\n", datalen);
return;
}
switch (type) {
case M_DATA:
if (datalen > 0) {
retmsg = PROBE_DATA; /* M_DATA > 0 */
} else {
retmsg = PROBE_EOF; /* M_DATA == 0 */
}
break;
case M_FLUSH:
retmsg = PROBE_FLUSH; /* M_FLUSH */
break;
case M_IOCTL:
retmsg = PROBE_GENERIC; /* Generic M_IOCTL */
iocp = (struct iocblk *) &datamsg->buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
switch (ioctype) {
# ifdef USE_TERMIO
case TCSETA:
case TCSETAW:
case TCSETAF:
tio = (struct termio *) iocdata;
if (tio->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
# endif
case TCSETS:
case TCSETSW:
case TCSETSF:
tios = (struct termios *) iocdata;
if (tios->c_cflag & CLOCAL) {
retmsg = PROBE_CLOCAL; /* CLOCAL ON */
}
break;
default:
break;
}
}
if (Debug > 1) {
sysmessage (MSG_DEBUG, "PROBE: msg %d\n", retmsg);
}
return (retmsg);
}
int
dev_getdata(void)
{
int ctllen, datalen;
int retc;
int flags = 0;
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
unsigned char type;
ctlmsg->buf = Ctlbuf;
ctlmsg->maxlen = 16;
datamsg->buf = Databuf;
datamsg->maxlen = Pty.iosize;
if ((retc = getmsg (P_mfd, ctlmsg, datamsg, &flags)) == -1) {
sysmessage(MSG_ERR,
"Can't get a message from master pty: %s\n",
strerror(errno));
# ifdef TSR_MEASURE
devnreads++;
# endif
return (retc);
}
ctllen = ctlmsg->len;
datalen = datamsg->len;
if (ctllen == -1) {
type = Lasttype;
} else if (ctllen == 4) {
type = GET_VALUE_4(&ctlmsg->buf[0]);
Lasttype = type;
} else {
sysmessage(MSG_ERR, "Undesired control message size: %d\n",
ctllen);
return (-1);
}
if (datalen == -1) {
sysmessage (MSG_ERR,
" DATA: Undesired data message size: %d\n", datalen);
return (-1);
}
if (Debug > 2) {
sysmessage (MSG_DEBUG,
" DATA: Ctl: %d bytes, Type: %d, Data: %d bytes, flags: %08X\n",
ctllen, type, datalen, flags);
}
if (Debug > 2) {
int i;
char debbuf[128];
char oct[8];
sprintf(debbuf, "CTL: ");
for (i = 0; i < ctllen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) ctlmsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
sprintf(debbuf, "DAT: ");
for (i = 0; i < datalen && i < 8; i++) {
sprintf(oct, "%02X ", (unsigned char) datamsg->buf[i]);
strcat (debbuf, oct);
}
sysmessage (MSG_DEBUG, "%s\n", debbuf);
}
parse_message (type, datamsg->buf, datalen);
return (0);
}
int
dev_putdata(struct buffer *bp)
{
struct pty * pty = &Pty;
int ret;
int size;
int frombuf;
while (bp->b_hold) {
size = min (bp->b_hold, pty->iosize);
if ((ret = write (P_mfd, bp->b_rem, size)) == -1) {
if (errno == EAGAIN) {
ret = 0;
} else {
sysmessage(MSG_ERR,
"Can't write on master pty: %s\n",
strerror(errno));
}
# ifdef TSR_MEASURE
devnwrites++;
# endif
return (ret);
}
# ifdef TSR_MEASURE
devwrites++;
devwbytes += ret;
# endif
FORWARD_BUFFER(bp, ret);
}
if (bp->b_hold == 0) {
RESET_BUFFER(bp);
}
return (0);
}
void
dev_interrupt(void)
{
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
ctlmsg->len = 4;
SET_VALUE_4(&ctlmsg->buf[0], M_SIG);
datamsg->len = 4;
SET_VALUE_4(&datamsg->buf[0], SIGINT);
if (putmsg (P_mfd, ctlmsg, datamsg, RS_HIPRI) == -1) {
sysmessage (MSG_ERR,
"Can't send SIGINT to slave device : %s\n",
strerror (errno));
}
}
void
dev_hangup(void)
{
struct strbuf * ctlmsg = &Message.ctlbuf;
struct strbuf * datamsg = &Message.databuf;
ctlmsg->len = 4;
SET_VALUE_4(&ctlmsg->buf[0], M_SIG);
datamsg->len = 4;
SET_VALUE_4(&datamsg->buf[0], SIGHUP);
if (putmsg (P_mfd, ctlmsg, datamsg, RS_HIPRI) == -1) {
sysmessage (MSG_ERR,
"Can't send SIGHUP to slave device : %s\n",
strerror (errno));
}
}
/*
* Streams message routines
*/
void
parse_message (unsigned char type, char *buf, int size)
{
char * msgt;
int i;
struct iocblk * iocp;
struct buffer * bp = Pty.inbuff;
print_msg(type, (unsigned char *) buf, size);
if (size > 0) {
switch (Pty.state) {
case PTY_CLOSED:
case PTY_OPERRONLY:
SET_EVENT(EV_UP, EV_UPOPEN, 0, 0);
break;
}
} else if (size == -1) {
sysmessage (MSG_WARNING, "PARSE: Message data size == -1 \n");
return;
}
switch (type) {
case M_DATA:
# ifdef TSR_MEASURE
devreads++;
devrbytes += size;
# endif
if (size == 0) {
SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
} else {
COPY_TO_BUFFER(bp, buf, size);
SET_EVENT(EV_UP, EV_UPDATA, 0, 0);
}
break;
case M_IOCTL :
iocp = (struct iocblk *) &buf[0];
parse_ioctl(iocp->ioc_cmd,
(void *) &buf[sizeof (struct iocblk)]);
break;
case M_FLUSH :
parse_msgflush((int) buf[0]);
break;
default:
sysmessage(MSG_DEBUG, "Unsupported stream message: %d\n",
type);
print_msg(type, (unsigned char *)buf, size);
break;
}
}
void
parse_msgflush (int queues)
{
int mode;
switch (queues) {
case FLUSHR:
mode = OPFLUSH_IN;
break;
case FLUSHW:
mode = OPFLUSH_OUT;
break;
case FLUSHRW:
default:
mode = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPFLUSH, (void *) &mode, sizeof (int));
}
/*
* Termio / Termios routines
*/
void
parse_ioctl (int ioctype, void *iocdata)
{
switch (ioctype) {
# ifdef USE_TERMIO
case TCSETA:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAW:
parse_termio(ioctype, (struct termio *) iocdata);
break;
case TCSETAF:
parse_termio(ioctype, (struct termio *) iocdata);
break;
# endif
case TCSBRK:
parse_break((int *) iocdata);
break;
case TCFLSH:
parse_iocflush((int *) iocdata);
break;
case TCSETS:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSW:
parse_termios(ioctype, (struct termios *) iocdata);
break;
case TCSETSF:
parse_termios(ioctype, (struct termios *) iocdata);
break;
default:
sysmessage(MSG_DEBUG, "Unsupported ioctl: %c %d\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF);
}
}
# ifdef USE_TERMIO
void
parse_termio(int mode, struct termio *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETA:
iocp->io_oper = OP_SETNOW;
break;
case TCSETAW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETAF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termio_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termio_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
# endif
void
parse_termios(int mode, struct termios *tp)
{
struct iocontrol * iocp = &Pty.iocontrol;
struct portconfig * pcp = &iocp->io_portconfig;
switch (mode) {
case TCSETS:
iocp->io_oper = OP_SETNOW;
break;
case TCSETSW:
iocp->io_oper = OP_SETWAIT;
break;
case TCSETSF:
iocp->io_oper = OP_SETFLUSH;
break;
}
Pty.portmodes = termios_to_portmodes(tp);
memset ((void *) pcp, 0, sizeof (struct portconfig));
termios_to_portconfig(tp, pcp);
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_break(int *interval)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_SENDBREAK;
iocp->io_arg = *interval;
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
void
parse_iocflush(int *queues)
{
struct iocontrol * iocp = &Pty.iocontrol;
iocp->io_oper = OP_FLUSH;
switch (*queues) {
case TCIFLUSH:
iocp->io_arg = OPFLUSH_IN;
break;
case TCOFLUSH:
iocp->io_arg = OPFLUSH_OUT;
break;
case TCIOFLUSH:
iocp->io_arg = OPFLUSH_IO;
break;
}
SET_EVENT(EV_UP, EV_UPCONTROL, 0, 0);
}
# ifdef USE_TERMIO
int
termio_to_portmodes(struct termio *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termio_to_portconfig(struct termio *tp, struct portconfig *pcp)
{
/* Speed */
pcp->speed = baud_index_to_int(tp->c_cflag & CBAUD);
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
# endif
int
termios_to_portmodes(struct termios *tp)
{
int portmodes;
if (tp->c_iflag & IGNBRK) {
portmodes |= PORT_IGNBRK;
} else {
portmodes &= ~PORT_IGNBRK;
}
if (tp->c_iflag & BRKINT) {
portmodes |= PORT_BRKINT;
} else {
portmodes &= ~PORT_BRKINT;
}
if (tp->c_iflag & IGNPAR) {
portmodes |= PORT_IGNPAR;
} else {
portmodes &= ~PORT_IGNPAR;
}
if (tp->c_iflag & PARMRK) {
portmodes |= PORT_PARMRK;
} else {
portmodes &= ~PORT_PARMRK;
}
if (tp->c_cflag & CLOCAL) {
portmodes |= PORT_CLOCAL;
} else {
portmodes &= ~PORT_CLOCAL;
}
if (tp->c_cflag & HUPCL) {
portmodes |= PORT_HUPCL;
} else {
portmodes &= ~PORT_HUPCL;
}
return (portmodes);
}
void
termios_to_portconfig(struct termios *tp, struct portconfig *pcp)
{
/* Speed */
speed_t speed = cfgetospeed(tp);
pcp->speed = baud_index_to_int(speed);
if(pcp->speed == -1)
{
sysmessage(MSG_DEBUG, "Unsupported speed: %d\n", speed);
pcp->speed = 115200;
}
/* Datasize */
switch (tp->c_cflag & CSIZE) {
case CS5:
pcp->datasize = 5;
break;
case CS6:
pcp->datasize = 6;
break;
case CS7:
pcp->datasize = 7;
break;
case CS8:
default:
pcp->datasize = 8;
break;
}
/* Stopsize */
if (tp->c_cflag & CSTOPB) {
pcp->stopsize = COM_SSIZE_TWO;
} else {
pcp->stopsize = COM_SSIZE_ONE;
}
/* Parity */
if (tp->c_cflag & PARENB) {
if (tp->c_cflag & PARODD) {
pcp->parity = COM_PARITY_ODD;
} else {
pcp->parity = COM_PARITY_EVEN;
}
} else {
pcp->parity = COM_PARITY_NONE;
}
/* Flow Control */
if (tp->c_iflag & IXON) {
pcp->flowc = COM_FLOW_SOFT;
} else { /* Warning, assumes hardware flow control */
pcp->flowc = COM_FLOW_HARD;
}
}
/* Termios must be clean */
void
portconfig_to_termios (struct portconfig *pcp, struct termios *tp)
{
/* Speed */
speed_t speed = int_to_baud_index(pcp->speed);
if(speed == B0 && pcp->speed != 0)
{
sysmessage(MSG_DEBUG, "Unsupported speed: %d\n", pcp->speed);
speed = B115200;
}
cfsetospeed (tp, (speed_t) speed);
cfsetispeed (tp, (speed_t) B0);
/* Datasize */
switch (pcp->datasize) {
case 5:
tp->c_cflag |= CS5;
break;
case 6:
tp->c_cflag |= CS6;
break;
case 7:
tp->c_cflag |= CS7;
break;
case 8:
tp->c_cflag |= CS8;
break;
}
/* Stopsize */
if (pcp->stopsize == COM_SSIZE_TWO) {
tp->c_cflag |= CSTOPB;
} /* else one stop bit */
/* Parity */
switch (pcp->parity) {
case COM_PARITY_EVEN:
tp->c_cflag |= PARENB;
break;
case COM_PARITY_ODD:
tp->c_cflag |= PARENB|PARODD;
break;
case COM_PARITY_NONE:
default:
break;
}
/* Flow Control */
switch (pcp->flowc) {
case COM_FLOW_SOFT:
tp->c_iflag |= IXON;
break;
default:
break;
}
}
/*
* Debug routines
*/
void
print_msg(int type, unsigned char *buf, int size)
{
char *msgt;
struct iocblk * iocp;
int ioctype;
unsigned char * iocdata;
char dbuf[64];
if (Debug > 2) {
switch (type) {
case M_IOCTL:
iocp = (struct iocblk *) &buf[0];
ioctype = iocp->ioc_cmd;
iocdata = (unsigned char *) iocp + sizeof (struct iocblk);
sprintf(dbuf, "M_IOCTL (Ioctl %c %d), %d bytes: %s\n",
(ioctype & IOCTYPE) >> 8, ioctype & 0xFF,
iocp->ioc_count, ioctl_name(ioctype, iocdata));
break;
case M_DATA:
msgt = "M_DATA (Regular data): ";
sprintf(dbuf, "%s, %d bytes\n", msgt, size);
break;
case M_FLUSH:
msgt = "M_FLUSH (flush your queues)";
sprintf(dbuf, "%s: queue %d", msgt, buf[0]);
break;
case M_PROTO :
msgt = "M_PROTO (protocol control)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_BREAK :
msgt = "M_BREAK (line break)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PASSFP:
msgt = "M_PASSFP (pass file pointer)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SIG :
msgt = "M_SIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_DELAY :
msgt = "M_DELAY (real-time xmit delay (1 param))";
sprintf(dbuf, "%s\n", msgt);
break;
case M_CTL :
msgt = "M_CTL (device-specific control message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_SETOPTS:
msgt = "M_SETOPT S(set various stream head options)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_RSE :
msgt = "M_RSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCACK:
msgt = "M_IOCACK (acknowledge ioctl)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCNAK:
msgt = "M_IOCNAK (negative ioctl acknowledge)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCPROTO:
msgt = "M_PCPROTO (priority proto message)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCSIG :
msgt = "M_PCSIG (generate process signal)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_READ :
msgt = "M_READ (generate read notification)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOP :
msgt = "M_STOP (stop transmission immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_START :
msgt = "M_START (restart transmission after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_HANGUP:
msgt = "M_HANGUP (line disconnect)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_ERROR :
msgt = "M_ERROR (fatal error used to set u.u_error)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYIN:
msgt = "M_COPYIN (request to copyin data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_COPYOUT:
msgt = "M_COPYOUT (request to copyout data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_IOCDATA:
msgt = "M_IOCDATA (response to M_COPYIN and M_COPYOUT)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_PCRSE :
msgt = "M_PCRSE (reserved for RSE use only)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STOPI :
msgt = "M_STOPI (stop reception immediately)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_STARTI:
msgt = "M_STARTI (restart reception after stop)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_HPDATA:
msgt = "M_HPDATA (PSE-private: high priority data)";
sprintf(dbuf, "%s\n", msgt);
break;
case M_NOTIFY:
msgt = "M_NOTIFY (Reports result of read at stream head)";
sprintf(dbuf, "%s\n", msgt);
break;
}
sysmessage (MSG_DEBUG, "%s", dbuf);
}
}
char ioctlbuf[32];
char *
ioctl_name (int type, void *arg)
{
char * msgt;
if (Debug > 2) {
switch (type) {
# ifdef USE_TERMIO
case TCGETA:
msgt = "TCGETA";
break;
case TCSETA:
msgt = "TCSETA";
break;
case TCSETAW:
msgt = "TCSETAW";
break;
case TCSETAF:
msgt = "TCSETAF";
break;
# endif
case TCSBRK:
msgt = "TCSBRK";
break;
case TCXONC:
msgt = "TCXONC";
break;
case TCFLSH:
msgt = "TCFLSH";
break;
case TCGETS:
msgt = "TCGETS";
break;
case TCSETS:
msgt = "TCSETS";
break;
case TCSETSW:
msgt = "TCSETSW";
break;
case TCSETSF:
msgt = "TCSETSF";
break;
default:
msgt = "UNKNOWN";
break;
}
sprintf(ioctlbuf, "%s", msgt);
return (ioctlbuf);
} else {
return ((char *) 0);
}
}
cyclades-serial-client-0.93ubuntu1/telnet.c 0000664 0000000 0000000 00000043174 07710220715 015652 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* telnet.c
* Telnet Network Virtual Terminal routines
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* History
* 22/12/1999 V.1.0.1 Some debug enhancements
*
*/
#include
#include
#include
#define _TSR_TELNET_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/telnet.h"
#include "inc/sock.h"
/*
* Telnet Protocol Internal Routines
*/
void do_option (int option);
void dont_option (int option);
void will_option (int option);
void wont_option (int option);
void send_option (int type, int option);
void handle_suboption (unsigned char *suboptp, int subsize);
/*
* RFC 2217 Com Port Routines
*/
void comport_config (void);
void comport_default (void);
int sync_comport_command (int command, int arg);
int comport_command (int command, int arg);
void handle_com_port_command (unsigned char *buf);
/*
* Debug Routines
*/
void print_all (void);
void print_option (unsigned char c);
void print_control (unsigned char c);
void print_linestate (int state);
void print_modemstate (int state);
void print_speed(int speed);
void print_datasize (int datasize);
void print_stopsize (int stopsize);
void print_parity (int parity);
void print_setcontrol (int control);
void print_purge (int purge);
void print_command(int cmdidx);
/*
* Internal Variables
*/
struct comport Comport;
# define SUBOPT_MAXSIZE 64
unsigned char Suboptbuf[SUBOPT_MAXSIZE];
int Suboptsize;
unsigned char Comibuf[SOCK_MAXIOSZ];
unsigned char Comobuf[SOCK_MAXIOSZ];
/*
* Telnet Protocol Access Routines
*/
int
tel_init(int netsize, struct buffer *ibp, struct buffer *obp)
{
int retries = 0;
Nvt.iosize = netsize;
Nvt.inbuff = ibp;
Nvt.outbuff = obp;
Nvt.comport = &Comport;
comport_default(); /* Initialize with default values */
if(Nvt.servertype == SRV_SOCKET)
return(E_NORMAL);
sysdelay (SERVER_DELAY); /* Wait telnet startup */
SET_I_WANT_TO_SUPPORT(NVT_COM_PORT_OPTION);
SEND_WILL(NVT_COM_PORT_OPTION);
SET_I_SENT_IT(NVT_COM_PORT_OPTION);
SET_HE_MAY_SUPPORT(NVT_SUPP_GO_AHEAD);
SEND_DO(NVT_SUPP_GO_AHEAD);
SET_HE_RECV_IT(NVT_SUPP_GO_AHEAD);
tel_getdata();
do {
sysdelay (OPTION_DELAY);
tel_getdata();
} while (!I_DO_SUPPORT(NVT_COM_PORT_OPTION) && retries++ < 2);
if (I_DO_SUPPORT(NVT_COM_PORT_OPTION)) {
comport_config();
}
return(E_NORMAL);
}
/*
* Telnet Protocol state
*/
int S_state = S_DATA;
int
tel_getdata (void)
{
int i;
int ret;
struct buffer * bp = Nvt.inbuff;
unsigned char c;
if((ret = sock_read(Comibuf, Nvt.iosize)) <= 0)
return -1;
if (Debug > 2) {
sysmessage (MSG_DEBUG,
"Sock_read, %d bytes: %02X %02X %02X %02X %02X %02X %02X %02X\n",
ret, Comibuf[0], Comibuf[1], Comibuf[2], Comibuf[3],
Comibuf[4], Comibuf[5], Comibuf[6], Comibuf[7]);
}
if (Nvt.servertype == SRV_SOCKET) {
COPY_TO_BUFFER(bp, Comibuf, ret);
SET_EVENT(EV_RN, EV_RNDATA, 0, 0);
return (0);
}
for (i = 0; i < ret; i++) {
c = Comibuf[i];
switch (S_state) {
case S_DATA:
if (c == IAC) {
S_state = S_IAC;
print_control(c);
} else {
PUT_BUFFER(bp, c);
/* Event EV_RNDATA will be set at end */
}
break;
case S_IAC:
switch (c) {
case DO:
S_state = S_DO;
print_control(c);
break;
case DONT:
S_state = S_DONT;
print_control(c);
break;
case WILL:
S_state = S_WILL;
print_control(c);
break;
case WONT:
S_state = S_WONT;
print_control(c);
break;
case SB:
S_state = S_SB;
print_control(c);
Suboptsize = 0;
break;
case IAC:
default:
S_state = S_DATA;
PUT_BUFFER(bp, c);
break;
}
break;
case S_DO:
print_option(c);
S_state = S_DATA;
do_option(c);
break;
case S_DONT:
print_option(c);
S_state = S_DATA;
dont_option(c);
break;
case S_WILL:
print_option(c);
S_state = S_DATA;
will_option(c);
break;
case S_WONT:
print_option(c);
S_state = S_DATA;
wont_option (c);
break;
case S_SB:
if (c == IAC) {
S_state = S_SE;
print_control(c);
} else {
if (Suboptsize > SUBOPT_MAXSIZE) {
sysmessage (MSG_WARNING,
"Suboption too large\n");
} else {
Suboptbuf[Suboptsize++] = c;
}
}
break;
case S_SE:
if (c == SE) {
S_state = S_DATA;
print_control(c);
handle_suboption(Suboptbuf, Suboptsize);
Suboptsize = 0;
} else {
S_state = S_DATA;
sysmessage (MSG_WARNING,
"Suboption not terminated: %d", c);
}
break;
}
}
if (bp->b_hold) {
SET_EVENT(EV_RN, EV_RNDATA, 0, 0);
}
print_all();
return (0);
}
int
tel_putdata(struct buffer *bp)
{
unsigned char c;
int ret;
int size;
int frombuf;
while(bp->b_hold)
{
if(Nvt.servertype == SRV_SOCKET)
{
size = min (bp->b_hold, Nvt.iosize);
COPY_FROM_BUFFER(bp, Comobuf, size);
if ((ret = sock_write (Comobuf, size)) != size) {
if (ret < 0) {
return (ret);
} else {
frombuf = size - ret;
REWIND_BUFFER(bp, frombuf);
}
break;
}
} else { /* OH OH -> Handling IAC */
frombuf = min (bp->b_hold, Nvt.iosize);
size = 0;
while (frombuf--) {
c = GET_BUFFER(bp);
if (c == IAC) {
if (size == Nvt.iosize - 1) {
/* avoid break IAC mapping */
REWIND_BUFFER(bp, 1);
frombuf++;
break;
}
Comobuf[size++] = IAC;
}
Comobuf[size++] = c;
if (size == Nvt.iosize) {
break;
}
}
/* the following used to be #if 1 in the linux tree and not included for HPUX */
#ifdef __linux__
frombuf = 0;
while (size > 0) {
if ((ret = sock_write (&Comobuf[frombuf], size)) == size) {
break;
}
if (Debug > 2) {
sysmessage (MSG_DEBUG, "Sock write: %d of %d\n", ret, size);
}
if (ret < 0) {
return (ret);
}
frombuf += ret;
size -= ret;
}
#else
if ((ret = sock_write (Comobuf, size)) != size) {
if (Debug > 2) {
sysmessage (MSG_DEBUG, "Sock write: %d\n", ret);
}
if (ret < 0) {
return (ret);
} else {
frombuf = 0;
while (size-- > ret) {
if ((c = Comobuf[size-1])
== IAC) {
continue;
}
frombuf++;
}
}
if (Debug > 2) {
sysmessage (MSG_DEBUG, "Buffer rewind %d\n",
frombuf);
}
REWIND_BUFFER(bp, frombuf);
break;
}
#endif
}
}
if (bp->b_hold == 0) {
RESET_BUFFER(bp);
}
return (0);
}
int
tel_putcmd (int command, int arg)
{
return (comport_command(command, arg));
}
void
tel_free(void)
{
int opt;
/* Set Telnet protocol in a initial state */
S_state = S_DATA;
Suboptsize = 0;
for (opt = 0; opt < NVT_NUMOPTS; opt++) {
CLR_I_WANT_TO_SUPPORT(opt);
}
(void) sock_unlink();
}
/*
* Telnet Protocol Internal Routines
*/
void
do_option (int opt)
{
if (I_WANT_TO_SUPPORT(opt)) {
SET_I_DO_SUPPORT(opt);
if (!I_SENT_IT(opt)) {
SEND_WILL(opt);
SET_I_SENT_IT(opt);
}
} else {
SEND_WONT(opt);
}
}
void
dont_option (int opt)
{
CLR_I_DO_SUPPORT(opt);
}
void
will_option (int opt)
{
if (HE_MAY_SUPPORT(opt)) {
SET_HE_DOES_SUPPORT(opt);
if (!HE_RECV_IT(opt)) {
SEND_DO(opt);
SET_HE_RECV_IT(opt);
}
} else {
SEND_DONT(opt);
}
}
void
wont_option (int opt)
{
CLR_HE_DOES_SUPPORT(opt);
}
void
send_option (int type, int opt)
{
int ret;
int size;
unsigned char *obp;
obp = &Comobuf[0];
*obp++ = IAC;
*obp++ = type;
*obp++ = opt;
size = 3;
obp = &Comobuf[0];
if (Debug > 2) {
sysmessage (MSG_DEBUG, "Sock_write, 3 bytes: %02X %02X %02X\n",
Comobuf[0], Comobuf[1], Comobuf[2]);
}
while (size) {
if ((ret = sock_write (obp, size)) == -1) {
SET_EVENT(EV_RN, EV_RNHANG, 0, 0);
break;
} else if (ret != size) {
sysmessage (MSG_NOTICE,
"Partial write in send_option: %d/%d\n",
ret, size);
sysdelay(ROOM_DELAY); /* Wait for room */
}
size -= ret;
obp += ret;
}
}
void
handle_suboption (unsigned char *suboptp, int subsize)
{
unsigned char subopt = *suboptp;
print_option(subopt);
switch (subopt) {
case NVT_COM_PORT_OPTION:
handle_com_port_command(++suboptp);
subsize--;
break;
default:
sysmessage (MSG_WARNING,"suboption not supported: %d\n",
subopt);
break;
}
}
/*
* RFC 2217 Com Port Routines
*/
void
comport_config(void)
{
int mask;
Comport.support = TRUE;
/* Get configuration values */
sync_comport_command(USR_COM_SET_BAUDRATE, COM_BAUD_REQ);
sync_comport_command(USR_COM_SET_DATASIZE, COM_DSIZE_REQ);
sync_comport_command(USR_COM_SET_PARITY, COM_PARITY_REQ);
sync_comport_command(USR_COM_SET_STOPSIZE, COM_SSIZE_REQ);
sync_comport_command(USR_COM_SET_CONTROL, COM_FLOW_REQ);
/* Set port events mask */
mask = MODEM_DCD;
sync_comport_command(USR_COM_SET_MODEMSTATE_MASK, mask);
mask = LINE_BREAK_ERROR | LINE_PARITY_ERROR;
sync_comport_command(USR_COM_SET_LINESTATE_MASK, mask);
sysdelay(NOTIFY_DELAY); /* Wait for notifications */
tel_getdata();
}
void
comport_default(void)
{
Comport.support = FALSE;
/*96008N1, No flow , aLL signals ON, noerrors */
Comport.portconfig.speed = 9600;
Comport.portconfig.datasize = 8;
Comport.portconfig.stopsize = COM_SSIZE_ONE;
Comport.portconfig.parity = COM_PARITY_NONE;
Comport.portconfig.flowc = COM_FLOW_NONE;
Comport.portstate.modemstate = MODEM_DCD|MODEM_DSR|MODEM_CTS;
Comport.portstate.linestate = 0;
}
int
sync_comport_command (int command, int arg)
{
if(comport_command (command, arg) == -1)
return -1;
SET_CMD_ACTIVE(command);
do {
sysdelay(COMPORT_DELAY);
tel_getdata();
} while (IS_CMD_ACTIVE(command));
return 0;
}
int
comport_command (int command, int arg)
{
int size;
int ret;
unsigned char *obp;
if (Nvt.comport->support == FALSE) {
CLR_CMD_ACTIVE(command); /* Synchronous operation */
SET_EVENT (EV_RN, EV_RNCMDOK, 0, 0);
return (0);
}
obp = &Comobuf[0];
*obp++ = IAC;
*obp++ = SB;
*obp++ = NVT_COM_PORT_OPTION;
*obp++ = (unsigned char) command;
switch (command) {
case USR_COM_SET_BAUDRATE:
SET_VALUE_4(obp, arg);
obp += 4;
break;
default:
SET_VALUE_1(obp, arg);
obp += 1;
break;
}
*obp++ = IAC;
*obp++ = SE;
size = (int) (obp - &Comobuf[0]);
obp = &Comobuf[0];
if (Debug > 2) {
sysmessage (MSG_DEBUG,
"Sock_write, %d bytes: %02X %02X %02X %02X %02X %02X %02X %02X\n",
size, Comobuf[0], Comobuf[1], Comobuf[2], Comobuf[3],
Comobuf[4], Comobuf[5], Comobuf[6], Comobuf[7]);
}
while (size) {
if ((ret = sock_write (obp, size)) == -1) {
SET_EVENT(EV_RN, EV_RNHANG, 0, 0);
return (-1);
} else if (ret != size) {
sysmessage (MSG_NOTICE,
"Partial write in send_comport: %d/%d\n",
ret, size);
sysdelay(ROOM_DELAY); /* Wait for room */
}
size -= ret;
obp += ret;
}
return (0);
}
void
handle_com_port_command (unsigned char *buf)
{
unsigned char cmd = *buf++;
int cmdarg;
int cmdidx;
int is_notify = 0;
int notify;
cmdidx = (int) cmd;
if (cmd >= RAS_COM_START && cmd <= RAS_COM_END) {
cmdidx -= RAS_COM_START;
}
print_command (cmdidx);
switch (cmd) {
case RAS_COM_SIGNATURE:
case RAS_COM_FLOWCONTROL_SUSPEND:
case RAS_COM_FLOWCONTROL_RESUME:
break;
case RAS_COM_SET_BAUDRATE:
Comport.portconfig.speed = GET_VALUE_4 (buf);
print_speed (Comport.portconfig.speed);
break;
case RAS_COM_SET_DATASIZE:
Comport.portconfig.datasize = GET_VALUE_1 (buf);
print_datasize (Comport.portconfig.datasize);
break;
case RAS_COM_SET_PARITY:
Comport.portconfig.parity = GET_VALUE_1 (buf);
print_parity(Comport.portconfig.parity);
break;
case RAS_COM_SET_STOPSIZE:
Comport.portconfig.stopsize = GET_VALUE_1 (buf);
print_stopsize(Comport.portconfig.stopsize);
break;
case RAS_COM_SET_CONTROL:
cmdarg = GET_VALUE_1 (buf);
print_setcontrol(cmdarg);
switch (cmdarg) {
case COM_OFLOW_NONE:
case COM_OFLOW_SOFT:
case COM_OFLOW_HARD:
Comport.portconfig.flowc = cmdarg;
break;
default:
break;
}
break;
case RAS_COM_NOTIFY_LINESTATE:
is_notify = 1;
cmdarg = GET_VALUE_1 (buf);
print_linestate(cmdarg);
Comport.portstate.linestate = cmdarg;
if (cmdarg & LINE_BREAK_ERROR) {
notify = NT_BREAK;
SET_EVENT(EV_RN, EV_RNNTFY, ¬ify, sizeof (int));
}
if (cmdarg & LINE_PARITY_ERROR) {
notify = NT_PARITY;
SET_EVENT(EV_RN, EV_RNNTFY, ¬ify, sizeof (int));
}
break;
case RAS_COM_SET_LINESTATE_MASK:
cmdarg = GET_VALUE_1 (buf);
print_linestate(cmdarg);
break;
case RAS_COM_NOTIFY_MODEMSTATE:
is_notify = 1;
cmdarg = GET_VALUE_1 (buf);
if ((cmdarg ^ Comport.portstate.modemstate) & MODEM_DCD) {
if (Comport.portstate.modemstate & MODEM_DCD) {
notify = NT_DCDOFF;
SET_EVENT(EV_RN, EV_RNNTFY, ¬ify,
sizeof (int));
} else {
notify = NT_DCDON;
SET_EVENT(EV_RN, EV_RNNTFY, ¬ify,
sizeof (int));
}
}
Comport.portstate.modemstate = cmdarg;
print_modemstate(cmdarg);
break;
case RAS_COM_SET_MODEMSTATE_MASK:
cmdarg = GET_VALUE_1 (buf);
print_modemstate (cmdarg);
break;
case RAS_COM_PURGE_DATA:
cmdarg = GET_VALUE_1 (buf);
print_purge(cmdarg);
break;
default:
sysmessage (MSG_NOTICE, "Unnimplemented command: %d\n", cmd);
break;
}
if (!is_notify) {
if (IS_CMD_ACTIVE(cmdidx)) {
CLR_CMD_ACTIVE(cmdidx); /* Synchronous operation */
} else {
SET_EVENT(EV_RN, EV_RNCMDOK, 0, 0);
}
}
print_all();
}
/*
* Debug Routines
*/
char Debugbuf[512];
void
print_all (void)
{
if (Debugbuf[0] != 0) {
sysmessage (MSG_DEBUG, "%s\n", Debugbuf);
}
Debugbuf[0] = 0;
}
/*
* Telnet Protocol Debug
*/
void
print_control(unsigned char c)
{
if (Debug > 2) {
char msgbuf[32];
switch (c) {
case DO:
sprintf(msgbuf, "DO ");
break;
case DONT:
sprintf(msgbuf, "DONT ");
break;
case WILL:
sprintf(msgbuf, "WILL ");
break;
case WONT:
sprintf(msgbuf, "WONT ");
break;
case IAC:
sprintf(msgbuf, "IAC ");
break;
case SE:
sprintf(msgbuf, "SE ");
break;
case SB:
sprintf(msgbuf, "SB ");
break;
default:
sprintf(msgbuf, "Ctl %02X ", c);
break;
}
strcat(Debugbuf, msgbuf);
}
}
void
print_option (unsigned char c)
{
if (Debug > 2) {
char msgbuf[32];
switch (c) {
case NVT_BINARY:
sprintf(msgbuf, "BINARY ");
break;
case NVT_ECHO:
sprintf(msgbuf, "ECHO ");
break;
case NVT_SUPP_GO_AHEAD:
sprintf(msgbuf, "SUPPRESS GO AHEAD ");
break;
case NVT_COM_PORT_OPTION:
sprintf(msgbuf, "COMM PORT OPTION ");
break;
default:
sprintf(msgbuf, "Cmd %3d ", c);
break;
}
strcat(Debugbuf, msgbuf);
}
}
/*
* Com Port Option Debug
*/
const char * const Command_names[] = {
"COM_SIGNATURE",
"COM_SET_BAUDRATE",
"COM_SET_DATASIZE",
"COM_SET_PARITY",
"COM_SET_STOPSIZE",
"COM_SET_CONTROL",
"COM_NOTIFY_LINESTATE",
"COM_NOTIFY_MODEMSTATE",
"COM_FLOWCONTROL_SUSPEND",
"COM_FLOWCONTROL_RESUME",
"COM_SET_LINESTATE_MASK",
"COM_SET_MODEMSTATE_MASK",
"COM_PURGE_DATA"
};
const char * const Parity_names[] = {
"PARITY_REQ",
"PARITY_NONE",
"PARITY_ODD",
"PARITY_EVEN",
"PARITY_MARK",
"PARITY_SPACE",
};
const char * const Stop_names[] = {
"SSIZE_REQ",
"SSIZE_ONE",
"SSIZE_TWO",
"SSIZE_1DOT5",
};
const char * const Control_names[] = {
"OFLOW_REQ",
"OFLOW_NONE",
"OFLOW_SOFT",
"OFLOW_HARD",
"BREAK_REQ",
"BREAK_ON",
"BREAK_OFF",
"DTR_REQ",
"DTR_ON",
"DTR_OFF",
"RTS_REQ",
"RTS_ON",
"RTS_OFF",
"IFLOW_REQ",
"IFLOW_NONE",
"IFLOW_SOFT",
"IFLOW_HARD",
"DCD_FLOW",
"DTR_FLOW",
"DSR_FLOW",
};
const char * const Purge_names[] = {
"What??",
"COM_PURGE_RECV",
"COM_PURGE_XMIT",
"COM_PURGE_BOTH",
};
void
print_linestate (int state)
{
if (Debug > 2) {
char linestates [256];
linestates[0] = 0;
if (state & LINE_TIMEOUT_ERROR) {
strcat (linestates, "LINE_TIMEOUT_ERROR ");
}
if (state & LINE_SHIFTREG_EMPTY ) {
strcat (linestates, "LINE_SHIFTREG_EMPTY ");
}
if (state & LINE_HOLDREG_EMPTY ) {
strcat (linestates, "LINE_HOLDREG_EMPTY ");
}
if (state & LINE_BREAK_ERROR ) {
strcat (linestates, "LINE_BREAK_ERROR ");
}
if (state & LINE_FRAME_ERROR ) {
strcat (linestates, "LINE_FRAME_ERROR ");
}
if (state & LINE_PARITY_ERROR ) {
strcat (linestates, "LINE_PARITY_ERROR ");
}
if (state & LINE_OVERRUN_ERROR ) {
strcat (linestates, "LINE_OVERRUN_ERROR ");
}
if (state & LINE_DATA_READY ) {
strcat (linestates, "LINE_DATA_READY ");
}
strcat (Debugbuf, linestates);
}
}
void
print_modemstate (int state)
{
if (Debug > 2) {
char modemstates [256];
modemstates[0] = 0;
if (state & MODEM_DCD) {
strcat (modemstates, "MODEM_DCD ");
}
if (state & MODEM_RI) {
strcat (modemstates, "MODEM_RI ");
}
if (state & MODEM_DSR) {
strcat (modemstates, "MODEM_DSR ");
}
if (state & MODEM_CTS) {
strcat (modemstates, "MODEM_CTS ");
}
if (state & MODEM_DELTA_DCD) {
strcat (modemstates, "MODEM_DELTA_DCD ");
}
if (state & MODEM_TRAIL_RI) {
strcat (modemstates, "MODEM_TRAIL_RI ");
}
if (state & MODEM_DELTA_DSR) {
strcat (modemstates, "MODEM_DELTA_DSR ");
}
if (state & MODEM_DELTA_CTS) {
strcat (modemstates, "MODEM_DELTA_CTS ");
}
strcat (Debugbuf, modemstates);
}
}
void
print_speed(int speed)
{
if (Debug > 2) {
char buf [32];
sprintf (buf, "Speed: %d bps ", speed);
strcat (Debugbuf, buf);
}
}
void
print_datasize (int datasize)
{
if (Debug > 2) {
char buf [32];
sprintf (buf, "Datasize: %d bits ", datasize);
strcat (Debugbuf, buf);
}
}
void
print_stopsize (int stopsize)
{
if (Debug > 2) {
char buf [32];
sprintf (buf, "%s ", Stop_names[stopsize]);
strcat (Debugbuf, buf);
}
}
void
print_parity (int parity)
{
if (Debug > 2) {
char buf [32];
sprintf (buf, "%s ", Parity_names[parity]);
strcat (Debugbuf, buf);
}
}
void
print_setcontrol (int control)
{
if (Debug > 2) {
char buf [32];
sprintf (buf, "%s ", Control_names[control]);
strcat (Debugbuf, buf);
}
}
void
print_purge (int purge)
{
if (Debug > 2) {
char buf [32];
sprintf (buf, "%s ", Purge_names[purge]);
strcat (Debugbuf, buf);
}
}
void
print_command(int cmdidx)
{
if (Debug > 2) {
char buf [32];
sprintf (buf, "%s: ", Command_names[cmdidx]);
strcat (Debugbuf, buf);
}
}
cyclades-serial-client-0.93ubuntu1/cyclades-ser-cli.c 0000664 0000000 0000000 00000012771 07713630562 017511 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* tsrsock.c
* cyclades-ser-cli main code
*
* History
* 08/17/1999 V.1.0.0 Initial revision
*
* 17/12/1999 V.1.0.1 Version was changed to 1.0.1
*
* Oct-27-2001 V.1.0.2
* Program version has changed to 1.2.0
* Retry message now is of Warning type
*/
#include
#include
#include
#include
#include
#include
#include
# define _TSR_TSRSOCK_
#include "inc/cyclades-ser-cli.h"
#include "inc/system.h"
#include "inc/tsrio.h"
#include "inc/sock.h"
#include "inc/dev.h"
#include "inc/misc.h"
#include "inc/telnet.h"
#include
#include
#include
int P_contr[MAX_CONTROL_SOCKS], P_contr_listen;
/*
* Internal Variables
*/
static const char *const Version="cyclades-ser-cli " TSRDEV_VERSION " " TSRDEV_DATE;
/*
* Internal Functions
*/
#ifndef HAVE_DAEMON
#include "inc/daemon.h"
#endif
static void helpmsg (void);
static void mkidmsg(char *pgname, char *device);
int main (int argc, char **argv)
{
int i;
char * device;
char * rasname;
int physport;
int ptyiosize;
int netiosize;
int retrydelay;
int retry, nretries;
int opt;
int retst;
int devmodem;
int closemode;
int baseport;
struct sockaddr_un control_addr;
struct sigaction act;
struct stat stat_buf;
act.sa_handler = SIG_IGN;
if(sigaction(SIGPIPE, &act, NULL))
sysmessage(MSG_ERR, "Can't block SIGPIPE.\n");
ptyiosize = DEV_DEFIOSZ;
netiosize = SOCK_DEFIOSZ;
retrydelay = RETRY_DELAY ;
nretries = NUM_RETRIES;
Nvt.servertype = SRV_RTELNET;
devmodem = DEV_MODEM;
closemode = CLOSE_HANG;
baseport = 0;
Console = FALSE;
Foreground = FALSE;
Pgname = argv[0];
Debug = 0;
while ((opt = getopt(argc,argv, "u:n:r:fi:st:m:c:p:d:xvhH")) != EOF) {
switch (opt) {
case 'u' :
ptyiosize = atoi(optarg);
if (ptyiosize > DEV_MAXIOSZ) {
ptyiosize = DEV_MAXIOSZ;
}
break;
case 'n' :
netiosize = atoi(optarg);
if (netiosize > SOCK_MAXIOSZ) {
netiosize = SOCK_MAXIOSZ;
}
break;
case 'r' :
nretries = atoi(optarg);
break;
case 'f' :
Foreground = TRUE;
break;
case 'i' :
retrydelay = atoi(optarg) * 1000;
break;
case 's' :
Nvt.servertype = SRV_SOCKET;
if(!baseport)
baseport = SOCKET_BASE;
break;
case 'm' :
devmodem = atoi (optarg);
break;
case 'c' :
closemode = atoi (optarg);
break;
case 'p' :
baseport = atoi (optarg);
break;
case 'd' :
Debug = atoi (optarg);
break;
case 'x' :
Console = TRUE;
Foreground = TRUE;
break;
case 'v' :
printf("%s\n", Version);
exit (E_NORMAL);
case 'h':
case 'H':
default :
helpmsg();
exit(E_PARMINVAL);
}
}
if(!baseport)
baseport = RTELNET_BASE;
argc -= optind;
argv += optind;
if (argc != 3 ) {
helpmsg();
exit (E_PARMINVAL);
}
device = argv[0];
mkidmsg(Pgname, device);
if(strncmp(device, "/dev/", 5) != 0)
fprintf(stderr, "%s: Warning, device does not have a \"/dev\" prefix\n", Idmsg);
rasname = argv[1];
physport = atoi (argv[2]);
if (physport == 0) {
if (Nvt.servertype == SRV_RTELNET) {
baseport = RTELNET_STD;
} else {
fprintf(stderr,
"%s: Physical port must be > 0 for socket service\n", Idmsg);
exit (E_PARMINVAL);
}
}
init_system();
/* Get socket and device addresses */
if ((retst = dev_getaddr(device)) != E_NORMAL) {
exit (retst);
}
if(Nvt.servertype == SRV_RTELNET)
{
P_contr_listen = socket(PF_UNIX, SOCK_STREAM, 0);
if(P_contr_listen == -1)
{
sysmessage(MSG_ERR, "Can't create Unix socket.\n");
exit(1);
}
control_addr.sun_family = AF_UNIX;
snprintf(P_contrname, sizeof(P_contrname), "%s.control", device);
P_contrname[sizeof(P_contrname) - 1] = '\0';
if(!stat(P_contrname, &stat_buf))
{
sysmessage(MSG_WARNING, "Removing old control socket \"%s\".\n", P_contrname);
unlink(P_contrname);
}
strcpy(control_addr.sun_path, P_contrname);
if(bind(P_contr_listen, (struct sockaddr *)&control_addr
, sizeof(control_addr)) || listen(P_contr_listen, 8))
{
sysmessage(MSG_ERR, "Can't bind Unix socket.\n");
exit(1);
}
for(i = 0; i < MAX_CONTROL_SOCKS; i++)
P_contr[i] = -1;
}
if ((retst = sock_getaddr(rasname, baseport, physport)) != E_NORMAL)
exit (retst);
retry = 0;
if(!Foreground)
daemon(0, 0);
while (retry < nretries) {
if (retry) {
if (retrydelay) {
sysdelay(retrydelay);
}
sysmessage(MSG_WARNING, "Trying again ... \n");
}
if ((retst = sock_link(netiosize)) != E_NORMAL) {
if (retst != E_CONNECT) {
doexit(retst);
}
retry++;
continue;
}
retry = 0;
tsr_init(netiosize, ptyiosize, devmodem, closemode);
/* Main scheduler */
tsr_io();
retry++;
}
sysmessage (MSG_ERR, "Exiting ...\n");
doexit (E_RETRYEND);
/* Not Reached */
return 0; /* gcc gives a warning otherwise */
}
static void
helpmsg (void)
{
fprintf(stderr, "Usage: cyclades-ser-cli [options] devname rasname physport\n");
fprintf(stderr, "\toptions:\n");
fprintf(stderr, "\t\t[-h] [-v] [-x]\n");
fprintf(stderr, "\t\t[-u ptyiosize] [-n netiosize] [-i retrydelay]\n");
fprintf(stderr, "\t\t[-r numretries] [-t devtype] [-s servertype]\n");
fprintf(stderr, "\t\t[-m devmodem] [-c closemode] [-p startport]\n");
fprintf(stderr, "\t\t[-d deblevel]\n");
}
static void
mkidmsg(char *pgname, char *device)
{
char *cp;
if ((cp = strrchr (pgname, '/')) != (char *) NULL) {
cp++;
} else {
cp = pgname;
}
Pgname = cp;
sprintf(Idmsg, "%7s %s", cp, device);
}
cyclades-serial-client-0.93ubuntu1/sco-dev.c 0000664 0000000 0000000 00000026137 07713631541 015725 0 ustar /*
*
* Copyright (C) Cyclades Corporation, 1999-1999. All rights reserved.
*
*
* dev.c
* Unix Pty Device routines
*
* History
* 01/31/2000 V.1.0.0 Initial revision
*
*/
/* Open / stat includes */
# include
# include
# include
/* Errno */
# include
# include
# include
/* Termio */
# ifdef INCLUDE_TERMIO
# include
# endif
/* Termios */
# include
/* Pseudo tty */
# include