mirror of
https://github.com/3cky/mbusd.git
synced 2024-12-23 16:27:33 +01:00
Initial revision
This commit is contained in:
commit
0696cbd292
26
COPYING
Normal file
26
COPYING
Normal file
@ -0,0 +1,26 @@
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS gateway license *
|
||||
|
||||
Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
182
INSTALL
Normal file
182
INSTALL
Normal file
@ -0,0 +1,182 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
467
Makefile
Normal file
467
Makefile
Normal file
@ -0,0 +1,467 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = .
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
|
||||
bindir = ${exec_prefix}/bin
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
datadir = ${prefix}/share
|
||||
sysconfdir = ${prefix}/etc
|
||||
sharedstatedir = ${prefix}/com
|
||||
localstatedir = ${prefix}/var
|
||||
libdir = ${exec_prefix}/lib
|
||||
infodir = ${prefix}/info
|
||||
mandir = ${prefix}/man
|
||||
includedir = ${prefix}/include
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/mbusd
|
||||
pkglibdir = $(libdir)/mbusd
|
||||
pkgincludedir = $(includedir)/mbusd
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = ${SHELL} /usr/home/avm/work/mbus/missing --run aclocal
|
||||
AUTOCONF = ${SHELL} /usr/home/avm/work/mbus/missing --run autoconf
|
||||
AUTOMAKE = ${SHELL} /usr/home/avm/work/mbus/missing --run automake
|
||||
AUTOHEADER = ${SHELL} /usr/home/avm/work/mbus/missing --run autoheader
|
||||
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = s,x,x,
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = i386-unknown-freebsdelf4.8
|
||||
host_triplet = i386-unknown-freebsdelf4.8
|
||||
AMTAR = ${SHELL} /usr/home/avm/work/mbus/missing --run tar
|
||||
AS = @AS@
|
||||
AWK = gawk
|
||||
CC = gcc
|
||||
DEPDIR = .deps
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT =
|
||||
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LN_S = ln -s
|
||||
NO_PREFIX_PACKAGE_DATA_DIR = share/mbusd
|
||||
NO_PREFIX_PACKAGE_DOC_DIR = doc/mbusd
|
||||
NO_PREFIX_PACKAGE_HELP_DIR = share/mbusd/help
|
||||
NO_PREFIX_PACKAGE_MENU_DIR = share/mbusd
|
||||
NO_PREFIX_PACKAGE_PIXMAPS_DIR = share/mbusd/pixmaps
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = o
|
||||
PACKAGE = mbusd
|
||||
PACKAGE_DATA_DIR = /usr/local/share/mbusd
|
||||
PACKAGE_DOC_DIR = /usr/local/doc/mbusd
|
||||
PACKAGE_HELP_DIR = /usr/local/share/mbusd/help
|
||||
PACKAGE_MENU_DIR = /usr/local/share/mbusd
|
||||
PACKAGE_PIXMAPS_DIR = /usr/local/share/mbusd/pixmaps
|
||||
RANLIB = ranlib
|
||||
VERSION = 0.1.1
|
||||
am__include = include
|
||||
am__quote =
|
||||
install_sh = /usr/home/avm/work/mbus/install-sh
|
||||
|
||||
SUBDIRS = src doc
|
||||
|
||||
mbusddocdir = ${prefix}/doc/mbusd
|
||||
mbusddoc_DATA = \
|
||||
README\
|
||||
COPYING\
|
||||
AUTHORS\
|
||||
ChangeLog\
|
||||
INSTALL\
|
||||
NEWS\
|
||||
TODO
|
||||
|
||||
|
||||
EXTRA_DIST = $(mbusddoc_DATA)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
DATA = $(mbusddoc_DATA)
|
||||
|
||||
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
|
||||
uninstall-info-recursive all-recursive install-data-recursive \
|
||||
install-exec-recursive installdirs-recursive install-recursive \
|
||||
uninstall-recursive check-recursive installcheck-recursive
|
||||
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
|
||||
Makefile.am Makefile.in NEWS TODO acconfig.h acinclude.m4 \
|
||||
aclocal.m4 config.guess config.h.in config.sub configure \
|
||||
configure.in depcomp install-sh ltconfig ltmain.sh missing \
|
||||
mkinstalldirs
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$@ $(SHELL) ./config.status
|
||||
|
||||
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
$(ACLOCAL_M4): configure.in acinclude.m4
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h stamp-hT
|
||||
@echo timestamp > stamp-hT 2> /dev/null
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@mv stamp-hT stamp-h
|
||||
$(srcdir)/config.h.in: $(srcdir)/./stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/./stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/./stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h
|
||||
@rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT
|
||||
@echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
uninstall-info-am:
|
||||
install-mbusddocDATA: $(mbusddoc_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(mbusddocdir)
|
||||
@list='$(mbusddoc_DATA)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(mbusddocdir)/$$f"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(mbusddocdir)/$$f; \
|
||||
done
|
||||
|
||||
uninstall-mbusddocDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(mbusddoc_DATA)'; for p in $$list; do \
|
||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
||||
echo " rm -f $(DESTDIR)$(mbusddocdir)/$$f"; \
|
||||
rm -f $(DESTDIR)$(mbusddocdir)/$$f; \
|
||||
done
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP)
|
||||
|
||||
GTAGS:
|
||||
here=`CDPATH=: && cd $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = .
|
||||
# Avoid unsightly `./'.
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
|
||||
GZIP_ENV = --best
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" \
|
||||
distdir=../$(distdir)/$$subdir \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="${top_distdir}" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
|
||||
&& cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|
||||
|| (echo "Error: files left after uninstall" 1>&2; \
|
||||
exit 1) ) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distclean \
|
||||
&& rm -f $(distdir).tar.gz \
|
||||
&& (test `find . -type f -print | wc -l` -eq 0 \
|
||||
|| (echo "Error: files left after distclean" 1>&2; \
|
||||
exit 1) )
|
||||
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||
sed 'h;s/./=/g;p;x;p;x'
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(DATA) config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
$(mkinstalldirs) $(DESTDIR)$(mbusddocdir)
|
||||
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
dist-all: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status config.cache config.log
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-mbusddocDATA
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-mbusddocDATA
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-libtool clean-recursive dist dist-all \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-recursive distclean-tags distdir \
|
||||
dvi dvi-am dvi-recursive info info-am info-recursive install \
|
||||
install-am install-data install-data-am install-data-recursive \
|
||||
install-exec install-exec-am install-exec-recursive \
|
||||
install-info install-info-am install-info-recursive install-man \
|
||||
install-mbusddocDATA install-recursive install-strip \
|
||||
installcheck installcheck-am installdirs installdirs-am \
|
||||
installdirs-recursive maintainer-clean maintainer-clean-generic \
|
||||
maintainer-clean-recursive mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool mostlyclean-recursive tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-info-recursive uninstall-mbusddocDATA \
|
||||
uninstall-recursive
|
||||
|
||||
|
||||
# Copy all the spec files. Of cource, only one is actually used.
|
||||
dist-hook:
|
||||
for specfile in *.spec; do \
|
||||
if test -f $$specfile; then \
|
||||
cp -p $$specfile $(distdir); \
|
||||
fi \
|
||||
done
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
24
Makefile.am
Normal file
24
Makefile.am
Normal file
@ -0,0 +1,24 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = src doc
|
||||
|
||||
mbusddocdir = ${prefix}/doc/mbusd
|
||||
mbusddoc_DATA = \
|
||||
README\
|
||||
COPYING\
|
||||
AUTHORS\
|
||||
ChangeLog\
|
||||
INSTALL\
|
||||
NEWS\
|
||||
TODO
|
||||
|
||||
EXTRA_DIST = $(mbusddoc_DATA)
|
||||
|
||||
# Copy all the spec files. Of cource, only one is actually used.
|
||||
dist-hook:
|
||||
for specfile in *.spec; do \
|
||||
if test -f $$specfile; then \
|
||||
cp -p $$specfile $(distdir); \
|
||||
fi \
|
||||
done
|
||||
|
467
Makefile.in
Normal file
467
Makefile.in
Normal file
@ -0,0 +1,467 @@
|
||||
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMTAR = @AMTAR@
|
||||
AS = @AS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
NO_PREFIX_PACKAGE_DATA_DIR = @NO_PREFIX_PACKAGE_DATA_DIR@
|
||||
NO_PREFIX_PACKAGE_DOC_DIR = @NO_PREFIX_PACKAGE_DOC_DIR@
|
||||
NO_PREFIX_PACKAGE_HELP_DIR = @NO_PREFIX_PACKAGE_HELP_DIR@
|
||||
NO_PREFIX_PACKAGE_MENU_DIR = @NO_PREFIX_PACKAGE_MENU_DIR@
|
||||
NO_PREFIX_PACKAGE_PIXMAPS_DIR = @NO_PREFIX_PACKAGE_PIXMAPS_DIR@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_DATA_DIR = @PACKAGE_DATA_DIR@
|
||||
PACKAGE_DOC_DIR = @PACKAGE_DOC_DIR@
|
||||
PACKAGE_HELP_DIR = @PACKAGE_HELP_DIR@
|
||||
PACKAGE_MENU_DIR = @PACKAGE_MENU_DIR@
|
||||
PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
install_sh = @install_sh@
|
||||
|
||||
SUBDIRS = src doc
|
||||
|
||||
mbusddocdir = ${prefix}/doc/mbusd
|
||||
mbusddoc_DATA = \
|
||||
README\
|
||||
COPYING\
|
||||
AUTHORS\
|
||||
ChangeLog\
|
||||
INSTALL\
|
||||
NEWS\
|
||||
TODO
|
||||
|
||||
|
||||
EXTRA_DIST = $(mbusddoc_DATA)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
DATA = $(mbusddoc_DATA)
|
||||
|
||||
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
|
||||
uninstall-info-recursive all-recursive install-data-recursive \
|
||||
install-exec-recursive installdirs-recursive install-recursive \
|
||||
uninstall-recursive check-recursive installcheck-recursive
|
||||
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
|
||||
Makefile.am Makefile.in NEWS TODO acconfig.h acinclude.m4 \
|
||||
aclocal.m4 config.guess config.h.in config.sub configure \
|
||||
configure.in depcomp install-sh ltconfig ltmain.sh missing \
|
||||
mkinstalldirs
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$@ $(SHELL) ./config.status
|
||||
|
||||
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
$(ACLOCAL_M4): configure.in acinclude.m4
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h stamp-hT
|
||||
@echo timestamp > stamp-hT 2> /dev/null
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@mv stamp-hT stamp-h
|
||||
$(srcdir)/config.h.in: $(srcdir)/./stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/./stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/./stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h
|
||||
@rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT
|
||||
@echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
uninstall-info-am:
|
||||
install-mbusddocDATA: $(mbusddoc_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(mbusddocdir)
|
||||
@list='$(mbusddoc_DATA)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(mbusddocdir)/$$f"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(mbusddocdir)/$$f; \
|
||||
done
|
||||
|
||||
uninstall-mbusddocDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(mbusddoc_DATA)'; for p in $$list; do \
|
||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
||||
echo " rm -f $(DESTDIR)$(mbusddocdir)/$$f"; \
|
||||
rm -f $(DESTDIR)$(mbusddocdir)/$$f; \
|
||||
done
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP)
|
||||
|
||||
GTAGS:
|
||||
here=`CDPATH=: && cd $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = .
|
||||
# Avoid unsightly `./'.
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
|
||||
GZIP_ENV = --best
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" \
|
||||
distdir=../$(distdir)/$$subdir \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="${top_distdir}" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
|
||||
&& cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|
||||
|| (echo "Error: files left after uninstall" 1>&2; \
|
||||
exit 1) ) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distclean \
|
||||
&& rm -f $(distdir).tar.gz \
|
||||
&& (test `find . -type f -print | wc -l` -eq 0 \
|
||||
|| (echo "Error: files left after distclean" 1>&2; \
|
||||
exit 1) )
|
||||
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||
sed 'h;s/./=/g;p;x;p;x'
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(DATA) config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
$(mkinstalldirs) $(DESTDIR)$(mbusddocdir)
|
||||
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
dist-all: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status config.cache config.log
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-mbusddocDATA
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-mbusddocDATA
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-libtool clean-recursive dist dist-all \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-recursive distclean-tags distdir \
|
||||
dvi dvi-am dvi-recursive info info-am info-recursive install \
|
||||
install-am install-data install-data-am install-data-recursive \
|
||||
install-exec install-exec-am install-exec-recursive \
|
||||
install-info install-info-am install-info-recursive install-man \
|
||||
install-mbusddocDATA install-recursive install-strip \
|
||||
installcheck installcheck-am installdirs installdirs-am \
|
||||
installdirs-recursive maintainer-clean maintainer-clean-generic \
|
||||
maintainer-clean-recursive mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool mostlyclean-recursive tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-info-recursive uninstall-mbusddocDATA \
|
||||
uninstall-recursive
|
||||
|
||||
|
||||
# Copy all the spec files. Of cource, only one is actually used.
|
||||
dist-hook:
|
||||
for specfile in *.spec; do \
|
||||
if test -f $$specfile; then \
|
||||
cp -p $$specfile $(distdir); \
|
||||
fi \
|
||||
done
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
5
TODO
Normal file
5
TODO
Normal file
@ -0,0 +1,5 @@
|
||||
To do:
|
||||
|
||||
* Broadcast MODBUS messaging implementation
|
||||
* Response receiving by length (currently by timeout)
|
||||
* SSL secure connection handling
|
13
acconfig.h
Normal file
13
acconfig.h
Normal file
@ -0,0 +1,13 @@
|
||||
#undef ENABLE_NLS
|
||||
#undef HAVE_CATGETS
|
||||
#undef HAVE_GETTEXT
|
||||
#undef HAVE_LC_MESSAGES
|
||||
#undef HAVE_STPCPY
|
||||
#undef HAVE_LIBSM
|
||||
#undef PACKAGE_LOCALE_DIR
|
||||
#undef PACKAGE_DOC_DIR
|
||||
#undef PACKAGE_DATA_DIR
|
||||
#undef PACKAGE_PIXMAPS_DIR
|
||||
#undef PACKAGE_HELP_DIR
|
||||
#undef PACKAGE_MENU_DIR
|
||||
#undef PACKAGE_SOURCE_DIR
|
1
acinclude.m4
Normal file
1
acinclude.m4
Normal file
@ -0,0 +1 @@
|
||||
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
|
1087
aclocal.m4
vendored
Normal file
1087
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
148
autogen.sh
Executable file
148
autogen.sh
Executable file
@ -0,0 +1,148 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
PKG_NAME="the package."
|
||||
|
||||
DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`autoconf' installed to."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
|
||||
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`libtool' installed."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
}
|
||||
|
||||
# grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
|
||||
# grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
|
||||
# (gettext --version) < /dev/null > /dev/null 2>&1 || {
|
||||
# echo
|
||||
# echo "**Error**: You must have \`gettext' installed."
|
||||
# echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
|
||||
# echo "(or a newer version if it is available)"
|
||||
# DIE=1
|
||||
# }
|
||||
# }
|
||||
|
||||
# grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
|
||||
# grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
|
||||
# (gettext --version) < /dev/null > /dev/null 2>&1 || {
|
||||
# echo
|
||||
# echo "**Error**: You must have \`gettext' installed."
|
||||
# echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
|
||||
# echo "(or a newer version if it is available)"
|
||||
# DIE=1
|
||||
# }
|
||||
# }
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`automake' installed."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
NO_AUTOMAKE=yes
|
||||
}
|
||||
|
||||
|
||||
# if no automake, don't bother testing for aclocal
|
||||
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
|
||||
echo "installed doesn't appear recent enough."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$*"; then
|
||||
echo "**Warning**: I am going to run \`configure' with no arguments."
|
||||
echo "If you wish to pass any to it, please specify them on the"
|
||||
echo \`$0\'" command line."
|
||||
echo
|
||||
fi
|
||||
|
||||
case $CC in
|
||||
xlc )
|
||||
am_opt=--include-deps;;
|
||||
esac
|
||||
|
||||
for coin in `find $srcdir -name configure.in -print`
|
||||
do
|
||||
dr=`dirname $coin`
|
||||
if test -f $dr/NO-AUTO-GEN; then
|
||||
echo skipping $dr -- flagged as no auto-gen
|
||||
else
|
||||
echo processing $dr
|
||||
macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
|
||||
( cd $dr
|
||||
aclocalinclude="$ACLOCAL_FLAGS"
|
||||
for k in $macrodirs; do
|
||||
if test -d $k; then
|
||||
aclocalinclude="$aclocalinclude -I $k"
|
||||
##else
|
||||
## echo "**Warning**: No such directory \`$k'. Ignored."
|
||||
fi
|
||||
done
|
||||
if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
|
||||
if grep "sed.*POTFILES" configure.in >/dev/null; then
|
||||
: do nothing -- we still have an old unmodified configure.in
|
||||
else
|
||||
echo "Creating $dr/aclocal.m4 ..."
|
||||
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
|
||||
echo "Running gettextize... Ignore non-fatal messages."
|
||||
./setup-gettext
|
||||
echo "Making $dr/aclocal.m4 writable ..."
|
||||
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
|
||||
fi
|
||||
fi
|
||||
if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
|
||||
echo "Creating $dr/aclocal.m4 ..."
|
||||
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
|
||||
echo "Running gettextize... Ignore non-fatal messages."
|
||||
./setup-gettext
|
||||
echo "Making $dr/aclocal.m4 writable ..."
|
||||
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
|
||||
fi
|
||||
if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
|
||||
echo "Running libtoolize..."
|
||||
libtoolize --force --copy
|
||||
fi
|
||||
echo "Running aclocal $aclocalinclude ..."
|
||||
aclocal $aclocalinclude
|
||||
if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
|
||||
echo "Running autoheader..."
|
||||
autoheader
|
||||
fi
|
||||
echo "Running automake --gnu $am_opt ..."
|
||||
automake --add-missing --gnu $am_opt
|
||||
echo "Running autoconf ..."
|
||||
autoconf
|
||||
)
|
||||
fi
|
||||
done
|
||||
|
||||
#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
|
||||
|
||||
if test x$NOCONFIGURE = x; then
|
||||
echo Running $srcdir/configure $conf_flags "$@" ...
|
||||
$srcdir/configure $conf_flags "$@" \
|
||||
&& echo Now type \`make\' to compile $PKG_NAME
|
||||
else
|
||||
echo Skipping configure process.
|
||||
fi
|
34
config.cache
Normal file
34
config.cache
Normal file
@ -0,0 +1,34 @@
|
||||
# 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.
|
||||
#
|
||||
am_cv_CC_dependencies_compiler_type=${am_cv_CC_dependencies_compiler_type=gcc}
|
||||
ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
|
||||
ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
|
||||
ac_cv_lib_cposix_strerror=${ac_cv_lib_cposix_strerror=no}
|
||||
ac_cv_exeext=${ac_cv_exeext=no}
|
||||
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
|
||||
ac_cv_prog_gnu_ld=${ac_cv_prog_gnu_ld=yes}
|
||||
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib}
|
||||
ac_cv_path_LD=${ac_cv_path_LD=/usr/libexec/elf/ld}
|
||||
ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
|
||||
ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'}
|
||||
ac_cv_header_stdc=${ac_cv_header_stdc=yes}
|
||||
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}
|
||||
ac_cv_path_NM=${ac_cv_path_NM='/usr/bin/nm -B'}
|
||||
ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}
|
||||
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
|
||||
am_cv_prog_cc_stdc=${am_cv_prog_cc_stdc=}
|
||||
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
|
||||
ac_cv_prog_AWK=${ac_cv_prog_AWK=gawk}
|
||||
ac_cv_lib_util_uu_lock=${ac_cv_lib_util_uu_lock=yes}
|
1121
config.guess
vendored
Executable file
1121
config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
29
config.h
Normal file
29
config.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* #undef ENABLE_NLS */
|
||||
/* #undef HAVE_CATGETS */
|
||||
/* #undef HAVE_GETTEXT */
|
||||
/* #undef HAVE_LC_MESSAGES */
|
||||
/* #undef HAVE_STPCPY */
|
||||
/* #undef HAVE_LIBSM */
|
||||
/* #undef PACKAGE_LOCALE_DIR */
|
||||
#define PACKAGE_DOC_DIR "/usr/local/doc/mbusd"
|
||||
#define PACKAGE_DATA_DIR "/usr/local/share/mbusd"
|
||||
#define PACKAGE_PIXMAPS_DIR "/usr/local/share/mbusd/pixmaps"
|
||||
#define PACKAGE_HELP_DIR "/usr/local/share/mbusd/help"
|
||||
#define PACKAGE_MENU_DIR "/usr/local/share/mbusd"
|
||||
#define PACKAGE_SOURCE_DIR "/usr/home/avm/work/mbus"
|
||||
|
||||
/* Define if you have the util library (-lutil). */
|
||||
#define HAVE_LIBUTIL 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "mbusd"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.1.1"
|
||||
|
28
config.h.in
Normal file
28
config.h.in
Normal file
@ -0,0 +1,28 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
#undef ENABLE_NLS
|
||||
#undef HAVE_CATGETS
|
||||
#undef HAVE_GETTEXT
|
||||
#undef HAVE_LC_MESSAGES
|
||||
#undef HAVE_STPCPY
|
||||
#undef HAVE_LIBSM
|
||||
#undef PACKAGE_LOCALE_DIR
|
||||
#undef PACKAGE_DOC_DIR
|
||||
#undef PACKAGE_DATA_DIR
|
||||
#undef PACKAGE_PIXMAPS_DIR
|
||||
#undef PACKAGE_HELP_DIR
|
||||
#undef PACKAGE_MENU_DIR
|
||||
#undef PACKAGE_SOURCE_DIR
|
||||
|
||||
/* Define if you have the util library (-lutil). */
|
||||
#undef HAVE_LIBUTIL
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
67
config.log
Normal file
67
config.log
Normal file
@ -0,0 +1,67 @@
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
configure:584: checking for a BSD compatible install
|
||||
configure:637: checking whether build environment is sane
|
||||
configure:708: checking for mawk
|
||||
configure:708: checking for gawk
|
||||
configure:738: checking whether make sets ${MAKE}
|
||||
configure:860: checking for strerror in -lcposix
|
||||
configure:879: cc -o conftest conftest.c -lcposix 1>&5
|
||||
/usr/libexec/elf/ld: cannot find -lcposix
|
||||
configure: failed program was:
|
||||
#line 868 "configure"
|
||||
#include "confdefs.h"
|
||||
/* 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 strerror();
|
||||
|
||||
int main() {
|
||||
strerror()
|
||||
; return 0; }
|
||||
configure:904: checking for gcc
|
||||
configure:1017: checking whether the C compiler (gcc ) works
|
||||
configure:1033: gcc -o conftest conftest.c 1>&5
|
||||
configure:1059: checking whether the C compiler (gcc ) is a cross-compiler
|
||||
configure:1064: checking whether we are using GNU C
|
||||
configure:1073: gcc -E conftest.c
|
||||
configure:1092: checking whether gcc accepts -g
|
||||
configure:1131: checking for style of include used by make
|
||||
configure:1165: checking dependency style of gcc
|
||||
configure:1235: checking for gcc option to accept ANSI C
|
||||
configure:1289: gcc -c -g -O2 conftest.c 1>&5
|
||||
configure:1313: checking how to run the C preprocessor
|
||||
configure:1334: gcc -E conftest.c >/dev/null 2>conftest.out
|
||||
configure:1393: checking for ANSI C header files
|
||||
configure:1406: gcc -E conftest.c >/dev/null 2>conftest.out
|
||||
configure:1473: gcc -o conftest -g -O2 conftest.c 1>&5
|
||||
configure:1572: checking host system type
|
||||
configure:1593: checking build system type
|
||||
configure:1613: checking for ranlib
|
||||
configure:1652: checking for ld used by GCC
|
||||
configure:1714: checking if the linker (/usr/libexec/elf/ld) is GNU ld
|
||||
GNU ld version 2.12.1 [FreeBSD] 2002-07-20
|
||||
configure:1730: checking for BSD-compatible nm
|
||||
configure:1766: checking whether ln -s works
|
||||
ltconfig:603: checking for object suffix
|
||||
ltconfig:604: gcc -c -g -O2 conftest.c 1>&5
|
||||
ltconfig:629: checking for executable suffix
|
||||
ltconfig:630: gcc -o conftest -g -O2 conftest.c 1>&5
|
||||
ltconfig:776: checking if gcc PIC flag -fPIC works
|
||||
ltconfig:777: gcc -c -g -O2 -fPIC -DPIC conftest.c 1>&5
|
||||
ltconfig:829: checking if gcc supports -c -o file.o
|
||||
ltconfig:830: gcc -c -g -O2 -o out/conftest2.o conftest.c 1>&5
|
||||
ltconfig:862: checking if gcc supports -c -o file.lo
|
||||
ltconfig:863: gcc -c -g -O2 -c -o conftest.lo conftest.c 1>&5
|
||||
ltconfig:914: checking if gcc supports -fno-rtti -fno-exceptions
|
||||
ltconfig:915: gcc -c -g -O2 -fno-rtti -fno-exceptions -c conftest.c conftest.c 1>&5
|
||||
ltconfig:958: checking if gcc static flag -static works
|
||||
ltconfig:959: gcc -o conftest -g -O2 -static conftest.c 1>&5
|
||||
GNU ld version 2.12.1 [FreeBSD] 2002-07-20
|
||||
ltconfig:1635: checking if global_symbol_pipe works
|
||||
ltconfig:1636: gcc -c -g -O2 conftest.c 1>&5
|
||||
ltconfig:1639: eval "/usr/bin/nm -B conftest.o | sed -n -e 's/^.*[ ]\([ABCDGISTW]\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' > conftest.nm"
|
||||
ltconfig:1691: gcc -o conftest -g -O2 -fno-builtin -fno-rtti -fno-exceptions conftest.c conftstm.o 1>&5
|
||||
configure:1952: checking for uu_lock in -lutil
|
||||
configure:1971: gcc -o conftest -g -O2 conftest.c -lutil 1>&5
|
376
config.status
Executable file
376
config.status
Executable file
@ -0,0 +1,376 @@
|
||||
#! /bin/sh
|
||||
# Generated automatically by configure.
|
||||
# Run this file to recreate the current configuration.
|
||||
# This directory was configured as follows,
|
||||
# on host stranger:
|
||||
#
|
||||
# ./configure
|
||||
#
|
||||
# Compiler output produced by configure, useful for debugging
|
||||
# configure, is in ./config.log if it exists.
|
||||
|
||||
ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]"
|
||||
for ac_option
|
||||
do
|
||||
case "$ac_option" in
|
||||
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
|
||||
echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion"
|
||||
exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;;
|
||||
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
|
||||
echo "./config.status generated by autoconf version 2.13"
|
||||
exit 0 ;;
|
||||
-help | --help | --hel | --he | --h)
|
||||
echo "$ac_cs_usage"; exit 0 ;;
|
||||
*) echo "$ac_cs_usage"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
ac_given_srcdir=.
|
||||
ac_given_INSTALL="/usr/bin/install -c"
|
||||
|
||||
trap 'rm -fr
|
||||
Makefile
|
||||
src/Makefile
|
||||
doc/Makefile
|
||||
config.h conftest*; exit 1' 1 2 15
|
||||
|
||||
# Protect against being on the right side of a sed subst in config.status.
|
||||
sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g;
|
||||
s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
|
||||
/^[ ]*VPATH[ ]*=[^:]*$/d
|
||||
|
||||
s%@SHELL@%/bin/sh%g
|
||||
s%@CFLAGS@%-g -O2%g
|
||||
s%@CPPFLAGS@%%g
|
||||
s%@CXXFLAGS@%%g
|
||||
s%@FFLAGS@%%g
|
||||
s%@DEFS@%-DHAVE_CONFIG_H%g
|
||||
s%@LDFLAGS@%%g
|
||||
s%@LIBS@%-lutil %g
|
||||
s%@exec_prefix@%${prefix}%g
|
||||
s%@prefix@%/usr/local%g
|
||||
s%@program_transform_name@%s,x,x,%g
|
||||
s%@bindir@%${exec_prefix}/bin%g
|
||||
s%@sbindir@%${exec_prefix}/sbin%g
|
||||
s%@libexecdir@%${exec_prefix}/libexec%g
|
||||
s%@datadir@%${prefix}/share%g
|
||||
s%@sysconfdir@%${prefix}/etc%g
|
||||
s%@sharedstatedir@%${prefix}/com%g
|
||||
s%@localstatedir@%${prefix}/var%g
|
||||
s%@libdir@%${exec_prefix}/lib%g
|
||||
s%@includedir@%${prefix}/include%g
|
||||
s%@oldincludedir@%/usr/include%g
|
||||
s%@infodir@%${prefix}/info%g
|
||||
s%@mandir@%${prefix}/man%g
|
||||
s%@INSTALL_PROGRAM@%${INSTALL}%g
|
||||
s%@INSTALL_SCRIPT@%${INSTALL_PROGRAM}%g
|
||||
s%@INSTALL_DATA@%${INSTALL} -m 644%g
|
||||
s%@PACKAGE@%mbusd%g
|
||||
s%@VERSION@%0.1.1%g
|
||||
s%@EXEEXT@%%g
|
||||
s%@OBJEXT@%o%g
|
||||
s%@ACLOCAL@%${SHELL} /usr/home/avm/work/mbus/missing --run aclocal%g
|
||||
s%@AUTOCONF@%${SHELL} /usr/home/avm/work/mbus/missing --run autoconf%g
|
||||
s%@AUTOMAKE@%${SHELL} /usr/home/avm/work/mbus/missing --run automake%g
|
||||
s%@AUTOHEADER@%${SHELL} /usr/home/avm/work/mbus/missing --run autoheader%g
|
||||
s%@MAKEINFO@%${SHELL} /usr/home/avm/work/mbus/missing --run makeinfo%g
|
||||
s%@AMTAR@%${SHELL} /usr/home/avm/work/mbus/missing --run tar%g
|
||||
s%@install_sh@%/usr/home/avm/work/mbus/install-sh%g
|
||||
s%@INSTALL_STRIP_PROGRAM@%${SHELL} $(install_sh) -c -s%g
|
||||
s%@AWK@%gawk%g
|
||||
s%@SET_MAKE@%%g
|
||||
s%@AMDEP_TRUE@%%g
|
||||
s%@AMDEP_FALSE@%#%g
|
||||
s%@AMDEPBACKSLASH@%\%g
|
||||
s%@DEPDIR@%.deps%g
|
||||
s%@CC@%gcc%g
|
||||
s%@am__include@%include%g
|
||||
s%@am__quote@%%g
|
||||
s%@CCDEPMODE@%depmode=gcc%g
|
||||
s%@CPP@%gcc -E%g
|
||||
s%@host@%i386-unknown-freebsdelf4.8%g
|
||||
s%@host_alias@%i386-unknown-freebsdelf4.8%g
|
||||
s%@host_cpu@%i386%g
|
||||
s%@host_vendor@%unknown%g
|
||||
s%@host_os@%freebsdelf4.8%g
|
||||
s%@build@%i386-unknown-freebsdelf4.8%g
|
||||
s%@build_alias@%i386-unknown-freebsdelf4.8%g
|
||||
s%@build_cpu@%i386%g
|
||||
s%@build_vendor@%unknown%g
|
||||
s%@build_os@%freebsdelf4.8%g
|
||||
s%@RANLIB@%ranlib%g
|
||||
s%@LN_S@%ln -s%g
|
||||
s%@LIBTOOL@%$(SHELL) $(top_builddir)/libtool%g
|
||||
s%@NO_PREFIX_PACKAGE_DATA_DIR@%share/mbusd%g
|
||||
s%@PACKAGE_DATA_DIR@%/usr/local/share/mbusd%g
|
||||
s%@NO_PREFIX_PACKAGE_DOC_DIR@%doc/mbusd%g
|
||||
s%@PACKAGE_DOC_DIR@%/usr/local/doc/mbusd%g
|
||||
s%@NO_PREFIX_PACKAGE_PIXMAPS_DIR@%share/mbusd/pixmaps%g
|
||||
s%@PACKAGE_PIXMAPS_DIR@%/usr/local/share/mbusd/pixmaps%g
|
||||
s%@NO_PREFIX_PACKAGE_HELP_DIR@%share/mbusd/help%g
|
||||
s%@PACKAGE_HELP_DIR@%/usr/local/share/mbusd/help%g
|
||||
s%@NO_PREFIX_PACKAGE_MENU_DIR@%share/mbusd%g
|
||||
s%@PACKAGE_MENU_DIR@%/usr/local/share/mbusd%g
|
||||
|
||||
CEOF
|
||||
|
||||
# Split the substitutions into bite-sized pieces for seds with
|
||||
# small command number limits, like on Digital OSF/1 and HP-UX.
|
||||
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
|
||||
ac_file=1 # Number of current file.
|
||||
ac_beg=1 # First line for current file.
|
||||
ac_end=$ac_max_sed_cmds # Line after last line for current file.
|
||||
ac_more_lines=:
|
||||
ac_sed_cmds=""
|
||||
while $ac_more_lines; do
|
||||
if test $ac_beg -gt 1; then
|
||||
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
|
||||
else
|
||||
sed "${ac_end}q" conftest.subs > conftest.s$ac_file
|
||||
fi
|
||||
if test ! -s conftest.s$ac_file; then
|
||||
ac_more_lines=false
|
||||
rm -f conftest.s$ac_file
|
||||
else
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds="sed -f conftest.s$ac_file"
|
||||
else
|
||||
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
|
||||
fi
|
||||
ac_file=`expr $ac_file + 1`
|
||||
ac_beg=$ac_end
|
||||
ac_end=`expr $ac_end + $ac_max_sed_cmds`
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds=cat
|
||||
fi
|
||||
|
||||
CONFIG_FILES=${CONFIG_FILES-"Makefile
|
||||
src/Makefile
|
||||
doc/Makefile
|
||||
"}
|
||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case "$ac_file" in
|
||||
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
|
||||
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
*) ac_file_in="${ac_file}.in" ;;
|
||||
esac
|
||||
|
||||
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
|
||||
|
||||
# Remove last slash and all that follows it. Not all systems have dirname.
|
||||
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
|
||||
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
||||
# The file is in a subdirectory.
|
||||
test ! -d "$ac_dir" && mkdir "$ac_dir"
|
||||
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
|
||||
# A "../" for each directory in $ac_dir_suffix.
|
||||
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
|
||||
else
|
||||
ac_dir_suffix= ac_dots=
|
||||
fi
|
||||
|
||||
case "$ac_given_srcdir" in
|
||||
.) srcdir=.
|
||||
if test -z "$ac_dots"; then top_srcdir=.
|
||||
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
|
||||
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
|
||||
*) # Relative path.
|
||||
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
|
||||
top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
|
||||
case "$ac_given_INSTALL" in
|
||||
[/$]*) INSTALL="$ac_given_INSTALL" ;;
|
||||
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
|
||||
esac
|
||||
|
||||
echo creating "$ac_file"
|
||||
rm -f "$ac_file"
|
||||
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
|
||||
case "$ac_file" in
|
||||
*Makefile*) ac_comsub="1i\\
|
||||
# $configure_input" ;;
|
||||
*) ac_comsub= ;;
|
||||
esac
|
||||
|
||||
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
|
||||
sed -e "$ac_comsub
|
||||
s%@configure_input@%$configure_input%g
|
||||
s%@srcdir@%$srcdir%g
|
||||
s%@top_srcdir@%$top_srcdir%g
|
||||
s%@INSTALL@%$INSTALL%g
|
||||
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
|
||||
fi; done
|
||||
rm -f conftest.s*
|
||||
|
||||
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
|
||||
# NAME is the cpp macro being defined and VALUE is the value it is being given.
|
||||
#
|
||||
# ac_d sets the value in "#define NAME VALUE" lines.
|
||||
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
|
||||
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
|
||||
ac_dC='\3'
|
||||
ac_dD='%g'
|
||||
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
|
||||
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||
ac_uB='\([ ]\)%\1#\2define\3'
|
||||
ac_uC=' '
|
||||
ac_uD='\4%g'
|
||||
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
|
||||
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||
ac_eB='$%\1#\2define\3'
|
||||
ac_eC=' '
|
||||
ac_eD='%g'
|
||||
|
||||
if test "${CONFIG_HEADERS+set}" != set; then
|
||||
CONFIG_HEADERS="config.h"
|
||||
fi
|
||||
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case "$ac_file" in
|
||||
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
|
||||
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
*) ac_file_in="${ac_file}.in" ;;
|
||||
esac
|
||||
|
||||
echo creating $ac_file
|
||||
|
||||
rm -f conftest.frag conftest.in conftest.out
|
||||
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
|
||||
cat $ac_file_inputs > conftest.in
|
||||
|
||||
cat > conftest.frag <<CEOF
|
||||
${ac_dA}PACKAGE${ac_dB}PACKAGE${ac_dC}"mbusd"${ac_dD}
|
||||
${ac_uA}PACKAGE${ac_uB}PACKAGE${ac_uC}"mbusd"${ac_uD}
|
||||
${ac_eA}PACKAGE${ac_eB}PACKAGE${ac_eC}"mbusd"${ac_eD}
|
||||
${ac_dA}VERSION${ac_dB}VERSION${ac_dC}"0.1.1"${ac_dD}
|
||||
${ac_uA}VERSION${ac_uB}VERSION${ac_uC}"0.1.1"${ac_uD}
|
||||
${ac_eA}VERSION${ac_eB}VERSION${ac_eC}"0.1.1"${ac_eD}
|
||||
${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD}
|
||||
${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD}
|
||||
${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD}
|
||||
${ac_dA}HAVE_LIBUTIL${ac_dB}HAVE_LIBUTIL${ac_dC}1${ac_dD}
|
||||
${ac_uA}HAVE_LIBUTIL${ac_uB}HAVE_LIBUTIL${ac_uC}1${ac_uD}
|
||||
${ac_eA}HAVE_LIBUTIL${ac_eB}HAVE_LIBUTIL${ac_eC}1${ac_eD}
|
||||
CEOF
|
||||
sed -f conftest.frag conftest.in > conftest.out
|
||||
rm -f conftest.in
|
||||
mv conftest.out conftest.in
|
||||
|
||||
cat > conftest.frag <<CEOF
|
||||
${ac_dA}PACKAGE_DATA_DIR${ac_dB}PACKAGE_DATA_DIR${ac_dC}"/usr/local/share/mbusd"${ac_dD}
|
||||
${ac_uA}PACKAGE_DATA_DIR${ac_uB}PACKAGE_DATA_DIR${ac_uC}"/usr/local/share/mbusd"${ac_uD}
|
||||
${ac_eA}PACKAGE_DATA_DIR${ac_eB}PACKAGE_DATA_DIR${ac_eC}"/usr/local/share/mbusd"${ac_eD}
|
||||
${ac_dA}PACKAGE_DOC_DIR${ac_dB}PACKAGE_DOC_DIR${ac_dC}"/usr/local/doc/mbusd"${ac_dD}
|
||||
${ac_uA}PACKAGE_DOC_DIR${ac_uB}PACKAGE_DOC_DIR${ac_uC}"/usr/local/doc/mbusd"${ac_uD}
|
||||
${ac_eA}PACKAGE_DOC_DIR${ac_eB}PACKAGE_DOC_DIR${ac_eC}"/usr/local/doc/mbusd"${ac_eD}
|
||||
${ac_dA}PACKAGE_PIXMAPS_DIR${ac_dB}PACKAGE_PIXMAPS_DIR${ac_dC}"/usr/local/share/mbusd/pixmaps"${ac_dD}
|
||||
${ac_uA}PACKAGE_PIXMAPS_DIR${ac_uB}PACKAGE_PIXMAPS_DIR${ac_uC}"/usr/local/share/mbusd/pixmaps"${ac_uD}
|
||||
${ac_eA}PACKAGE_PIXMAPS_DIR${ac_eB}PACKAGE_PIXMAPS_DIR${ac_eC}"/usr/local/share/mbusd/pixmaps"${ac_eD}
|
||||
${ac_dA}PACKAGE_HELP_DIR${ac_dB}PACKAGE_HELP_DIR${ac_dC}"/usr/local/share/mbusd/help"${ac_dD}
|
||||
${ac_uA}PACKAGE_HELP_DIR${ac_uB}PACKAGE_HELP_DIR${ac_uC}"/usr/local/share/mbusd/help"${ac_uD}
|
||||
${ac_eA}PACKAGE_HELP_DIR${ac_eB}PACKAGE_HELP_DIR${ac_eC}"/usr/local/share/mbusd/help"${ac_eD}
|
||||
CEOF
|
||||
sed -f conftest.frag conftest.in > conftest.out
|
||||
rm -f conftest.in
|
||||
mv conftest.out conftest.in
|
||||
|
||||
cat > conftest.frag <<CEOF
|
||||
${ac_dA}PACKAGE_MENU_DIR${ac_dB}PACKAGE_MENU_DIR${ac_dC}"/usr/local/share/mbusd"${ac_dD}
|
||||
${ac_uA}PACKAGE_MENU_DIR${ac_uB}PACKAGE_MENU_DIR${ac_uC}"/usr/local/share/mbusd"${ac_uD}
|
||||
${ac_eA}PACKAGE_MENU_DIR${ac_eB}PACKAGE_MENU_DIR${ac_eC}"/usr/local/share/mbusd"${ac_eD}
|
||||
${ac_dA}PACKAGE_SOURCE_DIR${ac_dB}PACKAGE_SOURCE_DIR${ac_dC}"/usr/home/avm/work/mbus"${ac_dD}
|
||||
${ac_uA}PACKAGE_SOURCE_DIR${ac_uB}PACKAGE_SOURCE_DIR${ac_uC}"/usr/home/avm/work/mbus"${ac_uD}
|
||||
${ac_eA}PACKAGE_SOURCE_DIR${ac_eB}PACKAGE_SOURCE_DIR${ac_eC}"/usr/home/avm/work/mbus"${ac_eD}
|
||||
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
|
||||
CEOF
|
||||
sed -f conftest.frag conftest.in > conftest.out
|
||||
rm -f conftest.in
|
||||
mv conftest.out conftest.in
|
||||
|
||||
rm -f conftest.frag conftest.h
|
||||
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
|
||||
cat conftest.in >> conftest.h
|
||||
rm -f conftest.in
|
||||
if cmp -s $ac_file conftest.h 2>/dev/null; then
|
||||
echo "$ac_file is unchanged"
|
||||
rm -f conftest.h
|
||||
else
|
||||
# Remove last slash and all that follows it. Not all systems have dirname.
|
||||
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
|
||||
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
||||
# The file is in a subdirectory.
|
||||
test ! -d "$ac_dir" && mkdir "$ac_dir"
|
||||
fi
|
||||
rm -f $ac_file
|
||||
mv conftest.h $ac_file
|
||||
fi
|
||||
fi; done
|
||||
|
||||
am_indx=1
|
||||
for am_file in config.h; do
|
||||
case " $CONFIG_HEADERS " in
|
||||
*" $am_file "*)
|
||||
am_dir=`echo $am_file |sed 's%:.*%%;s%[^/]*$%%'`
|
||||
if test -n "$am_dir"; then
|
||||
am_tmpdir=`echo $am_dir |sed 's%^\(/*\).*$%\1%'`
|
||||
for am_subdir in `echo $am_dir |sed 's%/% %'`; do
|
||||
am_tmpdir=$am_tmpdir$am_subdir/
|
||||
if test ! -d $am_tmpdir; then
|
||||
mkdir $am_tmpdir
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo timestamp > "$am_dir"stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr $am_indx + 1`
|
||||
done
|
||||
AMDEP_TRUE=""
|
||||
ac_aux_dir="."
|
||||
|
||||
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
|
||||
|
||||
test x"$AMDEP_TRUE" != x"" ||
|
||||
for mf in $CONFIG_FILES; do
|
||||
case "$mf" in
|
||||
Makefile) dirpart=.;;
|
||||
*/Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
|
||||
*) continue;;
|
||||
esac
|
||||
grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
|
||||
# Extract the definition of DEP_FILES from the Makefile without
|
||||
# running `make'.
|
||||
DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n -e '/^U = / s///p' < "$mf"`
|
||||
test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
|
||||
# We invoke sed twice because it is the simplest approach to
|
||||
# changing $(DEPDIR) to its actual value in the expansion.
|
||||
for file in `sed -n -e '
|
||||
/^DEP_FILES = .*\\\\$/ {
|
||||
s/^DEP_FILES = //
|
||||
:loop
|
||||
s/\\\\$//
|
||||
p
|
||||
n
|
||||
/\\\\$/ b loop
|
||||
p
|
||||
}
|
||||
/^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
|
||||
$ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
exit 0
|
1232
config.sub
vendored
Executable file
1232
config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
83
configure.in
Normal file
83
configure.in
Normal file
@ -0,0 +1,83 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(configure.in)
|
||||
AM_INIT_AUTOMAKE(mbusd, 0.1.1)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
AC_HEADER_STDC
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl Checks for programs.
|
||||
dnl Checks for libraries.
|
||||
dnl Checks for header files.
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_LIB(util, uu_lock, ,
|
||||
AC_MSG_WARN("Function uu_lock\(\) is not found in libutil. UUCP locking switched off!"))
|
||||
dnl Checks for Additional stuffs.
|
||||
|
||||
dnl Set PACKAGE SOURCE DIR in config.h.
|
||||
packagesrcdir=`cd $srcdir && pwd`
|
||||
|
||||
dnl Set PACKAGE PREFIX
|
||||
if test "x${prefix}" = "xNONE"; then
|
||||
packageprefix=${ac_default_prefix}
|
||||
else
|
||||
packageprefix=${prefix}
|
||||
fi
|
||||
|
||||
dnl Set PACKAGE DATA & DOC DIR
|
||||
packagedatadir=share/${PACKAGE}
|
||||
packagedocdir=doc/${PACKAGE}
|
||||
|
||||
dnl Set PACKAGE DIRS in config.h.
|
||||
packagepixmapsdir=${packagedatadir}/pixmaps
|
||||
packagehelpdir=${packagedatadir}/help
|
||||
packagemenudir=${packagedatadir}
|
||||
|
||||
dnl Subst PACKAGE_DATA_DIR.
|
||||
NO_PREFIX_PACKAGE_DATA_DIR="${packagedatadir}"
|
||||
AC_SUBST(NO_PREFIX_PACKAGE_DATA_DIR)
|
||||
PACKAGE_DATA_DIR="${packageprefix}/${packagedatadir}"
|
||||
AC_SUBST(PACKAGE_DATA_DIR)
|
||||
|
||||
dnl Subst PACKAGE_DOC_DIR.
|
||||
NO_PREFIX_PACKAGE_DOC_DIR="${packagedocdir}"
|
||||
AC_SUBST(NO_PREFIX_PACKAGE_DOC_DIR)
|
||||
PACKAGE_DOC_DIR="${packageprefix}/${packagedocdir}"
|
||||
AC_SUBST(PACKAGE_DOC_DIR)
|
||||
|
||||
dnl Subst PACKAGE_PIXMAPS_DIR.
|
||||
NO_PREFIX_PACKAGE_PIXMAPS_DIR="${packagepixmapsdir}"
|
||||
AC_SUBST(NO_PREFIX_PACKAGE_PIXMAPS_DIR)
|
||||
PACKAGE_PIXMAPS_DIR="${packageprefix}/${packagepixmapsdir}"
|
||||
AC_SUBST(PACKAGE_PIXMAPS_DIR)
|
||||
|
||||
dnl Subst PACKAGE_HELP_DIR.
|
||||
NO_PREFIX_PACKAGE_HELP_DIR="${packagehelpdir}"
|
||||
AC_SUBST(NO_PREFIX_PACKAGE_HELP_DIR)
|
||||
PACKAGE_HELP_DIR="${packageprefix}/${packagehelpdir}"
|
||||
AC_SUBST(PACKAGE_HELP_DIR)
|
||||
|
||||
dnl Subst PACKAGE_MENU_DIR.
|
||||
NO_PREFIX_PACKAGE_MENU_DIR="${packagemenudir}"
|
||||
AC_SUBST(NO_PREFIX_PACKAGE_MENU_DIR)
|
||||
PACKAGE_MENU_DIR="${packageprefix}/${packagemenudir}"
|
||||
AC_SUBST(PACKAGE_MENU_DIR)
|
||||
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${packageprefix}/${packagedatadir}")
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_DOC_DIR, "${packageprefix}/${packagedocdir}")
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_PIXMAPS_DIR, "${packageprefix}/${packagepixmapsdir}")
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_HELP_DIR, "${packageprefix}/${packagehelpdir}")
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_MENU_DIR, "${packageprefix}/${packagemenudir}")
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
doc/Makefile
|
||||
])
|
||||
|
411
depcomp
Executable file
411
depcomp
Executable file
@ -0,0 +1,411 @@
|
||||
#! /bin/sh
|
||||
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# 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, 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.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. This file always lives in the current directory.
|
||||
# Also, the AIX compiler puts `$object:' at the start of each line;
|
||||
# $object doesn't have directory information.
|
||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
outname="$stripped.o"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
|
||||
tmpdepfile1="$object.d"
|
||||
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a space and a tab in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*) # this is libtool, let us make it quiet
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case "$arg" in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
# X makedepend
|
||||
(
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in no)
|
||||
set ""; shift
|
||||
cleared=yes
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tail +3 "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
263
doc/Makefile
Normal file
263
doc/Makefile
Normal file
@ -0,0 +1,263 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = ..
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
|
||||
bindir = ${exec_prefix}/bin
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
datadir = ${prefix}/share
|
||||
sysconfdir = ${prefix}/etc
|
||||
sharedstatedir = ${prefix}/com
|
||||
localstatedir = ${prefix}/var
|
||||
libdir = ${exec_prefix}/lib
|
||||
infodir = ${prefix}/info
|
||||
mandir = ${prefix}/man
|
||||
includedir = ${prefix}/include
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/mbusd
|
||||
pkglibdir = $(libdir)/mbusd
|
||||
pkgincludedir = $(includedir)/mbusd
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = ${SHELL} /usr/home/avm/work/mbus/missing --run aclocal
|
||||
AUTOCONF = ${SHELL} /usr/home/avm/work/mbus/missing --run autoconf
|
||||
AUTOMAKE = ${SHELL} /usr/home/avm/work/mbus/missing --run automake
|
||||
AUTOHEADER = ${SHELL} /usr/home/avm/work/mbus/missing --run autoheader
|
||||
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = s,x,x,
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = i386-unknown-freebsdelf4.8
|
||||
host_triplet = i386-unknown-freebsdelf4.8
|
||||
AMTAR = ${SHELL} /usr/home/avm/work/mbus/missing --run tar
|
||||
AS = @AS@
|
||||
AWK = gawk
|
||||
CC = gcc
|
||||
DEPDIR = .deps
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT =
|
||||
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LN_S = ln -s
|
||||
NO_PREFIX_PACKAGE_DATA_DIR = share/mbusd
|
||||
NO_PREFIX_PACKAGE_DOC_DIR = doc/mbusd
|
||||
NO_PREFIX_PACKAGE_HELP_DIR = share/mbusd/help
|
||||
NO_PREFIX_PACKAGE_MENU_DIR = share/mbusd
|
||||
NO_PREFIX_PACKAGE_PIXMAPS_DIR = share/mbusd/pixmaps
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = o
|
||||
PACKAGE = mbusd
|
||||
PACKAGE_DATA_DIR = /usr/local/share/mbusd
|
||||
PACKAGE_DOC_DIR = /usr/local/doc/mbusd
|
||||
PACKAGE_HELP_DIR = /usr/local/share/mbusd/help
|
||||
PACKAGE_MENU_DIR = /usr/local/share/mbusd
|
||||
PACKAGE_PIXMAPS_DIR = /usr/local/share/mbusd/pixmaps
|
||||
RANLIB = ranlib
|
||||
VERSION = 0.1.1
|
||||
am__include = include
|
||||
am__quote =
|
||||
install_sh = /usr/home/avm/work/mbus/install-sh
|
||||
|
||||
man_MANS = mbusd.8
|
||||
subdir = doc
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu doc/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
uninstall-info-am:
|
||||
|
||||
man8dir = $(mandir)/man8
|
||||
install-man8: $(man8_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(man8dir)
|
||||
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
uninstall-man8:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man8dir)
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-generic distclean-libtool
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man: install-man8
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man8
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-man8 install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-man uninstall-man8
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
3
doc/Makefile.am
Normal file
3
doc/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
man_MANS = mbusd.8
|
263
doc/Makefile.in
Normal file
263
doc/Makefile.in
Normal file
@ -0,0 +1,263 @@
|
||||
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMTAR = @AMTAR@
|
||||
AS = @AS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
NO_PREFIX_PACKAGE_DATA_DIR = @NO_PREFIX_PACKAGE_DATA_DIR@
|
||||
NO_PREFIX_PACKAGE_DOC_DIR = @NO_PREFIX_PACKAGE_DOC_DIR@
|
||||
NO_PREFIX_PACKAGE_HELP_DIR = @NO_PREFIX_PACKAGE_HELP_DIR@
|
||||
NO_PREFIX_PACKAGE_MENU_DIR = @NO_PREFIX_PACKAGE_MENU_DIR@
|
||||
NO_PREFIX_PACKAGE_PIXMAPS_DIR = @NO_PREFIX_PACKAGE_PIXMAPS_DIR@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_DATA_DIR = @PACKAGE_DATA_DIR@
|
||||
PACKAGE_DOC_DIR = @PACKAGE_DOC_DIR@
|
||||
PACKAGE_HELP_DIR = @PACKAGE_HELP_DIR@
|
||||
PACKAGE_MENU_DIR = @PACKAGE_MENU_DIR@
|
||||
PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
install_sh = @install_sh@
|
||||
|
||||
man_MANS = mbusd.8
|
||||
subdir = doc
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu doc/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
uninstall-info-am:
|
||||
|
||||
man8dir = $(mandir)/man8
|
||||
install-man8: $(man8_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(man8dir)
|
||||
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
uninstall-man8:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man8dir)
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-generic distclean-libtool
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man: install-man8
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man8
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-man8 install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-man uninstall-man8
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
79
doc/mbusd.8
Normal file
79
doc/mbusd.8
Normal file
@ -0,0 +1,79 @@
|
||||
.TH "mbusd" 8 "13 September 2003" "mbusd 0.1.1"
|
||||
.SH NAME
|
||||
mbusd \- OpenMODBUS/TCP to MODBUS RTU gateway server
|
||||
.SH SYNOPSIS
|
||||
.B mbusd
|
||||
.RB [ -h ]
|
||||
.RB [ -d ]
|
||||
.RB [ -v
|
||||
.IR level ]
|
||||
.RB [ -L
|
||||
.IR name ]
|
||||
.RB [ -p
|
||||
.IR name ]
|
||||
.RB [ -s
|
||||
.IR value ]
|
||||
.RB [ -P
|
||||
.IR number ]
|
||||
.RB [ -C
|
||||
.IR number ]
|
||||
.RB [ -N
|
||||
.IR number ]
|
||||
.RB [ -R
|
||||
.IR value ]
|
||||
.RB [ -W
|
||||
.IR value ]
|
||||
.RB [ -T
|
||||
.IR value ]
|
||||
.SH DESCRIPTION
|
||||
\fImbusd\fR is OpenMODBUS/TCP to MODBUS RTU gateway server.
|
||||
.SH OPTIONS
|
||||
.IP \fB-h\fR
|
||||
Usage help.
|
||||
.IP \fB-d\fR
|
||||
Instruct \fImbusd\fR not to fork itself (non-daemonize).
|
||||
.IP "\fB-v \fIlevel\fR"
|
||||
Specifies log verbosity level. 0 enables logging of errors only,
|
||||
1 also enables warnings and 2 enables information messages.
|
||||
If \fImbusd\fR was compiled in debug mode, valid log levels is up to 9,
|
||||
where log levels above 2 forces logging of information about additional
|
||||
internal events.
|
||||
.IP "\fB-L \fIname\fR"
|
||||
Specifies log file name.
|
||||
.IP "\fB-p \fIname\fR"
|
||||
Specifies serial port device name.
|
||||
.IP "\fB-s \fIvalue\fR"
|
||||
Specifies serial port speed.
|
||||
.IP "\fB-P \fInumber\fR"
|
||||
Specifies TCP port number.
|
||||
.IP "\fB-C \fInumber\fR"
|
||||
Specifies maximum number of simultaneous connections.
|
||||
.IP "\fB-N \fInumber\fR"
|
||||
Specifies maximum number of request retries. 0 - no retries.
|
||||
.IP "\fB-R \fIvalue\fR"
|
||||
Specifies pause between requests in miliseconds.
|
||||
.IP "\fB-W \fIvalue\fR"
|
||||
Specifies response wait time in miliseconds.
|
||||
.IP "\fB-T \fIvalue\fR"
|
||||
Specifies connection timeout value in seconds. 0 - no timeout.
|
||||
.SH NOTES
|
||||
Because MODBUS RTU protocol have situations which can't straightforwardly
|
||||
translated into MODBUS/TCP protocol entities, \fImbusd\fR extends standard excepton codes set.
|
||||
In case of situation when \fImbusd\fR received response with invalid CRC and can't correct
|
||||
error by re-request, it returns MODBUS/TCP packet with exception code 128. In case of situation
|
||||
when \fImbusd\fR can't receive response from MODBUS RTU device (e.g. addressed controller
|
||||
is not present on the network), it returns MODBUS/TCP packet with exception code 129.
|
||||
.SH FILES
|
||||
.PP
|
||||
The default locations of the \fImbusd\fR log file is:
|
||||
.PP
|
||||
/var/log/mbusd.log
|
||||
.SH BUGS
|
||||
Broadcast messaging on MODBUS network isn't supported.
|
||||
|
||||
Please send bug reports to author.
|
||||
.SH AUTHOR
|
||||
Victor Antonovich <avmlink@vlink.ru>.
|
||||
.SH LICENSE
|
||||
This program is distributed under the BSD-like license, included in
|
||||
each source file. See also COPYING file in the installation directory.
|
251
install-sh
Executable file
251
install-sh
Executable file
@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
130
mbus.prj
Normal file
130
mbus.prj
Normal file
@ -0,0 +1,130 @@
|
||||
# Anjuta Version 1.0.1
|
||||
Compatibility Level: 1
|
||||
|
||||
<PROJECT_DESCRIPTION_START>
|
||||
OpenMODBUS/TCP to RS-232/485 MODBUS network gateway server<PROJECT_DESCRIPTION_END>
|
||||
<CONFIG_PROGS_START>
|
||||
<CONFIG_PROGS_END>
|
||||
<CONFIG_LIBS_START>
|
||||
<CONFIG_LIBS_END>
|
||||
<CONFIG_HEADERS_START>
|
||||
<CONFIG_HEADERS_END>
|
||||
<CONFIG_CHARACTERISTICS_START>
|
||||
<CONFIG_CHARACTERISTICS_END>
|
||||
<CONFIG_LIB_FUNCS_START>
|
||||
<CONFIG_LIB_FUNCS_END>
|
||||
<CONFIG_ADDITIONAL_START>
|
||||
<CONFIG_ADDITIONAL_END>
|
||||
<CONFIG_FILES_START>
|
||||
<CONFIG_FILES_END>
|
||||
<MAKEFILE_AM_START>
|
||||
<MAKEFILE_AM_END>
|
||||
|
||||
props.file.type=project
|
||||
|
||||
anjuta.version=1.0.1
|
||||
anjuta.compatibility.level=1
|
||||
|
||||
project.name=mbusd
|
||||
project.type=GENERIC
|
||||
project.target.type=EXECUTABLE
|
||||
project.version=0.1
|
||||
project.author=avm
|
||||
project.source.target=mbusd
|
||||
project.has.gettext=0
|
||||
project.programming.language=C
|
||||
project.excluded.modules=intl
|
||||
|
||||
project.config.extra.modules.before=
|
||||
project.config.extra.modules.after=
|
||||
project.config.blocked=0
|
||||
project.config.disable.overwriting=0 0 0 0 0 0 0 0 0
|
||||
|
||||
project.menu.entry=mbusd Version 0.1
|
||||
project.menu.group=Applications
|
||||
project.menu.comment=mbusd Version 0.1
|
||||
project.menu.icon=
|
||||
project.menu.need.terminal=0
|
||||
|
||||
project.configure.options=
|
||||
anjuta.program.arguments=
|
||||
preferences.indent.automatic=1
|
||||
preferences.use.tabs=0
|
||||
preferences.indent.opening=0
|
||||
preferences.indent.closing=0
|
||||
preferences.tabsize=4
|
||||
preferences.indent.size=2
|
||||
preferences.autoformat.style=Custom style
|
||||
preferences.autoformat.custom.style= -i2 -sc -bl -cdb -cli0 -ei -nfcb -lp -di2
|
||||
preferences.autoformat.disable=0
|
||||
|
||||
module.include.name=include
|
||||
module.include.type=
|
||||
module.include.expanded=0
|
||||
module.include.files=
|
||||
|
||||
module.source.name=src
|
||||
module.source.type=
|
||||
module.source.expanded=1
|
||||
module.source.files=\
|
||||
main.c\
|
||||
tty.c\
|
||||
tty.h\
|
||||
globals.h\
|
||||
log.c\
|
||||
log.h\
|
||||
cfg.c\
|
||||
cfg.h\
|
||||
conn.c\
|
||||
conn.h\
|
||||
queue.c\
|
||||
queue.h\
|
||||
modbus.c\
|
||||
modbus.h\
|
||||
crc16.c\
|
||||
crc16.h\
|
||||
state.c\
|
||||
state.h\
|
||||
sig.h\
|
||||
sig.c\
|
||||
sock.h\
|
||||
sock.c
|
||||
|
||||
module.pixmap.name=pixmaps
|
||||
module.pixmap.type=
|
||||
module.pixmap.expanded=0
|
||||
module.pixmap.files=
|
||||
|
||||
module.data.name=data
|
||||
module.data.type=
|
||||
module.data.expanded=0
|
||||
module.data.files=
|
||||
|
||||
module.help.name=help
|
||||
module.help.type=
|
||||
module.help.expanded=0
|
||||
module.help.files=
|
||||
|
||||
module.doc.name=doc
|
||||
module.doc.type=
|
||||
module.doc.expanded=0
|
||||
module.doc.files=
|
||||
|
||||
module.po.expanded=0
|
||||
module.po.files=
|
||||
|
||||
compiler.options.supports=
|
||||
compiler.options.include.paths=
|
||||
compiler.options.library.paths=
|
||||
compiler.options.libraries=\
|
||||
util
|
||||
compiler.options.libraries.selected=1
|
||||
compiler.options.defines=
|
||||
compiler.options.warning.buttons=0 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1
|
||||
compiler.options.optimize.buttons=0 1 0 0
|
||||
compiler.options.other.buttons=0 0
|
||||
compiler.options.other.c.flags=-W -pedantic
|
||||
compiler.options.other.l.flags=
|
||||
compiler.options.other.l.libs=
|
||||
project.source.paths=
|
||||
|
75
mbus.pws
Normal file
75
mbus.pws
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
[filenumbers]
|
||||
0=46
|
||||
1=162
|
||||
2=26
|
||||
3=17
|
||||
4=61
|
||||
5=101
|
||||
6=53
|
||||
7=45
|
||||
8=68
|
||||
9=397
|
||||
10=55
|
||||
11=32
|
||||
12=27
|
||||
13=45
|
||||
14=49
|
||||
15=36
|
||||
16=56
|
||||
17=88
|
||||
18=1
|
||||
19=128
|
||||
20=25
|
||||
21=138
|
||||
22=32
|
||||
23=48
|
||||
|
||||
[filemarkers]
|
||||
0=
|
||||
1=
|
||||
2=
|
||||
3=
|
||||
4=
|
||||
5=
|
||||
6=
|
||||
7=
|
||||
8=
|
||||
9=321,
|
||||
10=
|
||||
11=
|
||||
12=
|
||||
13=
|
||||
14=
|
||||
15=
|
||||
16=
|
||||
17=
|
||||
18=
|
||||
19=
|
||||
20=
|
||||
21=
|
||||
22=
|
||||
23=
|
||||
|
||||
[executer]
|
||||
RunInTerminal=true
|
||||
|
||||
[Project DBase]
|
||||
ShowLocals=true
|
||||
|
||||
[find_text]
|
||||
0=log
|
||||
1=MODBUS
|
||||
2=DEBUG
|
||||
3=read(
|
||||
4=write(
|
||||
5=log_
|
||||
6=FD_SET
|
||||
7=CONN_RQST
|
||||
|
||||
[find_in_files]
|
||||
0=#elif
|
||||
1=DEBUG
|
||||
2=Modbus
|
||||
3=modbus
|
||||
4=TRY
|
32
mbusd.pws
Normal file
32
mbusd.pws
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
[executer]
|
||||
RunInTerminal=true
|
||||
|
||||
[Project DBase]
|
||||
ShowLocals=true
|
||||
|
||||
[filenumbers]
|
||||
0=143
|
||||
1=143
|
||||
2=1
|
||||
3=217
|
||||
4=1
|
||||
|
||||
[filemarkers]
|
||||
0=
|
||||
1=
|
||||
2=
|
||||
3=
|
||||
4=
|
||||
|
||||
[filelist]
|
||||
0=/usr/home/avm/work/mbus/src/sock.c
|
||||
1=/usr/home/avm/work/mbus/src/tty.c
|
||||
2=/usr/home/avm/work/mbus/src/globals.h
|
||||
|
||||
[find_text]
|
||||
0=TIOS
|
||||
|
||||
[find_in_files]
|
||||
0=tty_open
|
||||
1=INTBUFSIZE
|
283
missing
Executable file
283
missing
Executable file
@ -0,0 +1,283 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 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, 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.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing 0.3 - GNU automake"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar ${1+"$@"} && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar ${1+"$@"} && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" ${1+"$@"} && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" ${1+"$@"} && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
40
mkinstalldirs
Executable file
40
mkinstalldirs
Executable file
@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.1 2003/09/13 20:37:59 kapyar Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
202
setup-gettext
Executable file
202
setup-gettext
Executable file
@ -0,0 +1,202 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# setup-gettext - Provides compatibility with versions of gettext
|
||||
# from the 0.10.x series and 0.11.x.
|
||||
#
|
||||
# Copyright (C) 2002 Christian Hammond.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
VERSION=0.1.3
|
||||
|
||||
VERBOSE=1
|
||||
|
||||
parse_gettext_version() {
|
||||
GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'`
|
||||
GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'`
|
||||
GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'`
|
||||
GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'`
|
||||
}
|
||||
|
||||
find_gettext() {
|
||||
GETTEXT_TOOL=autopoint
|
||||
|
||||
(autopoint --version) < /dev/null > /dev/null 2>&1 || {
|
||||
GETTEXT_TOOL=gettextize
|
||||
|
||||
(gettextize --version) < /dev/null > /dev/null 2>&1 || {
|
||||
GETTEXT_TOOL=
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
install() {
|
||||
[ -f configure.in ] && {
|
||||
cp configure.in .tmp-configure.in
|
||||
sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
|
||||
AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.in > configure.in
|
||||
rm .tmp-configure.in
|
||||
}
|
||||
|
||||
[ -f configure.ac ] && {
|
||||
cp configure.ac .tmp-configure.ac
|
||||
sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
|
||||
AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.ac > configure.ac
|
||||
rm .tmp-configure.ac
|
||||
}
|
||||
|
||||
[ -f autogen.sh ] && {
|
||||
cp autogen.sh .tmp-autogen.sh
|
||||
sed -e 's/\(gettextize\|autopoint\) --version/.\/setup-gettext --gettext-tool/1' -e 's/^\(echo.*|[\t ]*\)\?\(gettextize\|autopoint\) -.*$/.\/setup-gettext/1' < .tmp-autogen.sh > autogen.sh
|
||||
rm .tmp-autogen.sh
|
||||
}
|
||||
|
||||
echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' >> acinclude.m4
|
||||
}
|
||||
|
||||
backup_m4() {
|
||||
[ -d m4 ] && mv m4 m4~
|
||||
}
|
||||
|
||||
restore_m4() {
|
||||
[ -d m4~ ] && {
|
||||
rm -rf m4
|
||||
mv m4~ m4
|
||||
}
|
||||
}
|
||||
|
||||
restore_files() {
|
||||
[ -f configure.in~ ] && mv -f configure.in~ configure.in
|
||||
[ -f configure.ac~ ] && mv -f configure.ac~ configure.ac
|
||||
[ -f Makefile.am~ ] && mv -f Makefile.am~ Makefile.am
|
||||
}
|
||||
|
||||
abort() {
|
||||
restore_files
|
||||
restore_m4
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Main code
|
||||
|
||||
find_gettext
|
||||
|
||||
# See if a version of gettext and its tools are installed.
|
||||
if [ x$GETTEXT_TOOL = x ]; then
|
||||
echo
|
||||
echo "You do not have a version of gettext installed."
|
||||
echo "Please download one from your local package repository or"
|
||||
echo "from ftp://ftp.gnu.org/pub/gnu/gettext/"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
parse_gettext_version
|
||||
|
||||
NUMVAR=$#
|
||||
|
||||
if [ $NUMVAR -gt 0 ]; then
|
||||
if [ $NUMVAR -gt 1 ]; then
|
||||
echo "Only one option at a time!"
|
||||
exit 1
|
||||
|
||||
elif [ $1 = "--gettext-tool" ]; then
|
||||
echo $GETTEXT_TOOL
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--help" ]; then
|
||||
echo "setup-gettext v$VERSION"
|
||||
echo "Usage:"
|
||||
echo " --gettext-tool Returns gettextize or autopoint, depending"
|
||||
echo " on the version of gettext installed."
|
||||
echo " --gettext-version Returns the version of gettext installed."
|
||||
echo " --gettext-major-version Returns the major version of gettext installed."
|
||||
echo " --gettext-minor-version Returns the minor version of gettext installed."
|
||||
echo " --gettext-micro-version Returns the micro version of gettext installed."
|
||||
echo " --help Displays this help screen."
|
||||
echo
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--version" ]; then
|
||||
echo $VERSION
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--gettext-version" ]; then
|
||||
echo $GETTEXT_VERSION
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--gettext-major-version" ]; then
|
||||
echo $GETTEXT_MAJOR_VERSION
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--gettext-minor-version" ]; then
|
||||
echo $GETTEXT_MINOR_VERSION
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--gettext-micro-version" ]; then
|
||||
echo $GETTEXT_MICRO_VERSION
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--install" ]; then
|
||||
install
|
||||
echo "setup-gettext installed."
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--happy-url" ]; then
|
||||
echo http://gaim.sf.net/forkgettext.jpg
|
||||
exit 0
|
||||
|
||||
elif [ $1 = "--verbose" ]; then
|
||||
VERBOSE=1
|
||||
|
||||
else
|
||||
echo "Invalid option '$1'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Okay, run the main stuff
|
||||
if [ "$GETTEXT_TOOL" = "autopoint" ]; then
|
||||
backup_m4
|
||||
[ $VERBOSE -eq 1 ] && echo " autopoint --force"
|
||||
echo n | autopoint --force || abort
|
||||
restore_m4
|
||||
else
|
||||
if [ $GETTEXT_MINOR_VERSION -eq 11 ]; then
|
||||
backup_m4
|
||||
|
||||
# Gettext is pure evil. It DEMANDS that we press Return no matter
|
||||
# what. This gets rid of their happy "feature" of doom.
|
||||
[ $VERBOSE -eq 1 ] && \
|
||||
echo " gettextize --copy --force --intl --no-changelog"
|
||||
|
||||
sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize
|
||||
chmod +x .temp-gettextize
|
||||
echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort
|
||||
rm .temp-gettextize
|
||||
|
||||
restore_files
|
||||
restore_m4
|
||||
|
||||
[ -f po/Makevars.template ] && mv po/Makevars.template po/Makevars
|
||||
else
|
||||
[ $VERBOSE -eq 1 ] && echo " gettextize --copy --force"
|
||||
echo n | gettextize --copy --force || exit;
|
||||
fi
|
||||
fi
|
||||
|
1
src/.deps/cfg.Po
Normal file
1
src/.deps/cfg.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/conn.Po
Normal file
1
src/.deps/conn.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/crc16.Po
Normal file
1
src/.deps/crc16.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/log.Po
Normal file
1
src/.deps/log.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/main.Po
Normal file
1
src/.deps/main.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/modbus.Po
Normal file
1
src/.deps/modbus.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/queue.Po
Normal file
1
src/.deps/queue.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/sig.Po
Normal file
1
src/.deps/sig.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/sock.Po
Normal file
1
src/.deps/sock.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/state.Po
Normal file
1
src/.deps/state.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
1
src/.deps/tty.Po
Normal file
1
src/.deps/tty.Po
Normal file
@ -0,0 +1 @@
|
||||
# dummy
|
382
src/Makefile
Normal file
382
src/Makefile
Normal file
@ -0,0 +1,382 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = ..
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
|
||||
bindir = ${exec_prefix}/bin
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
datadir = ${prefix}/share
|
||||
sysconfdir = ${prefix}/etc
|
||||
sharedstatedir = ${prefix}/com
|
||||
localstatedir = ${prefix}/var
|
||||
libdir = ${exec_prefix}/lib
|
||||
infodir = ${prefix}/info
|
||||
mandir = ${prefix}/man
|
||||
includedir = ${prefix}/include
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/mbusd
|
||||
pkglibdir = $(libdir)/mbusd
|
||||
pkgincludedir = $(includedir)/mbusd
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = ${SHELL} /usr/home/avm/work/mbus/missing --run aclocal
|
||||
AUTOCONF = ${SHELL} /usr/home/avm/work/mbus/missing --run autoconf
|
||||
AUTOMAKE = ${SHELL} /usr/home/avm/work/mbus/missing --run automake
|
||||
AUTOHEADER = ${SHELL} /usr/home/avm/work/mbus/missing --run autoheader
|
||||
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = s,x,x,
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = i386-unknown-freebsdelf4.8
|
||||
host_triplet = i386-unknown-freebsdelf4.8
|
||||
AMTAR = ${SHELL} /usr/home/avm/work/mbus/missing --run tar
|
||||
AS = @AS@
|
||||
AWK = gawk
|
||||
CC = gcc
|
||||
DEPDIR = .deps
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT =
|
||||
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LN_S = ln -s
|
||||
NO_PREFIX_PACKAGE_DATA_DIR = share/mbusd
|
||||
NO_PREFIX_PACKAGE_DOC_DIR = doc/mbusd
|
||||
NO_PREFIX_PACKAGE_HELP_DIR = share/mbusd/help
|
||||
NO_PREFIX_PACKAGE_MENU_DIR = share/mbusd
|
||||
NO_PREFIX_PACKAGE_PIXMAPS_DIR = share/mbusd/pixmaps
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = o
|
||||
PACKAGE = mbusd
|
||||
PACKAGE_DATA_DIR = /usr/local/share/mbusd
|
||||
PACKAGE_DOC_DIR = /usr/local/doc/mbusd
|
||||
PACKAGE_HELP_DIR = /usr/local/share/mbusd/help
|
||||
PACKAGE_MENU_DIR = /usr/local/share/mbusd
|
||||
PACKAGE_PIXMAPS_DIR = /usr/local/share/mbusd/pixmaps
|
||||
RANLIB = ranlib
|
||||
VERSION = 0.1.1
|
||||
am__include = include
|
||||
am__quote =
|
||||
install_sh = /usr/home/avm/work/mbus/install-sh
|
||||
|
||||
CFLAGS = \
|
||||
-W -pedantic\
|
||||
-Wall -O2
|
||||
|
||||
|
||||
bin_PROGRAMS = mbusd
|
||||
|
||||
mbusd_SOURCES = \
|
||||
main.c\
|
||||
tty.c\
|
||||
tty.h\
|
||||
globals.h\
|
||||
log.c\
|
||||
log.h\
|
||||
cfg.c\
|
||||
cfg.h\
|
||||
conn.c\
|
||||
conn.h\
|
||||
queue.c\
|
||||
queue.h\
|
||||
modbus.c\
|
||||
modbus.h\
|
||||
crc16.c\
|
||||
crc16.h\
|
||||
state.c\
|
||||
state.h\
|
||||
sig.h\
|
||||
sig.c\
|
||||
sock.h\
|
||||
sock.c
|
||||
|
||||
subdir = src
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
bin_PROGRAMS = mbusd$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
am_mbusd_OBJECTS = main.$(OBJEXT) tty.$(OBJEXT) log.$(OBJEXT) \
|
||||
cfg.$(OBJEXT) conn.$(OBJEXT) queue.$(OBJEXT) modbus.$(OBJEXT) \
|
||||
crc16.$(OBJEXT) state.$(OBJEXT) sig.$(OBJEXT) sock.$(OBJEXT)
|
||||
mbusd_OBJECTS = $(am_mbusd_OBJECTS)
|
||||
mbusd_LDADD = $(LDADD)
|
||||
mbusd_DEPENDENCIES =
|
||||
mbusd_LDFLAGS =
|
||||
|
||||
DEFS = -DHAVE_CONFIG_H
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
CPPFLAGS =
|
||||
LDFLAGS =
|
||||
LIBS = -lutil
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
DEP_FILES = $(DEPDIR)/cfg.Po $(DEPDIR)/conn.Po \
|
||||
$(DEPDIR)/crc16.Po $(DEPDIR)/log.Po \
|
||||
$(DEPDIR)/main.Po $(DEPDIR)/modbus.Po \
|
||||
$(DEPDIR)/queue.Po $(DEPDIR)/sig.Po \
|
||||
$(DEPDIR)/sock.Po $(DEPDIR)/state.Po \
|
||||
$(DEPDIR)/tty.Po
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
|
||||
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(mbusd_SOURCES)
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
SOURCES = $(mbusd_SOURCES)
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then \
|
||||
f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
|
||||
rm -f $(DESTDIR)$(bindir)/$$f; \
|
||||
done
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
mbusd$(EXEEXT): $(mbusd_OBJECTS) $(mbusd_DEPENDENCIES)
|
||||
@rm -f mbusd$(EXEEXT)
|
||||
$(LINK) $(mbusd_LDFLAGS) $(mbusd_OBJECTS) $(mbusd_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
include $(DEPDIR)/cfg.Po
|
||||
include $(DEPDIR)/conn.Po
|
||||
include $(DEPDIR)/crc16.Po
|
||||
include $(DEPDIR)/log.Po
|
||||
include $(DEPDIR)/main.Po
|
||||
include $(DEPDIR)/modbus.Po
|
||||
include $(DEPDIR)/queue.Po
|
||||
include $(DEPDIR)/sig.Po
|
||||
include $(DEPDIR)/sock.Po
|
||||
include $(DEPDIR)/state.Po
|
||||
include $(DEPDIR)/tty.Po
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf $(DEPDIR)
|
||||
|
||||
.c.o:
|
||||
source='$<' object='$@' libtool=no \
|
||||
depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
|
||||
$(CCDEPMODE) $(depcomp) \
|
||||
$(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
|
||||
|
||||
.c.obj:
|
||||
source='$<' object='$@' libtool=no \
|
||||
depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
|
||||
$(CCDEPMODE) $(depcomp) \
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.c.lo:
|
||||
source='$<' object='$@' libtool=yes \
|
||||
depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
|
||||
$(CCDEPMODE) $(depcomp) \
|
||||
$(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
|
||||
CCDEPMODE = depmode=gcc
|
||||
uninstall-info-am:
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
|
||||
|
||||
GTAGS:
|
||||
here=`CDPATH=: && cd $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic clean-libtool distclean distclean-compile \
|
||||
distclean-depend distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am info info-am install \
|
||||
install-am install-binPROGRAMS install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool tags uninstall uninstall-am \
|
||||
uninstall-binPROGRAMS uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
31
src/Makefile.am
Normal file
31
src/Makefile.am
Normal file
@ -0,0 +1,31 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
CFLAGS =\
|
||||
-W -pedantic\
|
||||
-Wall -O2
|
||||
|
||||
bin_PROGRAMS = mbusd
|
||||
|
||||
mbusd_SOURCES = \
|
||||
main.c\
|
||||
tty.c\
|
||||
tty.h\
|
||||
globals.h\
|
||||
log.c\
|
||||
log.h\
|
||||
cfg.c\
|
||||
cfg.h\
|
||||
conn.c\
|
||||
conn.h\
|
||||
queue.c\
|
||||
queue.h\
|
||||
modbus.c\
|
||||
modbus.h\
|
||||
crc16.c\
|
||||
crc16.h\
|
||||
state.c\
|
||||
state.h\
|
||||
sig.h\
|
||||
sig.c\
|
||||
sock.h\
|
||||
sock.c
|
382
src/Makefile.in
Normal file
382
src/Makefile.in
Normal file
@ -0,0 +1,382 @@
|
||||
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMTAR = @AMTAR@
|
||||
AS = @AS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
NO_PREFIX_PACKAGE_DATA_DIR = @NO_PREFIX_PACKAGE_DATA_DIR@
|
||||
NO_PREFIX_PACKAGE_DOC_DIR = @NO_PREFIX_PACKAGE_DOC_DIR@
|
||||
NO_PREFIX_PACKAGE_HELP_DIR = @NO_PREFIX_PACKAGE_HELP_DIR@
|
||||
NO_PREFIX_PACKAGE_MENU_DIR = @NO_PREFIX_PACKAGE_MENU_DIR@
|
||||
NO_PREFIX_PACKAGE_PIXMAPS_DIR = @NO_PREFIX_PACKAGE_PIXMAPS_DIR@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_DATA_DIR = @PACKAGE_DATA_DIR@
|
||||
PACKAGE_DOC_DIR = @PACKAGE_DOC_DIR@
|
||||
PACKAGE_HELP_DIR = @PACKAGE_HELP_DIR@
|
||||
PACKAGE_MENU_DIR = @PACKAGE_MENU_DIR@
|
||||
PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
install_sh = @install_sh@
|
||||
|
||||
CFLAGS = \
|
||||
-W -pedantic\
|
||||
-Wall -O2
|
||||
|
||||
|
||||
bin_PROGRAMS = mbusd
|
||||
|
||||
mbusd_SOURCES = \
|
||||
main.c\
|
||||
tty.c\
|
||||
tty.h\
|
||||
globals.h\
|
||||
log.c\
|
||||
log.h\
|
||||
cfg.c\
|
||||
cfg.h\
|
||||
conn.c\
|
||||
conn.h\
|
||||
queue.c\
|
||||
queue.h\
|
||||
modbus.c\
|
||||
modbus.h\
|
||||
crc16.c\
|
||||
crc16.h\
|
||||
state.c\
|
||||
state.h\
|
||||
sig.h\
|
||||
sig.c\
|
||||
sock.h\
|
||||
sock.c
|
||||
|
||||
subdir = src
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
bin_PROGRAMS = mbusd$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
am_mbusd_OBJECTS = main.$(OBJEXT) tty.$(OBJEXT) log.$(OBJEXT) \
|
||||
cfg.$(OBJEXT) conn.$(OBJEXT) queue.$(OBJEXT) modbus.$(OBJEXT) \
|
||||
crc16.$(OBJEXT) state.$(OBJEXT) sig.$(OBJEXT) sock.$(OBJEXT)
|
||||
mbusd_OBJECTS = $(am_mbusd_OBJECTS)
|
||||
mbusd_LDADD = $(LDADD)
|
||||
mbusd_DEPENDENCIES =
|
||||
mbusd_LDFLAGS =
|
||||
|
||||
DEFS = @DEFS@
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/cfg.Po $(DEPDIR)/conn.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/crc16.Po $(DEPDIR)/log.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/main.Po $(DEPDIR)/modbus.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/queue.Po $(DEPDIR)/sig.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/sock.Po $(DEPDIR)/state.Po \
|
||||
@AMDEP_TRUE@ $(DEPDIR)/tty.Po
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
|
||||
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(mbusd_SOURCES)
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
SOURCES = $(mbusd_SOURCES)
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then \
|
||||
f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
|
||||
rm -f $(DESTDIR)$(bindir)/$$f; \
|
||||
done
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
mbusd$(EXEEXT): $(mbusd_OBJECTS) $(mbusd_DEPENDENCIES)
|
||||
@rm -f mbusd$(EXEEXT)
|
||||
$(LINK) $(mbusd_LDFLAGS) $(mbusd_OBJECTS) $(mbusd_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cfg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/conn.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/crc16.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/log.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/modbus.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/queue.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sig.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sock.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/state.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/tty.Po@am__quote@
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf $(DEPDIR)
|
||||
|
||||
.c.o:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
|
||||
|
||||
.c.obj:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.c.lo:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
uninstall-info-am:
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
|
||||
|
||||
GTAGS:
|
||||
here=`CDPATH=: && cd $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic clean-libtool distclean distclean-compile \
|
||||
distclean-depend distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am info info-am install \
|
||||
install-am install-binPROGRAMS install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool tags uninstall uninstall-am \
|
||||
uninstall-binPROGRAMS uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
61
src/cfg.c
Normal file
61
src/cfg.c
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* cfg.c - configuration related procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cfg.c,v 1.1 2003/09/13 20:38:11 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "cfg.h"
|
||||
|
||||
/* Global configuration storage variable */
|
||||
cfg_t cfg;
|
||||
|
||||
/*
|
||||
* Setting up config defaults
|
||||
*/
|
||||
void
|
||||
cfg_init(void)
|
||||
{
|
||||
#ifdef LOG
|
||||
cfg.dbglvl = 2;
|
||||
strncpy(cfg.logname, LOGNAME, INTBUFSIZE);
|
||||
#endif
|
||||
strncpy(cfg.ttyport, DEFAULT_PORT, INTBUFSIZE);
|
||||
cfg.ttyspeed = DEFAULT_SPEED;
|
||||
#ifdef TRXCTL
|
||||
cfg.trxcntl = TRX_ADDC;
|
||||
#endif
|
||||
cfg.serverport = DEFAULT_SERVERPORT;
|
||||
cfg.maxconn = DEFAULT_MAXCONN;
|
||||
cfg.maxtry = DEFAULT_MAXTRY;
|
||||
cfg.rqstpause = DEFAULT_RQSTPAUSE;
|
||||
cfg.respwait = DEFAULT_RESPWAIT;
|
||||
cfg.resppause = DV(3, cfg.ttyspeed);
|
||||
cfg.conntimeout = DEFAULT_CONNTIMEOUT;
|
||||
}
|
77
src/cfg.h
Normal file
77
src/cfg.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* cfg.h - configuration related procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cfg.h,v 1.1 2003/09/13 20:38:16 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _CFG_H
|
||||
#define _CFG_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "log.h"
|
||||
#include "tty.h"
|
||||
#include "conn.h"
|
||||
|
||||
/* Global configuration storage structure */
|
||||
typedef struct
|
||||
{
|
||||
#ifdef LOG
|
||||
/* debug level */
|
||||
char dbglvl;
|
||||
/* log file name */
|
||||
char logname[INTBUFSIZE + 1];
|
||||
#endif
|
||||
/* tty port name */
|
||||
char ttyport[INTBUFSIZE + 1];
|
||||
/* tty speed */
|
||||
int ttyspeed;
|
||||
/* trx control type (0 - ADDC, 1 - by RTS) */
|
||||
int trxcntl;
|
||||
/* TCP server port number */
|
||||
int serverport;
|
||||
/* maximum number of connections */
|
||||
int maxconn;
|
||||
/* number of tries of request in case timeout (0 - no tries attempted) */
|
||||
int maxtry;
|
||||
/* staled connection timeout (in sec) */
|
||||
int conntimeout;
|
||||
/* inter-request pause (in msec) */
|
||||
unsigned long rqstpause;
|
||||
/* response waiting time (in msec) */
|
||||
unsigned long respwait;
|
||||
/* inter-byte response pause (in usec) */
|
||||
unsigned long resppause;
|
||||
} cfg_t;
|
||||
|
||||
/* Prototypes */
|
||||
extern cfg_t cfg;
|
||||
void cfg_init(void);
|
||||
|
||||
#endif /* _CFG_H */
|
585
src/conn.c
Normal file
585
src/conn.c
Normal file
@ -0,0 +1,585 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* conn.c - connections management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: conn.c,v 1.1 2003/09/13 20:38:33 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "conn.h"
|
||||
#include "queue.h"
|
||||
#include "state.h"
|
||||
|
||||
/* global variables */
|
||||
extern int server_sd;
|
||||
extern queue_t queue;
|
||||
extern ttydata_t tty;
|
||||
extern cfg_t cfg;
|
||||
|
||||
conn_t *actconn; /* last active connection */
|
||||
int max_sd; /* major descriptor in the select() sets */
|
||||
|
||||
void conn_tty_start(ttydata_t *tty, conn_t *conn);
|
||||
ssize_t conn_read(int d, void *buf, size_t nbytes);
|
||||
ssize_t conn_write(int d, void *buf, size_t nbytes);
|
||||
int conn_select(int nfds,
|
||||
fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||
struct timeval *timeout);
|
||||
|
||||
#define FD_MSET(d, s) do { FD_SET(d, s); max_sd = MAX(d, max_sd); } while (0);
|
||||
|
||||
/*
|
||||
* Connections startup initialization
|
||||
* Parameters: none
|
||||
* Return: RC_OK in case of success, RC_ERR otherwise
|
||||
*/
|
||||
int
|
||||
conn_init(void)
|
||||
{
|
||||
/* tty device initialization */
|
||||
#ifdef TRXCTL
|
||||
tty_init(&tty, cfg.ttyport, cfg.ttyspeed, cfg.trxcntl);
|
||||
#else
|
||||
tty_init(&tty, cfg.ttyport, cfg.ttyspeed);
|
||||
#endif
|
||||
if (tty_open(&tty) != RC_OK)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "conn_init():"
|
||||
" can't open tty device %s (%s)",
|
||||
cfg.ttyport, strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
state_tty_set(&tty, TTY_READY);
|
||||
|
||||
/* create server socket */
|
||||
if ((server_sd =
|
||||
sock_create_server("", cfg.serverport, TRUE)) < 0)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "conn_init():"
|
||||
" can't create listen() socket (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
|
||||
/* connections queue initialization */
|
||||
queue_init(&queue);
|
||||
|
||||
return RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open new client connection
|
||||
* Parameters: none
|
||||
* Return: none
|
||||
*/
|
||||
void
|
||||
conn_open(void)
|
||||
{
|
||||
int sd;
|
||||
conn_t *newconn;
|
||||
struct sockaddr_in rmt_addr;
|
||||
|
||||
if ((sd = sock_accept(server_sd, &rmt_addr, TRUE)) == RC_ERR)
|
||||
{ /* error in conn_accept() */
|
||||
#ifdef LOG
|
||||
log(0, "conn_open(): error in accept() (%s)", strerror(errno));
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#ifdef LOG
|
||||
log(2, "conn_open(): accepting connection from %s",
|
||||
inet_ntoa(rmt_addr.sin_addr));
|
||||
#endif
|
||||
/* compare descriptor of connection with FD_SETSIZE */
|
||||
if (sd >= FD_SETSIZE)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(1, "conn_open(): FD_SETSIZE limit reached,"
|
||||
" connection from %s will be dropped",
|
||||
inet_ntoa(rmt_addr.sin_addr));
|
||||
#endif
|
||||
close(sd);
|
||||
return;
|
||||
}
|
||||
/* check current number of connections */
|
||||
if (queue.len == cfg.maxconn)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(1, "conn_open(): number of connections limit reached,"
|
||||
" connection from %s will be dropped",
|
||||
inet_ntoa(rmt_addr.sin_addr));
|
||||
#endif
|
||||
close(sd);
|
||||
return;
|
||||
}
|
||||
/* enqueue connection */
|
||||
newconn = queue_new_elem(&queue);
|
||||
newconn->sd = sd;
|
||||
memcpy((void *) &newconn->sockaddr,
|
||||
&rmt_addr, sizeof(struct sockaddr_in));
|
||||
state_conn_set(newconn, CONN_HEADER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close client connection
|
||||
* Parameters: CONN - ptr to connection to close
|
||||
* Return: pointer to next queue element
|
||||
*/
|
||||
conn_t *
|
||||
conn_close(conn_t *conn)
|
||||
{
|
||||
conn_t *nextconn;
|
||||
#ifdef LOG
|
||||
log(2, "conn_close(): closing connection from %s",
|
||||
inet_ntoa(conn->sockaddr.sin_addr));
|
||||
#endif
|
||||
/* close socket */
|
||||
close(conn->sd);
|
||||
/* get pointer to next element */
|
||||
nextconn = queue_next_elem(&queue, conn);
|
||||
/* dequeue connection */
|
||||
queue_delete_elem(&queue, conn);
|
||||
if (actconn == conn) actconn = nextconn;
|
||||
return nextconn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start tty transaction
|
||||
* Parameters: TTY - ptr to tty structure,
|
||||
* CONN - ptr to active connection
|
||||
* Return: none
|
||||
*/
|
||||
void
|
||||
conn_tty_start(ttydata_t *tty, conn_t *conn)
|
||||
{
|
||||
(void)memcpy((void *)tty->txbuf,
|
||||
(void *)(conn->buf + HDRSIZE),
|
||||
MB_HDR(conn->buf, MB_LENGTH_L));
|
||||
modbus_crc_write(tty->txbuf, MB_HDR(conn->buf, MB_LENGTH_L));
|
||||
tty->txlen = MB_HDR(conn->buf, MB_LENGTH_L) + CRCSIZE;
|
||||
state_tty_set(tty, TTY_RQST);
|
||||
actconn = conn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read() wrapper. Read nomore BYTES from descriptor D in buffer BUF
|
||||
* Return: number of successfully readed bytes,
|
||||
* RC_ERR in case of error.
|
||||
*/
|
||||
ssize_t
|
||||
conn_read(int d, void *buf, size_t nbytes)
|
||||
{
|
||||
int rc;
|
||||
do
|
||||
{ /* trying read from descriptor while breaked by signals */
|
||||
rc = read(d, buf, nbytes);
|
||||
} while (rc == -1 && errno == EINTR);
|
||||
return (rc < 0) ? RC_ERR : rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write() wrapper. Write nomore BYTES to descriptor D from buffer BUF
|
||||
* Return: number of successfully written bytes,
|
||||
* RC_ERR in case of error.
|
||||
*/
|
||||
ssize_t
|
||||
conn_write(int d, void *buf, size_t nbytes)
|
||||
{
|
||||
int rc;
|
||||
do
|
||||
{ /* trying write to descriptor while breaked by signals */
|
||||
rc = write(d, buf, nbytes);
|
||||
} while (rc == -1 && errno == EINTR);
|
||||
return (rc < 0) ? RC_ERR : rc;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Select() wrapper with signal checking.
|
||||
* Return: number number of ready descriptors,
|
||||
* RC_ERR in case of error.
|
||||
*/
|
||||
int
|
||||
conn_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
int rc;
|
||||
do
|
||||
{ /* trying to select() while breaked by signals */
|
||||
rc = select(nfds, readfds, writefds, exceptfds, timeout);
|
||||
} while (rc == -1 && errno == EINTR);
|
||||
return (rc < 0) ? RC_ERR : rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Connections serving loop
|
||||
* Parameters: none
|
||||
* Return: none
|
||||
*/
|
||||
void
|
||||
conn_loop(void)
|
||||
{
|
||||
int rc, max_sd, len, min_timeout;
|
||||
fd_set sdsetrd, sdsetwr;
|
||||
struct timeval ts, tts, t_out;
|
||||
unsigned long tval, tout_sec, tout = 0ul;
|
||||
conn_t *curconn = NULL;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
/* check for the signals */
|
||||
if (sig_flag) sig_exec();
|
||||
|
||||
/* update FD_SETs */
|
||||
FD_ZERO(&sdsetrd);
|
||||
max_sd = server_sd;
|
||||
FD_MSET(server_sd, &sdsetrd);
|
||||
FD_ZERO(&sdsetwr);
|
||||
|
||||
/* update FD_SETs by TCP connections */
|
||||
len = queue.len;
|
||||
curconn = queue.beg;
|
||||
min_timeout = cfg.conntimeout;
|
||||
while (len--)
|
||||
{
|
||||
switch (curconn->state)
|
||||
{
|
||||
case CONN_HEADER:
|
||||
case CONN_RQST:
|
||||
FD_MSET(curconn->sd, &sdsetrd);
|
||||
break;
|
||||
case CONN_RESP:
|
||||
FD_MSET(curconn->sd, &sdsetwr);
|
||||
break;
|
||||
}
|
||||
min_timeout = MIN(min_timeout, curconn->timeout);
|
||||
curconn = queue_next_elem(&queue, curconn);
|
||||
}
|
||||
|
||||
/* update FD_SETs by tty connection */
|
||||
FD_MSET(tty.fd, &sdsetrd);
|
||||
if (tty.state == TTY_RQST) FD_MSET(tty.fd, &sdsetwr);
|
||||
|
||||
if (tty.timer)
|
||||
{ /* tty.timer is non-zero in TTY_PAUSE, TTY_RESP states */
|
||||
t_out.tv_sec = tty.timer / 1000000ul;
|
||||
t_out.tv_usec = tty.timer % 1000000ul;
|
||||
}
|
||||
else
|
||||
{
|
||||
t_out.tv_usec = 0ul;
|
||||
if (cfg.conntimeout)
|
||||
t_out.tv_sec = min_timeout; /* minor timeout value */
|
||||
else
|
||||
t_out.tv_sec = 10ul; /* XXX default timeout value */
|
||||
}
|
||||
|
||||
(void)gettimeofday(&ts, NULL); /* make timestamp */
|
||||
|
||||
#ifdef DEBUG
|
||||
log(7, "conn_loop(): select(): max_sd = %d, t_out = %06lu:%06lu ",
|
||||
max_sd, t_out.tv_sec, t_out.tv_usec);
|
||||
#endif
|
||||
|
||||
rc = select(max_sd + 1, &sdsetrd, &sdsetwr, NULL, &t_out);
|
||||
|
||||
if (rc < 0)
|
||||
{ /* some error caused while select() */
|
||||
if (errno == EINTR) continue; /* process signals */
|
||||
/* unrecoverable error in select(), exiting */
|
||||
#ifdef LOG
|
||||
log(0, "conn_loop(): error in select() (%s)", strerror(errno));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
/* calculating elapsed time */
|
||||
(void)gettimeofday(&tts, NULL);
|
||||
tval = 1000000ul * (tts.tv_sec - ts.tv_sec) +
|
||||
(tts.tv_usec - ts.tv_usec);
|
||||
|
||||
/* modify tty timer */
|
||||
if (tty.timer)
|
||||
{ /* tty timer is active */
|
||||
if (tty.timer <= tval)
|
||||
switch (tty.state)
|
||||
{ /* timer expired */
|
||||
case TTY_PAUSE:
|
||||
/* inter-request pause elapsed */
|
||||
/* looking for connections in CONN_TTY state */
|
||||
curconn = state_conn_search(&queue, actconn, CONN_TTY);
|
||||
if (curconn != NULL)
|
||||
conn_tty_start(&tty, curconn);
|
||||
else
|
||||
state_tty_set(&tty, TTY_READY);
|
||||
break;
|
||||
case TTY_RESP:
|
||||
/* checking for received data */
|
||||
if (FD_ISSET(tty.fd, &sdsetrd)) break;
|
||||
/* response timeout handling */
|
||||
if (!tty.ptrbuf)
|
||||
{/* there no bytes received */
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: response timeout", tty.ptrbuf);
|
||||
#endif
|
||||
if (!tty.trynum)
|
||||
modbus_ex_write(actconn->buf, MB_EX_TIMEOUT);
|
||||
else
|
||||
{ /* retry request */
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: attempt to retry request (%u of %u)",
|
||||
cfg.maxtry - tty.trynum + 1, cfg.maxtry);
|
||||
#endif
|
||||
state_tty_set(&tty, TTY_RQST);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* some data received */
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: response readed (total %d bytes)", tty.ptrbuf);
|
||||
#endif
|
||||
if (tty.ptrbuf >= MB_MIN_LEN &&
|
||||
modbus_crc_correct(tty.rxbuf, tty.ptrbuf))
|
||||
{ /* received response is correct, make OpenMODBUS response */
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: response is correct");
|
||||
#endif
|
||||
(void)memcpy((void *)(actconn->buf + HDRSIZE),
|
||||
(void *)tty.rxbuf, tty.ptrbuf - CRCSIZE);
|
||||
WORD_WR_BE(actconn->buf + MB_LENGTH_H, tty.ptrbuf - CRCSIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* received response is incomplete or CRC failed */
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: response is incorrect");
|
||||
#endif
|
||||
if (!tty.trynum)
|
||||
modbus_ex_write(actconn->buf, MB_EX_CRC);
|
||||
else
|
||||
{ /* retry request */
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: attempt to retry request (%u of %u)",
|
||||
cfg.maxtry - tty.trynum + 1, cfg.maxtry);
|
||||
#endif
|
||||
state_tty_set(&tty, TTY_RQST);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* switch connection to response state */
|
||||
state_conn_set(actconn, CONN_RESP);
|
||||
/* make inter-request pause */
|
||||
state_tty_set(&tty, TTY_PAUSE);
|
||||
break;
|
||||
}
|
||||
else tty.timer -= tval;
|
||||
}
|
||||
|
||||
if (cfg.conntimeout)
|
||||
{ /* expire staled connections */
|
||||
tout += tval;
|
||||
tout_sec = tout / 1000000ul;
|
||||
if (tout_sec)
|
||||
{ /* at least one second elapsed, check for staled connections */
|
||||
len = queue.len;
|
||||
curconn = queue.beg;
|
||||
while (len--)
|
||||
{
|
||||
curconn->timeout -= tout_sec;
|
||||
if (curconn->timeout <= 0)
|
||||
{ /* timeout expired */
|
||||
if (curconn->state == CONN_TTY)
|
||||
{ /* deadlock in CONN_TTY state, exiting */
|
||||
#ifdef LOG
|
||||
log(0, "conn[%s]: state CONN_TTY deadlock, exiting!",
|
||||
inet_ntoa(curconn->sockaddr.sin_addr));
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
/* purge connection */
|
||||
#ifdef LOG
|
||||
log(2, "conn[%s]: timeout, closing connection",
|
||||
inet_ntoa(curconn->sockaddr.sin_addr));
|
||||
#endif
|
||||
curconn = conn_close(curconn);
|
||||
continue;
|
||||
}
|
||||
curconn = queue_next_elem(&queue, curconn);
|
||||
}
|
||||
tout = tout % 1000000ul;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == 0)
|
||||
continue; /* timeout caused, we will do select() again */
|
||||
|
||||
/* checking for pending connections */
|
||||
if (FD_ISSET(server_sd, &sdsetrd)) conn_open();
|
||||
|
||||
/* tty processing */
|
||||
if (tty.state == TTY_RQST)
|
||||
if (FD_ISSET(tty.fd, &sdsetwr))
|
||||
{
|
||||
rc = conn_write(tty.fd, tty.txbuf + tty.ptrbuf,
|
||||
tty.txlen - tty.ptrbuf);
|
||||
if (rc <= 0)
|
||||
{ /* error - we can't continue... */
|
||||
#ifdef LOG
|
||||
log(0, "tty: error in write() (%s)", strerror(errno));
|
||||
#endif
|
||||
break; /* exiting... */
|
||||
}
|
||||
#ifdef DEBUG
|
||||
log(7, "tty: written %d bytes", rc);
|
||||
#endif
|
||||
tty.ptrbuf += rc;
|
||||
if (tty.ptrbuf == tty.txlen)
|
||||
{ /* request transmitting completed, switch to TTY_RESP */
|
||||
#ifdef DEBUG
|
||||
log(7, "tty: request written (total %d bytes)", tty.txlen);
|
||||
#endif
|
||||
state_tty_set(&tty, TTY_RESP);
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(tty.fd, &sdsetrd))
|
||||
{
|
||||
if (tty.state == TTY_RESP)
|
||||
{
|
||||
rc = conn_read(tty.fd, tty.rxbuf + tty.ptrbuf,
|
||||
tty.rxlen - tty.ptrbuf);
|
||||
if (rc <= 0)
|
||||
{ /* error - we can't continue... */
|
||||
#ifdef LOG
|
||||
log(0, "tty: error in read() (%s)", strerror(errno));
|
||||
#endif
|
||||
break; /* exiting... */
|
||||
}
|
||||
#ifdef DEBUG
|
||||
log(7, "tty: readed %d bytes", rc);
|
||||
#endif
|
||||
tty.ptrbuf += rc;
|
||||
if (tty.ptrbuf == tty.rxlen)
|
||||
{ /* XXX still generating error response */
|
||||
modbus_ex_write(actconn->buf, MB_EX_CRC);
|
||||
/* switch connection to response state */
|
||||
state_conn_set(actconn, CONN_RESP);
|
||||
/* make inter-request pause */
|
||||
state_tty_set(&tty, TTY_PAUSE);
|
||||
}
|
||||
else
|
||||
/* reset timer */
|
||||
tty.timer = cfg.respwait * 1000l;
|
||||
}
|
||||
else
|
||||
{ /* drop unexpected tty data */
|
||||
if ((rc = conn_read(tty.fd, tty.rxbuf, BUFSIZE)) <= 0)
|
||||
{ /* error - we can't continue... */
|
||||
#ifdef LOG
|
||||
log(0, "tty: error in read() (%s)", strerror(errno));
|
||||
#endif
|
||||
break; /* exiting... */
|
||||
}
|
||||
#ifdef DEBUG
|
||||
log(7, "tty: dropped %d bytes", rc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* processing data on the sockets */
|
||||
len = queue.len;
|
||||
curconn = queue.beg;
|
||||
while (len--)
|
||||
{
|
||||
switch (curconn->state)
|
||||
{
|
||||
case CONN_HEADER:
|
||||
case CONN_RQST:
|
||||
if (FD_ISSET(curconn->sd, &sdsetrd))
|
||||
{
|
||||
rc = conn_read(curconn->sd,
|
||||
curconn->buf + curconn->ctr,
|
||||
RQSTSIZE - curconn->ctr);
|
||||
if (rc <= 0)
|
||||
{ /* error - drop this connection and go to next queue element */
|
||||
curconn = conn_close(curconn);
|
||||
break;
|
||||
}
|
||||
curconn->ctr += rc;
|
||||
if (curconn->state == CONN_HEADER)
|
||||
if (curconn->ctr >= HDRSIZE)
|
||||
{ /* header received completely */
|
||||
if (modbus_check_header(curconn->buf) != RC_OK)
|
||||
{ /* header is damaged, drop connection */
|
||||
curconn = conn_close(curconn);
|
||||
break;
|
||||
}
|
||||
state_conn_set(curconn, CONN_RQST);
|
||||
}
|
||||
if (curconn->state == CONN_RQST)
|
||||
if (curconn->ctr >=
|
||||
HDRSIZE + MB_HDR(curconn->buf, MB_LENGTH_L))
|
||||
{ /* ### packet received completely ### */
|
||||
state_conn_set(curconn, CONN_TTY);
|
||||
if (tty.state == TTY_READY)
|
||||
conn_tty_start(&tty, curconn);
|
||||
}
|
||||
}
|
||||
curconn = queue_next_elem(&queue, curconn);
|
||||
break;
|
||||
case CONN_RESP:
|
||||
if (FD_ISSET(curconn->sd, &sdsetwr))
|
||||
{
|
||||
rc = conn_write(curconn->sd,
|
||||
curconn->buf + curconn->ctr,
|
||||
MB_HDR(curconn->buf, MB_LENGTH_L) +
|
||||
HDRSIZE - curconn->ctr);
|
||||
if (rc <= 0)
|
||||
{ /* error - drop this connection and go to next queue element */
|
||||
curconn = conn_close(curconn);
|
||||
break;
|
||||
}
|
||||
curconn->ctr += rc;
|
||||
if (curconn->ctr == (MB_HDR(curconn->buf, MB_LENGTH_L) + HDRSIZE))
|
||||
state_conn_set(curconn, CONN_HEADER);
|
||||
}
|
||||
curconn = queue_next_elem(&queue, curconn);
|
||||
break;
|
||||
} /* switch (curconn->state) */
|
||||
} /* while (len--) */
|
||||
} /* while (TRUE) */
|
||||
|
||||
/* XXX some cleanup must be here */
|
||||
}
|
90
src/conn.h
Normal file
90
src/conn.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* conn.h - connections management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: conn.h,v 1.1 2003/09/13 20:38:33 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _CONN_H
|
||||
#define _CONN_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "cfg.h"
|
||||
#include "sock.h"
|
||||
#include "modbus.h"
|
||||
#include "sig.h"
|
||||
#ifdef LOG
|
||||
#include "log.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Default values
|
||||
*/
|
||||
#define DEFAULT_SERVERPORT 502
|
||||
#define DEFAULT_MAXCONN 32
|
||||
#define DEFAULT_MAXTRY 3
|
||||
#define DEFAULT_RQSTPAUSE 100
|
||||
#define DEFAULT_RESPWAIT 10
|
||||
#define DEFAULT_CONNTIMEOUT 60
|
||||
|
||||
#define CRCSIZE 2 /* size (in bytes) of CRC */
|
||||
#define HDRSIZE 6 /* size (in bytes) of header */
|
||||
#define BUFSIZE 256 /* size (in bytes) of MODBUS data */
|
||||
#define RQSTSIZE (HDRSIZE + BUFSIZE - 2) /* size (in bytes) of MODBUS request */
|
||||
|
||||
/*
|
||||
* Client connection FSM states
|
||||
*/
|
||||
#define CONN_HEADER 0
|
||||
#define CONN_RQST 1
|
||||
#define CONN_TTY 2
|
||||
#define CONN_RESP 3
|
||||
|
||||
/*
|
||||
* Client connection related data storage structure
|
||||
*/
|
||||
typedef struct conn_t
|
||||
{
|
||||
struct conn_t *prev; /* linked list previous connection */
|
||||
struct conn_t *next; /* linked list next connection */
|
||||
int sd; /* socket descriptor */
|
||||
int state; /* current state */
|
||||
int timeout; /* timeout value, secs */
|
||||
struct sockaddr_in sockaddr; /* connection structure */
|
||||
int ctr; /* counter of data in the buffer */
|
||||
unsigned char buf[HDRSIZE + BUFSIZE]; /* data buffer */
|
||||
} conn_t;
|
||||
|
||||
/* prototypes */
|
||||
int conn_init(void);
|
||||
void conn_loop(void);
|
||||
void conn_open(void);
|
||||
conn_t *conn_close(conn_t *conn);
|
||||
|
||||
#endif /* _CONN_H */
|
79
src/crc16.c
Normal file
79
src/crc16.c
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* crc16.c - Cyclic Redundant Checks calculating
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: crc16.c,v 1.1 2003/09/13 20:38:39 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "crc16.h"
|
||||
|
||||
unsigned short
|
||||
crc_16_tab[] = {
|
||||
0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
|
||||
0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440,
|
||||
0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40,
|
||||
0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841,
|
||||
0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40,
|
||||
0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41,
|
||||
0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641,
|
||||
0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040,
|
||||
0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240,
|
||||
0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441,
|
||||
0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41,
|
||||
0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840,
|
||||
0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41,
|
||||
0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40,
|
||||
0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640,
|
||||
0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041,
|
||||
0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240,
|
||||
0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441,
|
||||
0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41,
|
||||
0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840,
|
||||
0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41,
|
||||
0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40,
|
||||
0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640,
|
||||
0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041,
|
||||
0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241,
|
||||
0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440,
|
||||
0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40,
|
||||
0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841,
|
||||
0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40,
|
||||
0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41,
|
||||
0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641,
|
||||
0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040
|
||||
};
|
||||
|
||||
unsigned short
|
||||
crc16(unsigned char *buf, unsigned int bsize)
|
||||
{
|
||||
unsigned short crc = 0xffff;
|
||||
while (bsize--)
|
||||
crc = (unsigned short)(crc >> 8) ^ crc_16_tab[(crc ^ *buf++) & 0xff];
|
||||
return crc;
|
||||
}
|
41
src/crc16.h
Normal file
41
src/crc16.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* crc16.h - Cyclic Redundant Checks calculating
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: crc16.h,v 1.1 2003/09/13 20:38:45 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _CRC_H
|
||||
#define _CRC_H
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
unsigned short crc16(unsigned char *buf, unsigned int bsize);
|
||||
|
||||
#endif /*_CRC_H */
|
103
src/globals.h
Normal file
103
src/globals.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* globals.h - global definitions
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: globals.h,v 1.1 2003/09/13 20:38:16 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _GLOBALS_H
|
||||
#define _GLOBALS_H
|
||||
|
||||
/* Include global configuration header file */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_LIBUTIL
|
||||
#include <libutil.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Uncomment this for enabling logging facility
|
||||
*/
|
||||
#define LOG
|
||||
#ifdef LOG
|
||||
/* uncomment this line for extra debug log info */
|
||||
#define DEBUG
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Useful min/max macroses
|
||||
*/
|
||||
#define MAX(a, b) ( (a > b) ? a : b )
|
||||
#define MIN(a, b) ( (a < b) ? a : b )
|
||||
|
||||
/*
|
||||
* Boolean constants
|
||||
*/
|
||||
#define FALSE 0
|
||||
#define TRUE !FALSE
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
#define RC_OK 0
|
||||
#define RC_ERR -1
|
||||
#define RC_BREAK -2
|
||||
#define RC_TIMEOUT -3
|
||||
#define RC_AOPEN -4
|
||||
#define RC_ACLOSE -5
|
||||
|
||||
/* Internal string buffers size */
|
||||
#if defined(PATH_MAX)
|
||||
#define INTBUFSIZE PATH_MAX
|
||||
#else
|
||||
#define INTBUFSIZE 1023
|
||||
#endif
|
||||
|
||||
#endif
|
112
src/log.c
Normal file
112
src/log.c
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* log.c - debug logging facility
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.c,v 1.1 2003/09/13 20:38:16 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#ifdef LOG
|
||||
#include "cfg.h"
|
||||
|
||||
/* log file full name */
|
||||
char logfullname[INTBUFSIZE + 1];
|
||||
|
||||
int
|
||||
log_init(char *logname)
|
||||
{
|
||||
FILE *logfile;
|
||||
int maxlen = INTBUFSIZE;
|
||||
|
||||
/* checking log file name */
|
||||
if (*logname != '/')
|
||||
{
|
||||
strncpy(logfullname, LOGPATH, maxlen);
|
||||
maxlen -= strlen(logfullname);
|
||||
strncat(logfullname, logname, maxlen);
|
||||
}
|
||||
else strncpy(logfullname, logname, maxlen);
|
||||
|
||||
logfile = fopen(logfullname, "at");
|
||||
if (logfile)
|
||||
{
|
||||
fclose(logfile);
|
||||
return RC_OK;
|
||||
}
|
||||
*logfullname = '\0';
|
||||
return RC_ERR;
|
||||
}
|
||||
|
||||
/* Append message STRING to log file LOGNAME */
|
||||
int
|
||||
log_app(char *logname, char *string)
|
||||
{
|
||||
FILE *logfile;
|
||||
logfile = fopen(logname, "at");
|
||||
if (logfile)
|
||||
{
|
||||
fputs(string, logfile);
|
||||
fclose(logfile);
|
||||
return RC_OK;
|
||||
}
|
||||
return RC_ERR;
|
||||
}
|
||||
|
||||
/* Put message with format FMT with errorlevel LEVEL to log file */
|
||||
void
|
||||
log(int level, char *fmt, ...)
|
||||
{
|
||||
#ifdef HRDATE
|
||||
time_t tt;
|
||||
struct tm *t;
|
||||
#else
|
||||
struct timeval tv;
|
||||
#endif
|
||||
va_list args;
|
||||
int strsize = 0;
|
||||
static char str[INTBUFSIZE + 1] = {0}, *p;
|
||||
|
||||
if (*logfullname == '\0' || level > cfg.dbglvl) return;
|
||||
#ifdef HRDATE
|
||||
tt = time(NULL);
|
||||
t = localtime(&tt);
|
||||
strsize += strftime(str, 32, "%d %b %Y %H:%M:%S ", t);
|
||||
#else
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
strsize += snprintf(str, 32, "%06lu:%06lu ", tv.tv_sec, tv.tv_usec);
|
||||
#endif
|
||||
va_start(args, fmt);
|
||||
p = str + strsize;
|
||||
strsize += vsnprintf(p, INTBUFSIZE - strsize, fmt, args);
|
||||
va_end(args);
|
||||
strcpy(str + strsize++, "\n");
|
||||
log_app(logfullname, str);
|
||||
}
|
||||
#endif
|
49
src/log.h
Normal file
49
src/log.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* log.h - debug logging facility
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.h,v 1.1 2003/09/13 20:38:16 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LOG_H
|
||||
#define _LOG_H
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
/* Default log file path and name */
|
||||
#define LOGPATH "/var/log/"
|
||||
#define LOGNAME "mbus.log"
|
||||
|
||||
#ifdef LOG
|
||||
int log_init(char *logname);
|
||||
int log_app(char *logname, char *string);
|
||||
void log(int level, char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#endif /* _LOG_H */
|
247
src/main.c
Normal file
247
src/main.c
Normal file
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* main.c - main module
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: main.c,v 1.1 2003/09/13 20:38:16 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "cfg.h"
|
||||
#include "tty.h"
|
||||
#include "sock.h"
|
||||
#include "conn.h"
|
||||
#include "queue.h"
|
||||
#include "sig.h"
|
||||
#ifdef LOG
|
||||
#include "log.h"
|
||||
#endif
|
||||
|
||||
int isdaemon = TRUE;
|
||||
|
||||
void usage(char *exename);
|
||||
|
||||
/* Server socket */
|
||||
int server_sd = -1;
|
||||
/* TTY related data storage variable */
|
||||
ttydata_t tty;
|
||||
/* Connections queue descriptor */
|
||||
queue_t queue;
|
||||
|
||||
void
|
||||
usage(char *exename)
|
||||
{
|
||||
printf("%s-%s copyright (c) Victor Antonovich, 2002-2003 // 2:5055/124.13@fidonet\n"
|
||||
"usage: %s [<options>] \n"
|
||||
"-h this help\n"
|
||||
"-d don't daemonize\n"
|
||||
#ifdef LOG
|
||||
#ifdef DEBUG
|
||||
"-v<level> set log level (0-9, default %d, 0 - errors only)\n"
|
||||
#else
|
||||
"-v<level> set log level (0-2, default %d, 0 - errors only)\n"
|
||||
#endif
|
||||
"-L<name> set log file name (default %s%s)\n"
|
||||
#endif
|
||||
"-p<name> set serial port device name (default %s)\n"
|
||||
"-s<value> set serial port speed (default %d)\n"
|
||||
#ifdef TRXCTL
|
||||
"-t force RTS RS-485 transmitting/receiving control\n"
|
||||
#endif
|
||||
"-P<number> set TCP server port number (default %d)\n"
|
||||
"-C<number> set number of simultaneous connections\n"
|
||||
" (1-128, default %d)\n"
|
||||
"-N<number> set number of request retries\n"
|
||||
" (0-15, default %d, 0 - without retries)\n"
|
||||
"-R<value> set pause between requests, millisecs\n"
|
||||
" (1-10000, default %lu)\n"
|
||||
"-W<value> set response wait time, millisecs\n"
|
||||
" (1-10000, default %lu)\n"
|
||||
"-T<value> set connection timeout value, secs\n"
|
||||
" (0-1000, default %d, 0 - no timeout)"
|
||||
"\n", PACKAGE, VERSION, exename,
|
||||
#ifdef LOG
|
||||
cfg.dbglvl, LOGPATH, LOGNAME,
|
||||
#endif
|
||||
cfg.ttyport, cfg.ttyspeed, cfg.serverport, cfg.maxconn,
|
||||
cfg.maxtry, cfg.rqstpause, cfg.respwait, cfg.conntimeout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int err = 0, rc;
|
||||
sig_init();
|
||||
cfg_init();
|
||||
|
||||
/* command line parsing */
|
||||
while ((rc = getopt(argc, argv,
|
||||
"dh"
|
||||
#ifdef TRXCTL
|
||||
"t"
|
||||
#endif
|
||||
#ifdef LOG
|
||||
"v:L:"
|
||||
#endif
|
||||
"p:s:P:C:N:R:W:T:")) != RC_ERR)
|
||||
{
|
||||
switch (rc)
|
||||
{
|
||||
case 'd':
|
||||
isdaemon = FALSE;
|
||||
break;
|
||||
#ifdef TRXCTL
|
||||
case 't':
|
||||
cfg.trxcntl = TRX_RTS;
|
||||
break;
|
||||
#endif
|
||||
#ifdef LOG
|
||||
case 'v':
|
||||
cfg.dbglvl = (char)strtol(optarg, NULL, 0);
|
||||
#ifdef DEBUG
|
||||
if (cfg.dbglvl < 0 || cfg.dbglvl > 9)
|
||||
{ /* report about invalid log level */
|
||||
printf("-v: invalid loglevel"
|
||||
" (%d, must be 0-9)\n", cfg.dbglvl);
|
||||
#else
|
||||
if (cfg.dbglvl < 0 || cfg.dbglvl > 9)
|
||||
{ /* report about invalid log level */
|
||||
printf("-v: invalid loglevel"
|
||||
" (%d, must be 0-2)\n", cfg.dbglvl);
|
||||
#endif
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
if (*optarg != '/')
|
||||
{ /* concatenate given log file name with default path */
|
||||
strncpy(cfg.logname, LOGPATH, INTBUFSIZE);
|
||||
strncat(cfg.logname, optarg,
|
||||
INTBUFSIZE - strlen(cfg.logname));
|
||||
}
|
||||
else strncpy(cfg.logname, optarg, INTBUFSIZE);
|
||||
break;
|
||||
#endif
|
||||
case 'p':
|
||||
if (*optarg != '/')
|
||||
{ /* concatenate given port name with default */
|
||||
/* path to devices mountpoint */
|
||||
strncpy(cfg.ttyport, "/dev/", INTBUFSIZE);
|
||||
strncat(cfg.ttyport, optarg,
|
||||
INTBUFSIZE - strlen(cfg.ttyport));
|
||||
}
|
||||
else strncpy(cfg.ttyport, optarg, INTBUFSIZE);
|
||||
break;
|
||||
case 's':
|
||||
cfg.ttyspeed = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'P':
|
||||
cfg.serverport = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'C':
|
||||
cfg.maxconn = strtoul(optarg, NULL, 0);
|
||||
if (cfg.maxconn < 1 || cfg.maxconn > 128)
|
||||
{ /* report about invalid max conn number */
|
||||
printf("-C: invalid number"
|
||||
" (%d, must be 1-128)\n", cfg.maxconn);
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'N':
|
||||
cfg.maxtry = strtoul(optarg, NULL, 0);
|
||||
if (cfg.maxtry > 15)
|
||||
{ /* report about invalid max conn number */
|
||||
printf("-N: invalid number"
|
||||
" (%d, must be 0-15)\n", cfg.maxtry);
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
cfg.rqstpause = strtoul(optarg, NULL, 0);
|
||||
if (cfg.rqstpause < 1 || cfg.rqstpause > 10000)
|
||||
{ /* report about invalid rqst pause value */
|
||||
printf("-R: invalid number"
|
||||
" (%lu, must be 1-10000)\n", cfg.rqstpause);
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
cfg.respwait = strtoul(optarg, NULL, 0);
|
||||
if (cfg.respwait < 1 || cfg.respwait > 10000)
|
||||
{ /* report about invalid resp wait value */
|
||||
printf("-W: invalid number"
|
||||
" (%lu, must be 1-10000)\n", cfg.respwait);
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'T':
|
||||
cfg.conntimeout = strtoul(optarg, NULL, 0);
|
||||
if (cfg.conntimeout > 1000)
|
||||
{ /* report about invalid conn timeout value */
|
||||
printf("-T: invalid number"
|
||||
" (%d, must be 1-1000)\n", cfg.conntimeout);
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LOG
|
||||
log_init(cfg.logname);
|
||||
log(2, "%s-%s started...", PACKAGE, VERSION);
|
||||
#endif
|
||||
|
||||
if (conn_init())
|
||||
{
|
||||
#ifdef LOG
|
||||
err = errno;
|
||||
log(2, "conn_init() failed, exiting...");
|
||||
#endif
|
||||
exit(err);
|
||||
}
|
||||
|
||||
/* go or not to daemon mode? */
|
||||
if (isdaemon && (rc = daemon(TRUE, FALSE)))
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "Can't be daemonized (%s), exiting...", strerror(errno));
|
||||
#endif
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
conn_loop();
|
||||
err = errno;
|
||||
#ifdef LOG
|
||||
log(2, "%s-%s exited...", PACKAGE, VERSION);
|
||||
#endif
|
||||
return (err);
|
||||
}
|
||||
|
87
src/modbus.c
Normal file
87
src/modbus.c
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* modbus.c - MODBUS protocol related procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: modbus.c,v 1.1 2003/09/13 20:38:39 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "modbus.h"
|
||||
|
||||
/*
|
||||
* Check CRC of MODBUS frame
|
||||
* Parameters: FRAME - address of the frame,
|
||||
* LEN - frame length;
|
||||
* Return: 0 if CRC failed,
|
||||
* non-zero otherwise
|
||||
*/
|
||||
int
|
||||
modbus_crc_correct(unsigned char *frame, unsigned int len)
|
||||
{
|
||||
return (!crc16(frame, len));
|
||||
}
|
||||
|
||||
/*
|
||||
* Write CRC to MODBUS frame
|
||||
* Parameters: FRAME - address of the frame,
|
||||
* LEN - frame length;
|
||||
* Return: none
|
||||
*/
|
||||
void
|
||||
modbus_crc_write(unsigned char *frame, unsigned int len)
|
||||
{
|
||||
WORD_WR_LE(frame + len, crc16(frame, len));
|
||||
}
|
||||
|
||||
/*
|
||||
* Write exception response to OpenMODBUS request
|
||||
* Parameters: PACKET - address of the request packet,
|
||||
* CODE - exception code;
|
||||
* Return: none
|
||||
*/
|
||||
void
|
||||
modbus_ex_write(unsigned char *packet, unsigned char code)
|
||||
{
|
||||
MB_HDR(packet, MB_FCODE) |= 0x80;
|
||||
MB_HDR(packet, MB_DATA) = code;
|
||||
WORD_WR_BE(packet + MB_LENGTH_H, MB_EX_LEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check MODBUS packet header consistency
|
||||
* Parameters: HEADER - address of the header
|
||||
* Return: RC_OK if (mostly) all is right, RC_ERR otherwise
|
||||
*/
|
||||
int
|
||||
modbus_check_header(unsigned char *packet)
|
||||
{
|
||||
return (MB_HDR(packet, MB_PROTO_ID_H) == 0 &&
|
||||
MB_HDR(packet, MB_PROTO_ID_L) == 0 &&
|
||||
MB_HDR(packet, MB_LENGTH_H) == 0 &&
|
||||
MB_HDR(packet, MB_LENGTH_L) > 0) ? RC_OK : RC_ERR;
|
||||
}
|
96
src/modbus.h
Normal file
96
src/modbus.h
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* modbus.h - MODBUS protocol related procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: modbus.h,v 1.1 2003/09/13 20:38:45 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MODBUS_H
|
||||
#define _MODBUS_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "crc16.h"
|
||||
|
||||
/*
|
||||
* Macros for invoking data from MODBUS packet header
|
||||
*/
|
||||
#define MB_HDR(p, d) ( *(p + d) )
|
||||
|
||||
/*
|
||||
* MODBUS frame lengths
|
||||
*/
|
||||
#define MB_EX_LEN 3
|
||||
#define MB_MIN_LEN 4
|
||||
#define MB_MAX_LEN 256
|
||||
|
||||
/*
|
||||
* Macroses for word operations
|
||||
*/
|
||||
#define HIGH(w) ( (unsigned char)(((w) >> 8) & 0xff) )
|
||||
#define LOW(w) ( (unsigned char)((w) & 0xff) )
|
||||
#define WORD_WR_BE(p, w) do \
|
||||
{ *(p) = (unsigned char)(((w) >> 8) & 0xff); \
|
||||
*(p + 1) = (unsigned char)((w) & 0xff); } \
|
||||
while (0);
|
||||
#define WORD_RD_BE(p) ( (((unsigned short)*(p) << 8) & 0xff00) + \
|
||||
(*(p + 1) & 0xff) )
|
||||
#define WORD_WR_LE(p, w) do \
|
||||
{ *(p) = (unsigned char)((w) & 0xff); \
|
||||
*(p + 1) = (unsigned char)(((w) >> 8) & 0xff); } \
|
||||
while (0);
|
||||
#define WORD_RD_LE(p) ( (((unsigned short)*(p + 1) << 8) & 0xff00) + \
|
||||
(*(p) & 0xff) )
|
||||
|
||||
/*
|
||||
* MODBUS packet structure
|
||||
*/
|
||||
#define MB_TRANS_ID_H 0 /* transaction ID high byte */
|
||||
#define MB_TRANS_ID_L 1 /* transaction ID low byte */
|
||||
#define MB_PROTO_ID_H 2 /* protocol ID high byte */
|
||||
#define MB_PROTO_ID_L 3 /* protocol ID low byte */
|
||||
#define MB_LENGTH_H 4 /* length field high byte */
|
||||
#define MB_LENGTH_L 5 /* length field low byte */
|
||||
#define MB_UNIT_ID 6 /* unit identifier */
|
||||
#define MB_FCODE 7 /* function code */
|
||||
#define MB_DATA 8 /* MODBUS data */
|
||||
|
||||
/*
|
||||
* Exception codes
|
||||
*/
|
||||
#define MB_EX_CRC 128
|
||||
#define MB_EX_TIMEOUT 129
|
||||
|
||||
/* Prototypes */
|
||||
int modbus_crc_correct(unsigned char *frame, unsigned int len);
|
||||
void modbus_crc_write(unsigned char *frame, unsigned int len);
|
||||
void modbus_ex_write(unsigned char *packet, unsigned char code);
|
||||
int modbus_check_header(unsigned char *packet);
|
||||
|
||||
|
||||
#endif /* _MODBUS_H */
|
119
src/queue.c
Normal file
119
src/queue.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* queue.c - Óonnections queue management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: queue.c,v 1.1 2003/09/13 20:38:39 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "queue.h"
|
||||
|
||||
/*
|
||||
* Queue structure initialization
|
||||
*/
|
||||
void
|
||||
queue_init(queue_t *queue)
|
||||
{
|
||||
queue->beg = NULL;
|
||||
queue->end = NULL;
|
||||
queue->len = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add new element to queue
|
||||
*/
|
||||
conn_t *
|
||||
queue_new_elem(queue_t *queue)
|
||||
{
|
||||
conn_t *newconn = (conn_t *)malloc(sizeof(conn_t));
|
||||
if (!newconn)
|
||||
{ /* Aborting program execution */
|
||||
#ifdef LOG
|
||||
log(0, "queue_new_elem(): out of memory for new element (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
exit(errno);
|
||||
}
|
||||
newconn->next = NULL;
|
||||
if ((newconn->prev = queue->end) != NULL)
|
||||
queue->end->next = newconn;
|
||||
else /* we add first element */
|
||||
queue->beg = newconn;
|
||||
queue->end = newconn;
|
||||
queue->len++;
|
||||
#ifdef DEBUG
|
||||
log(5, "queue_new_elem(): length now is %d", queue->len);
|
||||
#endif
|
||||
return newconn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove element from queue
|
||||
*/
|
||||
void
|
||||
queue_delete_elem(queue_t *queue, conn_t *conn)
|
||||
{
|
||||
if (queue->len <= 0)
|
||||
{ /* queue is empty */
|
||||
#ifdef LOG
|
||||
log(1, "queue_delete_elem(): queue empty!");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (conn->prev == NULL)
|
||||
{ /* deleting first element */
|
||||
if ((queue->beg = queue->beg->next) != NULL)
|
||||
queue->beg->prev = NULL;
|
||||
}
|
||||
else
|
||||
conn->prev->next = conn->next;
|
||||
if (conn->next == NULL)
|
||||
{ /* deleting last element */
|
||||
if ((queue->end = queue->end->prev) != NULL)
|
||||
queue->end->next = NULL;
|
||||
}
|
||||
else
|
||||
conn->next->prev = conn->prev;
|
||||
queue->len--;
|
||||
free((void *)conn);
|
||||
#ifdef DEBUG
|
||||
log(5, "queue_delete_elem(): length now is %d", queue->len);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Obtain pointer to next element in the QUEUE (with wrapping)
|
||||
* Parameters: CONN - pointer to current queue element
|
||||
* Return: pointer to next queue element
|
||||
*/
|
||||
conn_t *
|
||||
queue_next_elem(queue_t *queue, conn_t *conn)
|
||||
{
|
||||
return (conn->next == NULL) ? queue->beg : conn->next;
|
||||
}
|
59
src/queue.h
Normal file
59
src/queue.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* queue.h - Óonnections queue management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: queue.h,v 1.1 2003/09/13 20:38:39 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _QUEUE_H
|
||||
#define _QUEUE_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "conn.h"
|
||||
#ifdef LOG
|
||||
#include "log.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Queue parameters structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
conn_t *beg; /* address of first queue element */
|
||||
conn_t *end; /* address of last queue element */
|
||||
int len; /* number of elements in the queue */
|
||||
} queue_t;
|
||||
|
||||
/* prototypes */
|
||||
void queue_init(queue_t *queue);
|
||||
conn_t *queue_new_elem(queue_t *queue);
|
||||
void queue_delete_elem(queue_t *queue, conn_t *conn);
|
||||
conn_t *queue_next_elem(queue_t *queue, conn_t *conn);
|
||||
|
||||
#endif /* _QUEUE_H */
|
153
src/sig.c
Normal file
153
src/sig.c
Normal file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* sig.c - signals management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sig.c,v 1.1 2003/09/13 20:38:33 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "sig.h"
|
||||
#include "tty.h"
|
||||
|
||||
/* signal flag */
|
||||
volatile sig_atomic_t sig_flag = 0;
|
||||
|
||||
/* internal prototypes */
|
||||
void sig_bus(int signum);
|
||||
void sig_segv(int signum);
|
||||
void sig_handler(int signum);
|
||||
|
||||
/*
|
||||
* Signal handler initialization
|
||||
* Return: none
|
||||
*/
|
||||
void
|
||||
sig_init(void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
sa.sa_flags = 0;
|
||||
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaddset(&sa.sa_mask, SIGSEGV);
|
||||
sigaddset(&sa.sa_mask, SIGBUS);
|
||||
sigaddset(&sa.sa_mask, SIGTERM);
|
||||
sigaddset(&sa.sa_mask, SIGHUP);
|
||||
sigaddset(&sa.sa_mask, SIGINT);
|
||||
sigaddset(&sa.sa_mask, SIGPIPE);
|
||||
sigaddset(&sa.sa_mask, SIGCHLD);
|
||||
sigaddset(&sa.sa_mask, SIGALRM);
|
||||
sigaddset(&sa.sa_mask, SIGUSR1);
|
||||
sigaddset(&sa.sa_mask, SIGUSR2);
|
||||
|
||||
sa.sa_handler = sig_segv;
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
|
||||
sa.sa_handler = sig_bus;
|
||||
sigaction(SIGBUS, &sa, NULL);
|
||||
|
||||
sa.sa_handler = sig_handler;
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
|
||||
sa.sa_handler = sig_handler;
|
||||
sigaction(SIGHUP, &sa, NULL);
|
||||
|
||||
sa.sa_handler = sig_handler;
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &sa, NULL);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGCHLD, &sa, NULL);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGALRM, &sa, NULL);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGUSR1, &sa, NULL);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGUSR2, &sa, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* SIGSEGV signal handler
|
||||
*/
|
||||
void
|
||||
sig_segv(int signum)
|
||||
{
|
||||
#ifndef SAFESIG
|
||||
signum = signum; /* prevent compiler warning */
|
||||
fprintf(stderr, "caught SIGSEGV, dumping core...");
|
||||
fclose(stderr);
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
|
||||
/*
|
||||
* SIGBUS signal handler
|
||||
*/
|
||||
void
|
||||
sig_bus(int signum)
|
||||
{
|
||||
#ifndef SAFESIG
|
||||
signum = signum; /* prevent compiler warning */
|
||||
fprintf(stderr, "caught SIGBUS, dumping core...");
|
||||
fclose(stderr);
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
|
||||
/*
|
||||
* Unignored signals handler
|
||||
*/
|
||||
void
|
||||
sig_handler(int signum)
|
||||
{
|
||||
#ifndef SAFESIG
|
||||
tty_sighup();
|
||||
#endif
|
||||
sig_flag = signum;
|
||||
}
|
||||
|
||||
/*
|
||||
* Signal action execution
|
||||
*/
|
||||
void
|
||||
sig_exec(void)
|
||||
{
|
||||
#ifdef LOG
|
||||
static char *signames[] = {
|
||||
"", "HUP", "INT", "QUIT", "ILL", "TRAP", "IOT", "BUS", "FPE",
|
||||
"KILL", "USR1", "SEGV", "USR2", "PIPE", "ALRM", "TERM" };
|
||||
log(2, "Terminated by signal: SIG%s", signames[sig_flag]);
|
||||
#endif
|
||||
/* currently simply exit the program */
|
||||
exit(1);
|
||||
}
|
47
src/sig.h
Normal file
47
src/sig.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* sig.h - signals management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sig.h,v 1.1 2003/09/13 20:38:39 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SIG_H
|
||||
#define _SIG_H
|
||||
|
||||
#include "globals.h"
|
||||
#ifdef LOG
|
||||
#include "log.h"
|
||||
#endif
|
||||
|
||||
/* prototypes */
|
||||
extern volatile sig_atomic_t sig_flag;
|
||||
void sig_init(void);
|
||||
void sig_exec(void);
|
||||
|
||||
#endif /* _SIG_H */
|
232
src/sock.c
Normal file
232
src/sock.c
Normal file
@ -0,0 +1,232 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* sock.c - socket manipulation routines
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sock.c,v 1.1 2003/09/13 20:38:45 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "sock.h"
|
||||
|
||||
/*
|
||||
* Bring i/o descriptor SD to BLKMODE (if non-zero - socket is nonblocking)
|
||||
*
|
||||
* Return: RC_ERR if there some errors
|
||||
*/
|
||||
int
|
||||
sock_set_blkmode(int sd, int blkmode)
|
||||
{
|
||||
int flags;
|
||||
|
||||
flags = fcntl(sd, F_GETFL);
|
||||
if (flags == -1) return -1;
|
||||
|
||||
flags = blkmode ? (flags | O_NONBLOCK) : (flags & ~O_NONBLOCK);
|
||||
flags = fcntl(sd, F_SETFL, flags);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create new socket in BLKMODE mode (if non-zero - socket is nonblocking)
|
||||
*
|
||||
* Return: socket descriptor, otherwise RC_ERR if there some errors
|
||||
*/
|
||||
int
|
||||
sock_create(int blkmode)
|
||||
{
|
||||
int sock;
|
||||
|
||||
if ((sock =
|
||||
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_create(): unable to create socket (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
|
||||
/* set socket to desired blocking mode */
|
||||
if (sock_set_blkmode(sock, blkmode) == -1)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_create(): unable to set "
|
||||
"server socket to nonblocking (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create new server socket with SERVER_PORT, SERVER_IP -
|
||||
* port and address to bind the socket,
|
||||
* BLKMODE - blocking mode (if non-zero - socket is nonblocking)
|
||||
*
|
||||
* Return: socket descriptor, otherwise RC_ERR if there some errors
|
||||
*/
|
||||
int
|
||||
sock_create_server(char *server_ip,
|
||||
unsigned short server_port, int blkmode)
|
||||
{
|
||||
struct sockaddr_in server_sockaddr;
|
||||
int sock_opt = 1;
|
||||
int server_s;
|
||||
|
||||
/* create socket in desired blocking mode */
|
||||
server_s = sock_create(blkmode);
|
||||
if (server_s < 0) return server_s;
|
||||
|
||||
/* set to close socket on exec() */
|
||||
if (fcntl(server_s, F_SETFD, 1) == -1)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_create_server():"
|
||||
" can't set close-on-exec on socket (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
/* set reuse socket address */
|
||||
if (setsockopt(server_s, SOL_SOCKET,
|
||||
SO_REUSEADDR, (void *)&sock_opt,
|
||||
sizeof(sock_opt)) == -1)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_create_server():"
|
||||
" can't set socket to SO_REUSEADDR (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
/* ajust socket rx and tx buffer sizes */
|
||||
sock_opt = SOCKBUFSIZE;
|
||||
if ((setsockopt(server_s, SOL_SOCKET,
|
||||
SO_SNDBUF, (void *)&sock_opt,
|
||||
sizeof(sock_opt)) == -1) ||
|
||||
(setsockopt(server_s, SOL_SOCKET,
|
||||
SO_RCVBUF, (void *)&sock_opt,
|
||||
sizeof(sock_opt)) == -1))
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_create_server():"
|
||||
" can't set socket TRX buffers sizes (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
|
||||
memset(&server_sockaddr, 0, sizeof(server_sockaddr));
|
||||
server_sockaddr.sin_family = AF_INET;
|
||||
|
||||
if (server_ip != NULL)
|
||||
inet_aton(server_ip, &server_sockaddr.sin_addr);
|
||||
else
|
||||
server_sockaddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
server_sockaddr.sin_port = htons(server_port);
|
||||
|
||||
if (bind(server_s, (struct sockaddr *) & server_sockaddr,
|
||||
sizeof(server_sockaddr)) == -1)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_create_server():"
|
||||
" unable to bind() socket (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
|
||||
/* let's listen */
|
||||
if (listen(server_s, BACKLOG) == -1)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_create_server():"
|
||||
" unable to listen() on socket (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
exit(errno);
|
||||
}
|
||||
return server_s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Accept connection from SERVER_SD - server socket descriptor
|
||||
* and create socket in BLKMODE blocking mode
|
||||
* (if non-zero - socket is nonblocking)
|
||||
*
|
||||
* Return: socket descriptor, otherwise RC_ERR if there some errors;
|
||||
* RMT_ADDR - ptr to connection info structure
|
||||
*/
|
||||
int
|
||||
sock_accept(int server_sd, struct sockaddr_in *rmt_addr, int blkmode)
|
||||
{
|
||||
int sd, sock_opt = SOCKBUFSIZE;
|
||||
int rmt_len = sizeof(struct sockaddr_in);
|
||||
|
||||
sd = accept(server_sd, (struct sockaddr *) rmt_addr,
|
||||
(socklen_t *) &rmt_len);
|
||||
if (sd == -1)
|
||||
{
|
||||
if (errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
/* some errors caused */
|
||||
#ifdef LOG
|
||||
log(0, "sock_accept(): error in accept() (%s)", strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
/* tune socket */
|
||||
if (sock_set_blkmode(sd, blkmode) == RC_ERR)
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_accept(): can't set socket blocking mode (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
close(sd);
|
||||
return RC_ERR;
|
||||
}
|
||||
/* ajust socket rx and tx buffer sizes */
|
||||
if ((setsockopt(sd, SOL_SOCKET,
|
||||
SO_SNDBUF, (void *)&sock_opt,
|
||||
sizeof(sock_opt)) == -1) ||
|
||||
(setsockopt(sd, SOL_SOCKET,
|
||||
SO_RCVBUF, (void *)&sock_opt,
|
||||
sizeof(sock_opt)) == -1))
|
||||
{
|
||||
#ifdef LOG
|
||||
log(0, "sock_accept():"
|
||||
" can't set socket TRX buffer sizes (%s)",
|
||||
strerror(errno));
|
||||
#endif
|
||||
return RC_ERR;
|
||||
}
|
||||
return sd;
|
||||
}
|
54
src/sock.h
Normal file
54
src/sock.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* sock.h - socket manipulation routines
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sock.h,v 1.1 2003/09/13 20:38:45 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SOCKUTILS_H
|
||||
#define _SOCKUTILS_H
|
||||
|
||||
#include "globals.h"
|
||||
#ifdef LOG
|
||||
#include "log.h"
|
||||
#endif
|
||||
|
||||
#define BACKLOG 5
|
||||
|
||||
/* Socket buffers size */
|
||||
#define SOCKBUFSIZE 512
|
||||
|
||||
int sock_set_blkmode(int sd, int blkmode);
|
||||
int sock_create(int blkmode);
|
||||
int sock_create_server(char *server_ip,
|
||||
unsigned short server_port, int blkmode);
|
||||
int sock_accept(int server_sd,
|
||||
struct sockaddr_in *rmt_addr, int blkmode);
|
||||
|
||||
#endif
|
162
src/state.c
Normal file
162
src/state.c
Normal file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* state.c - state management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: state.c,v 1.1 2003/09/13 20:38:33 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "state.h"
|
||||
|
||||
/*
|
||||
* Search for first client connection in state STATE
|
||||
* Parameters: CONN - ptr to queue element
|
||||
* (if NULL - search from queue begin),
|
||||
* QUEUE - ptr to the queue;
|
||||
* Return: pointer to queue element
|
||||
* or NULL if none found
|
||||
*/
|
||||
conn_t *
|
||||
state_conn_search(queue_t *queue, conn_t *conn, int state)
|
||||
{
|
||||
int len = queue->len;
|
||||
|
||||
/* check for zero queue length */
|
||||
if (!queue->len) return NULL;
|
||||
|
||||
if (conn == NULL)
|
||||
conn = queue->beg;
|
||||
else
|
||||
conn = queue_next_elem(queue, conn);
|
||||
|
||||
while (len--)
|
||||
{
|
||||
if (conn->state == state)
|
||||
return conn;
|
||||
conn = queue_next_elem(queue, conn);
|
||||
}
|
||||
|
||||
return NULL; /* none found */
|
||||
}
|
||||
|
||||
/*
|
||||
* Set connection CONN to STATE
|
||||
*/
|
||||
void
|
||||
state_conn_set(conn_t *conn, int state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case CONN_HEADER:
|
||||
conn->ctr = 0;
|
||||
#ifdef DEBUG
|
||||
log(5, "conn[%s]: state now is CONN_HEADER",
|
||||
inet_ntoa(conn->sockaddr.sin_addr));
|
||||
#endif
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
case CONN_RQST:
|
||||
log(5, "conn[%s]: state now is CONN_RQST",
|
||||
inet_ntoa(conn->sockaddr.sin_addr));
|
||||
break;
|
||||
case CONN_TTY:
|
||||
log(5, "conn[%s]: state now is CONN_TTY",
|
||||
inet_ntoa(conn->sockaddr.sin_addr));
|
||||
break;
|
||||
#endif
|
||||
case CONN_RESP:
|
||||
conn->ctr = 0;
|
||||
#ifdef DEBUG
|
||||
log(5, "conn[%s]: state now is CONN_RESP",
|
||||
inet_ntoa(conn->sockaddr.sin_addr));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
/* unknown state, exiting */
|
||||
#ifdef DEBUG
|
||||
log(5, "conn_set_state([%s]) - invalid state (%d)",
|
||||
inet_ntoa(conn->sockaddr.sin_addr), state);
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
conn->state = state;
|
||||
/* reset timeout value */
|
||||
conn->timeout = cfg.conntimeout;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set tty device to STATE
|
||||
*/
|
||||
void
|
||||
state_tty_set(ttydata_t *mod, int state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case TTY_PAUSE:
|
||||
mod->trynum = 0;
|
||||
mod->timer = (unsigned long)cfg.rqstpause * 1000l;
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: state now is TTY_PAUSE");
|
||||
#endif
|
||||
break;
|
||||
case TTY_READY:
|
||||
mod->trynum = 0;
|
||||
mod->timer = 0l;
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: state now is TTY_READY");
|
||||
#endif
|
||||
break;
|
||||
case TTY_RQST:
|
||||
mod->ptrbuf = 0;
|
||||
mod->timer = 0l;
|
||||
mod->trynum = mod->trynum ? --mod->trynum : (unsigned)cfg.maxtry;
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: state now is TTY_RQST");
|
||||
#endif
|
||||
#ifndef NOSILENT
|
||||
tty_delay(DV(2, cfg.ttyspeed));
|
||||
#endif
|
||||
break;
|
||||
case TTY_RESP:
|
||||
mod->ptrbuf = 0;
|
||||
/* XXX need real recv length? */
|
||||
mod->rxlen = TTY_BUFSIZE;
|
||||
mod->timer = cfg.respwait * 1000l + DV(mod->txlen, mod->speed);
|
||||
#ifdef DEBUG
|
||||
log(5, "tty: state now is TTY_RESP");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
/* unknown state, exiting */
|
||||
#ifdef DEBUG
|
||||
log(5, "tty_set_state() - invalid state (%d)", state);
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
mod->state = state;
|
||||
}
|
51
src/state.h
Normal file
51
src/state.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* state.h - state management procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: state.h,v 1.1 2003/09/13 20:38:45 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _STATE_H
|
||||
#define _STATE_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "conn.h"
|
||||
#include "tty.h"
|
||||
#include "queue.h"
|
||||
#include "cfg.h"
|
||||
#ifdef LOG
|
||||
#include "log.h"
|
||||
#endif
|
||||
|
||||
/* prototypes */
|
||||
conn_t *state_conn_search(queue_t *queue, conn_t *conn, int state);
|
||||
void state_conn_set(conn_t *conn, int state);
|
||||
void state_tty_set(ttydata_t *mod, int state);
|
||||
|
||||
#endif /* _STATE_H */
|
363
src/tty.c
Normal file
363
src/tty.c
Normal file
@ -0,0 +1,363 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* tty.c - terminal I/O related procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tty.c,v 1.1 2003/09/13 20:38:28 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "tty.h"
|
||||
|
||||
extern cfg_t cfg;
|
||||
|
||||
static int tty_break;
|
||||
|
||||
/*
|
||||
* Flag signal SIG
|
||||
*/
|
||||
void
|
||||
tty_sighup(void)
|
||||
{
|
||||
tty_break = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Init serial link parameters MOD to PORT name, SPEED and TRXCNTL type
|
||||
*/
|
||||
void
|
||||
#ifdef TRXCTL
|
||||
tty_init(ttydata_t *mod, char *port, int speed, int trxcntl)
|
||||
#else
|
||||
tty_init(ttydata_t *mod, char *port, int speed)
|
||||
#endif
|
||||
{
|
||||
mod->fd = -1;
|
||||
mod->port = port;
|
||||
mod->speed = speed;
|
||||
#ifdef TRXCTL
|
||||
mod->trxcntl = trxcntl;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBUTIL
|
||||
char *tty_get_name(char *ttyfullname);
|
||||
|
||||
char *
|
||||
tty_get_name(char *ttyfullname)
|
||||
{
|
||||
static char ttynamebuf[INTBUFSIZE + 1];
|
||||
char *ttyname = ttynamebuf, *ttynameptr = ttyname;
|
||||
strncpy(ttynamebuf, ttyfullname, INTBUFSIZE);
|
||||
for (ttynameptr = strtok(ttynamebuf, "/");
|
||||
ttynameptr;
|
||||
ttynameptr = strtok(NULL, "/"))
|
||||
{
|
||||
ttyname = ttynameptr;
|
||||
}
|
||||
return ttyname;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Opening serial link whith parameters in MOD
|
||||
*/
|
||||
int
|
||||
tty_open(ttydata_t *mod)
|
||||
{
|
||||
#ifdef HAVE_LIBUTIL
|
||||
int buferr, uuerr;
|
||||
char *ttyname = tty_get_name(mod->port);
|
||||
#endif
|
||||
if (mod->fd > 0)
|
||||
return RC_AOPEN; /* if already open... */
|
||||
tty_break = FALSE;
|
||||
#ifdef HAVE_LIBUTIL
|
||||
if ((uuerr = uu_lock(ttyname)) != UU_LOCK_OK)
|
||||
{
|
||||
buferr = errno;
|
||||
#ifdef LOG
|
||||
log(0, "uu_lock(): can't lock tty device %s (%s)",
|
||||
ttyname, uu_lockerr(uuerr));
|
||||
#endif
|
||||
errno = buferr;
|
||||
return RC_ERR;
|
||||
}
|
||||
#endif
|
||||
mod->fd = open(mod->port, O_RDWR | O_NONBLOCK);
|
||||
if (mod->fd < 0)
|
||||
return RC_ERR; /* attempt failed */
|
||||
return tty_set_attr(mod);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setting up tty device MOD attributes
|
||||
*/
|
||||
int
|
||||
tty_set_attr(ttydata_t *mod)
|
||||
{
|
||||
int flag;
|
||||
|
||||
if (tcgetattr(mod->fd, &mod->savedtios))
|
||||
return RC_ERR;
|
||||
memcpy(&mod->tios, &mod->savedtios, sizeof(mod->tios));
|
||||
mod->tios.c_cflag &= ~(CSTOPB | PARENB | PARODD | CRTSCTS);
|
||||
mod->tios.c_cflag |= CS8 | CREAD | CLOCAL;
|
||||
mod->tios.c_iflag = FALSE;
|
||||
mod->tios.c_oflag = FALSE;
|
||||
mod->tios.c_lflag = FALSE;
|
||||
mod->tios.c_cc[VTIME] = 0;
|
||||
mod->tios.c_cc[VMIN] = 1;
|
||||
cfsetspeed(&mod->tios, tty_transpeed(mod->speed));
|
||||
if (tcsetattr(mod->fd, TCSANOW, &mod->tios))
|
||||
return RC_ERR;
|
||||
#if defined(TIOCSETA)
|
||||
ioctl(mod->fd, TIOCSETA, &mod->tios);
|
||||
#else
|
||||
/* if TIOCSETA is not defined, try to fallback to TCSETA */
|
||||
ioctl(mod->fd, TCSETA, &mod->tios);
|
||||
#endif
|
||||
tcflush(mod->fd, TCIOFLUSH);
|
||||
#ifdef TRXCTL
|
||||
tty_clr_rts(mod->fd);
|
||||
#endif
|
||||
flag = fcntl(mod->fd, F_GETFL, 0);
|
||||
if (flag < 0)
|
||||
return RC_ERR;
|
||||
return fcntl(mod->fd, F_SETFL, flag | O_NONBLOCK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate integer SPEED value to speed_t constant
|
||||
*/
|
||||
speed_t
|
||||
tty_transpeed(int speed)
|
||||
{
|
||||
speed_t tspeed;
|
||||
switch (speed)
|
||||
{
|
||||
case 0:
|
||||
tspeed = B0;
|
||||
break;
|
||||
#if defined(B50)
|
||||
case 50:
|
||||
tspeed = B50;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B75)
|
||||
case 75:
|
||||
tspeed = B75;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B110)
|
||||
case 110:
|
||||
tspeed = B110;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B134)
|
||||
case 134:
|
||||
tspeed = B134;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B150)
|
||||
case 150:
|
||||
tspeed = B150;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B200)
|
||||
case 200:
|
||||
tspeed = B200;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B300)
|
||||
case 300:
|
||||
tspeed = B300;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B600)
|
||||
case 600:
|
||||
tspeed = B600;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B1200)
|
||||
case 1200:
|
||||
tspeed = B1200;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B1800)
|
||||
case 1800:
|
||||
tspeed = B1800;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B2400)
|
||||
case 2400:
|
||||
tspeed = B2400;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B4800)
|
||||
case 4800:
|
||||
tspeed = B4800;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B7200)
|
||||
case 7200:
|
||||
tspeed = B7200;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B9600)
|
||||
case 9600:
|
||||
tspeed = B9600;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B12000)
|
||||
case 12000:
|
||||
tspeed = B12000;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B14400)
|
||||
case 14400:
|
||||
tspeed = B14400;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B19200)
|
||||
case 19200:
|
||||
tspeed = B19200;
|
||||
break;
|
||||
#elif defined(EXTA)
|
||||
case 19200:
|
||||
tspeed = EXTA;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B38400)
|
||||
case 38400:
|
||||
tspeed = B38400;
|
||||
break;
|
||||
#elif defined(EXTB)
|
||||
case 38400:
|
||||
tspeed = EXTB;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B57600)
|
||||
case 57600:
|
||||
tspeed = B57600;
|
||||
break;
|
||||
#endif
|
||||
#if defined(B115200)
|
||||
case 115200:
|
||||
tspeed = B115200;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
tspeed = DEFAULT_BSPEED;
|
||||
}
|
||||
return tspeed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare tty device MOD to closing
|
||||
*/
|
||||
int
|
||||
tty_cooked(ttydata_t *mod)
|
||||
{
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
if (!isatty(mod->fd))
|
||||
return RC_ERR;
|
||||
if (tcsetattr(mod->fd, TCSAFLUSH, &mod->savedtios))
|
||||
return RC_ERR;
|
||||
return RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Closing tty device MOD
|
||||
*/
|
||||
int
|
||||
tty_close(ttydata_t *mod)
|
||||
{
|
||||
#ifdef HAVE_LIBUTIL
|
||||
int buferr;
|
||||
char *ttyname = tty_get_name(mod->port);
|
||||
#endif
|
||||
if (mod->fd < 0)
|
||||
return RC_ACLOSE; /* already closed */
|
||||
if (tty_cooked(mod))
|
||||
return RC_ERR;
|
||||
#ifdef HAVE_LIBUTIL
|
||||
if (close(mod->fd))
|
||||
return RC_ERR;
|
||||
if (uu_unlock(ttyname))
|
||||
{
|
||||
buferr = errno;
|
||||
#ifdef LOG
|
||||
log(0, "uu_lock(): can't unlock tty device %s",
|
||||
ttyname);
|
||||
#endif
|
||||
errno = buferr;
|
||||
return RC_ERR;
|
||||
}
|
||||
return RC_OK;
|
||||
#else
|
||||
return close(mod->fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef TRXCTL
|
||||
/* Set RTS line to active state */
|
||||
void
|
||||
tty_set_rts(int fd)
|
||||
{
|
||||
int mstat = TIOCM_RTS;
|
||||
ioctl(fd, TIOCMBIS, &mstat);
|
||||
}
|
||||
|
||||
/* Set RTS line to passive state */
|
||||
void
|
||||
tty_clr_rts(int fd)
|
||||
{
|
||||
int mstat = TIOCM_RTS;
|
||||
ioctl(fd, TIOCMBIC, &mstat);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Delay for USEC microsecs
|
||||
*/
|
||||
void
|
||||
tty_delay(int usec)
|
||||
{
|
||||
struct timeval tv, ttv;
|
||||
long ts;
|
||||
gettimeofday(&tv, NULL);
|
||||
do
|
||||
{
|
||||
(void)gettimeofday(&ttv, NULL);
|
||||
ts = 1000000 * (ttv.tv_sec - tv.tv_sec) + (ttv.tv_usec - tv.tv_usec);
|
||||
} while (ts < usec && !tty_break);
|
||||
}
|
||||
|
112
src/tty.h
Normal file
112
src/tty.h
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* OpenMODBUS/TCP to RS-232/485 MODBUS RTU gateway
|
||||
*
|
||||
* tty.h - terminal I/O related procedures
|
||||
*
|
||||
* Copyright (c) 2002-2003, Victor Antonovich (avmlink@vlink.ru)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tty.h,v 1.1 2003/09/13 20:38:28 kapyar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _TTY_H
|
||||
#define _TTY_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "cfg.h"
|
||||
|
||||
/*
|
||||
* Delay value calculation macros
|
||||
*/
|
||||
#define DV(x, y) (x * 10000000l / y)
|
||||
|
||||
/*
|
||||
* Default tty port parameters
|
||||
*/
|
||||
#define DEFAULT_PORT "/dev/cuaa0"
|
||||
#define DEFAULT_SPEED 19200
|
||||
#define DEFAULT_BSPEED B19200
|
||||
|
||||
/*
|
||||
* Maximum tty buffer size
|
||||
*/
|
||||
#define TTY_BUFSIZE 256
|
||||
|
||||
/*
|
||||
* TRX control types
|
||||
*/
|
||||
#ifdef TRX_CTL
|
||||
#define TRX_ADDC 0
|
||||
#define TRX_RTS !TRX_ADDC
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TTY device FSM states
|
||||
*/
|
||||
#define TTY_PAUSE 0
|
||||
#define TTY_READY 1
|
||||
#define TTY_RQST 2
|
||||
#define TTY_RESP 3
|
||||
|
||||
/*
|
||||
* TTY related data storage structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int fd; /* tty file descriptor */
|
||||
int speed; /* serial port speed */
|
||||
char *port; /* serial port device name */
|
||||
#ifdef TRXCTL
|
||||
int trxcntl; /* trx control type (0 - ADDC, RTS otherwise) */
|
||||
#endif
|
||||
struct termios tios; /* working termios structure */
|
||||
struct termios savedtios; /* saved termios structure */
|
||||
int state; /* current state */
|
||||
unsigned int trynum; /* try counter */
|
||||
unsigned long timer; /* time tracking variable */
|
||||
unsigned int txlen; /* tx data length */
|
||||
unsigned int rxlen; /* rx data length */
|
||||
unsigned char ptrbuf; /* ptr in the buffer */
|
||||
unsigned char txbuf[TTY_BUFSIZE]; /* transmitting buffer */
|
||||
unsigned char rxbuf[TTY_BUFSIZE]; /* receiving buffer */
|
||||
} ttydata_t;
|
||||
|
||||
/* prototypes */
|
||||
void tty_sighup(void);
|
||||
#ifdef TRXCTL
|
||||
void tty_init(ttydata_t *mod, char *port, int speed, int trxcntl);
|
||||
#else
|
||||
void tty_init(ttydata_t *mod, char *port, int speed);
|
||||
#endif
|
||||
int tty_open(ttydata_t *mod);
|
||||
int tty_set_attr(ttydata_t *mod);
|
||||
speed_t tty_transpeed(int speed);
|
||||
int tty_cooked(ttydata_t *mod);
|
||||
int tty_close(ttydata_t *mod);
|
||||
void tty_set_rts(int fd);
|
||||
void tty_clr_rts(int fd);
|
||||
void tty_delay(int usec);
|
||||
|
||||
#endif /* _TTY_H */
|
1
stamp-h.in
Normal file
1
stamp-h.in
Normal file
@ -0,0 +1 @@
|
||||
timestamp
|
Loading…
Reference in New Issue
Block a user