libax25-0.0.12-rc2+cvs20120204/0000755000175000017500000000000011713361515013263 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/ltconfig0000755000175000017500000026776507264463732015057 0ustar patpat#! /bin/sh # ltconfig - Create a system-specific libtool. # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # 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 2 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # 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. # A lot of this script is taken from autoconf-2.10. # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} echo=echo if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell. exec "$SHELL" "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`} case X$UNAME in *-DOS) PATH_SEPARATOR=';' ;; *) PATH_SEPARATOR=':' ;; esac fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi if test "X${echo_test_string+set}" != "Xset"; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string="`eval $cmd`") 2>/dev/null && echo_test_string="`eval $cmd`" && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then break fi done fi if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH /usr/ucb; do if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$dir/echo" break fi done IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running ltconfig again with it. ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf "%s\n"' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # Cool, printf works : elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # The name of this program. progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool VERSION=1.3.3 TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)" ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: default_ofile=libtool can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). enable_static=yes enable_fast_install=yes enable_dlopen=unknown enable_win32_dll=no ltmain= silent= srcdir= ac_config_guess= ac_config_sub= host= nonopt= ofile="$default_ofile" verify_host=yes with_gcc=no with_gnu_ld=no need_locks=yes ac_ext=c objext=o libext=a exeext= cache_file= old_AR="$AR" old_CC="$CC" old_CFLAGS="$CFLAGS" old_CPPFLAGS="$CPPFLAGS" old_LDFLAGS="$LDFLAGS" old_LD="$LD" old_LN_S="$LN_S" old_LIBS="$LIBS" old_NM="$NM" old_RANLIB="$RANLIB" old_DLLTOOL="$DLLTOOL" old_OBJDUMP="$OBJDUMP" old_AS="$AS" # Parse the command line options. args= prev= for option do case "$option" in -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then eval "$prev=\$option" prev= continue fi case "$option" in --help) cat <&2 echo "$help" 1>&2 exit 1 ;; *) if test -z "$ltmain"; then ltmain="$option" elif test -z "$host"; then # This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then # echo "$progname: warning \`$option' is not a valid host type" 1>&2 # fi host="$option" else echo "$progname: too many arguments" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac done if test -z "$ltmain"; then echo "$progname: you must specify a LTMAIN file" 1>&2 echo "$help" 1>&2 exit 1 fi if test ! -f "$ltmain"; then echo "$progname: \`$ltmain' does not exist" 1>&2 echo "$help" 1>&2 exit 1 fi # Quote any args containing shell metacharacters. ltconfig_args= for arg do case "$arg" in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ltconfig_args="$ltconfig_args '$arg'" ;; *) ltconfig_args="$ltconfig_args $arg" ;; esac done # A relevant subset of AC_INIT. # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 5 compiler messages saved in config.log # 6 checking for... messages and results if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>>./config.log # NLS nuisances. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test -n "$cache_file" && test -r "$cache_file"; then echo "loading cache $cache_file within ltconfig" . $cache_file fi if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi if test -z "$srcdir"; then # Assume the source directory is the same one as the path to LTMAIN. srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` test "$srcdir" = "$ltmain" && srcdir=. fi trap "$rm conftest*; exit 1" 1 2 15 if test "$verify_host" = yes; then # Check for config.guess and config.sub. ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/config.guess; then ac_aux_dir=$ac_dir break fi done if test -z "$ac_aux_dir"; then echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 echo "$help" 1>&2 exit 1 fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub # Make sure we can run config.sub. if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : else echo "$progname: cannot run $ac_config_sub" 1>&2 echo "$help" 1>&2 exit 1 fi echo $ac_n "checking host system type""... $ac_c" 1>&6 host_alias=$host case "$host_alias" in "") if host_alias=`$SHELL $ac_config_guess`; then : else echo "$progname: cannot guess host type; you must specify one" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac host=`$SHELL $ac_config_sub $host_alias` echo "$ac_t$host" 1>&6 # Make sure the host verified. test -z "$host" && exit 1 elif test -z "$host"; then echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 echo "$help" 1>&2 exit 1 else host_alias=$host fi # Transform linux* to *-*-linux-gnu*, to support old configure scripts. case "$host_os" in linux-gnu*) ;; linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` esac host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` case "$host_os" in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "${COLLECT_NAMES+set}" != set; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Determine commands to create old-style static archives. old_archive_cmds='$AR cru $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= # Set a sane default for `AR'. test -z "$AR" && AR=ar # Set a sane default for `OBJDUMP'. test -z "$OBJDUMP" && OBJDUMP=objdump # If RANLIB is not set, then run the test. if test "${RANLIB+set}" != "set"; then result=no echo $ac_n "checking for ranlib... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then RANLIB="ranlib" result="ranlib" break fi done IFS="$save_ifs" echo "$ac_t$result" 1>&6 fi if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" fi # Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$AS" && AS=as # Check to see if we are using GCC. if test "$with_gcc" != yes || test -z "$CC"; then # If CC is not set, then try to find GCC or a usable CC. if test -z "$CC"; then echo $ac_n "checking for gcc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then CC="gcc" break fi done IFS="$save_ifs" if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi fi # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". if test -z "$CC"; then echo $ac_n "checking for cc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" cc_rejected=no for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/cc || test -f $dir/cc$ac_exeext; then if test "$dir/cc" = "/usr/ucb/cc"; then cc_rejected=yes continue fi CC="cc" break fi done IFS="$save_ifs" if test $cc_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same name, so the bogon will be chosen # first if we set CC to just the name; use the full file name. shift set dummy "$dir/cc" "$@" shift CC="$@" fi fi if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$CC"; then echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 exit 1 fi fi # Now see if the compiler is really GCC. with_gcc=no echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 echo "$progname:581: checking whether we are using GNU C" >&5 $rm conftest.c cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes fi $rm conftest.c echo "$ac_t$with_gcc" 1>&6 fi # Allow CC to be a program name with arguments. set dummy $CC compiler="$2" echo $ac_n "checking for object suffix... $ac_c" 1>&6 $rm conftest* echo 'int i = 1;' > conftest.c echo "$progname:603: checking for object suffix" >& 5 if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c) ;; *) objext=`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* echo "$ac_t$objext" 1>&6 echo $ac_n "checking for executable suffix... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_exeext="no" $rm conftest* echo 'main () { return 0; }' > conftest.c echo "$progname:629: checking for executable suffix" >& 5 if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c | *.err | *.$objext ) ;; *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* fi if test "X$ac_cv_exeext" = Xno; then exeext="" else exeext="$ac_cv_exeext" fi echo "$ac_t$ac_cv_exeext" 1>&6 echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 pic_flag= special_shlib_compile_flags= wl= link_static_flag= no_builtin_flag= if test "$with_gcc" = yes; then wl='-Wl,' link_static_flag='-static' case "$host_os" in beos* | irix5* | irix6* | osf3* | osf4*) # PIC is the default for these OSes. ;; aix*) # Below there is a dirty hack to force normal static linking with -ldl # The problem is because libdl dynamically linked with both libc and # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but # we not sure about C++ programs. link_static_flag="$link_static_flag ${wl}-lC" ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. pic_flag='-m68020 -resident32 -malways-restore-a4' ;; sysv4*MP*) if test -d /usr/nec; then pic_flag=-Kconform_pic fi ;; *) pic_flag='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case "$host_os" in aix3* | aix4*) # All AIX code is PIC. link_static_flag='-bnso -bI:/lib/syscalls.exp' ;; hpux9* | hpux10* | hpux11*) # Is there a better link_static_flag that works with the bundled CC? wl='-Wl,' link_static_flag="${wl}-a ${wl}archive" pic_flag='+Z' ;; irix5* | irix6*) wl='-Wl,' link_static_flag='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; osf3* | osf4*) # All OSF/1 code is PIC. wl='-Wl,' link_static_flag='-non_shared' ;; sco3.2v5*) pic_flag='-Kpic' link_static_flag='-dn' special_shlib_compile_flags='-belf' ;; solaris*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; sunos4*) pic_flag='-PIC' link_static_flag='-Bstatic' wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; uts4*) pic_flag='-pic' link_static_flag='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then pic_flag='-Kconform_pic' link_static_flag='-Bstatic' fi ;; *) can_build_shared=no ;; esac fi if test -n "$pic_flag"; then echo "$ac_t$pic_flag" 1>&6 # Check to make sure the pic_flag actually works. echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $pic_flag -DPIC" echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then # Append any warnings to the config.log. cat conftest.err 1>&5 case "$host_os" in hpux9* | hpux10* | hpux11*) # On HP-UX, both CC and GCC only warn that PIC is supported... then they # create non-PIC objects. So, if there were any warnings, we assume that # PIC is not supported. if test -s conftest.err; then echo "$ac_t"no 1>&6 can_build_shared=no pic_flag= else echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" fi ;; *) echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" ;; esac else # Append any errors to the config.log. cat conftest.err 1>&5 can_build_shared=no pic_flag= echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else echo "$ac_t"none 1>&6 fi # Check to see if options -o and -c are simultaneously supported by compiler echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 $rm -r conftest 2>/dev/null mkdir conftest cd conftest $rm conftest* echo "int some_variable = 0;" > conftest.c mkdir out # According to Tom Tromey, Ian Lance Taylor reported there are C compilers # that will create temporary files in the current directory regardless of # the output directory. Thus, making CWD read-only will cause this test # to fail, enabling locking or at least warning the user not to do parallel # builds. chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.o" echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then echo "$ac_t"no 1>&6 compiler_c_o=no else echo "$ac_t"yes 1>&6 compiler_c_o=yes fi else # Append any errors to the config.log. cat out/conftest.err 1>&5 compiler_c_o=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" chmod u+w . $rm conftest* out/* rmdir out cd .. rmdir conftest $rm -r conftest 2>/dev/null if test x"$compiler_c_o" = x"yes"; then # Check to see if we can write to a .lo echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -c -o conftest.lo" echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_o_lo=no else echo "$ac_t"yes 1>&6 compiler_o_lo=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_o_lo=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else compiler_o_lo=no fi # Check to see if we can do hard links to lock some files if needed hard_links="nottested" if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$ac_t$hard_links" 1>&6 $rm conftest* if test "$hard_links" = no; then echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 need_locks=warn fi else need_locks=no fi if test "$with_gcc" = yes; then # Check to see if options -fno-rtti -fno-exceptions are supported by compiler echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_rtti_exceptions=no else echo "$ac_t"yes 1>&6 compiler_rtti_exceptions=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_rtti_exceptions=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* if test "$compiler_rtti_exceptions" = "yes"; then no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' else no_builtin_flag=' -fno-builtin' fi fi # Check for any special shared library compilation flags. if test -n "$special_shlib_compile_flags"; then echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : else echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 can_build_shared=no fi fi echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 $rm conftest* echo 'main(){return(0);}' > conftest.c save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $link_static_flag" echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then echo "$ac_t$link_static_flag" 1>&6 else echo "$ac_t"none 1>&6 link_static_flag= fi LDFLAGS="$save_LDFLAGS" $rm conftest* if test -z "$LN_S"; then # Check to see if we can use ln -s, or we need hard links. echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 $rm conftest.dat if ln -s X conftest.dat 2>/dev/null; then $rm conftest.dat LN_S="ln -s" else LN_S=ln fi if test "$LN_S" = "ln -s"; then echo "$ac_t"yes 1>&6 else echo "$ac_t"no 1>&6 fi fi # Make sure LD is an absolute path. if test -z "$LD"; then ac_prog=ld if test "$with_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 echo "$progname:991: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we are not using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld... $ac_c" 1>&6 echo "$progname:1015: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 echo "$progname:1018: checking for non-GNU ld" >&5 fi if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" fi if test -n "$LD"; then echo "$ac_t$LD" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$LD"; then echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 exit 1 fi fi # Check to see if it really is or is not GNU ld. echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then with_gnu_ld=yes else with_gnu_ld=no fi echo "$ac_t$with_gnu_ld" 1>&6 # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 allow_undefined_flag= no_undefined_flag= need_lib_prefix=unknown need_version=unknown # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments archive_cmds= archive_expsym_cmds= old_archive_from_new_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported runpath_var= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an egrep regular expression of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. case "$host_os" in cygwin* | mingw*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$with_gcc" != yes; then with_gnu_ld=no fi ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case "$host_os" in aix3* | aix4*) # On AIX, the GNU linker is very broken ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=yes # Extract the symbol export list from an `--export-all' def file, # then regenerate the def file from the symbol export list, so that # the compiled dll only exports the symbol export list. export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols' archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ _lt_hint=1; for symbol in `cat $export_symbols`; do echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def; _lt_hint=`expr 1 + \$_lt_hint`; done~ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' ;; netbsd*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' # can we support soname and/or expsyms with a.out? -oliva fi ;; solaris*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' case $host_os in cygwin* | mingw*) # dlltool doesn't understand --whole-archive et. al. whole_archive_flag_spec= ;; *) whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' ;; esac fi else # PORTME fill in a description of your system's linker (not GNU ld) case "$host_os" in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$with_gcc" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4*) hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' hardcode_libdir_separator=':' if test "$with_gcc" = yes; then collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi shared_flag='-shared' else shared_flag='${wl}-bM:SRE' hardcode_direct=yes fi allow_undefined_flag=' ${wl}-berok' archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' case "$host_os" in aix4.[01]|aix4.[01].*) # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on always_export_symbols=yes ;; esac ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; cygwin* | mingw*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs' fix_srcfile_path='`cygpath -w $srcfile`' ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9* | hpux10* | hpux11*) case "$host_os" in hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; esac hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' ;; irix5* | irix6*) if test "$with_gcc" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF fi hardcode_libdir_flag_spec='${wl}-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; openbsd*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' ;; osf3* | osf4*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case "$host_os" in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; sysv4*MP*) if test -d /usr/nec ;then # archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; *) ld_shlibs=no ;; esac fi echo "$ac_t$ld_shlibs" 1>&6 test "$ld_shlibs" = no && can_build_shared=no if test -z "$NM"; then echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 case "$NM" in [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -p" break else NM=${NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$NM" && NM=nm ;; esac echo "$ac_t$NM" 1>&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. symxfrm='\1 \2\3 \3' # Transform an extracted symbol line into a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" # Define system-specific variables. case "$host_os" in aix*) symcode='[BCDT]' ;; cygwin* | mingw*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" ;; irix*) symcode='[BCDEGRST]' ;; solaris*) symcode='[BDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then symcode='[ABCDGISTW]' fi # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no $rm conftest* cat > conftest.c <&5 if { (eval echo $progname:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then # Now try to grab the symbols. nlist=conftest.nm if { echo "$progname:1596: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if egrep ' nm_test_var$' "$nlist" >/dev/null; then if egrep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.c #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' cat <> conftest.c #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c cat <<\EOF >> conftest.c {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$objext conftstm.$objext save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="conftstm.$objext" CFLAGS="$CFLAGS$no_builtin_flag" if { (eval echo $progname:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then pipe_works=yes else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi LIBS="$save_LIBS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else global_symbol_pipe= fi done if test "$pipe_works" = yes; then echo "${ac_t}ok" 1>&6 else echo "${ac_t}failed" 1>&6 fi if test -z "$global_symbol_pipe"; then global_symbol_to_cdecl= fi # Check hardcoding attributes. echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var"; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$hardcode_shlibpath_var" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$ac_t$hardcode_action" 1>&6 reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 # PORTME Some linkers may need a different reload flag. reload_flag='-r' echo "$ac_t$reload_flag" 1>&6 test -n "$reload_flag" && reload_flag=" $reload_flag" # PORTME Fill in your ld.so characteristics library_names_spec= libname_spec='lib$name' soname_spec= postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" file_magic_cmd= file_magic_test_file= deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case "$host_os" in aix3*) version_type=linux library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH # AIX has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}.so$major' ;; aix4*) version_type=linux # AIX has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. # We preserve .a as extension for shared libraries though AIX4.2 # and later linker supports .so library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' shlibpath_var=LIBPATH deplibs_check_method=pass_all ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH deplibs_check_method=pass_all lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; bsdi4*) version_type=linux library_names_spec='${libname}.so$major ${libname}.so' soname_spec='${libname}.so' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw*) version_type=windows need_version=no need_lib_prefix=no if test "$with_gcc" = yes; then library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' else library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' fi dynamic_linker='Win32 ld.exe' deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' file_magic_cmd='${OBJDUMP} -f' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; freebsd1*) dynamic_linker=no ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case "$version_type" in freebsd-elf*) deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) deplibs_check_method=unknown library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac finish_cmds='PATH="\$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH case "$host_os" in freebsd2* | freebsd3.[01]*) shlibpath_overrides_runpath=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6*) version_type=irix need_lib_prefix=no need_version=no soname_spec='${libname}${release}.so.$major' library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' case "$host_os" in irix5*) libsuff= shlibsuff= # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case "$LD" in # libtool.m4 will add one of these switches to LD *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /lib${libsuff}/libc.so*` deplibs_check_method='pass_all' ;; # No shared lib support for Linux oldld, aout, or coff. linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. linux-gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` if test -f /lib/ld.so.1; then dynamic_linker='GNU ld.so' else # Only the GNU ld.so supports shared libraries on MkLinux. case "$host_cpu" in powerpc*) dynamic_linker=no ;; *) dynamic_linker='Linux ld.so' ;; esac fi ;; netbsd*) version_type=sunos if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH ;; openbsd*) version_type=sunos if test "$with_gnu_ld" = yes; then need_lib_prefix=no need_version=no fi library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' need_lib_prefix=no library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4*) version_type=osf need_version=no soname_spec='${libname}${release}.so' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' shlibpath_var=LD_LIBRARY_PATH # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method='file_magic COFF format alpha shared library' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so deplibs_check_method='pass_all' sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" file_magic_cmd=/usr/bin/file file_magic_test_file=/lib/libc.so ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case "$host_vendor" in ncr) deplibs_check_method='pass_all' ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; uts4*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; *) dynamic_linker=no ;; esac echo "$ac_t$dynamic_linker" 1>&6 test "$dynamic_linker" = no && can_build_shared=no # Report the final consequences. echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 # Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in # configure.in, otherwise build static only libraries. case "$host_os" in cygwin* | mingw* | os2*) if test x$can_build_shared = xyes; then test x$enable_win32_dll = xno && can_build_shared=no echo "checking if package supports dlls... $can_build_shared" 1>&6 fi ;; esac if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then case "$deplibs_check_method" in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case "$host_os" in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4*) test "$enable_shared" = yes && enable_static=no ;; esac echo "$ac_t$enable_shared" 1>&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "checking whether to build static libraries... $enable_static" 1>&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi echo $ac_n "checking for objdir... $ac_c" 1>&6 rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. objdir=_libs fi rmdir .libs 2>/dev/null echo "$ac_t$objdir" 1>&6 if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then lt_cv_dlopen=no lt_cv_dlopen_libs= echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 echo "$progname:2170: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen""... $ac_c" 1>&6 echo "$progname:2207: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else dlopen(); #endif ; return 0; } EOF if { (eval echo $progname:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_dlopen=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 echo "$progname:2251: checking for dld_link in -ldld" >&5 ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load""... $ac_c" 1>&6 echo "$progname:2288: checking for shl_load" >&5 if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else shl_load(); #endif ; return 0; } EOF if { (eval echo $progname:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shl_load=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shl_load=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 echo "$progname:2333: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 fi fi fi fi fi fi if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes fi case "$lt_cv_dlopen" in dlopen) for ac_hdr in dlfcn.h; do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "$progname:2395: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int fnord = 0; EOF ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo $progname:2405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi done if test "x$ac_cv_header_dlfcn_h" = xyes; then CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" fi eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" LIBS="$lt_cv_dlopen_libs $LIBS" echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2433: checking whether a program can dlopen itself" >&5 if test "${lt_cv_dlopen_self+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self" 1>&6 if test "$lt_cv_dlopen_self" = yes; then LDFLAGS="$LDFLAGS $link_static_flag" echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2506: checking whether a statically linked program can dlopen itself" >&5 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self_static=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self_static=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self_static=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 fi ;; esac case "$lt_cv_dlopen_self" in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case "$lt_cv_dlopen_self_static" in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Copy echo and quote the copy, instead of the original, because it is # used later. ltecho="$echo" if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then ltecho="$CONFIG_SHELL \$0 --fallback-echo" fi LTSHELL="$SHELL" LTCONFIG_VERSION="$VERSION" # Only quote variables if we're using ltmain.sh. case "$ltmain" in *.sh) # Now quote all the things that may contain metacharacters. for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ thread_safe_flag_spec whole_archive_flag_spec libname_spec \ library_names_spec soname_spec \ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case "$var" in reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ postinstall_cmds | postuninstall_cmds | \ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case "$ltecho" in *'\$0 --fallback-echo"') ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac trap "$rm \"$ofile\"; exit 1" 1 2 15 echo "creating $ofile" $rm "$ofile" cat < "$ofile" #! $SHELL # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Gordon Matzigkeit , 1996 # # This program 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 2 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # 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. # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="sed -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi ### BEGIN LIBTOOL CONFIG EOF cfgfile="$ofile" ;; *) # Double-quote the variables that need it (for aesthetics). for var in old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do eval "$var=\\\"\$var\\\"" done # Just create a config file. cfgfile="$ofile.cfg" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 echo "creating $cfgfile" $rm "$cfgfile" cat < "$cfgfile" # `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) EOF ;; esac cat <> "$cfgfile" # Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ # LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ # NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ # DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ # $0$ltconfig_args # # Compiler and other test output produced by $progname, useful for # debugging $progname, is in ./config.log if it exists. # The version of $progname that generated this script. LTCONFIG_VERSION=$LTCONFIG_VERSION # Shell to use when invoking shell scripts. SHELL=$LTSHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$ltecho # The archiver. AR=$AR # The default C compiler. CC=$CC # The linker used to build libraries. LD=$LD # Whether we need hard or soft links. LN_S=$LN_S # A BSD-compatible nm program. NM=$NM # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$reload_flag reload_cmds=$reload_cmds # How to pass a linker flag through the compiler. wl=$wl # Object file suffix (normally "o"). objext="$objext" # Old archive suffix (normally "a"). libext="$libext" # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$pic_flag # Does compiler simultaneously support -c and -o options? compiler_c_o=$compiler_c_o # Can we write directly to a .lo ? compiler_o_lo=$compiler_o_lo # Must we lock files when doing compilation ? need_locks=$need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$link_static_flag # Compiler flag to turn off builtin functions. no_builtin_flag=$no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$library_names_spec # The coded name of the library, if different from the real name. soname_spec=$soname_spec # Commands used to build and install an old-style archive. RANLIB=$RANLIB old_archive_cmds=$old_archive_cmds old_postinstall_cmds=$old_postinstall_cmds old_postuninstall_cmds=$old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$old_archive_from_new_cmds # Commands used to build and install a shared archive. archive_cmds=$archive_cmds archive_expsym_cmds=$archive_expsym_cmds postinstall_cmds=$postinstall_cmds postuninstall_cmds=$postuninstall_cmds # Method to check whether dependent libraries are shared objects. deplibs_check_method=$deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$global_symbol_to_cdecl # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$hardcode_libdir_separator # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Compile-time system search path for libraries sys_lib_search_path_spec=$sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$exclude_expsyms # Symbols that must always be exported. include_expsyms=$include_expsyms EOF case "$ltmain" in *.sh) echo '### END LIBTOOL CONFIG' >> "$ofile" echo >> "$ofile" case "$host_os" in aix3*) cat <<\EOF >> "$ofile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "${COLLECT_NAMES+set}" != set; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # Append the ltmain.sh script. sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) chmod +x "$ofile" ;; *) # Compile the libtool program. echo "FIXME: would compile $ltmain" ;; esac test -n "$cache_file" || exit 0 # AC_CACHE_SAVE trap '' 1 2 15 cat > confcache <<\EOF # 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. # EOF # 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 \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: libax25-0.0.12-rc2+cvs20120204/rose.30000644000175000017500000000174410774705515014335 0ustar patpat.TH INET 3 "2008-Feb-04" "Linux" "Linux Programmer's Manual" .SH NAME rose_aton, rose_ntoa, rose_cmp \- ROSE Address manipulation routines .SH SYNOPSIS .nf .B #include .sp .BI "int rose_aton(const char *" cp ", char *" inp ");" .sp .BI "char * rose_ntoa(rose_address *" cp ");" .sp .BI "int rose_cmp(rose_address *" a1 ", rose_address *" a2 ");" .fi .SH DESCRIPTION The .BR rose_aton () converts the ROSE address .I cp from an ASCII representation into network format. .PP The .BR rose_ntoa () converts the ROSE address .I cp that is network format to a string that is the ASCII representation of the address. .PP The .BR rose_cmp () compares the two ROSE address .I a1 and .I a2 that are in network format. .SH "RETURN VALUE" The .BR rose_ntoa () and .BR rose_aton () functions return zero if all went OK, -1 if not. .PP The .BR rose_cmp () returns 0 if addresses pointer by .I a1 and .I a2 are identical, 1 otherwise. .SH "SEE ALSO" .BR ax25 "(4), " netrom "(4), " rose "(4)" libax25-0.0.12-rc2+cvs20120204/README0000644000175000017500000000107407635165702014155 0ustar patpatAX25 Library ============ This library set is still really under test but is now release for general use. You are supposed to use glibc 2.1 (libc6 unstable libraries) for this package. I have attempted to cater for glibc 2.0 users here. To compile this I used: * A Debian GNU/Linux system * autoconf 2.57 * automake 1.5 * libtool 1.4.3 * libc 2.3.1 * gcc 3.2.3 This library is copyright by the respective authors (see AUTHORS for a list) and licensed under the GNU LGPL (see COPYING for more information). - Craig Small libax25-0.0.12-rc2+cvs20120204/COPYING0000644000175000017500000006347407264463674014353 0ustar patpat GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libax25-0.0.12-rc2+cvs20120204/axports.50000644000175000017500000000337010774705515015064 0ustar patpat.TH AXPORTS 5 "2008-Feb-04" Linux "Linux Programmer's Manual" .SH NAME .I /etc/ax25/axports \- AX.25 port configuration file. .SH DESCRIPTION .LP .I axports is an ASCII file that contains information about each of the physical AX.25 ports that are to be used. When dealing with an AX.25 utility such as .BR call , it takes an argument that is the port name. This port name is a reference to the line within .B axports, which has that name as its first argument. The information on each line contains enough information to bind the command to a particular physical AX.25 interface, this binding is done by matching the callsign on the line in .B axports with the callsign of the port set by .B kissattach. .LP The lines within .I axports must either be a comment line, which starts with a # in the first column, or a port description in the following format, each field being delimited by white space: .sp .RS name callsign speed paclen window description .RE .sp The field descriptions are: .sp .RS .TP 14 .B name is the unique identifier of the port. This is the name given as the port argument of many of the AX.25 support programs. This is .I not in any way related to actual device identities, just unique .TP 14 .B callsign the callsign of the physical interface to bind to. .TP 14 .B speed this is the speed of interface, a value of zero means that no speed will be set by kissattach(8). .TP 14 .B paclen is the default maximum packet size for this interface. .TP 14 .B window the default window size for this interface. .TP 14 .B description a free format description of this interface, this field extends to the end of the line. This field may contain spaces. .RE .SH FILES .LP /etc/ax25/axports .SH "SEE ALSO" .BR call (1), .BR ax25 (4), .BR axparms (8), .BR kissattach (8). libax25-0.0.12-rc2+cvs20120204/axutils.c0000644000175000017500000001274211514552006015122 0ustar patpat#include #include #include #include #include #include #include #include #include #include ax25_address null_ax25_address = {{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}}; /* * Library routine for callsign conversion. */ int ax25_aton_entry(const char *name, char *buf) { int ct = 0; int ssid = 0; const char *p = name; char c; while (ct < 6) { c = toupper(*p); if (c == '-' || c == '\0') break; if (!isalnum(c)) { printf("axutils: invalid symbol in callsign '%s'\n", name); return -1; } buf[ct] = c << 1; p++; ct++; } while (ct < 6) { buf[ct] = ' ' << 1; ct++; } if (*p != '\0') { p++; if (sscanf(p, "%d", &ssid) != 1 || ssid < 0 || ssid > 15) { printf("axutils: SSID must follow '-' and be numeric in the range 0-15 - '%s'\n", name); return -1; } } buf[6] = ((ssid + '0') << 1) & 0x1E; return 0; } int ax25_aton(const char *call, struct full_sockaddr_ax25 *sax) { char *bp, *np; char *addrp; int n = 0; char *tmp = strdup(call); if (tmp == NULL) return -1; bp = tmp; addrp = sax->fsa_ax25.sax25_call.ax25_call; do { /* Fetch one callsign token */ while (*bp != '\0' && isspace(*bp)) bp++; np = bp; while (*np != '\0' && !isspace(*np)) np++; if (*np != '\0') *np++ = '\0'; /* Check for the optional 'via' syntax */ if (n == 1 && (strcasecmp(bp, "V") == 0 || strcasecmp(bp, "VIA") == 0)) { bp = np; continue; } /* Process the token */ if (ax25_aton_entry(bp, addrp) == -1) { free(tmp); return -1; } /* Move along */ bp = np; n++; if (n == 1) addrp = sax->fsa_digipeater[0].ax25_call; /* First digipeater address */ else addrp += sizeof(ax25_address); } while (n <= AX25_MAX_DIGIS && *bp); free(tmp); /* Tidy up */ sax->fsa_ax25.sax25_ndigis = n - 1; sax->fsa_ax25.sax25_family = AF_AX25; return sizeof(struct full_sockaddr_ax25); } int ax25_aton_arglist(const char *call[], struct full_sockaddr_ax25 *sax) { const char *bp; char *addrp; int n = 0; int argp = 0; addrp = sax->fsa_ax25.sax25_call.ax25_call; do { /* Fetch one callsign token */ if ((bp = call[argp++]) == NULL) break; /* Check for the optional 'via' syntax */ if (n == 1 && (strcasecmp(bp, "V") == 0 || strcasecmp(bp, "VIA") == 0)) continue; /* Process the token */ if (ax25_aton_entry(bp, addrp) == -1) return -1; n++; if (n == 1) addrp = sax->fsa_digipeater[0].ax25_call; /* First digipeater address */ else addrp += sizeof(ax25_address); } while (n <= AX25_MAX_DIGIS && call[argp] != NULL); /* Tidy up */ sax->fsa_ax25.sax25_ndigis = n - 1; sax->fsa_ax25.sax25_family = AF_AX25; return sizeof(struct full_sockaddr_ax25); } /* * Library routine for Rose address conversion. */ int rose_aton(const char *addr, char *buf) { int i, n; if (strlen(addr) != 10) { printf("axutils: invalid rose address '%s' length = %d\n", addr, strlen(addr)); return -1; } if (strspn(addr, "0123456789") != 10) { printf("axutils: invalid characters in address\n"); return -1; } for (n = 0, i = 0; i < 5; i++, n += 2) { buf[i] = (addr[n + 0] - '0') << 4; buf[i] |= (addr[n + 1] - '0') << 0; } return 0; } /* * ax25 -> ascii conversion */ char *ax25_ntoa(const ax25_address *a) { static char buf[11]; char c, *s; int n; for (n = 0, s = buf; n < 6; n++) { c = (a->ax25_call[n] >> 1) & 0x7F; if (c != ' ') *s++ = c; } /* Convention is: -0 suffixes are NOT printed */ if (a->ax25_call[6] & 0x1E) { *s++ = '-'; if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { *s++ = '1'; n -= 10; } *s++ = n + '0'; } *s++ = '\0'; return buf; } /* * rose -> ascii conversion */ char *rose_ntoa(const rose_address *a) { static char buf[11]; sprintf(buf, "%02X%02X%02X%02X%02X", a->rose_addr[0] & 0xFF, a->rose_addr[1] & 0xFF, a->rose_addr[2] & 0xFF, a->rose_addr[3] & 0xFF, a->rose_addr[4] & 0xFF); return buf; } /* * Compare two ax.25 addresses */ int ax25_cmp(const ax25_address *a, const ax25_address *b) { if ((a->ax25_call[0] & 0xFE) != (b->ax25_call[0] & 0xFE)) return 1; if ((a->ax25_call[1] & 0xFE) != (b->ax25_call[1] & 0xFE)) return 1; if ((a->ax25_call[2] & 0xFE) != (b->ax25_call[2] & 0xFE)) return 1; if ((a->ax25_call[3] & 0xFE) != (b->ax25_call[3] & 0xFE)) return 1; if ((a->ax25_call[4] & 0xFE) != (b->ax25_call[4] & 0xFE)) return 1; if ((a->ax25_call[5] & 0xFE) != (b->ax25_call[5] & 0xFE)) return 1; if ((a->ax25_call[6] & 0x1E) != (b->ax25_call[6] & 0x1E)) /* SSID without control bit */ return 2; return 0; } /* * Compare two Rose addresses */ int rose_cmp(const rose_address *a, const rose_address *b) { int i; for (i = 0; i < 5; i++) if (a->rose_addr[i] != b->rose_addr[i]) return 1; return 0; } /* * Validate an AX.25 callsign. */ int ax25_validate(const char *call) { char s[7]; int n; for (n = 0; n < 6; n++) { s[n] = (call[n] >> 1) & 0x7F; } s[6] = '\0'; if (strspn(s, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ") == 6) return TRUE; return FALSE; } /* * Convert a string to upper case */ char *strupr(char *s) { char *p; if (s == NULL) return NULL; for (p = s; *p != '\0'; p++) *p = toupper(*p); return s; } /* * Convert a string to lower case */ char *strlwr(char *s) { char *p; if (s == NULL) return NULL; for (p = s; *p != '\0'; p++) *p = tolower(*p); return s; } libax25-0.0.12-rc2+cvs20120204/netax25/0000755000175000017500000000000011713361515014551 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/netax25/ttyutils.h0000644000175000017500000000361311217264177016633 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Generic serial port handling functions. */ #ifndef _TTYUTILS_H #define _TTYUTILS_H #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifdef __cplusplus extern "C" { #endif /* * Put a given file descriptor into raw mode, if the hwflag is set to TRUE * then hardware handshaking is enabled. Returns TRUE if successful. */ extern int tty_raw(int fd, int hwflag); /* * Set the speed of the given file descriptor. Returns TRUE is it was * successful. */ extern int tty_speed(int fd, int speed); /* * Determines whether a given tty is already open by another process. Returns * TRUE if is already locked, or FALSE if it is free. */ extern int tty_is_locked(char *tty); /* * Creates a lock file for the given tty. It writes the process ID to the * file so take care if doing a fork. Returns TRUE if everything was OK. */ extern int tty_lock(char *tty); /* * Removes the lock file for a given tty. Returns TRUE if successful. */ extern int tty_unlock(char *tty); #ifdef __cplusplus } #endif #endif libax25-0.0.12-rc2+cvs20120204/netax25/ax25io.h0000644000175000017500000000567411217264176016051 0ustar patpat/* AX25IO - Library for io manuipulation for AX.25 programs * Copyright (C) 1998 Tomi Manninen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _AX25IO_H #define _AX25IO_H #define AXBUFLEN 4096 typedef struct ax25io_s { int ifd; /* stdin socket index */ int ofd; /* stdout socket index */ char eol[4]; /* end-of-line sequence */ int eolmode; /* end-of-line translation on/off */ int telnetmode; /* telnet option negotiation on/off */ int tn_echo; /* will/wont echo */ int tn_linemode; /* will/wont linemode */ int size; /* size of the packet in input buffer */ int paclen; /* paclen */ unsigned char ibuf[AXBUFLEN]; /* input buffer */ unsigned char obuf[AXBUFLEN]; /* output buffer */ unsigned char gbuf[AXBUFLEN]; /* getline buffer */ int gbuf_usage; /* getline buffer usage */ int iptr; /* input pointer */ int optr; /* output pointer */ void *zptr; /* pointer to the compression struct */ struct ax25io_s *next; /* linked list pointer */ } ax25io; #define EOLMODE_TEXT 0 #define EOLMODE_BINARY 1 #define EOLMODE_GW 2 #define AX25_EOL "\r" #define NETROM_EOL AX25_EOL #define ROSE_EOL AX25_EOL #define INET_EOL "\r\n" #define UNSPEC_EOL "\n" #define INTERNAL_EOL 021271 #define ZERR_STREAM_END 1024 #define ZERR_STREAM_ERROR 1025 #define ZERR_DATA_ERROR 1026 #define ZERR_MEM_ERROR 1027 #define ZERR_BUF_ERROR 1028 #define ZERR_UNKNOWN 1029 extern ax25io *axio_init(int, int, int, char *); extern void axio_end(ax25io *); extern void axio_end_all(void); extern int axio_compr(ax25io *, int); extern int axio_paclen(ax25io *, int); extern int axio_eolmode(ax25io *, int); extern int axio_cmpeol(ax25io *, ax25io *); extern int axio_tnmode(ax25io *, int); extern int axio_flush(ax25io *); extern int axio_getc(ax25io *); extern int axio_putc(int, ax25io *); extern char *axio_getline(ax25io *); extern int axio_gets(char *, int, ax25io *); extern int axio_puts(const char *, ax25io *); extern int axio_printf(ax25io *, const char *, ...); extern int axio_tn_do_linemode(ax25io *); extern int axio_tn_will_echo(ax25io *); extern int axio_tn_wont_echo(ax25io *); #endif /* _AX25IO_H */ libax25-0.0.12-rc2+cvs20120204/netax25/nrconfig.h0000644000175000017500000000543711217264177016545 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * This file contains the definitions of the entry points into the NET/ROM * configuration functions. */ #ifndef _NRCONFIG_H #define _NRCONFIG_H #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifdef __cplusplus extern "C" { #endif /* * This function must be called before using any of the other functions in * this part of the library. It returns the number of active ports, or 0 * on failure. */ extern int nr_config_load_ports(void); /* * This function allows the enumeration of all the active configured ports. * Passing NULL as the argument returns the first port name in the list, * subsequent calls to this function should be made with the last port name * returned. A NULL return indicates either an error, or the end of the list. */ extern char *nr_config_get_next(char *); /* * This function maps the device name onto the port name (as used in the axports * file. On error a NULL is returned. */ extern char *nr_config_get_name(char *); /* * This function maps the port name onto the callsign of the port. On error a * NULL is returned. */ extern char *nr_config_get_addr(char *); /* * This function maps the port name onto the device name of the port. On error a * NULL is returned. */ extern char *nr_config_get_dev(char *); /* * This function maps the callsign in AX.25 shifted format onto the port name. * On error, NULL is returned. */ extern char *nr_config_get_port(ax25_address *); /* * This function takes the port name and returns the alias of the port. On * error NULL is returned. */ extern char *nr_config_get_alias(char *); /* * This function takes the port name and returns the maximum packet length. * On error a 0 is returned. */ extern int nr_config_get_paclen(char *); /* * This function takes the port name and returns the description of the port. * On error a NULL is returned. */ extern char *nr_config_get_desc(char *); #ifdef __cplusplus } #endif #endif libax25-0.0.12-rc2+cvs20120204/netax25/axconfig.h0000644000175000017500000000604511217264176016531 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * This file contains the definitions of the entry points into the AX.25 * configuration functions. */ #ifndef _AXCONFIG_H #define _AXCONFIG_H #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifdef __cplusplus extern "C" { #endif /* * This function must be called before using any of the other functions in * this part of the library. It returns the number of active ports, or 0 * on failure. */ extern int ax25_config_load_ports(void); /* * This function allows the enumeration of all the active configured ports. * Passing NULL as the argument returns the first port name in the list, * subsequent calls to this function should be made with the last port name * returned. A NULL return indicates either an error, or the end of the list. */ extern char *ax25_config_get_next(char *); /* * This function maps the device name onto the port name (as used in the axports * file. On error a NULL is returned. */ extern char *ax25_config_get_name(char *); /* * This function maps the port name onto the callsign of the port. On error a * NULL is returned. */ extern char *ax25_config_get_addr(char *); /* * This function maps the port name onto the device name of the port. On error a * NULL is returned. */ extern char *ax25_config_get_dev(char *); /* * This function maps the callsign onto the port name. The callsign should be * in shifted format as per get{peer,sock}name(2). A null_ax25_address will * return a "*" meaning all ports. On error NULL is returned. */ extern char *ax25_config_get_port(ax25_address *); /* * This function takes the port name and returns the default window size. On * error 0 is returned. */ extern int ax25_config_get_window(char *); /* * This function takes the port name and returns the maximum packet length. * On error a 0 is returned. */ extern int ax25_config_get_paclen(char *); /* * This function takes the port name and returns the baud rate. On error a * 0 is returned. */ extern int ax25_config_get_baud(char *); /* * This function takes the port name and returns the description of the port. * On error a NULL is returned. */ extern char *ax25_config_get_desc(char *); #ifdef __cplusplus } #endif #endif libax25-0.0.12-rc2+cvs20120204/netax25/axlib.h0000644000175000017500000000740611217264176016034 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Callsign conversion functions, converts callsigns into network bit * shifted format and vica versa. */ #ifndef _AXLIB_H #define _AXLIB_H #include #include #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifdef __cplusplus extern "C" { #endif /* * Libax25 version. */ extern char libax25_version[]; /* * The special "null" address, used as the default callsign in routing and * in other places. */ extern ax25_address null_ax25_address; /* * This function converts an ASCII representation of a callsign into network * format. It returns -1 on error, 0 otherwise. */ extern int ax25_aton_entry(const char *, char *); /* * This converts a string with optional digipeaters into a structure understood * by the kernel code. * * The string should be in the format: * * callsign [[V | VIA] callsign ...] * * On error a -1 is returned, otherwise the length of the structure is returned. */ extern int ax25_aton(const char *, struct full_sockaddr_ax25 *); /* * Similar to convert_call above except the callsign(s) are not held in a * string but in a NULL terminated array of pointers to the strings. * On error a -1 is returned, otherwise the length of the structure is returned. */ extern int ax25_aton_arglist(const char ** , struct full_sockaddr_ax25 *); /* * This function converts an ASCII representation of a Rose address into * network format. It returns -1 on error, 0 otherwise. The address must be * ten numbers long. */ extern int rose_aton(const char *, char *); /* * This function returns the textual representation of a callsign in * network format. The data returned is in a statically allocated area, and * subsequent calls will destroy previous callsigns returned. */ extern char *ax25_ntoa(const ax25_address *); /* * This function returns the textual representation of a Rose address in * network format. The data returned is in a statically allocated area, and * subsequent calls will destroy previous callsigns returned. */ extern char *rose_ntoa(const rose_address *); /* * Compares two AX.25 callsigns in network format. Returns a 0 if they are * identical, 1 if they differ, or 2 if only the SSIDs differ. */ extern int ax25_cmp(const ax25_address *, const ax25_address *); /* * Compares two Rose addresses in network format. Returns a 0 if they are * identical, 1 if they differ. */ extern int rose_cmp(const rose_address *, const rose_address *); /* * Validates an AX.25 callsign, returns TRUE if it is valid, or FALSE if it * is not. The callsign should be AX.25 shifted format. */ extern int ax25_validate(const char *); /* * Converts the giver string to upper case. It returns a pointer to the * original string. */ extern char *strupr(char *); /* * Converts the giver string to lower case. It returns a pointer to the * original string. */ extern char *strlwr(char *); #ifdef __cplusplus } #endif #endif libax25-0.0.12-rc2+cvs20120204/netax25/daemon.h0000644000175000017500000000246511217264176016200 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Function to convert a running process into a "proper" daemon. */ #ifndef _DAEMON_H #define _DAEMON_H #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifdef __cplusplus extern "C" { #endif /* * The argument is whether to ignore the death of child processes. The function * return non-zero if all was OK, else zero if there was a problem. */ extern int daemon_start(int); #ifdef __cplusplus } #endif #endif libax25-0.0.12-rc2+cvs20120204/netax25/rsconfig.h0000644000175000017500000000520111217264177016537 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * This file contains the definitions of the entry points into the Rose * configuration functions. */ #ifndef _RSCONFIG_H #define _RSCONFIG_H #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifdef __cplusplus extern "C" { #endif /* * This function must be called before using any of the other functions in * this part of the library. It returns the number of active ports, or 0 * on failure. */ extern int rs_config_load_ports(void); /* * This function allows the enumeration of all the active configured ports. * Passing NULL as the argument returns the first port name in the list, * subsequent calls to this function should be made with the last port name * returned. A NULL return indicates either an error, or the end of the list. */ extern char *rs_config_get_next(char *); /* * This function maps the device name onto the port name (as used in the axports * file. On error a NULL is returned. */ extern char *rs_config_get_name(char *); /* * This function maps the port name onto the address of the port. On error a * NULL is returned. */ extern char *rs_config_get_addr(char *); /* * This function maps the port name onto the device name of the port. On error a * NULL is returned. */ extern char *rs_config_get_dev(char *); /* * This function maps the Rose address in network format onto the port name. * On error, NULL is returned. */ extern char *rs_config_get_port(rose_address *); /* * This function takes the port name and returns the maximum packet length. * On error a 0 is returned. */ extern int rs_config_get_paclen(char *); /* * This function takes the port name and returns the description of the port. * On error a NULL is returned. */ extern char *rs_config_get_desc(char *); #ifdef __cplusplus } #endif #endif libax25-0.0.12-rc2+cvs20120204/netax25/mheard.h0000644000175000017500000000417211217264177016173 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * This file documents the layout of the mheard file. Since this file is * common to at least two of the AX25 utilities, it is documented here. */ #ifndef MHEARD_H #define MHEARD_H struct mheard_struct { ax25_address from_call; ax25_address to_call; char portname[20]; unsigned int count; unsigned int sframes; unsigned int uframes; unsigned int iframes; unsigned int ndigis; ax25_address digis[8]; time_t first_heard; time_t last_heard; #define MHEARD_TYPE_SABM 0 #define MHEARD_TYPE_SABME 1 #define MHEARD_TYPE_DISC 2 #define MHEARD_TYPE_UA 3 #define MHEARD_TYPE_DM 4 #define MHEARD_TYPE_RR 5 #define MHEARD_TYPE_RNR 6 #define MHEARD_TYPE_REJ 7 #define MHEARD_TYPE_FRMR 8 #define MHEARD_TYPE_I 9 #define MHEARD_TYPE_UI 10 #define MHEARD_TYPE_UNKNOWN 11 unsigned int type; #define MHEARD_MODE_TEXT 0x0001 #define MHEARD_MODE_ARP 0x0002 #define MHEARD_MODE_IP_DG 0x0004 #define MHEARD_MODE_IP_VC 0x0008 #define MHEARD_MODE_NETROM 0x0010 #define MHEARD_MODE_ROSE 0x0020 #define MHEARD_MODE_FLEXNET 0x0040 #define MHEARD_MODE_TEXNET 0x0080 #define MHEARD_MODE_PSATPB 0x0100 #define MHEARD_MODE_PSATFT 0x0200 #define MHEARD_MODE_SEGMENT 0x4000 #define MHEARD_MODE_UNKNOWN 0x8000 unsigned int mode; char spare[128]; }; #endif libax25-0.0.12-rc2+cvs20120204/netax25/procutils.h0000644000175000017500000001104411303536345016746 0ustar patpat/* LIBAX25 - Library for AX.25 programs * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat * and Alan Cox. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Support routines to simplify the reading of the /proc/net/ax25* and * /proc/net/nr* files. */ #ifndef _PROCUTILS_H #define _PROCUTILS_H #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifdef __cplusplus extern "C" { #endif struct proc_ax25_route { char call[10]; char dev[14]; int cnt; long t; struct proc_ax25_route *next; }; struct proc_ax25 { unsigned long magic; char dev[14]; char src_addr[10]; char dest_addr[10]; char digi_addr[8][11]; int ndigi; unsigned char st; unsigned short vs, vr, va; unsigned long t1timer, t1, t2timer, t2, t3timer, t3; unsigned long idletimer, idle; unsigned char n2count, n2; unsigned long rtt; unsigned char window; unsigned short paclen; unsigned short sndq, rcvq; unsigned long inode; struct proc_ax25 *next; }; struct proc_nr { char user_addr[10], dest_node[10], src_node[10]; char dev[14]; char my_circuit[6], ur_circuit[6]; unsigned char st; unsigned short vs, vr, va; unsigned long t1timer, t1, t2timer, t2, t4timer, t4; unsigned long idletimer, idle; unsigned char n2count, n2; unsigned char window; unsigned short sndq, rcvq; unsigned long inode; struct proc_nr *next; }; struct proc_nr_neigh { int addr; char call[10]; char dev[14]; int qual; int lock; int cnt; struct proc_nr_neigh *next; }; struct proc_nr_nodes { char call[10], alias[7]; unsigned char w, n; unsigned char qual1, qual2, qual3; unsigned char obs1, obs2, obs3; int addr1, addr2, addr3; struct proc_nr_nodes *next; }; struct proc_rs { char dest_addr[11], dest_call[10]; char src_addr[11], src_call[10]; char dev[14]; unsigned short lci; unsigned int neigh; unsigned char st; unsigned short vs, vr, va; unsigned short t, t1, t2, t3; unsigned short hb; unsigned long sndq, rcvq; struct proc_rs *next; }; struct proc_rs_route { unsigned short lci1; char address1[11], call1[10]; unsigned int neigh1; unsigned short lci2; char address2[11], call2[10]; unsigned int neigh2; struct proc_rs_route *next; }; struct proc_rs_neigh { int addr; char call[10]; char dev[14]; unsigned int count; unsigned int use; char mode[4]; char restart[4]; unsigned short t0, tf; struct proc_rs_neigh *next; }; struct proc_rs_nodes { char address[11]; unsigned char mask; unsigned char n; unsigned int neigh1, neigh2, neigh3; struct proc_rs_nodes *next; }; extern struct proc_ax25 *read_proc_ax25(void); extern void free_proc_ax25(struct proc_ax25 *ap); extern struct proc_ax25_route *read_proc_ax25_route(void); extern void free_proc_ax25_route(struct proc_ax25_route *rp); extern struct proc_nr *read_proc_nr(void); extern void free_proc_nr(struct proc_nr *); extern struct proc_nr_neigh *read_proc_nr_neigh(void); extern void free_proc_nr_neigh(struct proc_nr_neigh *np); extern struct proc_nr_nodes *read_proc_nr_nodes(void); extern void free_proc_nr_nodes(struct proc_nr_nodes *np); extern struct proc_rs *read_proc_rs(void); extern void free_proc_rs(struct proc_rs *); extern struct proc_rs_neigh *read_proc_rs_neigh(void); extern void free_proc_rs_neigh(struct proc_rs_neigh *); extern struct proc_rs_nodes *read_proc_rs_nodes(void); extern void free_proc_rs_nodes(struct proc_rs_nodes *); extern struct proc_rs_route *read_proc_rs_routes(void); extern void free_proc_rs_routes(struct proc_rs_route *); extern char *get_call(int uid); extern struct proc_ax25 *find_link(const char *src, const char *dest, const char *dev); extern struct proc_nr_neigh *find_neigh(int addr, struct proc_nr_neigh *neigh); extern struct proc_nr_nodes *find_node(char *addr, struct proc_nr_nodes *nodes); #ifdef _cplusplus } #endif #endif libax25-0.0.12-rc2+cvs20120204/netax25/ax25.h0000644000175000017500000001141211217265304015476 0ustar patpat/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _NETAX25_AX25_H #define _NETAX25_AX25_H 1 #include #include /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx. */ #define SOL_AX25 257 /* AX.25 flags: */ #define AX25_WINDOW 1 #define AX25_T1 2 #define AX25_T2 5 #define AX25_T3 4 #define AX25_N2 3 #define AX25_BACKOFF 6 #define AX25_EXTSEQ 7 #define AX25_PIDINCL 8 #define AX25_IDLE 9 #define AX25_PACLEN 10 #define AX25_IPMAXQUEUE 11 #define AX25_IAMDIGI 12 #define AX25_KILL 99 /* AX.25 socket ioctls: */ #define SIOCAX25GETUID (SIOCPROTOPRIVATE) #define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) #define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) #define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) #define SIOCAX25BPQADDR (SIOCPROTOPRIVATE+4) #define SIOCAX25GETPARMS (SIOCPROTOPRIVATE+5) #define SIOCAX25SETPARMS (SIOCPROTOPRIVATE+6) #define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) #define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) #define SIOCAX25GETINFO (SIOCPROTOPRIVATE+9) #define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) #define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) /* unknown: */ #define AX25_NOUID_DEFAULT 0 #define AX25_NOUID_BLOCK 1 #define AX25_SET_RT_IPMODE 2 /* Digipeating flags: */ #define AX25_DIGI_INBAND 0x01 /* Allow digipeating within port */ #define AX25_DIGI_XBAND 0x02 /* Allow digipeating across ports */ /* Maximim number of digipeaters: */ #define AX25_MAX_DIGIS 8 typedef struct { char ax25_call[7]; /* 6 call + SSID (shifted ascii) */ } ax25_address; struct sockaddr_ax25 { sa_family_t sax25_family; ax25_address sax25_call; int sax25_ndigis; }; /* * The sockaddr struct with the digipeater adresses: */ struct full_sockaddr_ax25 { struct sockaddr_ax25 fsa_ax25; ax25_address fsa_digipeater[AX25_MAX_DIGIS]; }; #define sax25_uid sax25_ndigis struct ax25_routes_struct { ax25_address port_addr; ax25_address dest_addr; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; /* The AX.25 ioctl structure: */ struct ax25_ctl_struct { ax25_address port_addr; ax25_address source_addr; ax25_address dest_addr; unsigned int cmd; unsigned long arg; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; struct ax25_info_struct { unsigned int n2, n2count; unsigned int t1, t1timer; unsigned int t2, t2timer; unsigned int t3, t3timer; unsigned int idle, idletimer; unsigned int state; unsigned int rcv_q, snd_q; }; struct ax25_fwd_struct { ax25_address port_from; ax25_address port_to; }; /* AX.25 route structure: */ struct ax25_route_opt_struct { ax25_address port_addr; ax25_address dest_addr; int cmd; int arg; }; /* AX.25 BPQ stuff: */ struct ax25_bpqaddr_struct { char dev[16]; ax25_address addr; }; /* Definitions for the AX.25 `values' fields: */ #define AX25_VALUES_IPDEFMODE 0 /* 'D'=DG 'V'=VC */ #define AX25_VALUES_AXDEFMODE 1 /* 8=Normal 128=Extended Seq Nos */ #define AX25_VALUES_NETROM 2 /* Allow NET/ROM - 0=No 1=Yes */ #define AX25_VALUES_TEXT 3 /* Allow PID=Text - 0=No 1=Yes */ #define AX25_VALUES_BACKOFF 4 /* 'E'=Exponential 'L'=Linear */ #define AX25_VALUES_CONMODE 5 /* Allow connected modes - 0=No 1=Yes */ #define AX25_VALUES_WINDOW 6 /* Default window size for standard AX.25 */ #define AX25_VALUES_EWINDOW 7 /* Default window size for extended AX.25 */ #define AX25_VALUES_T1 8 /* Default T1 timeout value */ #define AX25_VALUES_T2 9 /* Default T2 timeout value */ #define AX25_VALUES_T3 10 /* Default T3 timeout value */ #define AX25_VALUES_N2 11 /* Default N2 value */ #define AX25_VALUES_DIGI 12 /* Digipeat mode */ #define AX25_VALUES_IDLE 13 /* mode vc idle timer */ #define AX25_VALUES_PACLEN 14 /* AX.25 MTU */ #define AX25_VALUES_IPMAXQUEUE 15 /* Maximum number of buffers enqueued */ #define AX25_MAX_VALUES 20 struct ax25_parms_struct { ax25_address port_addr; unsigned short values[AX25_MAX_VALUES]; }; #endif /* netax25/ax25.h */ libax25-0.0.12-rc2+cvs20120204/netax25/CVS/0000755000175000017500000000000011713361515015204 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/netax25/CVS/Repository0000644000175000017500000000002011713361514017275 0ustar patpatlibax25/netax25 libax25-0.0.12-rc2+cvs20120204/netax25/CVS/Entries0000644000175000017500000000070211713361515016537 0ustar patpat/ax25.h/1.1/Sat Jun 20 23:03:32 2009/-ko/ /ax25io.h/1.1/Sat Jun 20 22:53:50 2009/-ko/ /axconfig.h/1.1/Sat Jun 20 22:53:50 2009/-ko/ /axlib.h/1.1/Sat Jun 20 22:53:50 2009/-ko/ /daemon.h/1.1/Sat Jun 20 22:53:50 2009/-ko/ /mheard.h/1.1/Sat Jun 20 22:53:51 2009/-ko/ /nrconfig.h/1.1/Sat Jun 20 22:53:51 2009/-ko/ /procutils.h/1.2/Thu Nov 26 17:37:41 2009/-ko/ /rsconfig.h/1.1/Sat Jun 20 22:53:51 2009/-ko/ /ttyutils.h/1.1/Sat Jun 20 22:53:51 2009/-ko/ D libax25-0.0.12-rc2+cvs20120204/netax25/CVS/Root0000644000175000017500000000005711713361514016053 0ustar patpat:pserver:cvs@cvs.linux-ax25.org:/home/ax25-cvs libax25-0.0.12-rc2+cvs20120204/netrose/0000755000175000017500000000000011713361515014742 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/netrose/rose.h0000644000175000017500000000620011217265305016060 0ustar patpat/* Definitions for Rose packet radio address family. Copyright (C) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* What follows is copied from the 2.1.93 . */ #ifndef _NETROSE_ROSE_H #define _NETROSE_ROSE_H 1 /* Socket level values. */ #define SOL_ROSE 260 /* These are the public elements of the Linux kernel Rose implementation. For kernel AX.25 see the file ax25.h. This file requires ax25.h for the definition of the ax25_address structure. */ #define ROSE_MTU 251 #define ROSE_MAX_DIGIS 6 #define ROSE_DEFER 1 #define ROSE_T1 2 #define ROSE_T2 3 #define ROSE_T3 4 #define ROSE_IDLE 5 #define ROSE_QBITINCL 6 #define ROSE_HOLDBACK 7 #define SIOCRSGCAUSE (SIOCPROTOPRIVATE + 0) #define SIOCRSSCAUSE (SIOCPROTOPRIVATE + 1) #define SIOCRSL2CALL (SIOCPROTOPRIVATE + 2) #define SIOCRSSL2CALL (SIOCPROTOPRIVATE + 2) #define SIOCRSACCEPT (SIOCPROTOPRIVATE + 3) #define SIOCRSCLRRT (SIOCPROTOPRIVATE + 4) #define SIOCRSGL2CALL (SIOCPROTOPRIVATE + 5) #define SIOCRSGFACILITIES (SIOCPROTOPRIVATE + 6) #define ROSE_DTE_ORIGINATED 0x00 #define ROSE_NUMBER_BUSY 0x01 #define ROSE_INVALID_FACILITY 0x03 #define ROSE_NETWORK_CONGESTION 0x05 #define ROSE_OUT_OF_ORDER 0x09 #define ROSE_ACCESS_BARRED 0x0B #define ROSE_NOT_OBTAINABLE 0x0D #define ROSE_REMOTE_PROCEDURE 0x11 #define ROSE_LOCAL_PROCEDURE 0x13 #define ROSE_SHIP_ABSENT 0x39 typedef struct { char rose_addr[5]; } rose_address; struct sockaddr_rose { sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; int srose_ndigis; ax25_address srose_digi; }; struct full_sockaddr_rose { sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; unsigned int srose_ndigis; ax25_address srose_digis[ROSE_MAX_DIGIS]; }; struct rose_route_struct { rose_address address; unsigned short int mask; ax25_address neighbour; char device[16]; unsigned char ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; struct rose_cause_struct { unsigned char cause; unsigned char diagnostic; }; struct rose_facilities_struct { rose_address source_addr, dest_addr; ax25_address source_call, dest_call; unsigned char source_ndigis, dest_ndigis; ax25_address source_digis[ROSE_MAX_DIGIS]; ax25_address dest_digis[ROSE_MAX_DIGIS]; unsigned int rand; rose_address fail_addr; ax25_address fail_call; }; #endif /* netrose/rose.h */ libax25-0.0.12-rc2+cvs20120204/netrose/CVS/0000755000175000017500000000000011713361515015375 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/netrose/CVS/Repository0000644000175000017500000000002011713361515017467 0ustar patpatlibax25/netrose libax25-0.0.12-rc2+cvs20120204/netrose/CVS/Entries0000644000175000017500000000005411713361515016730 0ustar patpat/rose.h/1.1/Sat Jun 20 23:03:33 2009/-ko/ D libax25-0.0.12-rc2+cvs20120204/netrose/CVS/Root0000644000175000017500000000005711713361515016245 0ustar patpat:pserver:cvs@cvs.linux-ax25.org:/home/ax25-cvs libax25-0.0.12-rc2+cvs20120204/AUTHORS0000644000175000017500000000007307264463671014347 0ustar patpatJonathan Naylor Tomi Manninen Jean-Paul ROUBELAT Alan Cox libax25-0.0.12-rc2+cvs20120204/axconfig.c0000644000175000017500000002017111712073315015223 0ustar patpat#define _LINUX_STRING_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pathnames.h" typedef struct _axport { struct _axport *Next; char *Name; char *Call; char *Device; int Baud; int Window; int Paclen; char *Description; } AX_Port; static AX_Port *ax25_ports = NULL; static AX_Port *ax25_port_tail = NULL; static int is_same_call(char *call1, char *call2) { if (!call1 || !call2) return 0; for (; *call1 && *call2; call1++, call2++) { if (*call1 == '-' || *call2 == '-') break; if (tolower(*call1 & 0xff) != tolower(*call2 & 0xff)) return 0; } if (!*call1 && !*call2) return 1; if (!*call1 && !strcmp(call2, "-0")) return 1; if (!*call2 && !strcmp(call1, "-0")) return 1; return (!strcmp(call1, call2) ? 1 : 0); } static AX_Port *ax25_port_ptr(char *name) { AX_Port *p = ax25_ports; if (name == NULL) return p; while (p != NULL) { if (p->Name != NULL && strcasecmp(p->Name, name) == 0) return p; if (p->Call != NULL && is_same_call(p->Call, name)) return p; p = p->Next; } return NULL; } char *ax25_config_get_next(char *name) { AX_Port *p; if (ax25_ports == NULL) return NULL; if (name == NULL) return ax25_ports->Name; if ((p = ax25_port_ptr(name)) == NULL) return NULL; p = p->Next; if (p == NULL) return NULL; return p->Name; } char *ax25_config_get_name(char *device) { AX_Port *p = ax25_ports; while (p != NULL) { if (p->Device != NULL) { if (strcmp(p->Device, device) == 0) return p->Name; } p = p->Next; } return NULL; } char *ax25_config_get_addr(char *name) { AX_Port *p = ax25_port_ptr(name); if (p == NULL) return NULL; return p->Call; } char *ax25_config_get_dev(char *name) { AX_Port *p = ax25_port_ptr(name); if (p == NULL) return NULL; return p->Device; } char *ax25_config_get_port(ax25_address *callsign) { AX_Port *p = ax25_ports; ax25_address addr; if (ax25_cmp(callsign, &null_ax25_address) == 0) return "*"; while (p != NULL) { if (p->Call != NULL) { ax25_aton_entry(p->Call, (char *)&addr); if (ax25_cmp(callsign, &addr) == 0) return p->Name; } p = p->Next; } return NULL; } int ax25_config_get_window(char *name) { AX_Port *p = ax25_port_ptr(name); if (p == NULL) return 0; return p->Window; } int ax25_config_get_paclen(char *name) { AX_Port *p = ax25_port_ptr(name); if (p == NULL) return 0; return p->Paclen; } int ax25_config_get_baud(char *name) { AX_Port *p = ax25_port_ptr(name); if (p == NULL) return 0; return p->Baud; } char *ax25_config_get_desc(char *name) { AX_Port *p = ax25_port_ptr(name); if (p == NULL) return NULL; return p->Description; } static int ax25_config_init_port(int fd, int lineno, char *line, const char **ifcalls, const char **ifdevs) { AX_Port *p; char *name, *call, *baud, *paclen, *window, *desc; const char *dev = NULL; int found; name = strtok(line, " \t"); call = strtok(NULL, " \t"); baud = strtok(NULL, " \t"); paclen = strtok(NULL, " \t"); window = strtok(NULL, " \t"); desc = strtok(NULL, ""); if (name == NULL || call == NULL || baud == NULL || paclen == NULL || window == NULL || desc == NULL) { fprintf(stderr, "axconfig: unable to parse line %d of axports file\n", lineno); return FALSE; } for (p = ax25_ports; p != NULL; p = p->Next) { if (p->Name != NULL && strcasecmp(name, p->Name) == 0) { fprintf(stderr, "axconfig: duplicate port name %s in line %d of axports file\n", name, lineno); return FALSE; } if (p->Call != NULL && is_same_call(call, p->Call)) { fprintf(stderr, "axconfig: duplicate callsign %s in line %d of axports file\n", call, lineno); return FALSE; } } if (atoi(baud) < 0) { fprintf(stderr, "axconfig: invalid baud rate setting %s in line %d of axports file\n", baud, lineno); return FALSE; } if (atoi(paclen) <= 0) { fprintf(stderr, "axconfig: invalid packet size setting %s in line %d of axports file\n", paclen, lineno); return FALSE; } if (atoi(window) <= 0) { fprintf(stderr, "axconfig: invalid window size setting %s in line %d of axports file\n", window, lineno); return FALSE; } strupr(call); found = 0; char *cp; if ((cp = strstr(call, "-0")) != NULL) *cp = '\0'; for (;ifcalls && *ifcalls; ++ifcalls, ++ifdevs) { if (strcmp(call, *ifcalls) == 0) { found = 1; dev = *ifdevs; break; } } if (!found) { #if 0 /* None of your business to complain about some port being down... */ fprintf(stderr, "axconfig: port with call '%s' is not active\n", call); #endif return FALSE; } if ((p = (AX_Port *)malloc(sizeof(AX_Port))) == NULL) { fprintf(stderr, "axconfig: out of memory!\n"); return FALSE; } p->Name = strdup(name); p->Call = strdup(call); p->Device = strdup(dev); p->Baud = atoi(baud); p->Window = atoi(window); p->Paclen = atoi(paclen); p->Description = strdup(desc); if (ax25_ports == NULL) ax25_ports = p; else ax25_port_tail->Next = p; ax25_port_tail = p; p->Next = NULL; return TRUE; } int ax25_config_load_ports(void) { FILE *fp = NULL; char buffer[256], *s; int fd = -1, lineno = 1, n = 0, i; const char **calllist = NULL; const char **devlist = NULL; const char **pp; int callcount = 0; struct ifreq ifr; /* Reliable listing of all network ports on Linux is only available via reading /proc/net/dev ... */ if ((fd = socket(PF_FILE, SOCK_DGRAM, 0)) < 0) { fprintf(stderr, "axconfig: unable to open socket (%s)\n", strerror(errno)); goto cleanup; } if ((fp = fopen("/proc/net/dev", "r"))) { /* Two header lines.. */ s = fgets(buffer, sizeof(buffer), fp); s = fgets(buffer, sizeof(buffer), fp); /* .. then network interface names */ while (!feof(fp)) { if (!fgets(buffer, sizeof(buffer), fp)) break; s = strchr(buffer, ':'); if (s) *s = 0; s = buffer; while (isspace(*s & 0xff)) ++s; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, s, IFNAMSIZ-1); ifr.ifr_name[IFNAMSIZ-1] = 0; if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { fprintf(stderr, "axconfig: SIOCGIFHWADDR: %s\n", strerror(errno)); return FALSE; } if (ifr.ifr_hwaddr.sa_family != ARPHRD_AX25) continue; /* store found interface callsigns */ /* ax25_ntoa() returns pointer to static buffer */ s = ax25_ntoa((void*)ifr.ifr_hwaddr.sa_data); if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { fprintf(stderr, "axconfig: SIOCGIFFLAGS: %s\n", strerror(errno)); return FALSE; } if (!(ifr.ifr_flags & IFF_UP)) continue; if ((pp = realloc(calllist, sizeof(char *) * (callcount+2))) == 0) break; calllist = pp; if ((pp = realloc(devlist, sizeof(char *) * (callcount+2))) == 0) break; devlist = pp; if ((calllist[callcount] = strdup(s)) != NULL) { if ((devlist[callcount] = strdup(ifr.ifr_name)) != NULL) { ++callcount; calllist[callcount] = NULL; devlist [callcount] = NULL; } else { free((void*)calllist[callcount]); calllist[callcount] = NULL; } } } fclose(fp); fp = NULL; } if ((fp = fopen(CONF_AXPORTS_FILE, "r")) == NULL) { fprintf(stderr, "axconfig: unable to open axports file %s (%s)\n", CONF_AXPORTS_FILE, strerror(errno)); goto cleanup; } while (fp && fgets(buffer, 255, fp)) { if ((s = strchr(buffer, '\n'))) *s = '\0'; if (strlen(buffer) > 0 && *buffer != '#') if (ax25_config_init_port(fd, lineno, buffer, calllist, devlist)) n++; lineno++; } cleanup:; if (fd >= 0) close(fd); if (fp) fclose(fp); for(i = 0; calllist && calllist[i]; ++i) { free((void*)calllist[i]); if (devlist[i] != NULL) free((void*)devlist[i]); } if (calllist) free(calllist); if (devlist) free(devlist); if (ax25_ports == NULL) return 0; return n; } libax25-0.0.12-rc2+cvs20120204/.cvsignore0000644000175000017500000000042511221527650015262 0ustar patpat*.o *.lo aclocal.m4 autom4te.cache config.cache config.guess config.h config.h.in config.log config.status config.sub configure depcomp install-sh libax25.spec ltmain.sh missing Makefile Makefile.in .deps stamp-h .libs libtool libax25.la libax25io.la libax25-*.tar.gz stamp-h1 libax25-0.0.12-rc2+cvs20120204/glibc.patch0000644000175000017500000000524107264463720015375 0ustar patpat--- netax25/ax25.h.orig Fri Apr 30 13:59:17 1999 +++ netax25/ax25.h Fri Apr 30 14:17:16 1999 @@ -36,6 +36,7 @@ #define AX25_IDLE 9 #define AX25_PACLEN 10 #define AX25_IPMAXQUEUE 11 +#define AX25_IAMDIGI 12 #define AX25_KILL 99 /* AX.25 socket ioctls: */ @@ -48,6 +49,9 @@ #define SIOCAX25SETPARMS (SIOCPROTOPRIVATE+6) #define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) #define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) +#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+9) +#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) +#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) /* unknown: */ #define AX25_NOUID_DEFAULT 0 @@ -101,6 +105,25 @@ ax25_address dest_addr; unsigned int cmd; unsigned long arg; + unsigned char digi_count; + ax25_address digi_addr[AX25_MAX_DIGIS]; + }; + +struct ax25_info_struct + { + unsigned int n2, n2count; + unsigned int t1, t1timer; + unsigned int t2, t2timer; + unsigned int t3, t3timer; + unsigned int idle, idletimer; + unsigned int state; + unsigned int rcv_q, snd_q; + }; + +struct ax25_fwd_struct + { + ax25_address port_from; + ax25_address port_to; }; /* AX.25 route structure: */ --- netrom/netrom.h.orig Fri Apr 30 14:17:53 1999 +++ netrom/netrom.h Fri Apr 30 14:19:52 1999 @@ -29,6 +29,7 @@ #define NETROM_T2 2 #define NETROM_N2 3 #define NETROM_PACLEN 5 +#define NETROM_T4 6 #define NETROM_KILL 99 @@ -45,6 +46,8 @@ char mnemonic[7]; ax25_address neighbour; unsigned int obs_count; + unsigned int ndigis; + ax25_address digipeaters[AX25_MAX_DIGIS]; }; /* NetRom socket ioctls: */ --- netrose/rose.h.orig Fri Apr 30 14:20:41 1999 +++ netrose/rose.h Fri Apr 30 14:24:55 1999 @@ -46,6 +46,7 @@ #define SIOCRSACCEPT (SIOCPROTOPRIVATE + 3) #define SIOCRSCLRRT (SIOCPROTOPRIVATE + 4) #define SIOCRSGL2CALL (SIOCPROTOPRIVATE + 5) +#define SIOCRSGFACILITIES (SIOCPROTOPRIVATE + 6) #define ROSE_DTE_ORIGINATED 0x00 #define ROSE_NUMBER_BUSY 0x01 @@ -73,6 +74,15 @@ ax25_address srose_digi; }; +struct full_sockaddr_rose +{ + sa_family_t srose_family; + rose_address srose_addr; + ax25_address srose_call; + unsigned int srose_ndigis; + ax25_address srose_digis[ROSE_MAX_DIGIS]; +}; + struct rose_route_struct { rose_address address; @@ -87,6 +97,18 @@ { unsigned char cause; unsigned char diagnostic; +}; + +struct rose_facilities_struct +{ + rose_address source_addr, dest_addr; + ax25_address source_call, dest_call; + unsigned char source_ndigis, dest_ndigis; + ax25_address source_digis[ROSE_MAX_DIGIS]; + ax25_address dest_digis[ROSE_MAX_DIGIS]; + unsigned int rand; + rose_address fail_addr; + ax25_address fail_call; }; #endif /* netrose/rose.h */ libax25-0.0.12-rc2+cvs20120204/daemon.c0000644000175000017500000000254211217264176014701 0ustar patpat#include #include #include #include #include #include #include #include #include #include int daemon_start(int ignsigcld) { /* Code to initialiaze a daemon process. Taken from _UNIX Network */ /* Programming_ pp.72-85, by W. Richard Stephens, Prentice */ /* Hall PTR, 1990 */ int childpid, fd; /* If started by init, don't bother */ if (getppid() == 1) goto out; /* Ignore the terminal stop signals */ signal(SIGTTOU, SIG_IGN); signal(SIGTTIN, SIG_IGN); signal(SIGTSTP, SIG_IGN); /* Fork and let parent exit, insures we're not a process group leader */ if ((childpid = fork()) < 0) { return 0; } else if (childpid > 0) { exit(0); } /* Disassociate from controlling terminal and process group. */ /* Ensure the process can't reacquire a new controlling terminal. */ if (setpgrp() == -1) return 0; if ((fd = open("/dev/tty", O_RDWR)) >= 0) { /* loose controlling tty */ ioctl(fd, TIOCNOTTY, NULL); close(fd); } out: /* Move the current directory to root, to make sure we aren't on a */ /* mounted filesystem. */ chdir("/"); /* Clear any inherited file mode creation mask. */ umask(0); if (ignsigcld) signal(SIGCHLD, SIG_IGN); /* That's it, we're a "daemon" process now */ return 1; } libax25-0.0.12-rc2+cvs20120204/pathnames.h0000644000175000017500000000141207264463746015431 0ustar patpat/* * pathnames.h : Paths that are used by the library */ /* * AX25_SYSCONFDIR is defined in the Makefile!! */ #define CONF_AXPORTS_FILE AX25_SYSCONFDIR"axports" #define CONF_NRPORTS_FILE AX25_SYSCONFDIR"nrports" #define CONF_RSPORTS_FILE AX25_SYSCONFDIR"rsports" #define PROC_AX25_FILE "/proc/net/ax25" #define PROC_AX25_ROUTE_FILE "/proc/net/ax25_route" #define PROC_AX25_CALLS_FILE "/proc/net/ax25_calls" #define PROC_NR_FILE "/proc/net/nr" #define PROC_NR_NEIGH_FILE "/proc/net/nr_neigh" #define PROC_NR_NODES_FILE "/proc/net/nr_nodes" #define PROC_RS_FILE "/proc/net/rose" #define PROC_RS_NEIGH_FILE "/proc/net/rose_neigh" #define PROC_RS_NODES_FILE "/proc/net/rose_nodes" #define PROC_RS_ROUTES_FILE "/proc/net/rose_routes" #define LOCK_SERIAL_DIR "/var/lock" libax25-0.0.12-rc2+cvs20120204/netrom/0000755000175000017500000000000011713361515014567 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/netrom/netrom.h0000644000175000017500000000435711217265304016253 0ustar patpat/* Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _NETROM_NETROM_H #define _NETROM_NETROM_H 1 #include /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx. */ #define SOL_NETROM 259 /* NetRom control values: */ #define NETROM_T1 1 #define NETROM_T2 2 #define NETROM_N2 3 #define NETROM_PACLEN 5 #define NETROM_T4 6 #define NETROM_IDLE 7 #define NETROM_KILL 99 /* Type of route: */ #define NETROM_NEIGH 0 #define NETROM_NODE 1 struct nr_route_struct { int type; ax25_address callsign; char device[16]; unsigned int quality; char mnemonic[7]; ax25_address neighbour; unsigned int obs_count; unsigned int ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; /* NetRom socket ioctls: */ #define SIOCNRGETPARMS (SIOCPROTOPRIVATE+0) #define SIOCNRSETPARMS (SIOCPROTOPRIVATE+1) #define SIOCNRDECOBS (SIOCPROTOPRIVATE+2) #define SIOCNRRTCTL (SIOCPROTOPRIVATE+3) #define SIOCNRCTLCON (SIOCPROTOPRIVATE+4) /* NetRom parameter structure: */ struct nr_parms_struct { unsigned int quality; unsigned int obs_count; unsigned int ttl; unsigned int timeout; unsigned int ack_delay; unsigned int busy_delay; unsigned int tries; unsigned int window; unsigned int paclen; }; /* NetRom control structure: */ struct nr_ctl_struct { unsigned char index; unsigned char id; unsigned int cmd; unsigned long arg; }; #endif /* netrom/netrom.h */ libax25-0.0.12-rc2+cvs20120204/netrom/CVS/0000755000175000017500000000000011713361515015222 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/netrom/CVS/Repository0000644000175000017500000000001711713361515017322 0ustar patpatlibax25/netrom libax25-0.0.12-rc2+cvs20120204/netrom/CVS/Entries0000644000175000017500000000005611713361515016557 0ustar patpat/netrom.h/1.1/Sat Jun 20 23:03:32 2009/-ko/ D libax25-0.0.12-rc2+cvs20120204/netrom/CVS/Root0000644000175000017500000000005711713361515016072 0ustar patpat:pserver:cvs@cvs.linux-ax25.org:/home/ax25-cvs libax25-0.0.12-rc2+cvs20120204/nrports0000644000175000017500000000021310774705515014721 0ustar patpat# /etc/ax25/nrports # # The format of this file is: # # name callsign alias paclen description # #netrom OH2BNS-10 #LNODE 235 Switch Port libax25-0.0.12-rc2+cvs20120204/nrconfig.c0000644000175000017500000001751011712073315015235 0ustar patpat#define _LINUX_STRING_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pathnames.h" #include #include typedef struct _nrport { struct _nrport *Next; char *Name; char *Call; char *Alias; char *Device; int Paclen; char *Description; } NR_Port; static NR_Port *nr_ports = NULL; static NR_Port *nr_port_tail = NULL; static int is_same_call(char *call1, char *call2) { if (!call1 || !call2) return 0; for (; *call1 && *call2; call1++, call2++) { if (*call1 == '-' || *call2 == '-') break; if (tolower(*call1 & 0xff) != tolower(*call2 & 0xff)) return 0; } if (!*call1 && !*call2) return 1; if (!*call1 && !strcmp(call2, "-0")) return 1; if (!*call2 && !strcmp(call1, "-0")) return 1; return (!strcmp(call1, call2) ? 1 : 0); } static NR_Port *nr_port_ptr(char *name) { NR_Port *p = nr_ports; if (name == NULL) return p; while (p != NULL) { if (p->Name != NULL && strcasecmp(name, p->Name) == 0) return p; p = p->Next; } return NULL; } char *nr_config_get_next(char *name) { NR_Port *p; if (nr_ports == NULL) return NULL; if (name == NULL) return nr_ports->Name; if ((p = nr_port_ptr(name)) == NULL) return NULL; p = p->Next; if (p == NULL) return NULL; return p->Name; } char *nr_config_get_name(char *device) { NR_Port *p = nr_ports; while (p != NULL) { if (p->Device != NULL && strcmp(device, p->Device) == 0) return p->Name; p = p->Next; } return NULL; } char *nr_config_get_addr(char *name) { NR_Port *p = nr_port_ptr(name); if (p == NULL) return NULL; return p->Call; } char *nr_config_get_dev(char *name) { NR_Port *p = nr_port_ptr(name); if (p == NULL) return NULL; return p->Device; } char *nr_config_get_port(ax25_address *callsign) { NR_Port *p = nr_ports; ax25_address addr; while (p != NULL) { if (p->Call != NULL) { ax25_aton_entry(p->Call, (char *)&addr); if (ax25_cmp(callsign, &addr) == 0) return p->Name; } p = p->Next; } return NULL; } char *nr_config_get_alias(char *name) { NR_Port *p = nr_port_ptr(name); if (p == NULL) return NULL; return p->Alias; } int nr_config_get_paclen(char *name) { NR_Port *p = nr_port_ptr(name); if (p == NULL) return 0; return p->Paclen; } char *nr_config_get_desc(char *name) { NR_Port *p = nr_port_ptr(name); if (p == NULL) return NULL; return p->Description; } static int nr_config_init_port(int fd, int lineno, char *line, const char **ifcalls, const char **ifdevs) { NR_Port *p; char *name, *call, *alias, *paclen, *desc; const char *dev = NULL; int found = 0; name = strtok(line, " \t"); call = strtok(NULL, " \t"); alias = strtok(NULL, " \t"); paclen = strtok(NULL, " \t"); desc = strtok(NULL, ""); if (name == NULL || call == NULL || alias == NULL || paclen == NULL || desc == NULL) { fprintf(stderr, "nrconfig: unable to parse line %d of config file\n", lineno); return FALSE; } for (p = nr_ports; p != NULL; p = p->Next) { if (p->Name != NULL && strcasecmp(name, p->Name) == 0) { fprintf(stderr, "nrconfig: duplicate port name %s in line %d of config file\n", name, lineno); return FALSE; } if (p->Call != NULL && is_same_call(call, p->Call)) { fprintf(stderr, "nrconfig: duplicate callsign %s in line %d of config file\n", call, lineno); return FALSE; } if (p->Alias != NULL && strcasecmp(alias, p->Alias) == 0) { fprintf(stderr, "nrconfig: duplicate alias %s in line %d of config file\n", alias, lineno); return FALSE; } } if (atoi(paclen) <= 0) { fprintf(stderr, "nrconfig: invalid packet size %s in line %d of config file\n", paclen, lineno); return FALSE; } strupr(call); strupr(alias); char *cp; if ((cp = strstr(call, "-0")) != NULL) *cp = 0; found = 0; for (;ifcalls && *ifcalls; ++ifcalls, ++ifdevs) { if (strcmp(call, *ifcalls) == 0) { found = 1; dev = *ifdevs; break; } } if (!found) { #if 0 /* None of your business to complain about some port being down... */ fprintf(stderr, "nrconfig: port %s not active\n", name); #endif return FALSE; } if ((p = (NR_Port *)malloc(sizeof(NR_Port))) == NULL) { fprintf(stderr, "nrconfig: out of memory!\n"); return FALSE; } p->Name = strdup(name); p->Call = strdup(call); p->Alias = strdup(alias); p->Device = strdup(dev); p->Paclen = atoi(paclen); p->Description = strdup(desc); if (nr_ports == NULL) nr_ports = p; else nr_port_tail->Next = p; nr_port_tail = p; p->Next = NULL; return TRUE; } int nr_config_load_ports(void) { FILE *fp = NULL; char buffer[256], *s; int fd = -1, lineno = 1, n = 0, i; const char **calllist = NULL; const char **devlist = NULL; const char **pp; int callcount = 0; struct ifreq ifr; /* Reliable listing of all network ports on Linux is only available via reading /proc/net/dev ... */ if ((fd = socket(PF_FILE, SOCK_DGRAM, 0)) < 0) { fprintf(stderr, "nrconfig: unable to open socket (%s)\n", strerror(errno)); goto cleanup; } if ((fp = fopen("/proc/net/dev", "r"))) { /* Two header lines.. */ s = fgets(buffer, sizeof(buffer), fp); s = fgets(buffer, sizeof(buffer), fp); /* .. then network interface names */ while (!feof(fp)) { if (!fgets(buffer, sizeof(buffer), fp)) break; s = strchr(buffer, ':'); if (s) *s = 0; s = buffer; while (isspace(*s & 0xff)) ++s; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, s, IFNAMSIZ-1); ifr.ifr_name[IFNAMSIZ-1] = 0; if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { fprintf(stderr, "nrconfig: SIOCGIFHWADDR: %s\n", strerror(errno)); return FALSE; } if (ifr.ifr_hwaddr.sa_family != ARPHRD_NETROM) continue; /* store found interface callsigns */ /* ax25_ntoa() returns pointer to static buffer */ s = ax25_ntoa((void*)ifr.ifr_hwaddr.sa_data); if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { fprintf(stderr, "nrconfig: SIOCGIFFLAGS: %s\n", strerror(errno)); return FALSE; } if (!(ifr.ifr_flags & IFF_UP)) continue; if ((pp = realloc(calllist, sizeof(char *) * (callcount+2))) == 0) break; calllist = pp; if ((pp = realloc(devlist, sizeof(char *) * (callcount+2))) == 0) break; devlist = pp; if ((calllist[callcount] = strdup(s)) != NULL) { if ((devlist[callcount] = strdup(ifr.ifr_name)) != NULL) { ++callcount; calllist[callcount] = NULL; devlist [callcount] = NULL; } else { free((void*)calllist[callcount]); calllist[callcount] = NULL; devlist[callcount] = NULL; } } } fclose(fp); fp = NULL; } if ((fp = fopen(CONF_NRPORTS_FILE, "r")) == NULL) { fprintf(stderr, "nrconfig: unable to open nrports file %s (%s)\n", CONF_NRPORTS_FILE, strerror(errno)); goto cleanup; } while (fp && fgets(buffer, 255, fp)) { if ((s = strchr(buffer, '\n'))) *s = '\0'; if (strlen(buffer) > 0 && *buffer != '#') if (nr_config_init_port(fd, lineno, buffer, calllist, devlist)) n++; lineno++; } cleanup:; if (fd >= 0) close(fd); if (fp) fclose(fp); for(i = 0; calllist && calllist[i]; ++i) { free((void*)calllist[i]); if (devlist[i] != NULL) free((void*)devlist[i]); } if (calllist) free(calllist); if (devlist) free(devlist); if (nr_ports == NULL) return 0; return n; } libax25-0.0.12-rc2+cvs20120204/ChangeLog0000644000175000017500000000525311712073316015040 0ustar patpat * Interfaces with a callsign without SSID were not been found anymore after the last patch below. See cvs comment for detail. Affected files: axconfig.c, nrconfig.c and procutils.c. -- Thomas Osterried DL9SAU Wed, 01 Feb 2012 00:10:45 +0100 * ax25_ntoa() does no longer print a zero SSID. This avoids addresses like AB3DEF-0 which is general convention anyway. -- Ralf Baechle DL5RB Thu, 10 Sep 2009 18:52:00 +0200 libax25 0.0.12 * Fix numerous warnings triggered by modern compilers * Updated to recent autoconf and automake version to keep the code buildable on modern distributions. * libax25 will again find AX.25 interfaces if if they do not have an IP address assigned. * Add support for building rpm packages. -- Ralf Baechle DL5RB Sat, 6 Jun 2009 17:00:00 +0100 libax25 0.0.11 * libax25io handles nonblocking io correctly. (PE1RXQ) THIS BREAKS PRACTICLY EVERY APP USING THIS LIBRARY, FIX THEM!!! -- Craig Small Fri, 21 Feb 2003 21:33:48 +1100 libax25 0.0.10 * Fixed byte counting in flush_obuf() (PE1RXQ) * Fixed buffer overflow in flush_obuf() (PE1RXQ) * axio_flush() actually flushes the buffer (PE1RXQ) -- Craig Small Fri, 29 Mar 2002 08:54:20 +1100 libax25 0.0.9 * Updated config.guess and config.sub for hppa * Updated stuff for new libtool -- Craig Small Tue, 28 Aug 2001 10:20:18 +1000 libax25 0.0.8 * Included ax25.h and rose.h for axlib.h Closes Debian bug #64102 -- Craig Small NEVER RELEASED libax25 0.0.7 * Added Tomi's patch to fix glibc 2.0 includes -- Craig Small Mon, 23 Aug 1999 11:23:40 +1000 libax25 0.0.6 * Fixed pathnames.h typo * Fixed instructions -- Craig Small , 19 Jul 1999 libax25 0.0.5 * More patches from Tomi for ax25io stuff * Cleaner way of naming config files * The licence use is now obvious * Added axports, rsports and nrports plus their man pages -- Craig Small , 5 Jul 1999 libax25 0.0.4 * Made some more functions use const args * Split the libaxio library out -- Craig Small , 30 Apr 1999 libax25 0.0.3 * Added Jean-Pauls ROSE patches * Changed all the convert names to ntoa type names * Added Tomi's axio stuff * Started writing ax25.3 and rose.3 -- Craig Small , 20 Apr 1999 libax25 0.0.2 * Initial version from Terry Dawson's code, split from the old ax25-utils package. -- Craig Small , 2 Apr 1999 libax25-0.0.12-rc2+cvs20120204/rsports0000644000175000017500000000015710774705515014735 0ustar patpat# /etc/ax25/rsports # # The format of this file is: # # name address description # #rose 2080192203 Rose port libax25-0.0.12-rc2+cvs20120204/axports0000644000175000017500000000031010774705515014710 0ustar patpat# /etc/ax25/axports # # The format of this file is: # # name callsign speed paclen window description # #1 OH2BNS-1 1200 255 2 144.675 MHz (1200 bps) #2 OH2BNS-9 38400 255 7 TNOS/Linux (38400 bps) libax25-0.0.12-rc2+cvs20120204/ttyutils.c0000644000175000017500000000511111217264176015332 0ustar patpat#include #include #include #include #include #include #include #include "pathnames.h" static struct speed_struct { int user_speed; speed_t termios_speed; } speed_table[] = { {300, B300}, {600, B600}, {1200, B1200}, {2400, B2400}, {4800, B4800}, {9600, B9600}, {19200, B19200}, {38400, B38400}, #ifdef B57600 {57600, B57600}, #endif #ifdef B115200 {115200, B115200}, #endif #ifdef B230400 {230400, B230400}, #endif #ifdef B460800 {460800, B460800}, #endif {-1, B0} }; int tty_raw(int fd, int hwflag) { struct termios term; if (tcgetattr(fd, &term) == -1) { perror("tty_raw: tcgetattr"); return FALSE; } term.c_cc[VMIN] = 1; term.c_cc[VTIME] = 0; term.c_iflag = IGNBRK | IGNPAR; term.c_oflag = 0; term.c_lflag = 0; #ifdef CIBAUD term.c_cflag = (term.c_cflag & (CBAUD | CIBAUD)) | CREAD | CS8 | CLOCAL; #else term.c_cflag = (term.c_cflag & CBAUD) | CREAD | CS8 | CLOCAL; #endif if (hwflag) term.c_cflag |= CRTSCTS; if (tcsetattr(fd, TCSANOW, &term) == -1) { perror("tty_raw: tcsetattr"); return FALSE; } return TRUE; } int tty_speed(int fd, int speed) { struct termios term; struct speed_struct *s; for (s = speed_table; s->user_speed != -1; s++) if (s->user_speed == speed) break; if (s->user_speed == -1) { fprintf(stderr, "tty_speed: invalid speed %d\n", speed); return FALSE; } if (tcgetattr(fd, &term) == -1) { perror("tty_speed: tcgetattr"); return FALSE; } cfsetispeed(&term, s->termios_speed); cfsetospeed(&term, s->termios_speed); if (tcsetattr(fd, TCSANOW, &term) == -1) { perror("tty_speed: tcsetattr"); return FALSE; } return TRUE; } int tty_is_locked(char *tty) { char buffer[50], *s; FILE *fp; int pid = 0; if ((s = strrchr(tty, '/')) != NULL) s++; else s = tty; sprintf(buffer, "%s/LCK..%s", LOCK_SERIAL_DIR, s); if ((fp = fopen(buffer, "r")) == NULL) return FALSE; if (fscanf(fp, "%d", &pid) != 1) { fclose(fp); return FALSE; } fclose(fp); if (kill(pid, 0) == 0) return TRUE; return FALSE; } int tty_lock(char *tty) { char buffer[50], *s; FILE *fp; if ((s = strrchr(tty, '/')) != NULL) s++; else s = tty; sprintf(buffer, "%s/LCK..%s", LOCK_SERIAL_DIR, s); if ((fp = fopen(buffer, "w")) == NULL) return FALSE; fprintf(fp, "%10d\n", getpid()); fclose(fp); return TRUE; } int tty_unlock(char *tty) { char buffer[50], *s; if ((s = strrchr(tty, '/')) != NULL) s++; else s = tty; sprintf(buffer, "%s/LCK..%s", LOCK_SERIAL_DIR, s); return unlink(buffer) == 0; } libax25-0.0.12-rc2+cvs20120204/rsconfig.c0000644000175000017500000001454411217264176015255 0ustar patpat#define _LINUX_STRING_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pathnames.h" typedef struct _rsport { struct _rsport *Next; char *Name; char *Addr; char *Device; char *Description; } RS_Port; static RS_Port *rs_ports = NULL; static RS_Port *rs_port_tail = NULL; static RS_Port *rs_port_ptr(char *name) { RS_Port *p = rs_ports; if (name == NULL) return p; while (p != NULL) { if (p->Name != NULL) { if (strcasecmp(name, p->Name) == 0) return p; } p = p->Next; } return NULL; } char *rs_config_get_next(char *name) { RS_Port *p; if (rs_ports == NULL) return NULL; if (name == NULL) return rs_ports->Name; if ((p = rs_port_ptr(name)) == NULL) return NULL; p = p->Next; if (p == NULL) return NULL; return p->Name; } char *rs_config_get_name(char *device) { RS_Port *p = rs_ports; while (p != NULL) { if (p->Device != NULL) { if (strcmp(device, p->Device) == 0) return p->Name; } p = p->Next; } return NULL; } char *rs_config_get_addr(char *name) { RS_Port *p = rs_port_ptr(name); if (p == NULL) return NULL; return p->Addr; } char *rs_config_get_dev(char *name) { RS_Port *p = rs_port_ptr(name); if (p == NULL) return NULL; return p->Device; } char *rs_config_get_port(rose_address *address) { RS_Port *p = rs_ports; rose_address addr; while (p != NULL) { if (p->Addr != NULL) { rose_aton(p->Addr, addr.rose_addr); if (rose_cmp(address, &addr) == 0) return p->Name; } p = p->Next; } return NULL; } char *rs_config_get_desc(char *name) { RS_Port *p = rs_port_ptr(name); if (p == NULL) return NULL; return p->Description; } int rs_config_get_paclen(char *name) { return 128; } static int rs_config_init_port(int fd, int lineno, char *line, const char **ifcalls, const char **ifdevs) { RS_Port *p; char *name, *addr, *desc; const char *dev = NULL; int found = 0; name = strtok(line, " \t"); addr = strtok(NULL, " \t"); desc = strtok(NULL, ""); if (name == NULL || addr == NULL || desc == NULL) { fprintf(stderr, "rsconfig: unable to parse line %d of config file\n", lineno); return FALSE; } for (p = rs_ports; p != NULL; p = p->Next) { if (p->Name != NULL && strcasecmp(name, p->Name) == 0) { fprintf(stderr, "rsconfig: duplicate port name %s in line %d of config file\n", name, lineno); return FALSE; } if (p->Addr != NULL && strcasecmp(addr, p->Addr) == 0) { fprintf(stderr, "rsconfig: duplicate address %s in line %d of config file\n", addr, lineno); return FALSE; } } found = 0; for (;ifcalls && *ifcalls; ++ifcalls, ++ifdevs) { if (strcmp(addr,*ifcalls) == 0) { found = 1; dev = *ifdevs; break; } } if (!found) { #if 0 /* None of your business to complain about some port being down... */ fprintf(stderr, "rsconfig: port %s not active\n", name); #endif return FALSE; } if ((p = (RS_Port *)malloc(sizeof(RS_Port))) == NULL) { fprintf(stderr, "rsconfig: out of memory!\n"); return FALSE; } p->Name = strdup(name); p->Addr = strdup(addr); p->Device = strdup(dev); p->Description = strdup(desc); if (rs_ports == NULL) rs_ports = p; else rs_port_tail->Next = p; rs_port_tail = p; p->Next = NULL; return TRUE; } int rs_config_load_ports(void) { FILE *fp = NULL; char buffer[256], *s; int fd, lineno = 1, n = 0, i; const char **calllist = NULL; const char **devlist = NULL; const char **pp; int callcount = 0; struct ifreq ifr; /* Reliable listing of all network ports on Linux is only available via reading /proc/net/dev ... */ if ((fd = socket(PF_FILE, SOCK_DGRAM, 0)) < 0) { fprintf(stderr, "rsconfig: unable to open socket (%s)\n", strerror(errno)); goto cleanup; } if ((fp = fopen("/proc/net/dev", "r"))) { /* Two header lines.. */ s = fgets(buffer, sizeof(buffer), fp); s = fgets(buffer, sizeof(buffer), fp); /* .. then network interface names */ while (!feof(fp)) { if (!fgets(buffer, sizeof(buffer), fp)) break; s = strchr(buffer, ':'); if (s) *s = 0; s = buffer; while (isspace(*s & 0xff)) ++s; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, s, IFNAMSIZ-1); ifr.ifr_name[IFNAMSIZ-1] = 0; if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { fprintf(stderr, "rsconfig: SIOCGIFHWADDR: %s\n", strerror(errno)); return FALSE; } if (ifr.ifr_hwaddr.sa_family != ARPHRD_ROSE) continue; /* store found interface callsigns */ /* rose_ntoa() returns pointer to static buffer */ s = rose_ntoa((void*)ifr.ifr_hwaddr.sa_data); if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { fprintf(stderr, "rsconfig: SIOCGIFFLAGS: %s\n", strerror(errno)); return FALSE; } if (!(ifr.ifr_flags & IFF_UP)) continue; if ((pp = realloc(calllist, sizeof(char *) * (callcount+2))) == 0) break; calllist = pp; if ((pp = realloc(devlist, sizeof(char *) * (callcount+2))) == 0) break; devlist = pp; if ((calllist[callcount] = strdup(s)) != NULL) { if ((devlist[callcount] = strdup(ifr.ifr_name)) != NULL) { ++callcount; calllist[callcount] = NULL; devlist [callcount] = NULL; } else { free((void*)calllist[callcount]); } } } fclose(fp); fp = NULL; } if ((fp = fopen(CONF_RSPORTS_FILE, "r")) == NULL) { fprintf(stderr, "rsconfig: unable to open axports file %s (%s)\n", CONF_RSPORTS_FILE, strerror(errno)); goto cleanup; } while (fp && fgets(buffer, 255, fp)) { if ((s = strchr(buffer, '\n'))) *s = '\0'; if (strlen(buffer) > 0 && *buffer != '#') if (rs_config_init_port(fd, lineno, buffer, calllist, devlist)) n++; lineno++; } cleanup:; if (fd >= 0) close(fd); if (fp) fclose(fp); for(i = 0; calllist && calllist[i]; ++i) { free((void*)calllist[i]); if (devlist[i] != NULL) free((void*)devlist[i]); } if (calllist) free(calllist); if (devlist) free(devlist); if (rs_ports == NULL) return 0; return n; } libax25-0.0.12-rc2+cvs20120204/nrports.50000644000175000017500000000263207264463746015102 0ustar patpat.TH NRPORTS 5 "2 August 1996" Linux "Linux Programmer's Manual" .SH NAME nrports \- NET/ROM port configuration file. .SH DESCRIPTION .LP .B Nrports is an ASCII file that contains information about each of the NET/ROM ports that are to be used. When dealing with an NET/ROM utility such as .B call, it takes an optional argument that is the port name. This port name is a reference to the line within .B nrports, which has the same name. The information on each line contains enough information to bind the command to a particular NET/ROM interface, this binding is done by matching the callsign on the line in .B nrports with the callsign of the port set by .B ifconfig. .LP The .B nrports file may contain comments that begin with a # in the first column, or a port description in the following format, each field being delimited by white space: .sp .RS name callsign alias paclen description .RE .sp The field descriptions are: .sp .RS .TP 14 .B name this is the unique NET/ROM port identifier. .TP 14 .B callsign the callsign of the NET/ROM interface to bind to. .TP 14 .B alias this is the alias of the NET/ROM port. .TP 14 .B paclen is the default packet size for this interface. .TP 14 .B description a free format description of this interface, this field extends to the end of the line. It may contain spaces. .RE .SH FILES .LP /etc/ax25/nrports .SH "SEE ALSO" .BR call (1), .BR netrom (4), .BR ifconfig (8), .BR nrparms (8). libax25-0.0.12-rc2+cvs20120204/rsports.50000644000175000017500000000241407264463747015106 0ustar patpat.TH RSPORTS 5 "27 August 1996" Linux "Linux Programmer's Manual" .SH NAME rsports \- Rose port configuration file. .SH DESCRIPTION .LP .B Rsports is an ASCII file that contains information about each of the Rose ports that are to be used. When dealing with a Rose utility such as .B call, it takes an optional argument that is the port name. This port name is a reference to the line within .B rsports, which has the same name. The information on each line contains enough information to bind the command to a particular Rose interface, this binding is done by matching the address on the line in .B rsports with the address of the port set by .B ifconfig or .B rsattach. .LP The .B rsports file may contain comments that begin with a # in the first column, or a port description in the following format, each field being delimited by white space: .sp .RS name address description .RE .sp The field descriptions are: .sp .RS .TP 14 .B name this is the unique Rose port identifier. .TP 14 .B address the address of the Rose interface to bind to. .TP 14 .B description a free format description of this interface, this field extends to the end of the line. It may contain spaces. .RE .SH FILES .LP /etc/ax25/rsports .SH "SEE ALSO" .BR call (1), .BR rose (4), .BR ifconfig (8), .BR rsparms (8). libax25-0.0.12-rc2+cvs20120204/ax25.30000644000175000017500000000421010774705515014133 0ustar patpat.TH INET 3 "2008-Feb-04" "Linux" "Linux Programmer's Manual" .SH NAME .B ax25_aton, ax25_aton_entry, ax25_aton_arglist, .B ax25_ntoa, ax25_cmp, ax25_validate \- AX25 Address manipulation routines .SH SYNOPSIS .nf .B #include .PP .BI "int ax25_aton(const char *" cp ", struct full_sockaddr_ax25 *" fsap ");" .PP .BI "int ax25_aton_arglist(const char **" cp ", struct full_sockaddr_ax25 *" fsap ");" .PP .BI "int ax25_aton_entry(const char *" cp ", char *" axp ");" .PP .BI "char *ax25_ntoa(ax25_address *" axp ");" .PP .BI "int ax25_cmp(ax25_address *" ax1 ", ax25_address *" ax2 ");" .PP .BI "int ax25_validate(char *" axp ");" .PP .BI "char *ax25_config_file(const char *filename);" .fi .SH DESCRIPTION .BR ax25_aton () takes the ASCII string .I cp that is in the format .I callsign .RI [[ V | VIA ] callsign "...]" and stores it in .I fsap in network format. .PP .BR ax25_aton_entry () takes the ASCII string of a callsign .I cp and stores it in network format in .I axp. .PP The .BR ax25_aton_arglist () takes a NULL terminated array of strings .I cp and stores it in .I fsap in network format. .PP The .BR ax25_ntoa () takes a network format address .I axp and returns the ASCII representation. The string is returned in a statically allocated buffer, which subsequent calls will overwrite. .PP The .BR ax25_cmp () function compares the two ax25 addresses, .I ax1 and .IR ax2 , that are in network format and determines wether they are identical, differ only by their SSIDs or are different. .PP The .BR ax25_validate () function checks to see if the address .I axp in network format is a correctly formatted address. .SH "RETURN VALUE" The .BR ax25_aton () and .BR ax25_aton_arglist () functions return -1 if an error occurs otherwise the length of the returned structure. .PP The .BR ax25_aton_entry () function returns -1 if an error occurs otherwise zero. .PP The .BR ax25_cmp () function returns 0 if the two addresses are identical, 1 if they are different or 2 is only the SSIDs are different. .PP The .BR ax25_validate () function returns TRUE if the callsign is valid or FALSE if it is not. .SH "SEE ALSO" .BR ax25 "(4), " netrom "(4), " rose "(4)" libax25-0.0.12-rc2+cvs20120204/ax25io.c0000644000175000017500000003206411217264176014547 0ustar patpat#include #include #include #include #include #include #include #include #include "config.h" static inline int send_iac_iac(ax25io *p); static inline int send_iac_cmd(ax25io *p, unsigned char cmd, unsigned char opt); static inline int send_linemode(ax25io *p); static ax25io *Iolist = NULL; /* --------------------------------------------------------------------- */ #ifdef HAVE_ZLIB_H #include struct compr_s { int z_error; /* "(de)compression error" flag */ unsigned char char_buf; /* temporary character buffer */ z_stream zin; /* decompressor structure */ z_stream zout; /* compressor structure */ }; #endif /* --------------------------------------------------------------------- */ ax25io *axio_init(int in, int out, int paclen, char *eol) { ax25io *new; if ((new = calloc(1, sizeof(ax25io))) == NULL) return NULL; if (paclen > AXBUFLEN) paclen = AXBUFLEN; new->ifd = in; new->ofd = out; new->eolmode = EOLMODE_TEXT; new->paclen = paclen; new->gbuf_usage = 0; strncpy(new->eol, eol, 3); new->eol[3] = 0; new->next = Iolist; Iolist = new; return new; } void axio_end(ax25io *p) { axio_flush(p); #ifdef HAVE_ZLIB_H if (p->zptr) { struct compr_s *z = (struct compr_s *) p->zptr; deflateEnd(&z->zout); inflateEnd(&z->zin); } #endif close(p->ifd); close(p->ofd); p->ifd = -1; p->ofd = -1; return; } void axio_end_all(void) { ax25io *p = Iolist; while (p != NULL) { if (p->ifd != -1 && p->ofd != -1) axio_end(p); p = p->next; } } /* --------------------------------------------------------------------- */ int axio_compr(ax25io *p, int flag) { #ifdef HAVE_ZLIB_H if (flag) { struct compr_s *z = calloc(1, sizeof(struct compr_s)); if (!z) return -1; p->zptr = z; if (inflateInit(&z->zin) != Z_OK) return -1; if (deflateInit(&z->zout, Z_BEST_COMPRESSION) != Z_OK) return -1; } return 0; #endif /* ax25_errno = AX25IO_NO_Z_SUPPORT; */ return -1; } int axio_paclen(ax25io *p, int paclen) { axio_flush(p); if (paclen > AXBUFLEN) return -1; return p->paclen = paclen; } int axio_eolmode(ax25io *p, int newmode) { int oldmode; oldmode = p->eolmode; p->eolmode = newmode; return oldmode; } int axio_cmpeol(ax25io *p1, ax25io *p2) { return strcmp(p1->eol, p2->eol); } int axio_tnmode(ax25io *p, int newmode) { int oldmode; oldmode = p->telnetmode; p->telnetmode = newmode; return oldmode; } static int flush_obuf(ax25io *p) { int ret, len; if (p->optr == 0) return 0; len = p->optr < p->paclen ? p->optr : p->paclen; if ((ret = write(p->ofd, p->obuf, len)) < 0) return -1; if (ret && ret < p->optr) memmove(p->obuf, &p->obuf[ret], p->optr - ret); p->optr -= ret; return ret; } int axio_flush(ax25io *p) { int flushed = 0; int ret; #ifdef HAVE_ZLIB_H if (p->zptr) { struct compr_s *z = (struct compr_s *) p->zptr; int ret; /* * Fail immediately if there has been an error in * compression or decompression. */ if (z->z_error) { errno = z->z_error; return -1; } /* * No new input, just flush the compression block. */ z->zout.next_in = NULL; z->zout.avail_in = 0; do { /* Adjust the output pointers */ z->zout.next_out = p->obuf + p->optr; z->zout.avail_out = p->paclen - p->optr; ret = deflate(&z->zout, Z_PARTIAL_FLUSH); p->optr = p->paclen - z->zout.avail_out; switch (ret) { case Z_OK: /* All OK */ break; case Z_BUF_ERROR: /* * Progress not possible, it's been * flushed already (I hope). */ break; case Z_STREAM_END: /* What ??? */ errno = z->z_error = ZERR_STREAM_END; return -1; case Z_STREAM_ERROR: /* Something strange */ errno = z->z_error = ZERR_STREAM_ERROR; return -1; default: errno = z->z_error = ZERR_UNKNOWN; return -1; } /* * If output buffer is full, flush it to make room * for more compressed data. */ if (z->zout.avail_out == 0 && flush_obuf(p) < 0) return -1; } while (z->zout.avail_out == 0); } #endif while (p->optr) { /* Return on error or if zero bytes written */ if ((ret = flush_obuf(p)) <= 0) return -1; flushed += ret; } return flushed; } static int rsend(char *c, int len, ax25io *p) { /* Don't go further until there is space */ if (p->paclen <= p->optr) { if (flush_obuf(p) <= 0) return -1; } #ifdef HAVE_ZLIB_H if (p->zptr) { struct compr_s *z = (struct compr_s *) p->zptr; int ret; /* * Fail immediately if there has been an error in * compression or decompression. */ if (z->z_error) { errno = z->z_error; return -1; } /* * One new character to input. */ z->zout.next_in = (unsigned char *) c; z->zout.avail_in = len; /* * Now loop until deflate returns with avail_out != 0 */ do { /* Adjust the output pointers */ z->zout.next_out = p->obuf + p->optr; z->zout.avail_out = p->paclen - p->optr; ret = deflate(&z->zout, Z_NO_FLUSH); p->optr = p->paclen - z->zout.avail_out; switch (ret) { case Z_OK: /* All OK */ break; case Z_STREAM_END: /* What ??? */ errno = z->z_error = ZERR_STREAM_END; return -1; case Z_STREAM_ERROR: /* Something strange */ errno = z->z_error = ZERR_STREAM_ERROR; return -1; case Z_BUF_ERROR: /* Progress not possible (should be) */ errno = z->z_error = ZERR_BUF_ERROR; return -1; default: errno = z->z_error = ZERR_UNKNOWN; return -1; } /* * If the output buffer is full, flush it to make * room for more compressed data. */ if (z->zout.avail_out == 0 && flush_obuf(p) < 0) return -1; } while (z->zout.avail_out == 0); return len; } #endif if (p->optr + len < AXBUFLEN) { memcpy(p->obuf + p->optr, c, len); p->optr += len; } else { errno = EAGAIN; return -1; } if (p->optr >= p->paclen && flush_obuf(p) < 0) return -1; return len; } /* --------------------------------------------------------------------- */ static int recv_ibuf(ax25io *p) { int ret; p->iptr = 0; p->size = 0; if ((ret = read(p->ifd, p->ibuf, AXBUFLEN)) < 0) return -1; if (ret == 0) { errno = 0; return -1; } return p->size = ret; } static int rrecvchar(ax25io *p) { #ifdef HAVE_ZLIB_H if (p->zptr) { struct compr_s *z = (struct compr_s *) p->zptr; int ret; /* * Fail immediately if there has been an error in * compression or decompression. */ if (z->z_error) { errno = z->z_error; return -1; } for (;;) { /* Adjust the input pointers */ z->zin.next_in = p->ibuf + p->iptr; z->zin.avail_in = p->size - p->iptr; /* Room for one output character */ z->zin.next_out = &z->char_buf; z->zin.avail_out = 1; ret = inflate(&z->zin, Z_PARTIAL_FLUSH); p->iptr = p->size - z->zin.avail_in; switch (ret) { case Z_OK: /* * Progress made! Return if there is * something to be returned. */ if (z->zin.avail_out == 0) return z->char_buf; break; case Z_BUF_ERROR: /* * Not enough new data to proceed, * let's hope we'll get some more below. */ break; case Z_STREAM_END: /* What ??? */ errno = z->z_error = ZERR_STREAM_END; return -1; case Z_STREAM_ERROR: /* Something weird */ errno = z->z_error = ZERR_STREAM_ERROR; return -1; case Z_DATA_ERROR: /* Compression protocol error */ errno = z->z_error = ZERR_DATA_ERROR; return -1; case Z_MEM_ERROR: /* Not enough memory */ errno = z->z_error = ZERR_MEM_ERROR; return -1; default: errno = z->z_error = ZERR_UNKNOWN; return -1; } /* * Our only hope is that inflate has consumed all * input and we can get some more. */ if (z->zin.avail_in == 0) { if (recv_ibuf(p) < 0) return -1; } else { /* inflate didn't consume all input ??? */ errno = z->z_error = ZERR_UNKNOWN; return -1; } } /* * We should never fall through here ??? */ errno = z->z_error = ZERR_UNKNOWN; return -1; } #endif if (p->iptr >= p->size && recv_ibuf(p) < 0) return -1; return p->ibuf[p->iptr++]; } /* --------------------------------------------------------------------- */ int axio_putc(int c, ax25io *p) { char cp; if (p->telnetmode && c == IAC) return send_iac_iac(p); if (c == INTERNAL_EOL) { if (p->eolmode == EOLMODE_BINARY) return rsend("\n", 1, p); else return rsend(p->eol, strlen(p->eol), p); } if (p->eolmode == EOLMODE_TEXT && c == '\n') return rsend(p->eol, strlen(p->eol), p); cp = c & 0xff; return rsend(&cp, 1, p); } int axio_getc(ax25io *p) { int c, opt; char *cp; opt = 0; /* silence warning */ if ((c = rrecvchar(p)) == -1) return -1; if (p->telnetmode && c == IAC) { if ((c = rrecvchar(p)) == -1) return -1; if (c > 249 && c < 255 && (opt = rrecvchar(p)) == -1) return -1; switch (c) { case IP: case ABORT: case xEOF: return -1; case SUSP: break; case SB: /* * Start of sub-negotiation. Just ignore everything * until we see a IAC SE (some negotiation...). */ if ((c = rrecvchar(p)) == -1) return -1; if ((opt = rrecvchar(p)) == -1) return -1; while (!(c == IAC && opt == SE)) { c = opt; if ((opt = rrecvchar(p)) == -1) return -1; } break; case WILL: /* * Client is willing to negotiate linemode and * we want it too. Tell the client to go to * local edit mode and also to translate any * signals to telnet commands. Clients answer * is ignored above (rfc1184 says client must obey * ECHO and TRAPSIG). */ if (opt == TELOPT_LINEMODE && p->tn_linemode) { if (send_linemode(p) < 0) return -1; } else { if (send_iac_cmd(p, DONT, opt) < 0) return -1; } axio_flush(p); break; case DO: switch (opt) { case TELOPT_SGA: if (send_iac_cmd(p, WILL, opt) < 0) return -1; axio_flush(p); break; case TELOPT_ECHO: /* * If we want echo then just silently * approve, otherwise deny. */ if (p->tn_echo) break; /* Note fall-through */ default: if (send_iac_cmd(p, WONT, opt) < 0) return -1; axio_flush(p); break; } break; case IAC: /* Escaped IAC */ return IAC; break; case WONT: case DONT: default: break; } return axio_getc(p); } if (c == p->eol[0]) { switch (p->eolmode) { case EOLMODE_BINARY: break; case EOLMODE_TEXT: for (cp = p->eol + 1; *cp; cp++) if (rrecvchar(p) == -1) return -1; c = '\n'; break; case EOLMODE_GW: for (cp = p->eol + 1; *cp; cp++) if (rrecvchar(p) == -1) return -1; c = INTERNAL_EOL; break; } } return c; } /* --------------------------------------------------------------------- */ int axio_gets(char *buf, int buflen, ax25io *p) { int c, len = 0; while (len < (buflen - 1)) { c = axio_getc(p); if (c == -1) { return -len; } /* NUL also interpreted as EOL */ if (c == '\n' || c == '\r' || c == 0) { buf[len] = 0; errno = 0; return len; } buf[len++] = c; } buf[buflen - 1] = 0; errno = 0; return len; } char *axio_getline(ax25io *p) { int ret; ret = axio_gets((char *) p->gbuf + p->gbuf_usage, AXBUFLEN - p->gbuf_usage, p); if (ret > 0 || (ret == 0 && errno == 0)) { p->gbuf_usage = 0; return (char *) p->gbuf; } p->gbuf_usage += ret; return NULL; } int axio_puts(const char *s, ax25io *p) { int count=0; while (*s) if (axio_putc(*s++, p) == -1) { if (errno != EAGAIN) return -1; else break; } else { count++; } return count; } /* --------------------------------------------------------------------- */ static int axio_vprintf(ax25io *p, const char *fmt, va_list args) { static char buf[AXBUFLEN]; int len, i; len = vsprintf(buf, fmt, args); for (i = 0; i < len; i++) if (axio_putc(buf[i], p) == -1) return -1; return len; } int axio_printf(ax25io *p, const char *fmt, ...) { va_list args; int len; va_start(args, fmt); len = axio_vprintf(p, fmt, args); va_end(args); return len; } /* --------------------------------------------------------------------- */ int axio_tn_do_linemode(ax25io *p) { if (send_iac_cmd(p, DO, TELOPT_LINEMODE) < 0) return -1; p->tn_linemode = 1; return 0; } int axio_tn_will_echo(ax25io *p) { if (send_iac_cmd(p, WILL, TELOPT_ECHO) < 0) return -1; p->tn_echo = 1; return 0; } int axio_tn_wont_echo(ax25io *p) { if (send_iac_cmd(p, WONT, TELOPT_ECHO) < 0) return -1; p->tn_echo = 0; return 0; } /* --------------------------------------------------------------------- */ static inline int send_iac_iac(ax25io *p) { unsigned char buf[2] = { IAC, IAC }; return rsend((char *) buf, 2, p); } static inline int send_iac_cmd(ax25io *p, unsigned char cmd, unsigned char opt) { unsigned char buf[3]; buf[0] = IAC; buf[1] = cmd; buf[2] = opt; return rsend((char *)buf, 3, p); } static inline int send_linemode(ax25io *p) { unsigned char buf[7] = { IAC, SB, TELOPT_LINEMODE, LM_MODE, MODE_EDIT | MODE_TRAPSIG, IAC, SE }; return rsend((char *) buf, 7, p); } /* --------------------------------------------------------------------- */ libax25-0.0.12-rc2+cvs20120204/configure.ac0000644000175000017500000000415011221527650015547 0ustar patpatAC_PREREQ(2.59) AC_INIT(libax25, 0.0.12-rc2, linux-hams@vger.kernel.org) AC_CONFIG_SRCDIR(axconfig.c) AM_INIT_AUTOMAKE([foreign no-define]) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_GCC_TRADITIONAL AC_PROG_LIBTOOL dnl Checks for libraries. AC_FUNC_SETPGRP AC_TYPE_SIGNAL AC_CHECK_FUNCS(socket strdup strerror strspn) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h unistd.h zlib.h) dnl Checks for working glibc 2.1 headers AC_MSG_CHECKING(for working netax25/ax25.h header file) AC_EGREP_HEADER(ax25_fwd_struct, netax25/ax25.h, has_ax25=yes, has_ax25=no) if test "$has_ax25" = "yes" ; then AC_DEFINE(HAVE_NETAX25_AX25_H, 1, [Define if you have a proper netax25/ax25.h header file]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AM_CONDITIONAL([AX25_H], [test "$has_ax25" = "yes"]) AC_MSG_CHECKING(for working netrom/netrom.h header file) AC_EGREP_HEADER(unsigned int ndigis, netrom/netrom.h, has_netrom=yes, has_netrom=no) if test "$has_netrom" = "yes" ; then AC_DEFINE(HAVE_NETROM_NETROM_H, 1, [Define if you have a proper netrom/netrom.h header file.]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AM_CONDITIONAL([NETROM_H], [test "$has_netrom" = "yes"]) AC_MSG_CHECKING(for working netrose/rose.h header file) AC_EGREP_HEADER(rose_facilities_struct, netrose/rose.h, has_rose=yes, has_rose=no) if test "$has_rose" = "yes" ; then AC_DEFINE(HAVE_NETROSE_ROSE_H, 1, [Define if you have a proper netrose/rose.h header file.]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AM_CONDITIONAL([ROSE_H], [test "$has_rose" = "yes"]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Only use -Wall if we have gcc if test "x$GCC" = "xyes"; then if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then CFLAGS="$CFLAGS -Wall" fi fi dnl Checks for library functions. basever=$(echo $PACKAGE_VERSION | sed -e 's@-.*$@@') AC_SUBST(BASEVERSION, [$basever]) extraver=$(echo $PACKAGE_VERSION | sed -e 's@@<:@^-@:>@*-@@' -e 's@-@_@') AC_SUBST(EXTRAVERSION, [$extraver]) AC_CONFIG_FILES([Makefile libax25.spec]) AC_OUTPUT libax25-0.0.12-rc2+cvs20120204/NEWS0000644000175000017500000000012107264463676013775 0ustar patpatNEWS for ax25-libs ================== This code is alpha, use at your own risk. libax25-0.0.12-rc2+cvs20120204/libax25.spec.in0000644000175000017500000000274511221527650016020 0ustar patpatName: libax25 Version: @BASEVERSION@@EXTRAVERSION@ Release: 1 Summary: AX.25 library for hamradio applications Group: System Environment/Libraries License: LGPLv2+ URL: http://www.linux-ax25.org/ Source0: http://www.linux-ax25.org/pub/%{name}/%{name}-@VERSION@.tar.gz BuildRoot: %{_tmppath}/%{name}-@VERSION@-%{release}-root-%(%{__id_u} -n) %description libax25 is a library for ham radio applications that use the AX.25, NETROM or ROSE protocols. Included are routines to do ax25 address parsing, common ax25 application config file parsing, etc. %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep %setup -q -n %{name}-@VERSION@ %build %configure --disable-static make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %clean rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING README %{_libdir}/*.so.* %{_mandir}/man?/* %files devel %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING README %{_includedir}/* %{_libdir}/*.so %changelog * Sat Jun 27 2009 Ralf Baechle - Initial version libax25-0.0.12-rc2+cvs20120204/CVS/0000755000175000017500000000000011713361514013715 5ustar patpatlibax25-0.0.12-rc2+cvs20120204/CVS/Repository0000644000175000017500000000001011713361510016002 0ustar patpatlibax25 libax25-0.0.12-rc2+cvs20120204/CVS/Entries.Log0000644000175000017500000000005711713361515015774 0ustar patpatA D/netax25//// A D/netrom//// A D/netrose//// libax25-0.0.12-rc2+cvs20120204/CVS/Entries0000644000175000017500000000234611713361514015256 0ustar patpat/.cvsignore/1.7/Sat Jun 27 23:47:52 2009// /AUTHORS/1.1.1.1/Tue Apr 10 01:54:01 2001// /COPYING/1.1.1.1/Tue Apr 10 01:54:04 2001// /ChangeLog/1.9/Tue Jan 31 23:18:38 2012// /INSTALL/1.1.1.1/Tue Apr 10 01:54:04 2001// /Makefile.am/1.6/Sat Jun 27 23:47:52 2009// /NEWS/1.1.1.1/Tue Apr 10 01:54:06 2001// /README/1.3/Sun Mar 16 21:25:22 2003// /ax25.3/1.2/Wed Apr 2 13:34:05 2008// /ax25io.c/1.5/Sat Jun 20 22:53:50 2009// /axconfig.c/1.12/Tue Jan 31 23:18:37 2012// /axports/1.2/Wed Apr 2 13:34:05 2008// /axports.5/1.2/Wed Apr 2 13:34:05 2008// /axutils.c/1.7/Sun Jan 16 11:18:30 2011// /configure.ac/1.10/Sat Jun 27 23:47:52 2009// /daemon.c/1.3/Sat Jun 20 22:53:50 2009// /glibc.patch/1.1.1.1/Tue Apr 10 01:54:24 2001// /libax25.spec.in/1.1/Sat Jun 27 23:47:52 2009/-ko/ /ltconfig/1.1.1.1/Tue Apr 10 01:54:34 2001// /nrconfig.c/1.7/Tue Jan 31 23:18:37 2012// /nrports/1.2/Wed Apr 2 13:34:05 2008// /nrports.5/1.1.1.1/Tue Apr 10 01:54:46 2001// /pathnames.h/1.1.1.1/Tue Apr 10 01:54:46 2001// /procutils.c/1.5/Tue Jan 31 23:18:37 2012// /rose.3/1.2/Wed Apr 2 13:34:05 2008// /rsconfig.c/1.6/Sat Jun 20 22:53:50 2009// /rsports/1.2/Wed Apr 2 13:34:05 2008// /rsports.5/1.1.1.1/Tue Apr 10 01:54:47 2001// /ttyutils.c/1.2/Sat Jun 20 22:53:50 2009// D libax25-0.0.12-rc2+cvs20120204/CVS/Root0000644000175000017500000000005711713361510014561 0ustar patpat:pserver:cvs@cvs.linux-ax25.org:/home/ax25-cvs libax25-0.0.12-rc2+cvs20120204/Makefile.am0000644000175000017500000000321311221527650015314 0ustar patpatlib_LTLIBRARIES = libax25.la libax25io.la libax25includedir = $(includedir) libax25ioincludedir = $(includedir) INCLUDES = -DAX25_SYSCONFDIR=\""$(sysconfdir)/ax25/"\" \ -DAX25_LOCALSTATEDIR=\""$(localstatedir)/ax25/"\" if !AX25_H USE_LIBAX25_AX25_H = netax25/ax25.h endif if !NETROM_H USE_LIBAX25_NETROM_H = netrom/netrom.h endif if !ROSE_H USE_LIBAX25_ROSE_H = netrose/rose.h endif nobase_libax25include_HEADERS = \ netax25/axlib.h \ netax25/axconfig.h \ netax25/nrconfig.h \ netax25/rsconfig.h \ netax25/daemon.h \ netax25/ttyutils.h \ netax25/procutils.h \ netax25/mheard.h \ $(USE_LIBAX25_AX25_H) \ $(USE_LIBAX25_NETROM_H) \ $(USE_LIBAX25_ROSE_H) nobase_libax25ioinclude_HEADERS = \ netax25/ax25io.h libax25_la_SOURCES = \ axconfig.c \ netax25/axconfig.h \ netax25/axlib.h \ axutils.c \ config.h \ daemon.c \ netax25/daemon.h \ netax25/mheard.h \ nrconfig.c \ netax25/nrconfig.h \ pathnames.h \ procutils.c \ netax25/procutils.h \ rsconfig.c \ netax25/rsconfig.h \ ttyutils.c \ netax25/ttyutils.h \ $(USE_LIBAX25_AX25_H) \ $(USE_LIBAX25_ROSE_H) libax25io_la_SOURCES = \ ax25io.c \ netax25/ax25io.h man_MANS = ax25.3 rose.3 axports.5 rsports.5 nrports.5 EXTRA_DIST= $(man_MANS) glibc.patch $(etcfiles) libax25.spec AX25_SYSCONFDIR=@sysconfdir@/ax25/ AX25_LOCALSTATEDIR=@localstatedir@/ax25/ # Needed so that the install is optional etcdir = $(AX25_SYSCONFDIR) etcfiles = axports rsports nrports installconf: $(mkinstalldirs) $(DESTDIR)$(etcdir) @list='$(etcfiles)'; for p in $$list; do \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(etcdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(etcdir)/$$p; \ done libax25-0.0.12-rc2+cvs20120204/INSTALL0000644000175000017500000000110207264463674014325 0ustar patpatInstallation Instructions for AX.25 Library =========================================== To make this library you will need the following: glibc2.1 (Debian 2.1.1-5 or RedHat glibc-2.1.2-3) A Modern kernel (2.2.x) libtool To build it you type: ./configure make make install If you want to put the files in the "normal" places, type: ./configure --exec_prefix=/usr --sysconfdir=/etc --localstatedir=/var make make install That will put the binaries in /usr/{s}bin and the config files in /etc/ax25 If you want to install the example config files make installconf libax25-0.0.12-rc2+cvs20120204/procutils.c0000644000175000017500000003554511712073315015464 0ustar patpat#include #include #include #include #include #include /* Needed by nrconfig.h */ #include #include #include "pathnames.h" #define min(a,b) ((a) < (b) ? (a) : (b)) static char *space = " \t\n\r"; /* * Version of atoi() that returns zero if s == NULL. */ static int safe_atoi(const char *s) { return s ? atoi(s) : 0; } /* * Version of atox() that returns zero if s == NULL. */ static unsigned long safe_atox(const char *s) { return s ? strtoul(s, NULL, 16) : 0; } /* * Version of strncpy() that returns NULL if either src or dest is NULL * and also makes sure destination string is always terminated. */ static char *safe_strncpy(char *dest, char *src, int n) { if (!dest || !src) return NULL; dest[n] = 0; return strncpy(dest, src, n); } /* * Our version of strtok(). This one does not touch the original string, * reports the identity of the delimitting character and does not * retain any state info. */ static char *token(char **ptr, const char *delim) { static char buf[256]; char *start; int len; if (!ptr || !*ptr || !delim) return NULL; start = *ptr + strspn(*ptr, delim); len = strcspn(start, delim); *ptr = start + len; if (len == 0) return NULL; len = min(len, sizeof(buf) - 1); memcpy(buf, start, len); buf[len] = 0; return buf; } struct proc_ax25 *read_proc_ax25(void) { FILE *fp; char buffer[256], *cp; struct proc_ax25 *p; struct proc_ax25 *list = NULL; errno = 0; if ((fp = fopen(PROC_AX25_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if ((p = calloc(1, sizeof(struct proc_ax25))) == NULL) break; cp = buffer; p->magic = safe_atox(token(&cp, space)); safe_strncpy(p->dev, token(&cp, space), 13); safe_strncpy(p->src_addr, token(&cp, space), 9); safe_strncpy(p->dest_addr, token(&cp, ", \t\r\n"), 9); p->ndigi = 0; while (*cp == ',' && p->ndigi < 9) { safe_strncpy(p->digi_addr[p->ndigi], token(&cp, ", \t\r\n"), 10); p->ndigi++; } p->st = safe_atoi(token(&cp, space)); p->vs = safe_atoi(token(&cp, space)); p->vr = safe_atoi(token(&cp, space)); p->va = safe_atoi(token(&cp, space)); p->t1timer = safe_atox(token(&cp, space)); p->t1 = safe_atox(token(&cp, space)); p->t2timer = safe_atox(token(&cp, space)); p->t2 = safe_atox(token(&cp, space)); p->t3timer = safe_atox(token(&cp, space)); p->t3 = safe_atox(token(&cp, space)); p->idletimer = safe_atox(token(&cp, space)); p->idle = safe_atox(token(&cp, space)); p->n2count = safe_atoi(token(&cp, space)); p->n2 = safe_atoi(token(&cp, space)); p->rtt = safe_atox(token(&cp, space)); p->window = safe_atoi(token(&cp, space)); p->paclen = safe_atoi(token(&cp, space)); p->sndq = safe_atoi(token(&cp, space)); p->rcvq = safe_atoi(token(&cp, space)); p->inode = safe_atox(token(&cp, space)); p->next = list; list = p; } fclose(fp); return list; } void free_proc_ax25(struct proc_ax25 *ap) { struct proc_ax25 *p; while (ap != NULL) { p = ap->next; free(ap); ap = p; } } struct proc_ax25_route *read_proc_ax25_route(void) { FILE *fp; char buffer[256], *cp; struct proc_ax25_route *new, *tmp, *p; struct proc_ax25_route *list = NULL; int i = 0; errno = 0; if ((fp = fopen(PROC_AX25_ROUTE_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((new = calloc(1, sizeof(struct proc_ax25_route))) == NULL) break; cp = buffer; safe_strncpy(new->call, token(&cp, space), 9); safe_strncpy(new->dev, token(&cp, space), 13); new->cnt = safe_atoi(token(&cp, space)); new->t = safe_atoi(token(&cp, space)); if (list == NULL || new->t > list->t) { tmp = list; list = new; new->next = tmp; } else { for (p = list; p->next != NULL; p = p->next) if (new->t > p->next->t) break; tmp = p->next; p->next = new; new->next = tmp; } } fclose(fp); return list; } void free_proc_ax25_route(struct proc_ax25_route *rp) { struct proc_ax25_route *p; while (rp != NULL) { p = rp->next; free(rp); rp = p; } } struct proc_nr *read_proc_nr(void) { FILE *fp; char buffer[256], *cp; struct proc_nr *p; struct proc_nr *list = NULL; int i = 0; errno = 0; if ((fp = fopen(PROC_NR_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((p = calloc(1, sizeof(struct proc_nr))) == NULL) break; cp = buffer; safe_strncpy(p->user_addr, token(&cp, space), 9); safe_strncpy(p->dest_node, token(&cp, space), 9); safe_strncpy(p->src_node, token(&cp, space), 9); safe_strncpy(p->dev, token(&cp, space), 13); safe_strncpy(p->my_circuit, token(&cp, space), 5); safe_strncpy(p->ur_circuit, token(&cp, space), 5); p->st = safe_atoi(token(&cp, space)); p->vs = safe_atoi(token(&cp, space)); p->vr = safe_atoi(token(&cp, space)); p->va = safe_atoi(token(&cp, space)); p->t1timer = safe_atox(token(&cp, "/")); p->t1 = safe_atox(token(&cp, "/ \t\r\n")); p->t2timer = safe_atox(token(&cp, "/")); p->t2 = safe_atox(token(&cp, "/ \t\r\n")); p->t4timer = safe_atox(token(&cp, "/")); p->t4 = safe_atox(token(&cp, "/ \t\r\n")); p->idletimer = safe_atox(token(&cp, "/")); p->idle = safe_atox(token(&cp, "/ \t\r\n")); p->n2count = safe_atoi(token(&cp, "/")); p->n2 = safe_atoi(token(&cp, "/ \t\r\n")); p->window = safe_atoi(token(&cp, space)); p->sndq = safe_atoi(token(&cp, space)); p->rcvq = safe_atoi(token(&cp, space)); p->inode = safe_atox(token(&cp, space)); p->next = list; list = p; } fclose(fp); return list; } void free_proc_nr(struct proc_nr *np) { struct proc_nr *p; while (np != NULL) { p = np->next; free(np); np = p; } } struct proc_nr_neigh *read_proc_nr_neigh(void) { FILE *fp; char buffer[256], *cp; struct proc_nr_neigh *p; struct proc_nr_neigh *list = NULL; int i = 0; errno = 0; if ((fp = fopen(PROC_NR_NEIGH_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((p = calloc(1, sizeof(struct proc_nr_neigh))) == NULL) break; cp = buffer; p->addr = safe_atoi(token(&cp, space)); safe_strncpy(p->call, token(&cp, space), 9); safe_strncpy(p->dev, token(&cp, space), 13); p->qual = safe_atoi(token(&cp, space)); p->lock = safe_atoi(token(&cp, space)); p->cnt = safe_atoi(token(&cp, space)); p->next = list; list = p; } fclose(fp); return list; } void free_proc_nr_neigh(struct proc_nr_neigh *np) { struct proc_nr_neigh *p; while (np != NULL) { p = np->next; free(np); np = p; } } struct proc_nr_nodes *read_proc_nr_nodes(void) { FILE *fp; char buffer[256], *cp; struct proc_nr_nodes *new, *tmp, *p; struct proc_nr_nodes *list = NULL; char *name; int i = 0; errno = 0; if ((fp = fopen(PROC_NR_NODES_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((new = calloc(1, sizeof(struct proc_nr_nodes))) == NULL) break; cp = buffer; safe_strncpy(new->call, token(&cp, space), 9); safe_strncpy(new->alias, token(&cp, space), 6); new->w = safe_atoi(token(&cp, space)); new->n = safe_atoi(token(&cp, space)); new->qual1 = safe_atoi(token(&cp, space)); new->obs1 = safe_atoi(token(&cp, space)); new->addr1 = safe_atoi(token(&cp, space)); if (new->n > 1) { new->qual2 = safe_atoi(token(&cp, space)); new->obs2 = safe_atoi(token(&cp, space)); new->addr2 = safe_atoi(token(&cp, space)); } if (new->n > 2) { new->qual3 = safe_atoi(token(&cp, space)); new->obs3 = safe_atoi(token(&cp, space)); new->addr3 = safe_atoi(token(&cp, space)); } if (list == NULL || strcmp(new->alias, list->alias) < 0) { tmp = list; list = new; new->next = tmp; } else { for (p = list; p->next != NULL; p = p->next) if (strcmp(new->alias, p->next->alias) < 0) break; tmp = p->next; p->next = new; new->next = tmp; } } /* * Now load the local nodes. */ name = NULL; while ((name = nr_config_get_next(name)) != NULL) { if ((new = calloc(1, sizeof(struct proc_nr_nodes))) == NULL) break; if ((cp = nr_config_get_addr(name)) == NULL) break; safe_strncpy(new->call, cp, 9); if ((cp = nr_config_get_alias(name)) == NULL) break; safe_strncpy(new->alias, cp, 6); new->w = 1; /* local node w */ new->qual1 = 255; /* obviously, local node quality should be set to maximum value */ new->obs1 = 6; /* persist */ /* * n == 0 indicates a local node. */ new->n = 0; if (list == NULL || strcmp(new->alias, list->alias) < 0) { tmp = list; list = new; new->next = tmp; } else { for (p = list; p->next != NULL; p = p->next) if (strcmp(new->alias, p->next->alias) < 0) break; tmp = p->next; p->next = new; new->next = tmp; } } fclose(fp); return list; } void free_proc_nr_nodes(struct proc_nr_nodes *np) { struct proc_nr_nodes *p; while (np != NULL) { p = np->next; free(np); np = p; } } struct proc_rs *read_proc_rs(void) { FILE *fp; char buffer[256]; struct proc_rs *p; struct proc_rs *list = NULL; int i = 0; errno = 0; if ((fp = fopen(PROC_RS_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((p = calloc(1, sizeof(struct proc_rs))) == NULL) break; safe_strncpy(p->dest_addr, strtok(buffer, " \t\n\r"), 10); safe_strncpy(p->dest_call, strtok(NULL, " \t\n\r"), 9); safe_strncpy(p->src_addr, strtok(NULL, " \t\n\r"), 10); safe_strncpy(p->src_call, strtok(NULL, " \t\n\r"), 9); safe_strncpy(p->dev, strtok(NULL, " \t\n\r"), 13); p->lci = safe_atox(strtok(NULL, " \t\n\r")); p->neigh = safe_atoi(strtok(NULL, " \t\n\r")); p->st = safe_atoi(strtok(NULL, " \t\n\r")); p->vs = safe_atoi(strtok(NULL, " \t\n\r")); p->vr = safe_atoi(strtok(NULL, " \t\n\r")); p->va = safe_atoi(strtok(NULL, " \t\n\r")); p->t = safe_atoi(strtok(NULL, " \t\n\r")); p->t1 = safe_atoi(strtok(NULL, " \t\n\r")); p->t2 = safe_atoi(strtok(NULL, " \t\n\r")); p->t3 = safe_atoi(strtok(NULL, " \t\n\r")); p->hb = safe_atoi(strtok(NULL, " \t\n\r")); p->sndq = safe_atoi(strtok(NULL, " \t\n\r")); p->rcvq = safe_atoi(strtok(NULL, " \t\n\r")); p->next = list; list = p; } fclose(fp); return list; } void free_proc_rs(struct proc_rs *ap) { struct proc_rs *p; while (ap != NULL) { p = ap->next; free(ap); ap = p; } } struct proc_rs_neigh *read_proc_rs_neigh(void) { FILE *fp; char buffer[256]; struct proc_rs_neigh *p; struct proc_rs_neigh *list = NULL; int i = 0; errno = 0; if ((fp = fopen(PROC_RS_NEIGH_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((p = calloc(1, sizeof(struct proc_rs_neigh))) == NULL) break; p->addr = safe_atoi(strtok(buffer, " \t\n\r")); safe_strncpy(p->call, strtok(NULL, " \t\n\r"), 9); safe_strncpy(p->dev, strtok(NULL, " \t\n\r"), 13); p->count = safe_atoi(strtok(NULL, " \t\n\r")); p->use = safe_atoi(strtok(NULL, " \t\n\r")); safe_strncpy(p->mode, strtok(NULL, " \t\n\r"), 3); safe_strncpy(p->restart, strtok(NULL, " \t\n\r"), 3); p->t0 = safe_atoi(strtok(NULL, " \t\n\r")); p->tf = safe_atoi(strtok(NULL, " \t\n\r")); p->next = list; list = p; } fclose(fp); return list; } void free_proc_rs_neigh(struct proc_rs_neigh *np) { struct proc_rs_neigh *p; while (np != NULL) { p = np->next; free(np); np = p; } } struct proc_rs_nodes *read_proc_rs_nodes(void) { FILE *fp; char buffer[256]; struct proc_rs_nodes *p; struct proc_rs_nodes *list = NULL; int i = 0; errno = 0; if ((fp = fopen(PROC_RS_NODES_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((p = calloc(1, sizeof(struct proc_rs_nodes))) == NULL) break; safe_strncpy(p->address, strtok(buffer, " \t\n\r"), 10); p->mask = safe_atoi(strtok(NULL, " \t\n\r")); p->n = safe_atoi(strtok(NULL, " \t\n\r")); p->neigh1 = safe_atoi(strtok(NULL, " \t\n\r")); p->neigh2 = safe_atoi(strtok(NULL, " \t\n\r")); p->neigh3 = safe_atoi(strtok(NULL, " \t\n\r")); p->next = list; list = p; } fclose(fp); return list; } void free_proc_rs_nodes(struct proc_rs_nodes *np) { struct proc_rs_nodes *p; while (np != NULL) { p = np->next; free(np); np = p; } } struct proc_rs_route *read_proc_rs_routes(void) { FILE *fp; char buffer[256]; struct proc_rs_route *p; struct proc_rs_route *list = NULL; int i = 0; errno = 0; if ((fp = fopen(PROC_RS_ROUTES_FILE, "r")) == NULL) return NULL; while (fgets(buffer, 256, fp) != NULL) { if (!i++) continue; if ((p = calloc(1, sizeof(struct proc_rs_route))) == NULL) break; p->lci1 = safe_atox(strtok(buffer, " \t\n\r")); safe_strncpy(p->address1, strtok(NULL, " \t\n\r"), 10); safe_strncpy(p->call1, strtok(NULL, " \t\n\r"), 9); p->neigh1 = safe_atoi(strtok(NULL, " \t\n\r")); p->lci2 = safe_atox(strtok(NULL, " \t\n\r")); safe_strncpy(p->address2, strtok(NULL, " \t\n\r"), 10); safe_strncpy(p->call2, strtok(NULL, " \t\n\r"), 9); p->neigh2 = safe_atoi(strtok(NULL, " \t\n\r")); p->next = list; list = p; } fclose(fp); return list; } void free_proc_rs_routes(struct proc_rs_route *np) { struct proc_rs_route *p; while (np != NULL) { p = np->next; free(np); np = p; } } char *get_call(int uid) { FILE *fp; char buf[256]; static char call[10]; int i = 0; errno = 0; if ((fp = fopen(PROC_AX25_CALLS_FILE, "r")) == NULL) return NULL; while (fgets(buf, 256, fp) != NULL) { if (!i++) continue; if (safe_atoi(strtok(buf, " \t\r\n")) == uid) { fclose(fp); safe_strncpy(call, strtok(NULL, " \t\r\n"), 9); return call; } } fclose(fp); return NULL; } struct proc_ax25 *find_link(const char *src, const char *dest, const char *dev) { static struct proc_ax25 a; struct proc_ax25 *p, *list; list = read_proc_ax25(); for (p = list; p != NULL; p = p->next) { if (!strcmp(src, p->src_addr) && !strcmp(dest, p->dest_addr) && !strcmp(dev, p->dev)) { a = *p; a.next = NULL; free_proc_ax25(list); return &a; } } free_proc_ax25(list); return NULL; } struct proc_nr_neigh *find_neigh(int addr, struct proc_nr_neigh *neighs) { static struct proc_nr_neigh n; struct proc_nr_neigh *p, *list; list = neighs ? neighs : read_proc_nr_neigh(); for (p = list; p != NULL; p = p->next) { if (addr == p->addr) { n = *p; n.next = NULL; p = &n; break; } } if (!neighs) free_proc_nr_neigh(list); return p; } struct proc_nr_nodes *find_node(char *addr, struct proc_nr_nodes *nodes) { static struct proc_nr_nodes n; struct proc_nr_nodes *p, *list; list = nodes ? nodes : read_proc_nr_nodes(); for (p = list; p != NULL; p = p->next) { if (!strcasecmp(addr, p->call) || !strcasecmp(addr, p->alias)) { n = *p; n.next = NULL; p = &n; break; } } if (!nodes) free_proc_nr_nodes(list); return p; }