Merge branch 'openbsd-initial' of https://github.com/czarkoff/tg

Conflicts:
	.gitignore
	README.md
This commit is contained in:
vysheng 2014-03-05 01:54:24 +04:00
commit 1f5050318b
9 changed files with 129 additions and 250 deletions

2
.gitignore vendored
View File

@ -5,5 +5,3 @@ autom4te.cache
config.h
config.log
config.status
.idea/
nbproject/

View File

@ -1,35 +0,0 @@
srcdir=.
CFLAGS=-g -O2 -I/usr/include/lua5.2
LDFLAGS=
CPPFLAGS=
DEFS=-DHAVE_CONFIG_H
COMPILE_FLAGS=${CFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb
EXTRA_LIBS=-lconfig -lcrypto -lz -lm -lreadline -llua5.2 -ldl
LOCAL_LDFLAGS=-rdynamic -ggdb ${EXTRA_LIBS}
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
HEADERS= ${srcdir}/constants.h ${srcdir}/include.h ${srcdir}/interface.h ${srcdir}/LICENSE.h ${srcdir}/loop.h ${srcdir}/mtproto-client.h ${srcdir}/mtproto-common.h ${srcdir}/net.h ${srcdir}/no-preview.h ${srcdir}/queries.h ${srcdir}/structures.h ${srcdir}/telegram.h ${srcdir}/tree.h ${srcdir}/config.h ${srcdir}/binlog.h ${srcdir}/tools.h ${srcdir}/lua-tg.h
INCLUDE=-I. -I${srcdir}
CC=gcc
OBJECTS=main.o loop.o interface.o net.o mtproto-common.o mtproto-client.o queries.o structures.o binlog.o tools.o lua-tg.o
.SUFFIXES:
.SUFFIXES: .c .h .o
all: telegram
${OBJECTS}: ${HEADERS}
telegram: ${OBJECTS}
${CC} ${OBJECTS} ${LINK_FLAGS} -o $@
.c.o :
${CC} ${COMPILE_FLAGS} ${INCLUDE} -c $< -o $@
clean:
rm -rf *.o telegram config.log config.status > /dev/null || echo "all clean"

View File

@ -4,7 +4,7 @@ CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
CPPFLAGS=@CPPFLAGS@
DEFS=@DEFS@
COMPILE_FLAGS=${CFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb
COMPILE_FLAGS=${CFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb
EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@
LOCAL_LDFLAGS=-rdynamic -ggdb ${EXTRA_LIBS}

View File

@ -19,13 +19,17 @@ or download and extract zip
$ wget https://github.com/vysheng/tg/archive/master.zip -O tg-master.zip
$ unzip tg-master.zip && cd tg-master
#### Linux
#### Linux and BSDs
Install libs: readline or libedit, openssl and (if you want to use config) libconfig and liblua.
If you do not want to use them pass options --disable-libconfig and --disable-liblua respectively.
Default Makefile uses liblua5.2 from ubuntu. If you use different version of liblua or Linux you have to run ./configure script or you will get some strange compilation error.
Install libs: readline openssl and (if you want to use config) libconfig and liblua.
If you do not want to use them pass options --disable-libconfig and --disable-liblua respectively
On ubuntu use:
$ sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev
On gentoo:
$ sudo emerge -av sys-libs/readline dev-libs/libconfig dev-libs/openssl dev-lang/lua
@ -34,7 +38,11 @@ On Fedora:
d
$ sudo yum install lua-devel openssl-devel libconfig-devel readline-devel
Default Makefile uses liblua5.2 from ubuntu. If you use different version of liblua or Linux you have to run ./configure script or you will get some strange compilation error.
On FreeBSD:
$ pkg install libconfig libexecinfo lua52
On OpenBSD:
$ pkg_add libconfig libexecinfo lua
Then,
@ -54,7 +62,6 @@ The client depends on [readline library](http://cnswww.cns.cwru.edu/php/chet/rea
Thanks to [@jfontan](https://github.com/vysheng/tg/issues/3#issuecomment-28293731) for this solution.
#### FreeBSD
Install these ports:

View File

@ -109,6 +109,7 @@
# * /usr/include/lua/X.Y
# * /usr/include/luaXY
# * /usr/local/include/luaX.Y
# * /usr/local/include/lua-X.Y
# * /usr/local/include/lua/X.Y
# * /usr/local/include/luaXY
#
@ -182,7 +183,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 20
#serial 21
dnl =========================================================================
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],
@ -195,7 +196,7 @@ AC_DEFUN([AX_PROG_LUA],
dnl Find a Lua interpreter.
m4_define_default([_AX_LUA_INTERPRETER_LIST],
[lua lua5.2 lua5.1 lua50])
[lua lua5.2 lua52 lua5.1 lua51 lua50])
m4_if([$1], [],
[ dnl No version check is needed. Find any Lua interpreter.
@ -259,7 +260,7 @@ AC_DEFUN([AX_PROG_LUA],
AC_CACHE_CHECK([for $ax_display_LUA version], [ax_cv_lua_version],
[ ax_cv_lua_version=`$LUA -e "print(_VERSION)" | \
sed "s|^Lua \(.*\)|\1|" | \
grep -o "^@<:@0-9@:>@\+\\.@<:@0-9@:>@\+"`
grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
])
AS_IF([test "x$ax_cv_lua_version" = 'x'],
[AC_MSG_ERROR([invalid Lua version number])])
@ -364,7 +365,7 @@ dnl =========================================================================
AC_DEFUN([_AX_LUA_CHK_VER],
[
_ax_test_ver=`$1 -e "print(_VERSION)" 2>/dev/null | \
sed "s|^Lua \(.*\)|\1|" | grep -o "^@<:@0-9@:>@\+\\.@<:@0-9@:>@\+"`
sed "s|^Lua \(.*\)|\1|" | grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
AS_IF([test "x$_ax_test_ver" = 'x'],
[_ax_test_ver='0'])
AX_COMPARE_VERSION([$_ax_test_ver], [ge], [$2])
@ -431,6 +432,7 @@ AC_DEFUN([AX_LUA_HEADERS],
/usr/include/lua/$LUA_VERSION \
/usr/include/lua$LUA_SHORT_VERSION \
/usr/local/include/lua$LUA_VERSION \
/usr/local/include/lua-$LUA_VERSION \
/usr/local/include/lua/$LUA_VERSION \
/usr/local/include/lua$LUA_SHORT_VERSION \
])
@ -490,7 +492,7 @@ int main(int argc, char ** argv)
],
[ ax_cv_lua_header_version=`./conftest$EXEEXT p | \
sed "s|^Lua \(.*\)|\1|" | \
grep -o "^@<:@0-9@:>@\+\\.@<:@0-9@:>@\+"`
grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
],
[ax_cv_lua_header_version='unknown'])
CPPFLAGS=$_ax_lua_saved_cppflags
@ -575,7 +577,12 @@ AC_DEFUN([AX_LUA_LIBS],
dnl Try to find the Lua libs.
_ax_lua_saved_libs=$LIBS
LIBS="$LIBS $LUA_LIB"
AC_SEARCH_LIBS([lua_load], [lua$LUA_VERSION lua$LUA_SHORT_VERSION lua],
AC_SEARCH_LIBS([lua_load],
[ lua$LUA_VERSION \
lua$LUA_SHORT_VERSION \
lua-$LUA_VERSION \
lua-$LUA_SHORT_VERSION \
lua],
[_ax_found_lua_libs='yes'],
[_ax_found_lua_libs='no'],
[$_ax_lua_extra_libs])

178
config.h
View File

@ -1,178 +0,0 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `alarm' function. */
#define HAVE_ALARM 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `endpwent' function. */
#define HAVE_ENDPWENT 1
/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <lauxlib.h> header file. */
#define HAVE_LAUXLIB_H 1
/* Define to 1 if you have the `config' library (-lconfig). */
#define HAVE_LIBCONFIG 1
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#define HAVE_LIBCRYPTO 1
/* Define to 1 if you have the `edit' library (-ledit). */
/* #undef HAVE_LIBEDIT */
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <luaconf.h> header file. */
#define HAVE_LUACONF_H 1
/* Define to 1 if you have the <lualib.h> header file. */
#define HAVE_LUALIB_H 1
/* Define to 1 if you have the <lua.h> header file. */
#define HAVE_LUA_H 1
/* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef HAVE_MACH_MACH_H */
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the `mkdir' function. */
#define HAVE_MKDIR 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#define HAVE_REALLOC 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strndup' function. */
#define HAVE_STRNDUP 1
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "telegram"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "telegram 0.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "telegram"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.1"
/* Use custom prog name */
/* #undef PROG_NAME */
/* Use libedit */
/* #undef READLINE_EDIT */
/* Use gnu libreadline */
#define READLINE_GNU 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* use lua */
#define USE_LUA 1
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */
/* Define to rpl_realloc if the replacement function should be used. */
/* #undef realloc */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */

93
configure vendored
View File

@ -2279,6 +2279,7 @@ ac_config_headers="$ac_config_headers config.h"
# * /usr/include/lua/X.Y
# * /usr/include/luaXY
# * /usr/local/include/luaX.Y
# * /usr/local/include/lua-X.Y
# * /usr/local/include/lua/X.Y
# * /usr/local/include/luaXY
#
@ -2352,7 +2353,7 @@ ac_config_headers="$ac_config_headers config.h"
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 20
#serial 21
@ -3170,6 +3171,10 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# BSD locations for headers and libraries from packages, Linux locations for self-compiled stuff.
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
# Checks for libraries.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
@ -3466,6 +3471,62 @@ $as_echo "#define READLINE_GNU 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetnum" >&5
$as_echo_n "checking for library containing tgetnum... " >&6; }
if ${ac_cv_search_tgetnum+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char tgetnum ();
int
main ()
{
return tgetnum ();
;
return 0;
}
_ACEOF
for ac_lib in '' ncursesw ncurses curses; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_tgetnum=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_tgetnum+:} false; then :
break
fi
done
if ${ac_cv_search_tgetnum+:} false; then :
else
ac_cv_search_tgetnum=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tgetnum" >&5
$as_echo "$ac_cv_search_tgetnum" >&6; }
ac_res=$ac_cv_search_tgetnum
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_set_prompt in -ledit" >&5
$as_echo_n "checking for rl_set_prompt in -ledit... " >&6; }
if ${ac_cv_lib_edit_rl_set_prompt+:} false; then :
@ -4049,7 +4110,7 @@ $as_echo "enabled" >&6; }
if test "x$LUA" = 'x'; then :
for ac_prog in lua lua5.2 lua5.1 lua50
for ac_prog in lua lua5.2 lua52 lua5.1 lua51 lua50
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@ -4126,7 +4187,7 @@ if ${ax_cv_lua_version+:} false; then :
else
ax_cv_lua_version=`$LUA -e "print(_VERSION)" | \
sed "s|^Lua \(.*\)|\1|" | \
grep -o "^[0-9]\+\\.[0-9]\+"`
grep -E -o "^[0-9]+\.[0-9]+"`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_version" >&5
@ -4290,6 +4351,7 @@ done
/usr/include/lua/$LUA_VERSION \
/usr/include/lua$LUA_SHORT_VERSION \
/usr/local/include/lua$LUA_VERSION \
/usr/local/include/lua-$LUA_VERSION \
/usr/local/include/lua/$LUA_VERSION \
/usr/local/include/lua$LUA_SHORT_VERSION \
; do
@ -4363,7 +4425,7 @@ _ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ax_cv_lua_header_version=`./conftest$EXEEXT p | \
sed "s|^Lua \(.*\)|\1|" | \
grep -o "^[0-9]\+\\.[0-9]\+"`
grep -E -o "^[0-9]+\.[0-9]+"`
else
ax_cv_lua_header_version='unknown'
@ -4643,7 +4705,11 @@ return lua_load ();
return 0;
}
_ACEOF
for ac_lib in '' lua$LUA_VERSION lua$LUA_SHORT_VERSION lua; do
for ac_lib in '' lua$LUA_VERSION \
lua$LUA_SHORT_VERSION \
lua-$LUA_VERSION \
lua-$LUA_SHORT_VERSION \
lua; do
if test -z "$ac_lib"; then
ac_res="none required"
else
@ -4693,7 +4759,7 @@ else
fi
EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ;
CFLAGS="${CFLAGS} ${LUA_INCLUDE}" ;
CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ;
$as_echo "#define USE_LUA 1" >>confdefs.h
@ -4713,7 +4779,7 @@ $as_echo "enabled" >&6; }
if test "x$LUA" = 'x'; then :
for ac_prog in lua lua5.2 lua5.1 lua50
for ac_prog in lua lua5.2 lua52 lua5.1 lua51 lua50
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@ -4790,7 +4856,7 @@ if ${ax_cv_lua_version+:} false; then :
else
ax_cv_lua_version=`$LUA -e "print(_VERSION)" | \
sed "s|^Lua \(.*\)|\1|" | \
grep -o "^[0-9]\+\\.[0-9]\+"`
grep -E -o "^[0-9]+\.[0-9]+"`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_version" >&5
@ -4954,6 +5020,7 @@ done
/usr/include/lua/$LUA_VERSION \
/usr/include/lua$LUA_SHORT_VERSION \
/usr/local/include/lua$LUA_VERSION \
/usr/local/include/lua-$LUA_VERSION \
/usr/local/include/lua/$LUA_VERSION \
/usr/local/include/lua$LUA_SHORT_VERSION \
; do
@ -5027,7 +5094,7 @@ _ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ax_cv_lua_header_version=`./conftest$EXEEXT p | \
sed "s|^Lua \(.*\)|\1|" | \
grep -o "^[0-9]\+\\.[0-9]\+"`
grep -E -o "^[0-9]+\.[0-9]+"`
else
ax_cv_lua_header_version='unknown'
@ -5307,7 +5374,11 @@ return lua_load ();
return 0;
}
_ACEOF
for ac_lib in '' lua$LUA_VERSION lua$LUA_SHORT_VERSION lua; do
for ac_lib in '' lua$LUA_VERSION \
lua$LUA_SHORT_VERSION \
lua-$LUA_VERSION \
lua-$LUA_SHORT_VERSION \
lua; do
if test -z "$ac_lib"; then
ac_res="none required"
else
@ -5357,7 +5428,7 @@ else
fi
EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ;
CFLAGS="${CFLAGS} ${LUA_INCLUDE}" ;
CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ;
$as_echo "#define USE_LUA 1" >>confdefs.h

View File

@ -8,6 +8,10 @@ m4_include([ax_lua.m4])
# Checks for programs.
AC_PROG_CC
# BSD locations for headers and libraries from packages, Linux locations for self-compiled stuff.
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
# Checks for libraries.
AC_CHECK_LIB([m], [sqrt])
AC_SEARCH_LIBS([clock_gettime], [rt])
@ -22,6 +26,7 @@ AC_CHECK_LIB([readline], [rl_save_prompt],
[ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ]
],
[
AC_SEARCH_LIBS([tgetnum], [ncursesw ncurses curses])
AC_CHECK_LIB([edit], [rl_set_prompt])
AC_DEFINE([READLINE_EDIT], [1], [Use libedit])
[ EXTRA_LIBS="${EXTRA_LIBS} -ledit" ; ]
@ -54,7 +59,7 @@ AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua],
AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
[EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
[CFLAGS="${CFLAGS} ${LUA_INCLUDE}" ; ]
[CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
AC_DEFINE(USE_LUA,1,[use lua])
],
[
@ -68,7 +73,7 @@ AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua],
AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
[EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
[CFLAGS="${CFLAGS} ${LUA_INCLUDE}" ; ]
[CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
AC_DEFINE(USE_LUA,1,[use lua])
],
[

View File

@ -31,7 +31,7 @@
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/endian.h>
#endif
#include <sys/types.h>
@ -58,6 +58,10 @@
#define __builtin_bswap32(x) bswap32(x)
#endif
#if defined(__OpenBSD__)
#define __builtin_bswap32(x) __swap32gen(x)
#endif
#define sha1 SHA1
#include "mtproto-common.h"
@ -1720,7 +1724,7 @@ int rpc_execute (struct connection *c, int op, int len) {
logprintf ( "have %d Response bytes\n", Response_len);
}
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined (__CYGWIN__)
setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
#endif
int o = c_state;
@ -1728,19 +1732,19 @@ int rpc_execute (struct connection *c, int op, int len) {
switch (o) {
case st_reqpq_sent:
process_respq_answer (c, Response/* + 8*/, Response_len/* - 12*/);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined (__CYGWIN__)
setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
#endif
return 0;
case st_reqdh_sent:
process_dh_answer (c, Response/* + 8*/, Response_len/* - 12*/);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined (__CYGWIN__)
setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
#endif
return 0;
case st_client_dh_sent:
process_auth_complete (c, Response/* + 8*/, Response_len/* - 12*/);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined (__CYGWIN__)
setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
#endif
return 0;
@ -1750,7 +1754,7 @@ int rpc_execute (struct connection *c, int op, int len) {
} else {
process_rpc_message (c, (void *)(Response/* + 8*/), Response_len/* - 12*/);
}
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined (__CYGWIN__)
setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
#endif
return 0;
@ -1778,7 +1782,7 @@ int tc_becomes_ready (struct connection *c) {
assert (write_out (c, &byte, 1) == 1);
flush_out (c);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined (__CYGWIN__)
setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
#endif
int o = c_state;