Add: Interpolate defective url(ttp:// --> http://).
Add: display referenced numbers in res view.
Add: restrict display res messges to res numbers or ids, the numbers link to a particular res number.
#GDBM_COMPT_OPT = -DGDBM_COMPT
#Option for development
-#CFLAGS = -g -Wall -DDEBUG ${CDEF} ${GDBM_COMPT_OPT}
+#CFLAGS = -g -Wall -DDEBUG ${DEFS} ${CDEF} ${GDBM_COMPT_OPT}
#Option for release
-CFLAGS = -Wall ${CDEF} ${GDBM_COMPT_OPT}
+CFLAGS = -Wall ${DEFS} ${CDEF} ${GDBM_COMPT_OPT}
CDEF = -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED
#-D_XOPEN_SOURCE
${OBJ_DIR}/ui/disp_html_result.o \
${OBJ_DIR}/ui/disp_string.o
-INC_FILES = ${INC_DIR}/env.h \
+INC_FILES = ${INC_DIR}/config.h \
+ ${INC_DIR}/env.h \
${INC_DIR}/error.h \
${INC_DIR}/nt_string.h \
${INC_DIR}/_2ch/_2ch.h \
CC = gcc
DEFS = -DHAVE_CONFIG_H
-LIBS = -lz -lssl -lsqlite3 -lpthread -lncursesw -lm -lgdbm_compat -lgdbm -ldl -lcrypto
+LIBS = -lz -lssl -lsqlite3 -lpthread -lncursesw -lm -lgdbm_compat -ldl -lcrypto
#LIBS = -lncursesw -lgdbm -lz -lm -lssl -lcrypto -lgdbm_compat -lsqlite3 -ldl -lpthread
INCLUDES = -I/usr/include/gdbm -I${INC_DIR}
OBJ_DIR = ./obj
GEN_DIR = ./gen
SRC_DIR = ${srcdir}/src
INC_DIR = ${SRC_DIR}/inc
-
+INSTALL_DIR = ${prefix}/bin
+INSTALL_PROG = /usr/bin/install -c
all : ${TARGET}
run :
@ ${SHELL} prepare_proj.sh -d
rm -rf ${TARGET}
+install: ${TARGET}
+ ${INSTALL_PROG} -m 755 -t ${INSTALL_DIR} ${TARGET}
+
$(OBJ_DIR)/print_help.o : help.txt help_gen
./help_gen help.txt > ${GEN_DIR}/print_help.c
${CC} ${CFLAGS} -c -o $@ ${GEN_DIR}/print_help.c
+${INC_DIR}/config.h : config.h
+ cp -f $< $@
+
help_gen : help_gen.c
${CC} -o $@ $<
#GDBM_COMPT_OPT = -DGDBM_COMPT
#Option for development
-#CFLAGS = -g -Wall -DDEBUG ${CDEF} ${GDBM_COMPT_OPT}
+#CFLAGS = -g -Wall -DDEBUG ${DEFS} ${CDEF} ${GDBM_COMPT_OPT}
#Option for release
-CFLAGS = -Wall ${CDEF} ${GDBM_COMPT_OPT}
+CFLAGS = -Wall ${DEFS} ${CDEF} ${GDBM_COMPT_OPT}
CDEF = -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED
#-D_XOPEN_SOURCE
${OBJ_DIR}/ui/disp_html_result.o \
${OBJ_DIR}/ui/disp_string.o
-INC_FILES = ${INC_DIR}/env.h \
+INC_FILES = ${INC_DIR}/config.h \
+ ${INC_DIR}/env.h \
${INC_DIR}/error.h \
${INC_DIR}/nt_string.h \
${INC_DIR}/_2ch/_2ch.h \
GEN_DIR = ./gen
SRC_DIR = ${srcdir}/src
INC_DIR = ${SRC_DIR}/inc
-
+INSTALL_DIR = ${prefix}/bin
+INSTALL_PROG = @INSTALL@
all : ${TARGET}
run :
@ ${SHELL} prepare_proj.sh -d
rm -rf ${TARGET}
+install: ${TARGET}
+ ${INSTALL_PROG} -m 755 -t ${INSTALL_DIR} ${TARGET}
+
$(OBJ_DIR)/print_help.o : help.txt help_gen
./help_gen help.txt > ${GEN_DIR}/print_help.c
${CC} ${CFLAGS} -c -o $@ ${GEN_DIR}/print_help.c
+${INC_DIR}/config.h : config.h
+ cp -f $< $@
+
help_gen : help_gen.c
${CC} -o $@ $<
- ntch version 1.0.1.5
+ ntch version 1.0.1.6
This file is part of ntch.
Linux用 2ch専用ブラウザー
--v --version
- バージョンを表示します
-
--h --help
- このヘルプを表示します
-
--r -refresh-screen
- 冗長な画面更新を行います。
- 画面がうまく更新されない時に指定しますが、ちらつくかもしれません
-
--o --out-path
- プログラムの作業ファイルを出力するディレクトリを指定します
- 無指定の時は、実行時のカレントディレクトリの配下にlogディレクトリを
- 作成して出力します。
-
-キーコマンド
-
-全般
- j 下移動
- k 上移動
- space 項目選択
- q 終了
- c 前画面に戻る
- f ページダウン
- b ページアップ
- z 画面リフレッシュ
-
-板メニュー
- h 左カラムへ移動
- l 右カラムへ移動
-
-スレタイ一覧
- :[数字] 指定されたスレッド番号にカーソル移動
- g 最後の行に移動する
- h [数字]で指定する前の表示位置に戻るUNDO
- l hで戻った移動を元に戻すREDO
- r 板を更新する
- /[検索文字列] 指定文字列の後方検索
- ?[検索文字列] 指定文字列の前方検索
- 検索文字列は任意で有り、指定しなかった場合
- 以前に指定した文字列で検索します
- デフォルトでregex関数に渡されるので
- 標準関数の正規表現が使用できます
- :s :sort [number|read|unread] スレタイを並べ替えます
- number スレッド番号順
- read 取得済みスレッド優先
- unread 未読数順
- リソースファイルに初期値を指定出来ます
- 実行ユーザーのホームディレクトリに.ntchrcファイルを
- 作成して、以下の書式で指定して下さい。
- sort=[number | read | unread]
- :d :del [スレ番号 | * ] 指定したスレッドの取得済みログを削除します
- * 表示している板の全ての取得済ログを削除
- スレ番号 以下の2ch形式の番号指定が使えます
- 10 - 10番のログを削除
- 14,17,20,100 - 指定した4つの番号を削除
- 25-50 - 25番から50番までを削除
-
-レス一覧
- :[数字] 指定されたレス番号にカーソル移動
- g 最後の行に移動する
- h [数字]で指定する前の表示位置に戻るUNDO
- l hで戻った移動を元に戻すREDO
- :w :write スレッドに書き込む為にエディターを起動します
- 標準でviエディターが立ち上がるので、本分を編集して
- 保存終了すると書込を行います。無編集、もしくは
- 本文が無い場合、書込を中止します。
- 編集テキストの上部に、mail:[メール], name:[名前]
- をそれぞれコロン記号の後に指定出来ます。
- ※)メール、名前は本文に含まれません。
- 書込確認、クッキー確認、エラーなどがサーバーから
- 返された時には、その内容をviエディターで表示します。
- 内容を確認してエディターを終了して下さい。
- 書込確認を中止する方法が(現時点で)ないでの
- その場合は強制終了して下さい。
- ●2chビューアーのIDを指定して書込が出来ます。
- 実行ユーザーのホームディレクトリに.ntchrcファイルを
- 作成して、以下の書式でIDとパスワードを指定して下さい。
- maru-id=[2chビューアーのユーザーID]
- maru-pw=[2chビューアーのパスワード]
- r スレッドを更新する
- /[検索文字列] 指定文字列の後方検索
- ?[検索文字列] 指定文字列の前方検索
- 検索文字列は任意で有り、指定しなかった場合
- 以前に指定した文字列で検索します
- デフォルトでregex関数に渡されるので
- 標準関数の正規表現が使用できます
- :n :new 新規取得スレにジャンプ
+ntch のインストール方法
+ダウンロードファイルを使用する場合、適当なディレクトリにntch-1.0.1.5.tgzファイルを解凍します
+tar zxvf ntch-1.0.1.6.tgz
+
+作成されたディレクトリに移動します
+
+cd ntch-1.0.1.6
+
+以下のコマンドを実行して、実行ファイルを作成します
+
+./configure
+
+make
+
+sudo make install
+
+実行ファイルはntchです。
+
+管理者権限が無い場合、適当なディレクトリに作業ディレクトリ内のntchをコピーして
+実行できます。
+
+デフォルトで、カレントディレクトリにlogディレクトリを作成して、2chから取得した
+データのログを保存します。
+-oオプションで出力先を指定出来ます。
+例: ntch -o ~/.ntch
+
+プログラムは実行時に、ユーザーのホームディレクトリ以下にディレクトリ .ntch を
+作成してcookieや、読込位置などのユーザー固有情報を保存します。
+
+
+ntchは以下のライブラリィに依存しています。openssl, gdbm, ncurses, sqlite
+これらのライブラリのデベロップ版がビルドには必要です。
+また、Fedora18で動作確認していますので、その他のディストリビューション等では、
+作成されたMakefileやソースファイルを編集する必要があるかもしれません。
#define HAVE_LIBCRYPTO 1
/* Define to 1 if you have the `gdbm' library (-lgdbm). */
-#define HAVE_LIBGDBM 1
+/* #undef HAVE_LIBGDBM */
/* Define to 1 if you have the `gdbm_compat' library (-lgdbm_compat). */
#define HAVE_LIBGDBM_COMPAT 1
#define PACKAGE_BUGREPORT "akohta001@gmail.com"
/* Define to the full name of this package. */
-#define PACKAGE_NAME "Ntch"
+#define PACKAGE_NAME "ntch"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "Ntch 1.0.1.5"
+#define PACKAGE_STRING "ntch 1.0.1.6"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ntch"
#define PACKAGE_URL "https://sourceforge.jp/projects/ntch/"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.0.1.5"
+#define PACKAGE_VERSION "1.0.1.6"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Ntch 1.0.1.5.
+# Generated by GNU Autoconf 2.69 for ntch 1.0.1.6.
#
# Report bugs to <akohta001@gmail.com>.
#
MAKEFLAGS=
# Identity of this package.
-PACKAGE_NAME='Ntch'
+PACKAGE_NAME='ntch'
PACKAGE_TARNAME='ntch'
-PACKAGE_VERSION='1.0.1.5'
-PACKAGE_STRING='Ntch 1.0.1.5'
+PACKAGE_VERSION='1.0.1.6'
+PACKAGE_STRING='ntch 1.0.1.6'
PACKAGE_BUGREPORT='akohta001@gmail.com'
PACKAGE_URL='https://sourceforge.jp/projects/ntch/'
# include <unistd.h>
#endif"
+ac_default_prefix=/usr/local
ac_subst_vars='LTLIBOBJS
+ac_prefix_program
LIBOBJS
EGREP
GREP
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures Ntch 1.0.1.5 to adapt to many kinds of systems.
+\`configure' configures ntch 1.0.1.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Ntch 1.0.1.5:";;
+ short | recursive ) echo "Configuration of ntch 1.0.1.6:";;
esac
cat <<\_ACEOF
it to find libraries and programs with nonstandard names/locations.
Report bugs to <akohta001@gmail.com>.
-Ntch home page: <https://sourceforge.jp/projects/ntch/>.
+ntch home page: <https://sourceforge.jp/projects/ntch/>.
_ACEOF
ac_status=$?
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-Ntch configure 1.0.1.5
+ntch configure 1.0.1.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by Ntch $as_me 1.0.1.5, which was
+It was created by ntch $as_me 1.0.1.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# Checks for libraries.
-# FIXME: Replace `main' with a function in `-lcrypto':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypto" >&5
-$as_echo_n "checking for main in -lcrypto... " >&6; }
-if ${ac_cv_lib_crypto_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BIO_ctrl in -lcrypto" >&5
+$as_echo_n "checking for BIO_ctrl in -lcrypto... " >&6; }
+if ${ac_cv_lib_crypto_BIO_ctrl+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 BIO_ctrl ();
int
main ()
{
-return main ();
+return BIO_ctrl ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_crypto_main=yes
+ ac_cv_lib_crypto_BIO_ctrl=yes
else
- ac_cv_lib_crypto_main=no
+ ac_cv_lib_crypto_BIO_ctrl=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_main" >&5
-$as_echo "$ac_cv_lib_crypto_main" >&6; }
-if test "x$ac_cv_lib_crypto_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_BIO_ctrl" >&5
+$as_echo "$ac_cv_lib_crypto_BIO_ctrl" >&6; }
+if test "x$ac_cv_lib_crypto_BIO_ctrl" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-ldl':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ldl" >&5
-$as_echo_n "checking for main in -ldl... " >&6; }
-if ${ac_cv_lib_dl_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 dlopen ();
int
main ()
{
-return main ();
+return dlopen ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_dl_main=yes
+ ac_cv_lib_dl_dlopen=yes
else
- ac_cv_lib_dl_main=no
+ ac_cv_lib_dl_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_main" >&5
-$as_echo "$ac_cv_lib_dl_main" >&6; }
-if test "x$ac_cv_lib_dl_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBDL 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lgdbm':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgdbm" >&5
-$as_echo_n "checking for main in -lgdbm... " >&6; }
-if ${ac_cv_lib_gdbm_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbm_open in -lgdbm" >&5
+$as_echo_n "checking for dbm_open in -lgdbm... " >&6; }
+if ${ac_cv_lib_gdbm_dbm_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 dbm_open ();
int
main ()
{
-return main ();
+return dbm_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_gdbm_main=yes
+ ac_cv_lib_gdbm_dbm_open=yes
else
- ac_cv_lib_gdbm_main=no
+ ac_cv_lib_gdbm_dbm_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_main" >&5
-$as_echo "$ac_cv_lib_gdbm_main" >&6; }
-if test "x$ac_cv_lib_gdbm_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_dbm_open" >&5
+$as_echo "$ac_cv_lib_gdbm_dbm_open" >&6; }
+if test "x$ac_cv_lib_gdbm_dbm_open" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBGDBM 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lgdbm_compat':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgdbm_compat" >&5
-$as_echo_n "checking for main in -lgdbm_compat... " >&6; }
-if ${ac_cv_lib_gdbm_compat_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbm_open in -lgdbm_compat" >&5
+$as_echo_n "checking for dbm_open in -lgdbm_compat... " >&6; }
+if ${ac_cv_lib_gdbm_compat_dbm_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 dbm_open ();
int
main ()
{
-return main ();
+return dbm_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_gdbm_compat_main=yes
+ ac_cv_lib_gdbm_compat_dbm_open=yes
else
- ac_cv_lib_gdbm_compat_main=no
+ ac_cv_lib_gdbm_compat_dbm_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_compat_main" >&5
-$as_echo "$ac_cv_lib_gdbm_compat_main" >&6; }
-if test "x$ac_cv_lib_gdbm_compat_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_compat_dbm_open" >&5
+$as_echo "$ac_cv_lib_gdbm_compat_dbm_open" >&6; }
+if test "x$ac_cv_lib_gdbm_compat_dbm_open" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBGDBM_COMPAT 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lm':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
-$as_echo_n "checking for main in -lm... " >&6; }
-if ${ac_cv_lib_m_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
+$as_echo_n "checking for sqrt in -lm... " >&6; }
+if ${ac_cv_lib_m_sqrt+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 sqrt ();
int
main ()
{
-return main ();
+return sqrt ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_m_main=yes
+ ac_cv_lib_m_sqrt=yes
else
- ac_cv_lib_m_main=no
+ ac_cv_lib_m_sqrt=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
-$as_echo "$ac_cv_lib_m_main" >&6; }
-if test "x$ac_cv_lib_m_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5
+$as_echo "$ac_cv_lib_m_sqrt" >&6; }
+if test "x$ac_cv_lib_m_sqrt" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lncursesw':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lncursesw" >&5
-$as_echo_n "checking for main in -lncursesw... " >&6; }
-if ${ac_cv_lib_ncursesw_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5
+$as_echo_n "checking for initscr in -lncursesw... " >&6; }
+if ${ac_cv_lib_ncursesw_initscr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 initscr ();
int
main ()
{
-return main ();
+return initscr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_ncursesw_main=yes
+ ac_cv_lib_ncursesw_initscr=yes
else
- ac_cv_lib_ncursesw_main=no
+ ac_cv_lib_ncursesw_initscr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_main" >&5
-$as_echo "$ac_cv_lib_ncursesw_main" >&6; }
-if test "x$ac_cv_lib_ncursesw_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5
+$as_echo "$ac_cv_lib_ncursesw_initscr" >&6; }
+if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNCURSESW 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lpthread':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpthread" >&5
-$as_echo_n "checking for main in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
+$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+if ${ac_cv_lib_pthread_pthread_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 pthread_create ();
int
main ()
{
-return main ();
+return pthread_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_main=yes
+ ac_cv_lib_pthread_pthread_create=yes
else
- ac_cv_lib_pthread_main=no
+ ac_cv_lib_pthread_pthread_create=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_main" >&5
-$as_echo "$ac_cv_lib_pthread_main" >&6; }
-if test "x$ac_cv_lib_pthread_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPTHREAD 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lsqlite3':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lsqlite3" >&5
-$as_echo_n "checking for main in -lsqlite3... " >&6; }
-if ${ac_cv_lib_sqlite3_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_initialize in -lsqlite3" >&5
+$as_echo_n "checking for sqlite3_initialize in -lsqlite3... " >&6; }
+if ${ac_cv_lib_sqlite3_sqlite3_initialize+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 sqlite3_initialize ();
int
main ()
{
-return main ();
+return sqlite3_initialize ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_sqlite3_main=yes
+ ac_cv_lib_sqlite3_sqlite3_initialize=yes
else
- ac_cv_lib_sqlite3_main=no
+ ac_cv_lib_sqlite3_sqlite3_initialize=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqlite3_main" >&5
-$as_echo "$ac_cv_lib_sqlite3_main" >&6; }
-if test "x$ac_cv_lib_sqlite3_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqlite3_sqlite3_initialize" >&5
+$as_echo "$ac_cv_lib_sqlite3_sqlite3_initialize" >&6; }
+if test "x$ac_cv_lib_sqlite3_sqlite3_initialize" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSQLITE3 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lssl':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lssl" >&5
-$as_echo_n "checking for main in -lssl... " >&6; }
-if ${ac_cv_lib_ssl_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
+$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
+if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 SSL_library_init ();
int
main ()
{
-return main ();
+return SSL_library_init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_ssl_main=yes
+ ac_cv_lib_ssl_SSL_library_init=yes
else
- ac_cv_lib_ssl_main=no
+ ac_cv_lib_ssl_SSL_library_init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_main" >&5
-$as_echo "$ac_cv_lib_ssl_main" >&6; }
-if test "x$ac_cv_lib_ssl_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
+$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
+if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSSL 1
_ACEOF
fi
-# FIXME: Replace `main' with a function in `-lz':
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lz" >&5
-$as_echo_n "checking for main in -lz... " >&6; }
-if ${ac_cv_lib_z_main+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5
+$as_echo_n "checking for inflate in -lz... " >&6; }
+if ${ac_cv_lib_z_inflate+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_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 inflate ();
int
main ()
{
-return main ();
+return inflate ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_z_main=yes
+ ac_cv_lib_z_inflate=yes
else
- ac_cv_lib_z_main=no
+ ac_cv_lib_z_inflate=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_main" >&5
-$as_echo "$ac_cv_lib_z_main" >&6; }
-if test "x$ac_cv_lib_z_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5
+$as_echo "$ac_cv_lib_z_inflate" >&6; }
+if test "x$ac_cv_lib_z_inflate" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBZ 1
_ACEOF
ac_config_files="$ac_config_files Makefile"
+ac_config_commands="$ac_config_commands make-gen-dir"
+
+
+if test "x$prefix" = xNONE; then
+ $as_echo_n "checking for prefix by " >&6
+ # Extract the first word of "ntch", so it can be a program name with args.
+set dummy ntch; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_prefix_program+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_prefix_program in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_prefix_program="$ac_prefix_program" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_prefix_program="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_prefix_program=$ac_cv_path_ac_prefix_program
+if test -n "$ac_prefix_program"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prefix_program" >&5
+$as_echo "$ac_prefix_program" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test -n "$ac_prefix_program"; then
+ prefix=`$as_dirname -- "$ac_prefix_program" ||
+$as_expr X"$ac_prefix_program" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_prefix_program" : 'X\(//\)[^/]' \| \
+ X"$ac_prefix_program" : 'X\(//\)$' \| \
+ X"$ac_prefix_program" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_prefix_program" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ prefix=`$as_dirname -- "$prefix" ||
+$as_expr X"$prefix" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$prefix" : 'X\(//\)[^/]' \| \
+ X"$prefix" : 'X\(//\)$' \| \
+ X"$prefix" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$prefix" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ fi
+fi
+
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by Ntch $as_me 1.0.1.5, which was
+This file was extended by ntch $as_me 1.0.1.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
_ACEOF
Configuration headers:
$config_headers
+Configuration commands:
+$config_commands
+
Report bugs to <akohta001@gmail.com>.
-Ntch home page: <https://sourceforge.jp/projects/ntch/>."
+ntch home page: <https://sourceforge.jp/projects/ntch/>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-Ntch config.status 1.0.1.5
+ntch config.status 1.0.1.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "make-gen-dir") CONFIG_COMMANDS="$CONFIG_COMMANDS make-gen-dir" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
fi # test -n "$CONFIG_HEADERS"
-eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
shift
for ac_tag
do
fi
;;
-
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
esac
+
+ case $ac_file$ac_mode in
+ "make-gen-dir":C) mkdir -p gen ;;
+
+ esac
done # for ac_tag
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([Ntch], [1.0.1.5], [akohta001@gmail.com],[ntch],[https://sourceforge.jp/projects/ntch/])
+AC_INIT([ntch], [1.0.1.6], [akohta001@gmail.com],[ntch],[https://sourceforge.jp/projects/ntch/])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
AC_PROG_INSTALL
# Checks for libraries.
-# FIXME: Replace `main' with a function in `-lcrypto':
-AC_CHECK_LIB([crypto], [main])
-# FIXME: Replace `main' with a function in `-ldl':
-AC_CHECK_LIB([dl], [main])
-# FIXME: Replace `main' with a function in `-lgdbm':
-AC_CHECK_LIB([gdbm], [main])
-# FIXME: Replace `main' with a function in `-lgdbm_compat':
-AC_CHECK_LIB([gdbm_compat], [main])
-# FIXME: Replace `main' with a function in `-lm':
-AC_CHECK_LIB([m], [main])
-# FIXME: Replace `main' with a function in `-lncursesw':
-AC_CHECK_LIB([ncursesw], [main])
-# FIXME: Replace `main' with a function in `-lpthread':
-AC_CHECK_LIB([pthread], [main])
-# FIXME: Replace `main' with a function in `-lsqlite3':
-AC_CHECK_LIB([sqlite3], [main])
-# FIXME: Replace `main' with a function in `-lssl':
-AC_CHECK_LIB([ssl], [main])
-# FIXME: Replace `main' with a function in `-lz':
-AC_CHECK_LIB([z], [main])
+AC_CHECK_LIB([crypto], [BIO_ctrl])
+AC_CHECK_LIB([dl], [dlopen])
+AC_CHECK_LIB([gdbm], [dbm_open])
+AC_CHECK_LIB([gdbm_compat], [dbm_open])
+AC_CHECK_LIB([m], [sqrt])
+AC_CHECK_LIB([ncursesw], [initscr])
+AC_CHECK_LIB([pthread], [pthread_create])
+AC_CHECK_LIB([sqlite3], [sqlite3_initialize])
+AC_CHECK_LIB([ssl], [SSL_library_init])
+AC_CHECK_LIB([z], [inflate])
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h locale.h memory.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h wchar.h])
AC_CONFIG_FILES([Makefile])
+AC_CONFIG_COMMANDS([make-gen-dir], [mkdir -p gen])
+AC_PREFIX_DEFAULT([/usr/local])
+AC_PREFIX_PROGRAM([ntch])
+
AC_OUTPUT
+++ /dev/null
-This directory will contain files generated by the project.
- ntch version 1.0.1.5
+ ntch version 1.0.1.6
This file is part of ntch.
Linux用 2ch専用ブラウザー
-v --version
- バージョンを表示します
+ バージョンを表示します
-h --help
- このヘルプを表示します
+ このヘルプを表示します
-r -refresh-screen
- 冗長な画面更新を行います。
- 画面がうまく更新されない時に指定しますが、ちらつくかもしれません
+ 冗長な画面更新を行います。
+ 画面がうまく更新されない時に指定しますが、ちらつくかもしれません
-o --out-path
- プログラムの作業ファイルを出力するディレクトリを指定します
- 無指定の時は、実行時のカレントディレクトリの配下にlogディレクトリを
- 作成して出力します。
+ プログラムの作業ファイルを出力するディレクトリを指定します
+ 無指定の時は、実行時のカレントディレクトリの配下にlogディレクトリを
+ 作成して出力します。
キーコマンド
全般
- j 下移動
- k 上移動
- space 項目選択
- q 終了
- c 前画面に戻る
- f ページダウン
- b ページアップ
- z 画面リフレッシュ
+ j 下移動
+ k 上移動
+ space 項目選択
+ q 終了
+ c 前画面に戻る
+ f ページダウン
+ b ページアップ
+ z 画面リフレッシュ
板メニュー
- h 左カラムへ移動
- l 右カラムへ移動
+ h 左カラムへ移動
+ l 右カラムへ移動
スレタイ一覧
- :[数字] 指定されたスレッド番号にカーソル移動
- g 最後の行に移動する
- h [数字]で指定する前の表示位置に戻るUNDO
- l hで戻った移動を元に戻すREDO
- r 板を更新する
- /[検索文字列] 指定文字列の後方検索
- ?[検索文字列] 指定文字列の前方検索
- 検索文字列は任意で有り、指定しなかった場合
- 以前に指定した文字列で検索します
- デフォルトでregex関数に渡されるので
- 標準関数の正規表現が使用できます
- :s :sort [number|read|unread] スレタイを並べ替えます
- number スレッド番号順
- read 取得済みスレッド優先
- unread 未読数順
- リソースファイルに初期値を指定出来ます
- 実行ユーザーのホームディレクトリに.ntchrcファイルを
- 作成して、以下の書式で指定して下さい。
- sort=[number | read | unread]
- :d :del [スレ番号 | * ] 指定したスレッドの取得済みログを削除します
- * 表示している板の全ての取得済ログを削除
- スレ番号 以下の2ch形式の番号指定が使えます
- 10 - 10番のログを削除
- 14,17,20,100 - 指定した4つの番号を削除
- 25-50 - 25番から50番までを削除
+ :[数字] 指定されたスレッド番号にカーソル移動
+ g 最後の行に移動する
+ h [数字]で指定する前の表示位置に戻るUNDO
+ l hで戻った移動を元に戻すREDO
+ r 板を更新する
+ /[検索文字列] 指定文字列の後方検索
+ ?[検索文字列] 指定文字列の前方検索
+ 検索文字列は任意で有り、指定しなかった場合
+ 以前に指定した文字列で検索します
+ デフォルトでregex関数に渡されるので
+ 標準関数の正規表現が使用できます
+ :s :sort [number|read|unread] スレタイを並べ替えます
+ number スレッド番号順
+ read 取得済みスレッド優先
+ unread 未読数順
+ リソースファイルに初期値を指定出来ます
+ 実行ユーザーのホームディレクトリに.ntchrcファイルを
+ 作成して、以下の書式で指定して下さい。
+ sort=[number | read | unread]
+ :d :del [スレ番号 | * ] 指定したスレッドの取得済みログを削除します
+ * 表示している板の全ての取得済ログを削除
+ スレ番号 以下の2ch形式の番号指定が使えます
+ 10 - 10番のログを削除
+ 14,17,20,100 - 指定した4つの番号を削除
+ 25-50 - 25番から50番までを削除
レス一覧
- :[数字] 指定されたレス番号にカーソル移動
- g 最後の行に移動する
- h [数字]で指定する前の表示位置に戻るUNDO
- l hで戻った移動を元に戻すREDO
- :w :write スレッドに書き込む為にエディターを起動します
- 標準でviエディターが立ち上がるので、本分を編集して
- 保存終了すると書込を行います。無編集、もしくは
- 本文が無い場合、書込を中止します。
- 編集テキストの上部に、mail:[メール], name:[名前]
- をそれぞれコロン記号の後に指定出来ます。
- ※)メール、名前は本文に含まれません。
- 書込確認、クッキー確認、エラーなどがサーバーから
- 返された時には、その内容をviエディターで表示します。
- 内容を確認してエディターを終了して下さい。
- 書込確認を中止する方法が(現時点で)ないでの
- その場合は強制終了して下さい。
- ●2chビューアーのIDを指定して書込が出来ます。
- 実行ユーザーのホームディレクトリに.ntchrcファイルを
- 作成して、以下の書式でIDとパスワードを指定して下さい。
- maru-id=[2chビューアーのユーザーID]
- maru-pw=[2chビューアーのパスワード]
- r スレッドを更新する
- /[検索文字列] 指定文字列の後方検索
- ?[検索文字列] 指定文字列の前方検索
- 検索文字列は任意で有り、指定しなかった場合
- 以前に指定した文字列で検索します
- デフォルトでregex関数に渡されるので
- 標準関数の正規表現が使用できます
- :n :new 新規取得スレにジャンプ
+ :[数字] 指定されたレス番号にカーソル移動
+ :[2ch形式の番号 | tree | t | id | i ]
+ [2ch形式の番号] 表示するレス番号を以下の2ch形式で指定できます
+ 14,17,20,100 - 指定した4つの番号を表示
+ 25-50 - 25番から50番までを表示
+ tree [数字] or t [数字] 指定レス番号が参照しているorされている
+ レスのみを表示します。
+ 数字とtree(もしくはt)の間には空白が必要です
+ id [ID] or i [ID] 指定IDを持つレスのみを表示します
+ 数字とid(もしくはi)の間には空白が必要です
+ g 最後の行に移動する
+ h [数字]で指定する前の表示位置に戻るUNDO
+ ※ :treeコマンドなどでレス表示をフィルターしている時は、
+ フィルターする前の画面に戻ります。
+ l hで戻った移動を元に戻すREDO
+ :w :write スレッドに書き込む為にエディターを起動します
+ 標準でviエディターが立ち上がるので、本分を編集して
+ 保存終了すると書込を行います。無編集、もしくは
+ 本文が無い場合、書込を中止します。
+ 編集テキストの上部に、mail:[メール], name:[名前]
+ をそれぞれコロン記号の後に指定出来ます。
+ ※)メール、名前は本文に含まれません。
+ 書込確認、クッキー確認、エラーなどがサーバーから
+ 返された時には、その内容をviエディターで表示します。
+ 内容を確認してエディターを終了して下さい。
+ 書込確認を中止する方法が(現時点で)ないでの
+ その場合は強制終了して下さい。
+ ●2chビューアーのIDを指定して書込が出来ます。
+ 実行ユーザーのホームディレクトリに.ntchrcファイルを
+ 作成して、以下の書式でIDとパスワードを指定して下さい。
+ maru-id=[2chビューアーのユーザーID]
+ maru-pw=[2chビューアーのパスワード]
+ r スレッドを更新する
+ /[検索文字列] 指定文字列の後方検索
+ ?[検索文字列] 指定文字列の前方検索
+ 検索文字列は任意で有り、指定しなかった場合
+ 以前に指定した文字列で検索します
+ デフォルトでregex関数に渡されるので
+ 標準関数の正規表現が使用できます
+ :n :new 新規取得スレにジャンプ
free(resp);
return NULL;
}
- resp->msg_header_line_num = 0;
- resp->msg_line_num = 0;
- resp->msg_line_linkp = NULL;
linkp = threadp->reslistp;
ptr = nt_link_add_data(linkp, resp);
void nt_res_free(nt_res_tp ptr)
{
assert(ptr);
- nt_res_msg_free(ptr);
+ //nt_res_msg_free(ptr);
free(ptr->name);
free(ptr->mail);
free(ptr->misc);
free(ptr);
}
-void nt_res_msg_free(nt_res_tp ptr)
-{
- nt_link_tp curp, nextp;
- assert(ptr);
- if(ptr->msg_line_linkp){
- curp = ptr->msg_line_linkp->next;
- while(curp != ptr->msg_line_linkp){
- nextp = curp->next;
- /* We must not free the data pointer
- * except the first one
- * because they're alocated as a same block.
- * This is wrong --> free(curp->data);
- */
- free(curp);
- curp = nextp;
- }
- free(curp->data);
- free(curp);
- ptr->msg_line_linkp = NULL;
- }
-}
-
-
nt_write_data_tp nt_write_data_alloc()
{
nt_write_data_tp writep
+/* Copyright 2013 Akira Ohta (akohta001@gmail.com)
+ This file is part of ntch.
+
+ The ntch is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The ntch 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 ntch. If not, see <http://www.gnu.org/licenses/>.
+
+*/
#include <wchar.h>
#include <assert.h>
static nt_category_tp get_last_category(nt_2ch_model_tp modelp);
-int parse_res_msg(nt_res_tp resp, size_t colmns)
-{
- int i, len, start, lines;
- wchar_t ch;
- wchar_t *buf, *cptr, *srcp;
- int offset;
- nt_link_tp linkp;
- int consume_colmns;
- int buf_idx;
-
- assert(resp->msg);
-
- nt_res_msg_free(resp);
- resp->msg_line_num = 0;
-
- len = wcslen(resp->msg);
-
- if(len == 0)
- return 0;
- buf = malloc(sizeof(wchar_t) * (len + 11));
- if(!buf)
- return 0;
- buf_idx = 0;
-
- srcp = resp->msg;
-
- lines = 0;
- start = 0;
- consume_colmns = 0;
- for(i = 0; i < len; i++){
- ch = srcp[i];
- switch(ch){
- case L'&':
- if(len > (i+5)){
- if(srcp[i+1] == L'q' &&
- srcp[i+2] == L'u' &&
- srcp[i+3] == L'o' &&
- srcp[i+4] == L't' &&
- srcp[i+5] == L';'){
- ch = L'\"';
- buf[buf_idx] = ch;
- buf_idx++;
- i += 5;
- break;
- }
- }
- if(len > (i+4)){
- if(srcp[i+1] == L'a' &&
- srcp[i+2] == L'm' &&
- srcp[i+3] == L'p' &&
- srcp[i+4] == L';'){
- ch = L'&';
- buf[buf_idx] = ch;
- buf_idx++;
- i += 4;
- break;
- }
- }
- if(len > (i+3)){
- if(srcp[i+1] == L'g' &&
- srcp[i+2] == L't' &&
- srcp[i+3] == L';'){
- ch = L'>';
- buf[buf_idx] = ch;
- buf_idx++;
- i += 3;
- break;
- }else if(srcp[i+1] == L'l' &&
- srcp[i+2] == L't' &&
- srcp[i+3] == L';'){
- ch = L'<';
- buf[buf_idx] = ch;
- buf_idx++;
- i += 3;
- break;
- }
- }
-
- goto DEF_LABEL;
- case L'<':
- if(len > (i+3) && srcp[i+1] == L'b' &&
- srcp[i+2] == L'r' &&
- srcp[i+3] == L'>'){
- cptr = buf + start;
- buf[buf_idx] = L'\0';
- buf_idx++;
- linkp = nt_link_add_data(
- resp->msg_line_linkp, cptr);
- if(!linkp)
- goto END_FOR;
- if(resp->msg_line_linkp == NULL)
- resp->msg_line_linkp = linkp;
-
- consume_colmns = 0;
- lines++;
- start = buf_idx;
- i += 3;
- break;
- }else if(len > (i+7) && srcp[i+1] == L'a' &&
- srcp[i+2] == L' ' &&
- srcp[i+3] == L'h' &&
- srcp[i+4] == L'r' &&
- srcp[i+5] == L'e' &&
- srcp[i+6] == L'f' &&
- srcp[i+7] == L'='){
- cptr = wcschr(srcp+i+8, L'>');
- if(cptr){
- offset = cptr - &(srcp[i]);
- i += offset;
- break;
- }
- }else if(len > (i+3) && srcp[i+1] == L'/' &&
- srcp[i+2] == L'a' &&
- srcp[i+3] == L'>'){
- i += 3;
- break;
- }
- /* fall through */
- default:
-DEF_LABEL:
- if(ch <= 128 || (ch >= 0xff66 && ch <= 0xff9d))
- offset = 1;
- else
- offset = 2;
-
- if(consume_colmns + offset > colmns){
- cptr = buf + start;
- buf[buf_idx] = L'\0';
- linkp = nt_link_add_data(
- resp->msg_line_linkp, cptr);
- if(!linkp)
- goto END_FOR;
- if(resp->msg_line_linkp == NULL)
- resp->msg_line_linkp = linkp;
-
- consume_colmns = 0;
- lines++;
- buf_idx++;
- start = buf_idx;
- i--;
- }else{
- consume_colmns += offset;
- buf[buf_idx] = ch;
- buf_idx++;
- }
- break;
- }/* end switch */
- } /* end for */
-END_FOR:
- if(consume_colmns > 0){
- cptr = buf + start;
- buf[buf_idx] = L'\0';
- linkp = nt_link_add_data(
- resp->msg_line_linkp, cptr);
- if(linkp){
- if(resp->msg_line_linkp == NULL)
- resp->msg_line_linkp = linkp;
- lines++;
- }
- }
- resp->msg_line_num = lines;
- return lines;
-}
BOOL parse_thread(nt_thread_tp threadp, const wchar_t *linep)
{
static nt_link_tp parse_number_list_local (const char *source,
const char **endpp);
+static nt_link_tp w_parse_number_list_local (const wchar_t *source,
+ const wchar_t **endpp);
-static int comp_int(int a, int b)
+int nt_comp_int(int a, int b)
{
if(a == b) return 0;
else if(a < b) return 1;
else return -1;
}
-nt_link_tp parse_number_list (const char *source, const char **endpp)
+nt_link_tp nt_parse_number_list (const char *source, const char **endpp)
{
nt_link_tp linkp =
parse_number_list_local(source, endpp);
if(!linkp)
return NULL;
- nt_link_n_sort(&linkp, comp_int);
+ nt_link_n_sort(&linkp, nt_comp_int);
return linkp;
}
+nt_link_tp nt_w_parse_number_list (const wchar_t *source, const wchar_t **endpp)
+{
+ nt_link_tp linkp =
+ w_parse_number_list_local(source, endpp);
+ if(!linkp)
+ return NULL;
+ nt_link_n_sort(&linkp, nt_comp_int);
+ return linkp;
+}
+
+wchar_t* nt_w_format_number_list (nt_link_tp num_listp)
+{
+ const int delta = 32;
+ wchar_t *buf;
+ int buf_size, len;
+ nt_link_tp linkp;
+ int prev_num, s_num, num, ret;
+
+ assert(num_listp);
+
+ buf = nt_w_str_resize(NULL, 0, delta);
+ if(!buf)
+ return NULL;
+ buf_size = delta;
+ len = 0;
+ s_num = -1;
+ prev_num = -1;
+ linkp = num_listp;
+ do{
+ num = linkp->n_data;
+ if(num <= 0){
+ break;
+ }else if(num == prev_num){
+ ;
+ }else if(num == prev_num+1){
+ if(s_num < 0)
+ s_num = prev_num;
+ }else{
+ if(s_num < 0){
+ if(len == 0)
+ ret = swprintf(buf, buf_size, L"%d", num);
+ else
+ ret = swprintf(buf+len, buf_size-len, L",%d", num);
+ }else{
+ if(len == 0)
+ ret = swprintf(buf, buf_size, L"%d-%d", num);
+ else
+ ret = swprintf(buf+len, buf_size-len, L",%d-%d", num);
+ }
+ if(ret < 0){
+ free(buf);
+ return NULL;
+ }
+ len += ret;
+ if(len+1 >= buf_size-12){
+ buf = nt_w_str_resize(buf, buf_size, buf_size + delta);
+ if(!buf)
+ return NULL;
+ buf_size += delta;
+ }
+ }
+ linkp = linkp->next;
+ }while(linkp != num_listp);
+
+ return buf;
+}
+
+
static nt_link_tp parse_number_list_local (const char *source,
const char **endpp)
{
return top_linkp;
}
+static nt_link_tp w_parse_number_list_local (const wchar_t *source,
+ const wchar_t **endpp)
+{
+ nt_link_tp linkp, top_linkp;
+ int i , len, state;
+ const wchar_t *start;
+ int n, prev;
+
+ assert(source);
+ if(endpp)
+ *endpp = source;
+
+ top_linkp = NULL;
+ linkp = NULL;
+ len = wcslen(source);
+ state = 0;
+
+ for(i = 0; i < len; i++){
+ switch(source[i]){
+ case L'0':
+ case L'1':
+ case L'2':
+ case L'3':
+ case L'4':
+ case L'5':
+ case L'6':
+ case L'7':
+ case L'8':
+ case L'9':
+ if(state == 0){
+ state = 1;
+ start = source + i;
+ }else if(state == 2){
+ state = 3;
+ start = source + i;
+ }else if(state != 1 && state != 3){
+ assert(0);
+ }
+ break;
+ case L' ':
+ case L',':
+ if(state == 1){
+ n = (int)wcstol(start, NULL, 10);
+ linkp = nt_link_add_n_data(top_linkp, n);
+ if(!top_linkp)
+ top_linkp= linkp;
+ if(endpp)
+ *endpp = source + i;
+ }else if(state == 3){
+ n = (int)wcstol(start, NULL, 10);
+ if(prev > n){
+ linkp = nt_link_add_n_data(top_linkp, prev);
+ if(!top_linkp)
+ top_linkp= linkp;
+ return top_linkp;
+ }
+ while(prev <= n){
+ linkp = nt_link_add_n_data(top_linkp, prev);
+ if(!top_linkp)
+ top_linkp = linkp;
+ prev++;
+ }
+ if(endpp)
+ *endpp = source + i;
+ }else if(state == 2){
+ linkp = nt_link_add_n_data(top_linkp, prev);
+ if(!top_linkp)
+ top_linkp = linkp;
+ return top_linkp;
+ }else{
+ return top_linkp;
+ }
+ state = 0;
+ break;
+ case L'-':
+ if(state == 1){
+ prev = (int)wcstol(start, NULL, 10);
+ if(endpp)
+ *endpp = source + i;
+ state = 2;
+ break;
+ }
+ /* fall through */
+ default:
+ goto END_FOR;
+ }/* end switch */
+ }/* end for */
+END_FOR:
+ if(state == 1){
+ n = (int)wcstol(start, NULL, 10);
+ linkp = nt_link_add_n_data(top_linkp, n);
+ if(!top_linkp)
+ top_linkp = linkp;
+ if(endpp)
+ *endpp = source + i;
+ }else if(state == 3){
+ n = (int)wcstol(start, NULL, 10);
+ if(prev > n){
+ linkp = nt_link_add_n_data(top_linkp, prev);
+ if(!top_linkp)
+ top_linkp = linkp;
+ return top_linkp;
+ }
+ while(prev <= n){
+ linkp = nt_link_add_n_data(top_linkp, prev);
+ if(!top_linkp)
+ top_linkp = linkp;
+ prev++;
+ }
+ }
+ return top_linkp;
+}
+
+wchar_t* nt_parse_res_msg(const wchar_t *srcp, nt_link_tp *num_linkpp)
+{
+ int i, len;
+ wchar_t ch;
+ wchar_t *buf, *cptr, *wrk_buf;
+ int offset;
+ int buf_idx, buf_size;
+ nt_link_tp wrk_linkp;
+
+ assert(num_linkpp);
+
+ len = wcslen(srcp);
+ const int delta = 20;
+
+ if(len == 0)
+ return NULL;
+ buf_size = len + delta;
+ buf = malloc(sizeof(wchar_t) * (buf_size));
+ if(!buf)
+ return NULL;
+ buf_idx = 0;
+
+ for(i = 0; i < len; i++){
+ ch = srcp[i];
+ switch(ch){
+ case L'&':
+ if(len > (i+5)){
+ if(srcp[i+1] == L'q' &&
+ srcp[i+2] == L'u' &&
+ srcp[i+3] == L'o' &&
+ srcp[i+4] == L't' &&
+ srcp[i+5] == L';'){
+ buf[buf_idx] =L'\"' ;
+ buf_idx++;
+ i += 5;
+ }
+ }
+ if(len > (i+4)){
+ if(srcp[i+1] == L'a' &&
+ srcp[i+2] == L'm' &&
+ srcp[i+3] == L'p' &&
+ srcp[i+4] == L';'){
+ buf[buf_idx] = L'&';
+ buf_idx++;
+ i += 4;
+ }
+ }
+ if(len > (i+3)){
+ if(srcp[i+1] == L'g' &&
+ srcp[i+2] == L't' &&
+ srcp[i+3] == L';'){
+ buf[buf_idx] = L'>';
+ buf_idx++;
+ i += 3;
+ wrk_linkp = w_parse_number_list_local(srcp+i+1, NULL);
+ if(wrk_linkp){
+ *num_linkpp = nt_link_add_last(*num_linkpp, wrk_linkp);
+ }
+ }else if(srcp[i+1] == L'l' &&
+ srcp[i+2] == L't' &&
+ srcp[i+3] == L';'){
+ buf[buf_idx] = L'<';
+ buf_idx++;
+ i += 3;
+ }
+ }
+ break;
+ case L'<':
+ if(len > (i+3) && srcp[i+1] == L'b' &&
+ srcp[i+2] == L'r' &&
+ srcp[i+3] == L'>'){
+ buf[buf_idx] = L'\n';
+ buf_idx++;
+ i += 3;
+ }else if(len > (i+7) && srcp[i+1] == L'a' &&
+ srcp[i+2] == L' ' &&
+ srcp[i+3] == L'h' &&
+ srcp[i+4] == L'r' &&
+ srcp[i+5] == L'e' &&
+ srcp[i+6] == L'f' &&
+ srcp[i+7] == L'='){
+ cptr = wcschr(srcp+i+8, L'>');
+ if(cptr){
+ offset = cptr - &(srcp[i]);
+ i += offset;
+ }
+ }else if(len > (i+3) && srcp[i+1] == L'/' &&
+ srcp[i+2] == L'a' &&
+ srcp[i+3] == L'>'){
+ i += 3;
+ }
+ break;
+ /* case L'>':
+ wrk_linkp = w_parse_number_list_local(srcp+i, NULL);
+ if(wrk_linkp){
+ *num_linkpp = nt_link_add_last(*num_linkpp, wrk_linkp);
+ }
+ goto DEF_LABEL; */
+ case L't':
+ if(len > (i+5) && (i == 0 || (i > 0 &&
+ srcp[i-1] != L'h' && srcp[i-1] != L'H')) &&
+ srcp[i+1] == L't' &&
+ srcp[i+2] == L'p' &&
+ srcp[i+3] == L':' &&
+ srcp[i+4] == L'/' &&
+ srcp[i+5] == L'/'){
+ buf[buf_idx] = L'h';
+ buf_idx++;
+ }
+ /* fall through */
+ default:
+//DEF_LABEL:
+ buf[buf_idx] = ch;
+ buf_idx++;
+ break;
+ }/* end switch */
+ if(buf_idx >= (buf_size-1)){
+ wrk_buf = nt_w_str_resize(buf, buf_size, (buf_size + delta));
+ if(!wrk_buf){
+ free(buf);
+ return NULL;
+ }
+ buf = wrk_buf;
+ buf_size += delta;
+ }
+ } /* end for */
+ buf[buf_idx] = L'\0';
+ return buf;
+}
#define _GNU_SOURCE
#include <getopt.h>
+#include "config.h"
#include "env.h"
#include "utils/nt_std_t.h"
#include "utils/file.h"
char EDITOR_CMD[1024];
int FORCE_REFRESH = 0;
int THREAD_SORT_TYPE = NT_THREAD_SORT_BY_READ;
-static char *app_name = "ntch";
-static char *version_name = "1.0.1.5";
+static char *app_name = PACKAGE_NAME;
+static char *version_name = PACKAGE_VERSION;
static char *def_editor_cmd = "vi";
char *MARU_ID;
wchar_t *mail;
wchar_t *misc;
wchar_t *msg;
- int msg_line_num;
- int msg_header_line_num;
- nt_link_tp msg_line_linkp;
} nt_res_t;
typedef struct tag_nt_2ch_model_t *nt_2ch_model_tp;
extern void nt_thread_free(nt_thread_tp ptr);
extern void nt_thread_children_free(nt_thread_tp ptr);
extern void nt_res_free(nt_res_tp ptr);
-extern void nt_res_msg_free(nt_res_tp ptr);
extern BOOL parse_board_menu(nt_2ch_model_tp modelp,
const wchar_t *linep);
extern BOOL parse_board(nt_board_tp boardp, const wchar_t *linep);
extern BOOL parse_thread(nt_thread_tp boardp, const wchar_t *linep);
-extern int parse_res_msg(nt_res_tp resp, size_t colmns);
extern void nt_set_selected_board(nt_2ch_model_tp modelp,
nt_category_tp categoryp, nt_board_tp boardp);
+/* Copyright 2013 Akira Ohta (akohta001@gmail.com)
+ This file is part of ntch.
+
+ The ntch is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The ntch 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 ntch. If not, see <http://www.gnu.org/licenses/>.
+
+*/
#ifndef _PARSE_2CH_H_
#define _PARSE_2CH_H_
-extern nt_link_tp parse_number_list (
+extern int nt_comp_int(int a, int b);
+
+extern nt_link_tp nt_parse_number_list (
const char *source, const char **endpp);
+extern wchar_t* nt_parse_res_msg(const wchar_t *srcp, nt_link_tp *num_linkpp);
+extern wchar_t* nt_w_format_number_list (nt_link_tp num_listp);
#endif /* _PARSE_2CH_H_ */
--- /dev/null
+/* 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 <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_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 `gethostbyname' function. */
+#define HAVE_GETHOSTBYNAME 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+#define HAVE_LIBCRYPTO 1
+
+/* Define to 1 if you have the `gdbm' library (-lgdbm). */
+/* #undef HAVE_LIBGDBM */
+
+/* Define to 1 if you have the `gdbm_compat' library (-lgdbm_compat). */
+#define HAVE_LIBGDBM_COMPAT 1
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if you have the `ncursesw' library (-lncursesw). */
+#define HAVE_LIBNCURSESW 1
+
+/* Define to 1 if you have the `ssl' library (-lssl). */
+#define HAVE_LIBSSL 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* 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 <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 `setlocale' function. */
+#define HAVE_SETLOCALE 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 `strchr' function. */
+#define HAVE_STRCHR 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 `strrchr' function. */
+#define HAVE_STRRCHR 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 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 <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "akohta001@gmail.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "ntch"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "ntch 1.0.1.6"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "ntch"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL "https://sourceforge.jp/projects/ntch/"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.0.1.6"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
#define NT_COMMAND1_SORT_UNREAD_2 "u"
#define NT_COMMAND1_DEL_THREAD_LOG_1 "del"
#define NT_COMMAND1_DEL_THREAD_LOG_2 "d"
+#define NT_COMMAND1_TREE_1 "tree"
+#define NT_COMMAND1_TREE_2 "t"
+#define NT_COMMAND1_ID_1 "id"
+#define NT_COMMAND1_ID_2 "i"
extern int set_option(int argc, char* argv[]);
} nt_stack_t;
extern void* nt_stack_push(nt_stack_tp stackp, void* data);
+extern void* nt_stack_peek(nt_stack_tp stackp);
extern void* nt_stack_pop(nt_stack_tp stackp);
extern void* nt_stack_cursor_next();
extern void* nt_stack_add_last(nt_stack_tp stackp, void* data);
+extern int nt_stack_get_position(nt_stack_tp stackp);
+extern BOOL nt_stack_is_empty(nt_stack_tp stackp);
extern nt_stack_tp nt_stack_alloc();
extern void nt_stack_free(nt_stack_tp ptr, nt_memfree_fn free_func);
extern nt_link_tp nt_link_add_n_data(nt_link_tp link, int n_data);
extern nt_link_tp nt_link_insert_before(nt_link_tp top_linkp,
nt_link_tp dest, nt_link_tp src);
+extern nt_link_tp nt_link_add_last(nt_link_tp top_linkp, nt_link_tp src);
extern nt_link_tp nt_link_remove(nt_link_tp src, nt_link_tp target);
extern nt_link_tp nt_link_remove2(nt_link_tp src, nt_link_tp target);
extern nt_link_tp nt_link_remove_by_data(nt_link_tp link, void *data);
extern char* nt_substr(const char *cptr, int start, int end);
extern BOOL nt_strtok(const char *str, char delim,
const char** start, const char **end);
+extern wchar_t* nt_w_str_resize(wchar_t *old_src,
+ size_t old_size, size_t new_size);
#endif /* _TEXT_H_ */
kvp = nt_key_value_alloc(key, value);
if(linkp){
wrk_linkp = nt_link_find(linkp, kvp, cmp_link_func);
- if(wrk_linkp)
- nt_link_remove(linkp, wrk_linkp);
+ if(wrk_linkp){
+ linkp = nt_link_remove2(linkp, wrk_linkp);
+ kvp_free_func(wrk_linkp->data);
+ free(wrk_linkp);
+ }
}
wrk_linkp = nt_link_add_data(linkp, kvp);
if(!linkp)
if(linkp){
wrk_linkp = nt_link_find(linkp, kvp, cmp_link_func);
if(wrk_linkp){
- wrk_linkp = nt_link_remove(linkp, wrk_linkp);
- if(wrk_linkp){
- kvp_free_func(wrk_linkp->data);
- free(wrk_linkp);
- }
+ linkp = nt_link_remove2(linkp, wrk_linkp);
+ kvp_free_func(wrk_linkp->data);
+ free(wrk_linkp);
}
}
wrk_linkp = nt_link_add_data(linkp, kvp);
#include "utils/text.h"
#include "_2ch/_2ch.h"
#include "_2ch/model_2ch.h"
+#include "_2ch/parse_2ch.h"
#include "ui/disp.h"
#include "ui/disp_string.h"
#define NT_CMD_NONE -1
#define NT_CMD_WRITE 1
#define NT_CMD_JMP_NEW 2
+#define NT_CMD_TREE 3
+#define NT_CMD_ID 4
typedef struct tag_ctx_reslist_t *ctx_reslist_tp;
typedef struct tag_ctx_reslist_t
int sel_res_no;
int sel_res_line;
+ nt_link_tp res_disp_list;
+
+ nt_stack_tp child_ctx_stackp;
+
} ctx_reslist_t;
+typedef struct tag_res_data_t *res_data_tp;
+typedef struct tag_res_data_t {
+ nt_res_t *resp;
+ nt_link_tp cite_num_list;
+ nt_link_tp cited_num_list;
+ int msg_line_num;
+ int msg_header_line_num;
+ nt_link_tp msg_line_linkp;
+ int id_num;
+}res_data_t;
static ctx_reslist_tp init_context(nt_2ch_model_tp modelp,
void *usr_db_handle);
+static BOOL reslist_clone(nt_thread_tp threadp, ctx_reslist_tp ctxp);
static void int_ptr_free(void *ptr);
-static int parse_cmd1(const char *param, int *statep);
+static int parse_cmd1(const char *param, int *statep, const char **end);
static BOOL search_line_asc(regex_t *regexp, nt_link_tp reslistp,
int *sel_res_no, int *sel_res_line, int column);
static BOOL search_line_desc(regex_t *regexp, ctx_reslist_tp ctxp,
nt_link_tp reslistp,
int *sel_res_no, int *sel_res_line, int column);
+static int parse_res_msg(nt_link_tp disp_res_list,
+ res_data_tp res_datap, size_t colmns);
+static void res_msg_free(void *ptr);
+static nt_link_tp get_cited_num_list(nt_link_tp res_listp, int seq_no);
+static BOOL reslist_copy(ctx_reslist_tp ctxp, ctx_reslist_tp copy_ctxp,
+ nt_link_tp num_listp);
+static ctx_reslist_tp init_sub_context(ctx_reslist_tp ctxp, nt_link_tp num_listp);
+static void free_reslist_sub_ctx(void *ptr);
+static nt_link_tp parse_tree_list(ctx_reslist_tp ctxp, const char *param);
+static nt_link_tp parse_id_list(ctx_reslist_tp ctxp, const char *param);
+static void search_up_tree(int seq_no, nt_link_tp disp_list, nt_link_tp *num_linkp);
+static void search_down_tree(int seq_no, nt_link_tp disp_list, nt_link_tp *num_linkp);
+static int get_id_num(ctx_reslist_tp ctxp, const wchar_t *misc);
+static BOOL set_res_header(ctx_reslist_tp ctxp, res_data_tp res_datap,
+ wchar_t *buf, size_t buf_len);
int disp_reslist(nt_window_tp wp, nt_2ch_model_tp modelp,
void *usr_db_handle)
{
- ctx_reslist_tp ctxp;
- nt_res_tp resp;
- nt_thread_tp threadp;
+ ctx_reslist_tp ctxp, child_ctxp;
+ res_data_tp res_datap;
nt_link_tp clistp;
+ nt_link_tp linkp;
+ nt_stack_tp stackp;
int i, rows;
int wlines;
int len, ch;
int line_num;
int cmd;
attr_t new_res_attr;
+ const char *endp;
ctxp = (ctx_reslist_tp)wp->data;
if(!ctxp){
if(!ctxp)
return DISP_STATE_ERROR;
wp->data = ctxp;
+ }else if(ctxp->child_ctx_stackp){
+ ctxp = (ctx_reslist_tp)nt_stack_peek(
+ ctxp->child_ctx_stackp);
+ if(!ctxp){
+ ctxp->child_ctx_stackp = NULL;
+ ctxp = (ctx_reslist_tp)wp->data;
+ }
}
ch = wp->key;
- threadp = modelp->selected_threadp;
if(ctxp->max_cur_res < 0 || ctxp->max_cur_offset < 0){
wlines = wp->lines;
int cur_res = ctxp->res_num - 1;
/* get the bottom scroll position*/
- clistp = threadp->reslistp->prev;
- while(clistp != threadp->reslistp){
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp){
- parse_res_msg(resp, wp->cols-5);
+ clistp = ctxp->res_disp_list->prev;
+ while(clistp != ctxp->res_disp_list){
+ res_datap = (res_data_tp)clistp->data;
+ if(!res_datap->msg_line_linkp){
+ parse_res_msg(ctxp->res_disp_list, res_datap, wp->cols-5);
}
- if(resp->msg_header_line_num <= 0){
- if(-1 == swprintf(buf, sizeof(buf)-1,
+ if(res_datap->msg_header_line_num <= 0){
+ /*if(-1 == swprintf(buf, sizeof(buf)-1,
L"%5d. %ls %ls %ls",
- resp->seq_no, resp->name,
- resp->mail, resp->misc)){
- resp->msg_header_line_num = 1;
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc)){*/
+ if(!set_res_header((ctx_reslist_tp)wp->data,
+ res_datap, buf, sizeof(buf)/sizeof(buf[0]))){
+ res_datap->msg_header_line_num = 1;
}else{
len = wcslen(buf);
cptr = buf;
cptr, wp->cols);
if(num <= 0)
break;
- resp->msg_header_line_num++;
+ res_datap->msg_header_line_num++;
len -= num;
cptr += num;
}
}
wlines--;
if(wlines == 0){
- ctxp->max_cur_offset = resp->msg_header_line_num;
- ctxp->max_cur_offset += resp->msg_line_num;
+ ctxp->max_cur_offset = res_datap->msg_header_line_num;
+ ctxp->max_cur_offset += res_datap->msg_line_num;
ctxp->max_cur_res = cur_res;
break;
}
- if(wlines <= resp->msg_line_num){
- ctxp->max_cur_offset = resp->msg_header_line_num;
- ctxp->max_cur_offset += resp->msg_line_num - wlines;
+ if(wlines <= res_datap->msg_line_num){
+ ctxp->max_cur_offset = res_datap->msg_header_line_num;
+ ctxp->max_cur_offset += res_datap->msg_line_num - wlines;
ctxp->max_cur_res = cur_res;
break;
}
- wlines -= resp->msg_line_num;
- if(wlines <= resp->msg_header_line_num){
+ wlines -= res_datap->msg_line_num;
+ if(wlines <= res_datap->msg_header_line_num){
ctxp->max_cur_offset =
- resp->msg_header_line_num - wlines;
+ res_datap->msg_header_line_num - wlines;
ctxp->max_cur_res = cur_res;
break;
}
- wlines -= resp->msg_header_line_num;
+ wlines -= res_datap->msg_header_line_num;
cur_res--;
if(cur_res < 0){
ctxp->max_cur_offset = 0;
case KEY_END:
if(ctxp->cur_res == ctxp->res_num - 1)
break;
- if(!threadp->reslistp)
+ if(!ctxp->res_disp_list)
break;
- clistp = threadp->reslistp->prev;
+ clistp = ctxp->res_disp_list->prev;
ctxp->cur_res = ctxp->max_cur_res;
ctxp->cur_res_offset = ctxp->max_cur_offset;
break;
case NT_KEY_LEFT:
if(!ctxp->selected_num_stackp)
break;
+ if(0 >= nt_stack_get_position(ctxp->selected_num_stackp)){
+ if((ctx_reslist_tp)wp->data != ctxp){
+ stackp = ((ctx_reslist_tp)wp->data)->child_ctx_stackp;
+ if(stackp){
+ if(0 >= nt_stack_get_position(stackp)){
+ ctxp = (ctx_reslist_tp)wp->data;
+ nt_stack_free(stackp, free_reslist_sub_ctx);
+ ((ctx_reslist_tp)wp->data)->child_ctx_stackp = NULL;
+ break;
+ }
+ child_ctxp = nt_stack_pop(stackp);
+ if(!child_ctxp)
+ break;
+ child_ctxp = nt_stack_peek(stackp);
+ if(!child_ctxp)
+ break;
+ ctxp = child_ctxp;
+ }
+ }
+ break;
+ }
nptr = malloc(sizeof(int));
*nptr = ctxp->cur_res;
ptr = nt_stack_add_last(ctxp->selected_num_stackp, nptr);
break;
ctxp->cur_res = num;
ctxp->cur_res_offset = 0;
- if(!threadp->reslistp)
+ if(!ctxp->res_disp_list)
break;
- clistp = threadp->reslistp;
+ clistp = ctxp->res_disp_list;
for(i = 0; i < num; i++)
clistp = clistp->next;
break;
break;
ctxp->cur_res = num;
ctxp->cur_res_offset = 0;
- if(!threadp->reslistp)
+ if(!ctxp->res_disp_list)
break;
- clistp = threadp->reslistp;
+ clistp = ctxp->res_disp_list;
for(i = 0; i < num; i++)
clistp = clistp->next;
break;
break;
adjust = FALSE;
if(search_asc){
- if(search_line_asc(&(ctxp->regex),threadp->reslistp,
+ if(search_line_asc(&(ctxp->regex),ctxp->res_disp_list,
&ctxp->sel_res_no, &ctxp->sel_res_line,
wp->cols - 5)){
adjust = TRUE;
}
}else{
if(search_line_desc(&(ctxp->regex),ctxp,
- threadp->reslistp,
+ ctxp->res_disp_list,
&ctxp->sel_res_no, &ctxp->sel_res_line,
wp->cols - 5)){
adjust = TRUE;
rows = ctxp->res_num - 1;
wlines = wp->lines / 2;
wlines -= ctxp->sel_res_line;
- clistp = threadp->reslistp->prev;
+ clistp = ctxp->res_disp_list->prev;
do{
if(rows <= ctxp->sel_res_no){
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp){
- parse_res_msg(resp, wp->cols-5);
+ res_datap = (res_data_tp)clistp->data;
+ //resp = (nt_res_tp)clistp->data;
+ if(!res_datap->msg_line_linkp){
+ parse_res_msg(ctxp->res_disp_list, res_datap, wp->cols-5);
}
- if(resp->msg_header_line_num <= 0){
- if(-1 == swprintf(buf, sizeof(buf)-1,
+ if(res_datap->msg_header_line_num <= 0){
+ /*if(-1 == swprintf(buf, sizeof(buf)-1,
L"%5d. %ls %ls %ls",
- resp->seq_no, resp->name,
- resp->mail, resp->misc)){
- resp->msg_header_line_num = 1;
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc)){*/
+ if(!set_res_header((ctx_reslist_tp)wp->data,
+ res_datap, buf, sizeof(buf)/sizeof(buf[0]))){
+ res_datap->msg_header_line_num = 1;
}else{
len = wcslen(buf);
cptr = buf;
cptr, wp->cols);
if(num <= 0)
break;
- resp->msg_header_line_num++;
+ res_datap->msg_header_line_num++;
len -= num;
cptr += num;
}
if(wlines <= ctxp->sel_res_line){
ctxp->cur_res = rows;
ctxp->cur_res_offset =
- resp->msg_header_line_num +
+ res_datap->msg_header_line_num +
(ctxp->sel_res_line - wlines);
set_value = TRUE;
break;
}
wlines -= ctxp->sel_res_line;
- }else if(wlines <= (resp->msg_line_num+1)){
+ }else if(wlines <= (res_datap->msg_line_num+1)){
ctxp->cur_res = rows;
ctxp->cur_res_offset =
- resp->msg_header_line_num + wlines;
+ res_datap->msg_header_line_num + wlines;
set_value = TRUE;
break;
}else{
- wlines -= resp->msg_line_num + 1;
+ wlines -= res_datap->msg_line_num + 1;
}
- if(wlines <= resp->msg_header_line_num){
+ if(wlines <= res_datap->msg_header_line_num){
ctxp->cur_res = rows;
ctxp->cur_res_offset =
- resp->msg_header_line_num - wlines;
+ res_datap->msg_header_line_num - wlines;
set_value = TRUE;
break;
}
- wlines -= resp->msg_header_line_num;
+ wlines -= res_datap->msg_header_line_num;
}
rows--;
clistp = clistp->prev;
- }while(clistp != threadp->reslistp->prev);
+ }while(clistp != ctxp->res_disp_list->prev);
if(!set_value){
ctxp->cur_res = 0;
ctxp->cur_res_offset = 0;
break;
case NT_KEY_COMMAND1:
assert(wp->cmd_param);
- cmd = parse_cmd1(wp->cmd_param, &state);
+ cmd = parse_cmd1(wp->cmd_param, &state, &endp);
switch(cmd){
case NT_CMD_WRITE:
return state;
ctxp->cur_res_offset = 0;
break;
default:
- num = atoi(wp->cmd_param);
- if(0 == num)
- break;
- num--;
- if(ctxp->cur_res == num)
- break;
- if(num >= ctxp->res_num)
+ if(cmd == NT_CMD_TREE){
+ linkp = parse_tree_list((ctx_reslist_tp)wp->data, endp);
+ }else if(cmd == NT_CMD_ID){
+ linkp = parse_id_list((ctx_reslist_tp)wp->data, endp);
+ }else{
+ linkp = nt_parse_number_list(wp->cmd_param, NULL);
+ }
+ if(!linkp)
break;
- nptr = malloc(sizeof(int));
- *nptr = ctxp->cur_res;
- ctxp->cur_res = num;
- ctxp->cur_res_offset = 0;
- if(!threadp->reslistp){
- free(nptr);
+ num = nt_link_num(linkp);
+ if(0 >= num){
break;
+ }else if(1 == num){
+ num = linkp->n_data;
+ free(linkp);
+ num--;
+ if(ctxp->cur_res == num)
+ break;
+ if(num >= ctxp->res_num)
+ break;
+ nptr = malloc(sizeof(int));
+ *nptr = ctxp->cur_res;
+ ctxp->cur_res = num;
+ ctxp->cur_res_offset = 0;
+ if(!ctxp->res_disp_list){
+ free(nptr);
+ break;
+ }
+ clistp = ctxp->res_disp_list;
+ for(i = 0; i < num; i++)
+ clistp = clistp->next;
+ nt_stack_push(ctxp->selected_num_stackp, nptr);
+ }else{
+ child_ctxp = init_sub_context((ctx_reslist_tp)wp->data, linkp);
+ if(child_ctxp){
+ ctxp = child_ctxp;
+ }
+ nt_all_link_free(linkp, NULL);
}
- clistp = threadp->reslistp;
- for(i = 0; i < num; i++)
- clistp = clistp->next;
- nt_stack_push(ctxp->selected_num_stackp, nptr);
break;
}/* end switch */
break;
break;
}
ctxp->cur_res--;
- clistp = threadp->reslistp;
+ clistp = ctxp->res_disp_list;
for(i = 0; i < ctxp->res_num; i++){
if(i == ctxp->cur_res)
break;
}
if(i == ctxp->res_num)
break;
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp){
- parse_res_msg(resp, wp->cols-5);
+ res_datap = (res_data_tp)clistp->data;
+ if(!res_datap->msg_line_linkp){
+ parse_res_msg(ctxp->res_disp_list, res_datap, wp->cols-5);
}
- if(resp->msg_header_line_num <= 0){
- if(-1 == swprintf(buf, sizeof(buf)-1,
+ if(res_datap->msg_header_line_num <= 0){
+ /*if(-1 == swprintf(buf, sizeof(buf)-1,
L"%5d. %ls %ls %ls",
- resp->seq_no, resp->name,
- resp->mail, resp->misc)){
- resp->msg_header_line_num = 1;
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc)){*/
+ if(!set_res_header((ctx_reslist_tp)wp->data,
+ res_datap, buf, sizeof(buf)/sizeof(buf[0]))){
+ res_datap->msg_header_line_num = 1;
}else{
len = wcslen(buf);
cptr = buf;
cptr, wp->cols);
if(num <= 0)
break;
- resp->msg_header_line_num++;
+ res_datap->msg_header_line_num++;
len -= num;
cptr += num;
}
}
}
- num = resp->msg_header_line_num;
- num += resp->msg_line_num;
+ num = res_datap->msg_header_line_num;
+ num += res_datap->msg_line_num;
ctxp->cur_res_offset = num;
break;
case NT_KEY_DOWN:
case KEY_DOWN:
ctxp->cur_res_offset++;
- clistp = threadp->reslistp;
+ clistp = ctxp->res_disp_list;
for(i = 0; i < ctxp->res_num; i++){
if(i == ctxp->cur_res)
break;
}
if(i == ctxp->res_num)
break;
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp){
- parse_res_msg(resp, wp->cols-5);
+ res_datap = (res_data_tp)clistp->data;
+ if(!res_datap->msg_line_linkp){
+ parse_res_msg(ctxp->res_disp_list, res_datap, wp->cols-5);
}
- if(resp->msg_header_line_num <= 0){
- if(-1 == swprintf(buf, sizeof(buf)-1,
+ if(res_datap->msg_header_line_num <= 0){
+ /*if(-1 == swprintf(buf, sizeof(buf)-1,
L"%5d. %ls %ls %ls",
- resp->seq_no, resp->name,
- resp->mail, resp->misc)){
- resp->msg_header_line_num = 1;
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc)){*/
+ if(!set_res_header((ctx_reslist_tp)wp->data,
+ res_datap, buf, sizeof(buf)/sizeof(buf[0]))){
+ res_datap->msg_header_line_num = 1;
}else{
len = wcslen(buf);
cptr = buf;
cptr, wp->cols);
if(num <= 0)
break;
- resp->msg_header_line_num++;
+ res_datap->msg_header_line_num++;
len -= num;
cptr += num;
}
}
}
- num = resp->msg_header_line_num;
- num += resp->msg_line_num + 1;
+ num = res_datap->msg_header_line_num;
+ num += res_datap->msg_line_num + 1;
if(ctxp->cur_res_offset >= num){
ctxp->cur_res++;
ctxp->cur_res_offset = 0;
break;
}
ctxp->cur_res--;
- clistp = threadp->reslistp;
+ clistp = ctxp->res_disp_list;
for(i = 0; i < ctxp->res_num; i++){
if(i == ctxp->cur_res)
break;
break;
}
for( ; i > 0; i--){
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp){
- parse_res_msg(resp, wp->cols-5);
+ res_datap = (res_data_tp)clistp->data;
+ if(!res_datap->msg_line_linkp){
+ parse_res_msg(ctxp->res_disp_list, res_datap, wp->cols-5);
}
- if(resp->msg_header_line_num <= 0){
- if(-1 == swprintf(buf, sizeof(buf)-1,
+ if(res_datap->msg_header_line_num <= 0){
+ /*if(-1 == swprintf(buf, sizeof(buf)-1,
L"%5d. %ls %ls %ls",
- resp->seq_no, resp->name,
- resp->mail, resp->misc)){
- resp->msg_header_line_num = 1;
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc)){*/
+ if(!set_res_header((ctx_reslist_tp)wp->data,
+ res_datap, buf, sizeof(buf)/sizeof(buf[0]))){
+ res_datap->msg_header_line_num = 1;
}else{
len = wcslen(buf);
cptr = buf;
cptr, wp->cols);
if(num <= 0)
break;
- resp->msg_header_line_num++;
+ res_datap->msg_header_line_num++;
len -= num;
cptr += num;
}
}
}
- num = resp->msg_header_line_num;
- num += resp->msg_line_num;
+ num = res_datap->msg_header_line_num;
+ num += res_datap->msg_line_num;
if(ctxp->cur_res_offset + num < 0){
ctxp->cur_res_offset += num;
ctxp->cur_res--;
break;
case NT_KEY_PAGEDOWN:
case KEY_NPAGE:
- clistp = threadp->reslistp;
+ clistp = ctxp->res_disp_list;
if(0 > ctxp->cur_res)
ctxp->cur_res = 0;
for(i = 0; i < ctxp->res_num; i++){
ctxp->cur_res_offset += wp->lines;
for( ; i < ctxp->res_num; i++){
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp){
- parse_res_msg(resp, wp->cols-5);
+ res_datap = (res_data_tp)clistp->data;
+ if(!res_datap->msg_line_linkp){
+ parse_res_msg(ctxp->res_disp_list, res_datap, wp->cols-5);
}
- if(resp->msg_header_line_num <= 0){
- if(-1 == swprintf(buf, sizeof(buf)-1,
+ if(res_datap->msg_header_line_num <= 0){
+ /*if(-1 == swprintf(buf, sizeof(buf)-1,
L"%5d. %ls %ls %ls",
- resp->seq_no, resp->name,
- resp->mail, resp->misc)){
- resp->msg_header_line_num = 1;
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc)){*/
+ if(!set_res_header((ctx_reslist_tp)wp->data,
+ res_datap, buf, sizeof(buf)/sizeof(buf[0]))){
+ res_datap->msg_header_line_num = 1;
}else{
len = wcslen(buf);
cptr = buf;
cptr, wp->cols);
if(num <= 0)
break;
- resp->msg_header_line_num++;
+ res_datap->msg_header_line_num++;
len -= num;
cptr += num;
}
}
}
- num = resp->msg_header_line_num;
- num += resp->msg_line_num + 1;
+ num = res_datap->msg_header_line_num;
+ num += res_datap->msg_line_num + 1;
if(num > ctxp->cur_res_offset){
break;
}
ctxp->cur_res_offset = ctxp->max_cur_offset;
}
- clistp = threadp->reslistp;
+ clistp = ctxp->res_disp_list;
res_offset = 0;
rows = 0;
for(i = 0; i < ctxp->res_num; i++){
if(rows == wp->lines)
break;
- resp = (nt_res_tp)clistp->data;
+ res_datap = (res_data_tp)clistp->data;
- if(-1 == swprintf(buf, sizeof(buf)-1,
- L"%5d. %ls %ls %ls",
- resp->seq_no, resp->name,
- resp->mail, resp->misc)){
+ if(!set_res_header((ctx_reslist_tp)wp->data,
+ res_datap, buf, sizeof(buf)/sizeof(buf[0]))){
continue;
}
len = wcslen(buf);
}
if(rows == wp->lines)
break;
- if(!resp->msg_line_linkp){
- parse_res_msg(resp, wp->cols-5);
+ if(!res_datap->msg_line_linkp){
+ parse_res_msg(ctxp->res_disp_list, res_datap, wp->cols-5);
}
- if(0 == resp->msg_line_num)
+ if(0 == res_datap->msg_line_num)
continue;
- link_curp = resp->msg_line_linkp;
+ link_curp = res_datap->msg_line_linkp;
line_num = 0;
do{
cptr = (wchar_t*)link_curp->data;
}
line_num++;
link_curp = link_curp->next;
- }while(resp->msg_line_linkp != link_curp);
+ }while(res_datap->msg_line_linkp != link_curp);
if(rows == wp->lines)
goto END_FOR;
if(res_offset >= ctxp->cur_res_offset){
wmove(wp->wp, rows, 0);
nt_add_wnch(wp->wp, L' ', 0, wp->cols);
+ if(res_datap->cited_num_list){
+ cptr = nt_w_format_number_list(
+ res_datap->cited_num_list);
+ if(cptr){
+ wmove(wp->wp, rows, 0);
+ nt_add_wnch(wp->wp, L' ', 0, 6);
+ nt_add_wstr(wp->wp, L"<<", 0);
+ nt_add_wnstr(wp->wp, cptr,
+ 0, wp->cols - 8);
+ free(cptr);
+ }
+ }else{
+ }
rows++;
}else{
res_offset++;
return DISP_STATE_RESLIST;
}
-static int parse_cmd1(const char *param, int *statep)
+static int get_id_num(ctx_reslist_tp ctxp, const wchar_t *misc)
{
- assert(param);
+ int num;
+ num = 0;
+ res_data_tp datap;
+ nt_res_tp resp;
+ wchar_t *cptr;
+ nt_link_tp linkp, disp_list;
+
+ assert(ctxp);
+
+ cptr = wcsstr(misc, L"ID:");
+ if(!cptr)
+ return 0;
+
+ cptr = nt_w_trim(cptr);
+ if(!cptr)
+ return 0;
+
+ disp_list = ctxp->res_disp_list;
+ linkp = disp_list;
+ do{
+ datap = (res_data_tp)linkp->data;
+ resp = datap->resp;
+ if(wcsstr(resp->misc, cptr))
+ num++;
+ linkp = linkp->next;
+ }while(linkp != disp_list);
+
+ free(cptr);
+ return num;
+}
- if(0 == strcmp(NT_COMMAND1_WRITE_MSG_1, param) ||
- 0 == strcmp(NT_COMMAND1_WRITE_MSG_2, param)){
+static BOOL set_res_header(ctx_reslist_tp ctxp, res_data_tp res_datap,
+ wchar_t *buf, size_t buf_len)
+{
+ int id_num;
+ id_num = res_datap->id_num;
+ if(id_num < 0){
+ id_num = get_id_num(ctxp, res_datap->resp->misc);
+ res_datap->id_num = id_num;
+ }
+ if(id_num <= 1){
+ if(-1 == swprintf(buf, buf_len-1,
+ L"%5d. %ls %ls %ls",
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc)){
+ return FALSE;
+ }
+ }else{
+ if(-1 == swprintf(buf, buf_len-1,
+ L"%5d. %ls %ls %ls(%d)",
+ res_datap->resp->seq_no, res_datap->resp->name,
+ res_datap->resp->mail, res_datap->resp->misc, id_num)){
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static int parse_cmd1(const char *param, int *statep, const char **end)
+{
+ int len;
+ const char *start;
+
+ assert(param);
+
+ if(!nt_strtok(param, ' ', &start, end))
+ return NT_CMD_NONE;
+
+ len = *end - start;
+ if(len <= 0)
+ return NT_CMD_NONE;
+
+ if(0 == strncmp(NT_COMMAND1_WRITE_MSG_1, start,len) ||
+ 0 == strncmp(NT_COMMAND1_WRITE_MSG_2, start,len)){
*statep = DISP_STATE_EDITOR;
return NT_CMD_WRITE;
- }else if(0 == strcmp(NT_COMMAND1_JMP_NEW_1, param) ||
- 0 == strcmp(NT_COMMAND1_JMP_NEW_2, param)){
+ }else if(0 == strncmp(NT_COMMAND1_JMP_NEW_1,start,len) ||
+ 0 == strncmp(NT_COMMAND1_JMP_NEW_2, start,len)){
return NT_CMD_JMP_NEW;
+ }else if(0 == strncmp(NT_COMMAND1_TREE_1, start,len) ||
+ 0 == strncmp(NT_COMMAND1_TREE_2, start,len)){
+ return NT_CMD_TREE;
+ }else if(0 == strncmp(NT_COMMAND1_ID_1, start,len) ||
+ 0 == strncmp(NT_COMMAND1_ID_2, start,len)){
+ return NT_CMD_ID;
}
return NT_CMD_NONE;
}
-
-
static ctx_reslist_tp init_context(nt_2ch_model_tp modelp,
void *usr_db_handle)
{
if(!ctxp)
return NULL;
- if(threadp->reslistp)
- ctxp->res_num = nt_link_num(threadp->reslistp);
ctxp->cur_res = 0;
ctxp->cur_res_offset = 0;
ctxp->max_cur_res = -1;
ctxp->regex_init = FALSE;
ctxp->sel_res_no = -1;
ctxp->sel_res_line = -1;
+ ctxp->child_ctx_stackp = NULL;
+ if(!reslist_clone(threadp, ctxp)){
+ free_reslist_ctx(ctxp);
+ return NULL;
+ }
+
ctxp->prev_read_cnt =
nt_usr_db_update_read_count(usr_db_handle,
boardp->name, threadp->file_name,
if(ctxp->prev_read_cnt > 0){
ctxp->cur_res = ctxp->prev_read_cnt;
}
-
+
return ctxp;
}
+static ctx_reslist_tp init_sub_context(ctx_reslist_tp ctxp, nt_link_tp num_listp)
+{
+ ctx_reslist_tp child_ctxp;
+ child_ctxp = (ctx_reslist_tp)calloc(1,sizeof(ctx_reslist_t));
+ if(!child_ctxp)
+ return NULL;
+
+ child_ctxp->cur_res = 0;
+ child_ctxp->cur_res_offset = 0;
+ child_ctxp->max_cur_res = -1;
+ child_ctxp->max_cur_offset = -1;
+ child_ctxp->selected_num_stackp = nt_stack_alloc();
+ child_ctxp->regex_init = FALSE;
+ child_ctxp->sel_res_no = -1;
+ child_ctxp->sel_res_line = -1;
+ child_ctxp->child_ctx_stackp = NULL;
+ child_ctxp->prev_read_cnt = 0;
+
+ if(!reslist_copy(ctxp, child_ctxp, num_listp)){
+ nt_stack_free(child_ctxp->selected_num_stackp, NULL);
+ free(child_ctxp);
+ return NULL;
+ }
+
+ if(!ctxp->child_ctx_stackp){
+ ctxp->child_ctx_stackp = nt_stack_alloc();
+ if(!ctxp->child_ctx_stackp){
+ nt_stack_free(child_ctxp->selected_num_stackp, NULL);
+ free(child_ctxp);
+ return NULL;
+ }
+ }
+ if(!nt_stack_push(ctxp->child_ctx_stackp, child_ctxp)){
+ nt_stack_free(child_ctxp->selected_num_stackp, NULL);
+ free(child_ctxp);
+ return NULL;
+ }
+ return child_ctxp;
+}
+
+static BOOL reslist_clone(nt_thread_tp threadp, ctx_reslist_tp ctxp)
+{
+ nt_link_tp linkp, r_linkp;
+ nt_res_tp resp;
+ res_data_tp datap;
+ int num_res;
+
+ assert(threadp);
+ assert(threadp->reslistp);
+
+ num_res = 0;
+ linkp = threadp->reslistp;
+ do{
+ datap = (res_data_tp)calloc(1, sizeof(res_data_t));
+ if(datap){
+ datap->id_num = -1;
+ resp = (nt_res_t *)linkp->data;
+ datap->resp = malloc(sizeof(nt_res_t));
+ if(datap->resp){
+ datap->resp->seq_no = resp->seq_no;
+ datap->resp->name = nt_w_str_clone(resp->name);
+ datap->resp->mail = nt_w_str_clone(resp->mail);
+ datap->resp->misc = nt_w_str_clone(resp->misc);
+ datap->resp->msg = nt_parse_res_msg(resp->msg,
+ &datap->cite_num_list);
+ if(!datap->resp->name || !datap->resp->mail ||
+ !datap->resp->misc || !datap->resp->msg){
+ free(datap->resp);
+ free(datap);
+ }else{
+ r_linkp = nt_link_add_data(ctxp->res_disp_list, datap);
+ if(!ctxp->res_disp_list)
+ ctxp->res_disp_list = r_linkp;
+ num_res++;
+ }
+ }
+ }
+ linkp = linkp->next;
+ }while(linkp != threadp->reslistp);
+
+ ctxp->res_num = num_res;
+ return TRUE;
+}
+
+static BOOL reslist_copy(ctx_reslist_tp ctxp, ctx_reslist_tp copy_ctxp, nt_link_tp num_listp)
+{
+ nt_link_tp linkp, r_linkp;
+ nt_link_tp d_linkp;
+ nt_res_tp resp;
+ res_data_tp datap;
+ int num_res;
+ int seq_no;
+
+ assert(ctxp && copy_ctxp && num_listp);
+
+ num_res = 0;
+ linkp = num_listp;
+ do{
+ seq_no = linkp->n_data;
+ d_linkp = ctxp->res_disp_list;
+ do{
+ datap = (res_data_tp)d_linkp->data;
+ resp = datap->resp;
+ if(seq_no == resp->seq_no){
+ r_linkp = nt_link_add_data(copy_ctxp->res_disp_list, datap);
+ if(r_linkp){
+ if(!copy_ctxp->res_disp_list)
+ copy_ctxp->res_disp_list = r_linkp;
+ num_res++;
+ }
+ break;
+ }
+ d_linkp = d_linkp->next;
+ }while(d_linkp != ctxp->res_disp_list);
+ linkp = linkp->next;
+ }while(linkp != num_listp);
+ copy_ctxp->res_num = num_res;
+ return TRUE;
+}
+
void free_reslist_ctx(void *ptr)
{
ctx_reslist_tp ctxp;
+ nt_stack_tp stackp;
+ if(!ptr)
+ return;
+ ctxp = (ctx_reslist_tp)ptr;
+ nt_stack_free(ctxp->selected_num_stackp, &int_ptr_free);
+ if(ctxp->regex_init)
+ regfree(&(ctxp->regex));
+ if(ctxp->res_disp_list){
+ nt_all_link_free(ctxp->res_disp_list, res_msg_free);
+ }
+ stackp = ctxp->child_ctx_stackp;
+ if(stackp){
+ nt_stack_free(stackp, free_reslist_sub_ctx);
+ }
+ free(ptr);
+}
+static void free_reslist_sub_ctx(void *ptr)
+{
+ ctx_reslist_tp ctxp;
if(!ptr)
return;
- ctxp = (ctx_reslist_tp)ptr;
- nt_stack_free(ctxp->selected_num_stackp, &int_ptr_free);
- if(ctxp->regex_init)
- regfree(&(ctxp->regex));
- free(ptr);
+ ctxp = (ctx_reslist_tp)ptr;
+ nt_stack_free(ctxp->selected_num_stackp, &int_ptr_free);
+ if(ctxp->regex_init)
+ regfree(&(ctxp->regex));
+ if(ctxp->res_disp_list){
+ nt_all_link_free(ctxp->res_disp_list, NULL);
+ }
+ free(ptr);
}
static void int_ptr_free(void *ptr)
free(ptr);
}
+static void res_msg_free(void *ptr)
+{
+ nt_link_tp curp, nextp;
+ res_data_tp res_datap;
+ nt_res_tp resp;
+
+ assert(ptr);
+
+ res_datap = (res_data_tp)ptr;
+
+ resp = res_datap->resp;
+
+ free(resp->name);
+ free(resp->mail);
+ free(resp->misc);
+ free(resp->msg);
+ free(resp);
+
+ if(res_datap->cite_num_list)
+ nt_all_link_free(res_datap->cite_num_list, NULL);
+ if(res_datap->cited_num_list)
+ nt_all_link_free(res_datap->cited_num_list, NULL);
+
+ if(res_datap->msg_line_linkp){
+ curp = res_datap->msg_line_linkp->next;
+ while(curp != res_datap->msg_line_linkp){
+ nextp = curp->next;
+ /* We must not free the data pointer
+ * except the first one
+ * because they're alocated as a same block.
+ * This is wrong --> free(curp->data);
+ */
+ free(curp);
+ curp = nextp;
+ }
+ free(curp->data);
+ free(curp);
+ res_datap->msg_line_linkp = NULL;
+ }
+ free(res_datap);
+}
+
+
+
+static nt_link_tp get_cited_num_list(nt_link_tp res_listp, int seq_no)
+{
+ nt_link_tp linkp, wrkp, wrk2p;
+ nt_link_tp num_listp;
+ res_data_tp res_datap;
+
+ num_listp = NULL;
+
+ linkp = res_listp;
+ do{
+ res_datap = (res_data_tp)linkp->data;
+ if(res_datap->cite_num_list){
+ wrkp = res_datap->cite_num_list;
+ do{
+ if(wrkp->n_data == seq_no){
+ wrk2p = nt_link_add_n_data(
+ num_listp, res_datap->resp->seq_no);
+ if(wrk2p && !num_listp)
+ num_listp = wrk2p;
+ break;
+ }
+ wrkp = wrkp->next;
+ }while(wrkp != res_datap->cite_num_list);
+ }
+ linkp = linkp->next;
+ }while(linkp != res_listp);
+ if(num_listp)
+ nt_link_n_sort(&num_listp, nt_comp_int);
+ return num_listp;
+}
+
+static int parse_res_msg(nt_link_tp disp_res_list,
+ res_data_tp res_datap, size_t colmns)
+{
+ int i, len, start, lines;
+ wchar_t ch;
+ wchar_t *buf, *cptr, *srcp, *wrk_buf;
+ int offset;
+ nt_link_tp linkp;
+ int consume_colmns;
+ int buf_idx, buf_size;
+ const int delta = 64;
+
+ assert(res_datap);
+ assert(res_datap->resp);
+ assert(res_datap->resp->msg);
+
+ //res_msg_free(res_datap);
+ res_datap->msg_line_num = 0;
+
+ len = wcslen(res_datap->resp->msg);
+ if(len == 0)
+ return 0;
+ buf_size = len + delta;
+
+ if(len == 0)
+ return 0;
+ buf = malloc(sizeof(wchar_t) * (buf_size));
+ if(!buf)
+ return 0;
+ buf_idx = 0;
+
+ srcp = res_datap->resp->msg;
+
+ lines = 0;
+ start = 0;
+ consume_colmns = 0;
+ for(i = 0; i < len; i++){
+ ch = srcp[i];
+ switch(ch){
+ case L'\n':
+ cptr = buf + start;
+ buf[buf_idx] = L'\0';
+ buf_idx++;
+ linkp = nt_link_add_data(
+ res_datap->msg_line_linkp, cptr);
+ if(!linkp)
+ goto END_FOR;
+ if(res_datap->msg_line_linkp == NULL)
+ res_datap->msg_line_linkp = linkp;
+
+ consume_colmns = 0;
+ lines++;
+ start = buf_idx;
+ break;
+ default:
+ if(ch <= 128 || (ch >= 0xff66 && ch <= 0xff9d))
+ offset = 1;
+ else
+ offset = 2;
+
+ if(consume_colmns + offset > colmns){
+ cptr = buf + start;
+ buf[buf_idx] = L'\0';
+ linkp = nt_link_add_data(
+ res_datap->msg_line_linkp, cptr);
+ if(!linkp)
+ goto END_FOR;
+ if(res_datap->msg_line_linkp == NULL)
+ res_datap->msg_line_linkp = linkp;
+
+ lines++;
+ buf_idx++;
+ start = buf_idx;
+ consume_colmns = 0;
+ i--;
+ }else{
+ consume_colmns += offset;
+ buf[buf_idx] = ch;
+ buf_idx++;
+ }
+ break;
+ }/* end switch */
+ if(buf_idx >= (buf_size-1)){
+ wrk_buf = nt_w_str_resize(buf, buf_size, (buf_size + delta));
+ if(!wrk_buf){
+ nt_all_link_free(
+ res_datap->msg_line_linkp, NULL);
+ free(buf);
+ res_datap->msg_line_linkp = NULL;
+ return 0;
+ }
+ buf = wrk_buf;
+ buf_size += delta;
+ }
+ } /* end for */
+END_FOR:
+ if(consume_colmns > 0){
+ cptr = buf + start;
+ buf[buf_idx] = L'\0';
+ linkp = nt_link_add_data(
+ res_datap->msg_line_linkp, cptr);
+ if(linkp){
+ if(res_datap->msg_line_linkp == NULL)
+ res_datap->msg_line_linkp = linkp;
+ lines++;
+ }
+ }
+ res_datap->msg_line_num = lines;
+
+ if(!res_datap->cited_num_list){
+ res_datap->cited_num_list =
+ get_cited_num_list(disp_res_list,
+ res_datap->resp->seq_no);
+ }
+ return lines;
+}
static BOOL search_line_asc(regex_t *regexp, nt_link_tp reslistp,
int *sel_res_no, int *sel_res_line, int column)
{
nt_link_tp clistp, listp;
- nt_res_tp resp;
+ //nt_res_tp resp;
+ res_data_tp res_datap;
int cur, line, res_no, res_line;
wchar_t *cptr;
char buf[256];
clistp = reslistp;
do{
if(cur >= res_no){
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp)
- parse_res_msg(resp, column);
- listp = resp->msg_line_linkp;
+ res_datap = (res_data_tp)clistp->data;
+ //resp = res_datap->resp;
+ if(!res_datap->msg_line_linkp)
+ parse_res_msg(reslistp, res_datap, column);
+ listp = res_datap->msg_line_linkp;
line = 0;
do{
if(line >= res_line){
}
line++;
listp = listp->next;
- }while(listp != resp->msg_line_linkp);
+ }while(listp != res_datap->msg_line_linkp);
res_line = 0;
}
cur++;
if(cur >= res_no)
break;
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp)
- parse_res_msg(resp, column);
- listp = resp->msg_line_linkp;
+ res_datap = (res_data_tp)clistp->data;
+ if(!res_datap->msg_line_linkp)
+ parse_res_msg(reslistp, res_datap, column);
+ listp = res_datap->msg_line_linkp;
line = 0;
do{
if(line >= res_line){
}
line++;
listp = listp->next;
- }while(listp != resp->msg_line_linkp);
+ }while(listp != res_datap->msg_line_linkp);
res_line = 0;
cur++;
clistp = clistp->next;
int *sel_res_no, int *sel_res_line, int column)
{
nt_link_tp clistp, listp;
- nt_res_tp resp;
+ //nt_res_tp resp;
+ res_data_tp res_datap;
int cur, line, res_no, res_line;
wchar_t *cptr;
char buf[256];
clistp = reslistp->prev;
do{
if(cur <= res_no){
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp)
- parse_res_msg(resp, column);
- listp = resp->msg_line_linkp->prev;
- line = resp->msg_line_num - 1;
+ res_datap = (res_data_tp)clistp->data;
+ //resp = res_datap->resp;
+ if(!res_datap->msg_line_linkp)
+ parse_res_msg(reslistp, res_datap, column);
+ listp = res_datap->msg_line_linkp->prev;
+ line = res_datap->msg_line_num - 1;
do{
if(line <= res_line){
cptr = (wchar_t*)listp->data;
}
line--;
listp = listp->prev;
- }while(listp != resp->msg_line_linkp->prev);
- res_line = resp->msg_line_num - 1;
+ }while(listp != res_datap->msg_line_linkp->prev);
+ res_line = res_datap->msg_line_num - 1;
}
cur--;
clistp = clistp->prev;
if(cur <= res_no)
break;
- resp = (nt_res_tp)clistp->data;
- if(!resp->msg_line_linkp)
- parse_res_msg(resp, column);
- listp = resp->msg_line_linkp->prev;
- line = resp->msg_line_num - 1;
+ res_datap = (res_data_tp)clistp->data;
+ //resp = (nt_res_tp)clistp->data;
+ if(!res_datap->msg_line_linkp)
+ parse_res_msg(reslistp, res_datap, column);
+ listp = res_datap->msg_line_linkp->prev;
+ line = res_datap->msg_line_num - 1;
do{
if(line >= res_line){
cptr = (wchar_t*)listp->data;
}
line--;
listp = listp->prev;
- }while(listp != resp->msg_line_linkp->prev);
- res_line = resp->msg_line_num - 1;
+ }while(listp != res_datap->msg_line_linkp->prev);
+ res_line = res_datap->msg_line_num - 1;
cur--;
clistp = clistp->prev;
}while(clistp != reslistp->prev);
return FALSE;
}
+
+
+static nt_link_tp parse_id_list(ctx_reslist_tp ctxp, const char *param)
+{
+ nt_link_tp linkp, disp_list;
+ nt_link_tp wrkp, num_linkp;
+ char buf[64];
+ wchar_t wc[64];
+ wchar_t *cptr;
+ int len;
+ const char *start, *end;
+ res_data_tp res_datap;
+ nt_res_tp resp;
+
+ assert(ctxp);
+ assert(ctxp->res_disp_list);
+
+ if(!nt_strtok(param, ' ', &start, &end))
+ return NULL;
+ len = end - start;
+ if(len <= 0)
+ return NULL;
+
+ strcpy(buf,"ID:");
+ strncat(buf, start, len);
+
+ if((size_t)-1 == mbstowcs(wc, buf, sizeof(wc)-1))
+ return NULL;
+
+ num_linkp = NULL;
+ disp_list = ctxp->res_disp_list;
+ linkp = disp_list;
+ do{
+ res_datap = (res_data_tp)linkp->data;
+ resp = res_datap->resp;
+ cptr = wcsstr(resp->misc, wc);
+ if(cptr){
+ wrkp = nt_link_add_n_data(num_linkp, resp->seq_no);
+ if(!num_linkp)
+ num_linkp = wrkp;
+ }
+ linkp = linkp->next;
+ }while(linkp != disp_list);
+
+ return num_linkp;
+}
+
+
+static nt_link_tp parse_tree_list(ctx_reslist_tp ctxp, const char *param)
+{
+ nt_link_tp linkp, disp_list;
+ nt_link_tp wrkp, num_linkp;
+ int len;
+ const char *start, *end;
+ res_data_tp res_datap;
+ nt_res_tp resp;
+ int num;
+
+ assert(ctxp);
+ assert(ctxp->res_disp_list);
+
+ if(!nt_strtok(param, ' ', &start, &end))
+ return NULL;
+ len = end - start;
+ if(len <= 0)
+ return NULL;
+
+ num = atoi(start);
+ if(num == 0)
+ return NULL;
+ num_linkp = nt_link_add_n_data(NULL, num);
+ if(!num_linkp)
+ return NULL;
+
+ disp_list = ctxp->res_disp_list;
+ linkp = disp_list;
+ do{
+ res_datap = (res_data_tp)linkp->data;
+ resp = res_datap->resp;
+ if(num == resp->seq_no){
+ if(res_datap->cite_num_list){
+ wrkp = res_datap->cite_num_list;
+ do{
+ if(wrkp->n_data < num)
+ search_up_tree(wrkp->n_data, disp_list, &num_linkp);
+ wrkp = wrkp->next;
+ }while(wrkp != res_datap->cite_num_list);
+ }
+ if(res_datap->cited_num_list){
+ wrkp = res_datap->cited_num_list;
+ do{
+ if(wrkp->n_data > num)
+ search_down_tree(wrkp->n_data, disp_list, &num_linkp);
+ wrkp = wrkp->next;
+ }while(wrkp != res_datap->cited_num_list);
+ }
+ break;
+ }
+ linkp = linkp->next;
+ }while(linkp != disp_list);
+ if(num_linkp)
+ nt_link_n_sort(&num_linkp, nt_comp_int);
+ return num_linkp;
+}
+static void search_up_tree(int seq_no, nt_link_tp disp_list, nt_link_tp *num_linkp)
+{
+ nt_link_tp linkp, wrkp;
+ nt_link_add_n_data(*num_linkp, seq_no);
+ res_data_tp res_datap;
+ nt_res_tp resp;
+
+ linkp = disp_list;
+ do{
+ res_datap = (res_data_tp)linkp->data;
+ resp = res_datap->resp;
+ if(seq_no == resp->seq_no){
+ if(res_datap->cite_num_list){
+ wrkp = res_datap->cite_num_list;
+ do{
+ if(wrkp->n_data < seq_no)
+ search_up_tree(wrkp->n_data, disp_list, num_linkp);
+ wrkp = wrkp->next;
+ }while(wrkp != res_datap->cite_num_list);
+ }
+ break;
+ }
+ linkp = linkp->next;
+ }while(linkp != disp_list);
+}
+
+static void search_down_tree(int seq_no, nt_link_tp disp_list, nt_link_tp *num_linkp)
+{
+ nt_link_tp linkp, wrkp;
+ nt_link_add_n_data(*num_linkp, seq_no);
+ res_data_tp res_datap;
+ nt_res_tp resp;
+
+ linkp = disp_list;
+ do{
+ res_datap = (res_data_tp)linkp->data;
+ resp = res_datap->resp;
+ if(seq_no == resp->seq_no){
+ if(res_datap->cited_num_list){
+ wrkp = res_datap->cited_num_list;
+ do{
+ if(wrkp->n_data > seq_no)
+ search_down_tree(wrkp->n_data, disp_list, num_linkp);
+ wrkp = wrkp->next;
+ }while(wrkp != res_datap->cited_num_list);
+ }
+ break;
+ }
+ linkp = linkp->next;
+ }while(linkp != disp_list);
+}
+
break;
return DISP_STATE_REFRESH;
}
- linkp = parse_number_list(end, NULL);
+ linkp = nt_parse_number_list(end, NULL);
if(!linkp)
break;
clistp = linkp;
#include <string.h>
#include <stdio.h>
#include <assert.h>
-#include <math.h>
#include "utils/nt_std_t.h"
#include "utils/base64.h"
return top_linkp;
}
+nt_link_tp nt_link_add_last(nt_link_tp top_linkp, nt_link_tp src)
+{
+ nt_link_tp old_last;
+
+ if(!top_linkp)
+ return src;
+
+ old_last = top_linkp->prev;
+ old_last->next = src;
+ top_linkp->prev = src->prev;
+ src->prev->next = top_linkp;
+ src->prev = old_last;
+ return top_linkp;
+}
+
void nt_link_sort(nt_link_tp *top_linkp, nt_compare_fn comp_func)
{
nt_link_tp cur_linkp, next_linkp, work_linkp;
return NULL;
}
+void* nt_stack_peek(nt_stack_tp stackp)
+{
+ int cursor;
+ nt_link_tp linkp;
+ assert(stackp);
+ if(!stackp->linkp)
+ return NULL;
+ linkp = stackp->linkp;
+ cursor = 0;
+ do{
+ if(cursor == stackp->cursor){
+ return linkp->data;
+ }
+ linkp = linkp->next;
+ cursor++;
+ }while(linkp != stackp->linkp);
+ return NULL;
+}
+int nt_stack_get_position(nt_stack_tp stackp)
+{
+ return stackp->cursor;
+}
+
+BOOL nt_stack_is_empty(nt_stack_tp stackp)
+{
+ return (!stackp->linkp);
+}
+
void* nt_stack_cursor_next(nt_stack_tp stackp)
{
int cursor;
#include "utils/nt_std_t.h"
#include "utils/text.h"
+
+wchar_t* nt_w_str_resize(wchar_t *old_src, size_t old_size, size_t new_size)
+{
+ wchar_t *wrk_buf;
+
+ assert(old_size < new_size && new_size > 0);
+
+ wrk_buf = malloc(sizeof(wchar_t) * (new_size));
+ if(!wrk_buf){
+ return NULL;
+ }
+
+ if(!old_src){
+ wrk_buf[0] = L'\0';
+ return wrk_buf;
+ }
+ wmemcpy(wrk_buf, old_src, old_size);
+ wrk_buf[old_size] = L'\0';
+ free(old_src);
+ return wrk_buf;
+}
+
BOOL nt_w_str_move(wchar_t *buf, size_t buf_len,
int move_index, int offset)
{
if(state == 0){
*start = str + i + 1;
}else if(state == 1){
- *end = str + i + 1;
+ *end = str + i;
return TRUE;
}
}else{