From 0999dbae05eb1519539532177d48a6189efb1d45 Mon Sep 17 00:00:00 2001 From: kapyar Date: Sat, 27 Sep 2003 13:45:00 +0000 Subject: [PATCH] File updated --- Makefile.in | 1 + config.h.in | 6 ++ configure | 170 +++++++++++++++++++++++++++++++++++++++++++++++- doc/Makefile.in | 6 +- doc/mbusd.8 | 79 ---------------------- src/globals.h | 22 +++---- src/queue.h | 4 +- src/sig.h | 4 +- src/sock.h | 4 +- src/state.h | 4 +- 10 files changed, 199 insertions(+), 101 deletions(-) delete mode 100644 doc/mbusd.8 diff --git a/Makefile.in b/Makefile.in index 7107b1e..790f058 100644 --- a/Makefile.in +++ b/Makefile.in @@ -294,6 +294,7 @@ GZIP_ENV = --best distdir: $(DISTFILES) -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) mkdir $(distdir) + $(mkinstalldirs) $(distdir)/doc @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ diff --git a/config.h.in b/config.h.in index 720d69f..9503730 100644 --- a/config.h.in +++ b/config.h.in @@ -17,6 +17,12 @@ #undef PACKAGE_MENU_DIR #undef PACKAGE_SOURCE_DIR +/* Define if you have the cfsetspeed function. */ +#undef HAVE_CFSETSPEED + +/* Define if you have the daemon function. */ +#undef HAVE_DAEMON + /* Define if you have the util library (-lutil). */ #undef HAVE_LIBUTIL diff --git a/configure b/configure index a91248f..6d80834 100755 --- a/configure +++ b/configure @@ -802,7 +802,7 @@ fi # Define the identity of the package. PACKAGE=mbusd -VERSION=0.1.1 +VERSION=0.1.2 cat >> confdefs.h <&2 fi +for ac_func in daemon +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2002: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in cfsetspeed +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2057: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +for ac_func in cfsetispeed +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2109: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +{ echo "configure: error: "Both cfsetspeed\(\) and cfsetispeed\(\) functions not found!"" 1>&2; exit 1; } +fi +done + +fi +done + packagesrcdir=`cd $srcdir && pwd` @@ -2166,6 +2332,7 @@ trap 'rm -fr `echo " Makefile src/Makefile doc/Makefile +doc/mbusd.8 config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF diff --git a/doc/Makefile.in b/doc/Makefile.in index a58105a..4f6d0cb 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -90,12 +90,12 @@ man_MANS = mbusd.8 subdir = doc mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = mbusd.8 DIST_SOURCES = NROFF = nroff MANS = $(man_MANS) -DIST_COMMON = Makefile.am Makefile.in +DIST_COMMON = Makefile.am Makefile.in mbusd.8.in all: all-am .SUFFIXES: @@ -115,6 +115,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +mbusd.8: $(top_builddir)/config.status mbusd.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status uninstall-info-am: man8dir = $(mandir)/man8 diff --git a/doc/mbusd.8 b/doc/mbusd.8 deleted file mode 100644 index 7c4651a..0000000 --- a/doc/mbusd.8 +++ /dev/null @@ -1,79 +0,0 @@ -.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 . -.SH LICENSE -This program is distributed under the BSD-like license, included in -each source file. See also COPYING file in the installation directory. diff --git a/src/globals.h b/src/globals.h index 57b6a74..b2fb689 100644 --- a/src/globals.h +++ b/src/globals.h @@ -28,7 +28,7 @@ * 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 $ + * $Id: globals.h,v 1.2 2003/09/27 13:45:01 kapyar Exp $ */ #ifndef _GLOBALS_H @@ -36,7 +36,7 @@ /* Include global configuration header file */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include @@ -59,7 +59,7 @@ #include #include #ifdef HAVE_LIBUTIL -#include +# include #endif /* @@ -68,7 +68,7 @@ #define LOG #ifdef LOG /* uncomment this line for extra debug log info */ -#define DEBUG +# define DEBUG #endif /* @@ -86,18 +86,18 @@ /* * Constants */ -#define RC_OK 0 -#define RC_ERR -1 -#define RC_BREAK -2 +#define RC_OK 0 +#define RC_ERR -1 +#define RC_BREAK -2 #define RC_TIMEOUT -3 -#define RC_AOPEN -4 -#define RC_ACLOSE -5 +#define RC_AOPEN -4 +#define RC_ACLOSE -5 /* Internal string buffers size */ #if defined(PATH_MAX) -#define INTBUFSIZE PATH_MAX +# define INTBUFSIZE PATH_MAX #else -#define INTBUFSIZE 1023 +# define INTBUFSIZE 1023 #endif #endif diff --git a/src/queue.h b/src/queue.h index 045c28f..4ed696d 100644 --- a/src/queue.h +++ b/src/queue.h @@ -28,7 +28,7 @@ * 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 $ + * $Id: queue.h,v 1.2 2003/09/27 13:45:01 kapyar Exp $ */ #ifndef _QUEUE_H @@ -37,7 +37,7 @@ #include "globals.h" #include "conn.h" #ifdef LOG -#include "log.h" +# include "log.h" #endif /* diff --git a/src/sig.h b/src/sig.h index 51a40a6..9f8094f 100644 --- a/src/sig.h +++ b/src/sig.h @@ -28,7 +28,7 @@ * 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 $ + * $Id: sig.h,v 1.2 2003/09/27 13:45:01 kapyar Exp $ */ #ifndef _SIG_H @@ -36,7 +36,7 @@ #include "globals.h" #ifdef LOG -#include "log.h" +# include "log.h" #endif /* prototypes */ diff --git a/src/sock.h b/src/sock.h index 417270c..99f88f7 100644 --- a/src/sock.h +++ b/src/sock.h @@ -28,7 +28,7 @@ * 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 $ + * $Id: sock.h,v 1.2 2003/09/27 13:45:01 kapyar Exp $ */ #ifndef _SOCKUTILS_H @@ -36,7 +36,7 @@ #include "globals.h" #ifdef LOG -#include "log.h" +# include "log.h" #endif #define BACKLOG 5 diff --git a/src/state.h b/src/state.h index 544cfa3..765ddf6 100644 --- a/src/state.h +++ b/src/state.h @@ -28,7 +28,7 @@ * 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 $ + * $Id: state.h,v 1.2 2003/09/27 13:45:01 kapyar Exp $ */ #ifndef _STATE_H @@ -40,7 +40,7 @@ #include "queue.h" #include "cfg.h" #ifdef LOG -#include "log.h" +# include "log.h" #endif /* prototypes */