From 4b039892965a3f2a2795484ebee162d99d4797e2 Mon Sep 17 00:00:00 2001 From: Masanori Ogino Date: Thu, 7 Dec 2023 15:02:09 +0900 Subject: [PATCH] Build sj3serv Signed-off-by: Masanori Ogino --- Makefile | 47 +++++++---- server/comuni.c => comuni.c | 0 server/error.c => error.c | 0 server/execute.c => execute.c | 0 server/main.c => main.c | 0 server/server.h => server.h | 2 + server/rc.sj3serv | 117 ---------------------------- server/rc.sj3serv.FreeBSD | 98 ----------------------- server/serverrc => serverrc | 0 server/setup.c => setup.c | 1 + server/time_stamp.c => time_stamp.c | 0 server/version.c => version.c | 0 12 files changed, 34 insertions(+), 231 deletions(-) rename server/comuni.c => comuni.c (100%) rename server/error.c => error.c (100%) rename server/execute.c => execute.c (100%) rename server/main.c => main.c (100%) rename server/server.h => server.h (99%) delete mode 100644 server/rc.sj3serv delete mode 100644 server/rc.sj3serv.FreeBSD rename server/serverrc => serverrc (100%) rename server/setup.c => setup.c (99%) rename server/time_stamp.c => time_stamp.c (100%) rename server/version.c => version.c (100%) diff --git a/Makefile b/Makefile index c315a5d..68eea34 100644 --- a/Makefile +++ b/Makefile @@ -35,42 +35,54 @@ CPPFLAGS += -I. -I./include -I./sj3h LDFLAGS += -L. # Public API library -SJ3LIB_OBJS = level1.o sj3lib.o string.o +PUBLIC_LIBS = libsj3lib.a libsj3lib.so.$(LIBVER) +SJ3LIB_OBJS = level1.o sj3lib.o string.o # Private libraries -KANAKAN_OBJS = adddic.o addelcmn.o alloc.o charsize.o chrtbl.o cl2knj.o \ - clstudy.o cmpstr.o conjunc.o connect.o cvtclknj.o cvtdict.o \ - cvtkanji.o deldic.o depend.o dict.o functbl.o fuzoku.o \ - fzkyomi.o getkanji.o getrank.o global2.o hzstrlen.o init.o \ - istrcmp.o memcpy.o memory2.o memset.o mk2claus.o mkbunset.o \ - mkjiritu.o mkkouho.o mknumber.o mvmemd.o mvmemi.o peepdic.o \ - ph2knj.o ph_khtbl.o priority.o prtytbl.o s2ctbl.o selclrec.o \ - selsuuji.o setconj.o setjrec.o setkouho.o setubi.o sj2code.o \ - skiphblk.o skipkstr.o srchdict.o srchhead.o srchidx.o \ - srchnum.o sstrcmp.o sstrlen.o sstrncmp.o stbtbl.o stttbl.o \ - study.o suujitbl.o terminat.o termtbl.o wakachi.o -SJ3RKCV_OBJS = rk_conv.o sj3_rkcv.o wc16_str.o +PRIVATE_LIBS = libkanakan.a libsj3rkcv.a +KANAKAN_OBJS = adddic.o addelcmn.o alloc.o charsize.o chrtbl.o cl2knj.o \ + clstudy.o cmpstr.o conjunc.o connect.o cvtclknj.o cvtdict.o \ + cvtkanji.o deldic.o depend.o dict.o functbl.o fuzoku.o \ + fzkyomi.o getkanji.o getrank.o global2.o hzstrlen.o init.o \ + istrcmp.o memcpy.o memory2.o memset.o mk2claus.o mkbunset.o \ + mkjiritu.o mkkouho.o mknumber.o mvmemd.o mvmemi.o peepdic.o \ + ph2knj.o ph_khtbl.o priority.o prtytbl.o s2ctbl.o selclrec.o \ + selsuuji.o setconj.o setjrec.o setkouho.o setubi.o sj2code.o \ + skiphblk.o skipkstr.o srchdict.o srchhead.o srchidx.o \ + srchnum.o sstrcmp.o sstrlen.o sstrncmp.o stbtbl.o stttbl.o \ + study.o suujitbl.o terminat.o termtbl.o wakachi.o +SJ3RKCV_OBJS = rk_conv.o sj3_rkcv.o wc16_str.o # Client applications +CLIENT_APPS = sj3dic sj3mkdic sj3stat SJ3DIC_OBJS = codecnv.o dictdisp.o dictmake.o hinsi.o sj3dic.o sj3err.o \ sjrc.o SJ3MKDIC_OBJS = char.o cnvhinsi.o file.o global.o hindo.o knjcvt.o makedict.o \ makelist.o makeseg.o memory.o offset.o readline.o string2.o SJ3STAT_OBJS = sj3stat.o -all: libsj3lib.a libsj3lib.so.$(LIBVER) libkanakan.a libsj3rkcv.a sj3dic sj3mkdic sj3stat +# Server daemon +SJ3SERV_OBJS = comuni.o error.o execute.o main.o setup.o time_stamp.o version.o + +ALL_OBJS = $(SJ3LIB_OBJS) $(KANAKAN_OBJS) $(SJ3RKCV_OBJS) $(SJ3DIC_OBJS) \ + $(SJ3MKDIC_OBJS) $(SJ3STAT_OBJS) $(SJ3SERV_OBJS) + +all: $(PUBLIC_LIBS) $(PRIVATE_LIBS) $(CLIENT_APPS) sj3serv install: all mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(INCLUDEDIR) mkdir -p $(DESTDIR)$(LIBDIR) + mkdir -p $(DESTDIR)/etc/sj3 $(INSTALL_PROGRAM) sj3dic $(DESTDIR)$(BINDIR) $(INSTALL_PROGRAM) sj3mkdic $(DESTDIR)$(BINDIR) + $(INSTALL_PROGRAM) sj3serv $(DESTDIR)$(BINDIR) $(INSTALL_PROGRAM) sj3stat $(DESTDIR)$(BINDIR) $(INSTALL_LIB) libsj3lib.a $(DESTDIR)$(LIBDIR) $(INSTALL_LIB) libsj3lib.so $(DESTDIR)$(LIBDIR) $(INSTALL_LIB) libsj3lib.so.$(LIBVER) $(DESTDIR)$(LIBDIR) $(INSTALL_DATA) sj3lib.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_DATA) serverrc $(DESTDIR)/etc/sj3 libsj3lib.a: $(SJ3LIB_OBJS) compats.o $(AR) crs $@ $(SJ3LIB_OBJS) compats.o @@ -91,12 +103,15 @@ sj3dic: $(SJ3DIC_OBJS) libsj3lib.a compats.o sj3mkdic: $(SJ3MKDIC_OBJS) libsj3lib.a compats.o $(CC) -static -o $@ $(SJ3MKDIC_OBJS) compats.o $(LDFLAGS) $(LDLIBS) -lsj3lib +sj3serv: $(SJ3SERV_OBJS) libsj3lib.a libkanakan.a compats.o + $(CC) -static -o $@ $(SJ3SERV_OBJS) compats.o $(LDFLAGS) $(LDLIBS) -lsj3lib -lkanakan + sj3stat: $(SJ3STAT_OBJS) libsj3lib.a compats.o $(CC) -static -o $@ $(SJ3STAT_OBJS) compats.o $(LDFLAGS) $(LDLIBS) -lsj3lib Paths.h: Paths.h.in sed -e "s|@SJ3CONFDIR@|/etc/sj3|" -e "s|@SJ3DICTDIR@|$(SHAREDIR)/sj3/dict|" Paths.h.in > $@ -$(SJ3LIB_OBJS) $(SJ3MKDIC_OBJS) $(SJ3STAT_OBJS) compats.o: config.h -$(SJ3LIB_OBJS) $(SJ3MKDIC_OBJS) $(SJ3STAT_OBJS): Paths.h +$(ALL_OBJS) compats.o: config.h +$(ALL_OBJS): Paths.h cnvhinsi.o: GramTable diff --git a/server/comuni.c b/comuni.c similarity index 100% rename from server/comuni.c rename to comuni.c diff --git a/server/error.c b/error.c similarity index 100% rename from server/error.c rename to error.c diff --git a/server/execute.c b/execute.c similarity index 100% rename from server/execute.c rename to execute.c diff --git a/server/main.c b/main.c similarity index 100% rename from server/main.c rename to main.c diff --git a/server/server.h b/server.h similarity index 99% rename from server/server.h rename to server.h index bab7da5..f2fcd23 100644 --- a/server/server.h +++ b/server.h @@ -50,7 +50,9 @@ u_char *put_ndata(u_char *p, int n); void get_buf(void); int get_byte(void); int get_word(void); +#ifndef NO_GET_INT int get_int(void); +#endif int get_nstring(u_char *p, int n); u_char *get_ndata(u_char *p, int n); diff --git a/server/rc.sj3serv b/server/rc.sj3serv deleted file mode 100644 index 56c7c71..0000000 --- a/server/rc.sj3serv +++ /dev/null @@ -1,117 +0,0 @@ -## -## Copyright (c) 1994 Sony Corporation -## -## Permission is hereby granted, free of charge, to any person obtaining -## a copy of this software and associated documentation files (the -## "Software"), to deal in the Software without restriction, including -## without limitation the rights to use, copy, modify, merge, publish, -## distribute, sublicense, and/or sell copies of the Software, and to -## permit persons to whom the Software is furnished to do so, subject to -## the following conditions: -## -## The above copyright notice and this permission notice shall be -## included in all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -## IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM, -## DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -## OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -## THE USE OR OTHER DEALINGS IN THE SOFTWARE. -## -## Except as contained in this notice, the name of Sony Corporation -## shall not be used in advertising or otherwise to promote the sale, use -## or other dealings in this Software without prior written authorization -## from Sony Corporation. -## - -## -## $SonyRCSfile: rc.sj3serv,v $ -## $SonyRevision: 1.1 $ -## $SonyDate: 1994/06/03 08:02:54 $ -## - -## sj3serv -## -## If you want to start sj3serv when system boots, please delete '#' at the -## head of CMDNAME below. -## - -CMDNAME=sj3serv - -PRINTNAME=$CMDNAME -CMDDIR=/usr/bin -BACKGROUND= -PATH=/usr/bin:/bin -CMDPATH=$CMDDIR/$CMDNAME - -RESTARTMESSAGE= -STARTMESSAGE= -DOWNMESSAGE= -#RESTARTMESSAGE="Restarting $PRINTNAME" -#STARTMESSAGE="Starting $PRINTNAME" -#DOWNMESSAGE="Killed $PRINTNAME" -USAGEMESSAGE="Usage: $0 [start|stop]" - -if [ "$CMDNAME" = "sj3serv" ] -then - if [ ! -d /usr/bin ] - then # /usr not mounted - exit - fi - - pid=`/sbin/findproc $CMDNAME` - case "$1" in - 'start') - if [ $pid ] - then - kill -TERM $pid - sleep 1 - pid=`/sbin/findproc $CMDNAME` - if [ $pid ] - then - kill -9 $pid - fi - if [ -f $CMDPATH ] - then - if [ "$RESTARTMESSAGE" ] - then - echo $RESTARTMESSAGE > /dev/console - fi - eval $CMDPATH $BACKGROUND - fi - else - if [ -f $CMDPATH ] - then - if [ "$STARTMESSAGE" ] - then - echo $STARTMESSAGE >/dev/console - fi - eval $CMDPATH $BACKGROUND - fi - fi - ;; - 'stop') - if [ $pid ] - then - kill -TERM $pid - sleep 1 - pid=`/sbin/findproc $CMDNAME` - if [ $pid ] - then - kill -9 $pid - fi - if [ "$DOWNMESSAGE" ] - then - echo $DOWNMESSAGE > /dev/console - fi - fi - ;; - *) - echo $USAGEMESSAGE - ;; - esac -fi - - diff --git a/server/rc.sj3serv.FreeBSD b/server/rc.sj3serv.FreeBSD deleted file mode 100644 index 6939bd8..0000000 --- a/server/rc.sj3serv.FreeBSD +++ /dev/null @@ -1,98 +0,0 @@ -## -## Copyright (c) 1994 Sony Corporation -## -## Permission is hereby granted, free of charge, to any person obtaining -## a copy of this software and associated documentation files (the -## "Software"), to deal in the Software without restriction, including -## without limitation the rights to use, copy, modify, merge, publish, -## distribute, sublicense, and/or sell copies of the Software, and to -## permit persons to whom the Software is furnished to do so, subject to -## the following conditions: -## -## The above copyright notice and this permission notice shall be -## included in all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -## IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM, -## DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -## OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -## THE USE OR OTHER DEALINGS IN THE SOFTWARE. -## -## Except as contained in this notice, the name of Sony Corporation -## shall not be used in advertising or otherwise to promote the sale, use -## or other dealings in this Software without prior written authorization -## from Sony Corporation. -## - -## -## $SonyRCSfile: rc.sj3serv.FreeBSD,v $ -## $SonyRevision: 1.1 $ -## $SonyDate: 1997/01/23 11:09:48 $ -## - -## sj3serv -## -## If you want to start sj3serv when system boots, please delete '#' at the -## head of CMDNAME below. -## - -CMDNAME=sj3serv - -PRINTNAME=$CMDNAME -CMDDIR=/usr/local/bin -BACKGROUND= -PATH=/usr/local/bin:/usr/bin:/bin -CMDPATH=$CMDDIR/$CMDNAME - -RESTARTMESSAGE= -STARTMESSAGE= -DOWNMESSAGE= -#RESTARTMESSAGE="Restarting $PRINTNAME" -#STARTMESSAGE="Starting $PRINTNAME" -#DOWNMESSAGE="Killed $PRINTNAME" -USAGEMESSAGE="Usage: $0 [start|stop]" - -## -## For system which don't have a findproc command.(FreeBSD, ...) -## Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10 -## - -if [ "$CMDNAME" = "sj3serv" ] -then - if [ ! -d /usr/local/bin ] - then # /usr/local not mounted - exit - fi - - case "$1" in - 'start') - if [ -f $CMDPATH ] - then - if [ "$STARTMESSAGE" ] - then - echo $STARTMESSAGE >/dev/console - fi - eval $CMDPATH $BACKGROUND - fi - ;; - 'stop') - ;; - '') - if [ -f $CMDPATH ] - then - if [ "$STARTMESSAGE" ] - then - echo $STARTMESSAGE >/dev/console - fi - eval $CMDPATH $BACKGROUND - fi - ;; - *) - echo $USAGEMESSAGE - ;; - esac -fi - - diff --git a/server/serverrc b/serverrc similarity index 100% rename from server/serverrc rename to serverrc diff --git a/server/setup.c b/setup.c similarity index 99% rename from server/setup.c rename to setup.c index c87e7f5..f02b710 100644 --- a/server/setup.c +++ b/setup.c @@ -58,6 +58,7 @@ #include "Struct.h" #include "sj_global.h" #include "kanakan.h" +#define NO_GET_INT #include "server.h" typedef struct strlist { diff --git a/server/time_stamp.c b/time_stamp.c similarity index 100% rename from server/time_stamp.c rename to time_stamp.c diff --git a/server/version.c b/version.c similarity index 100% rename from server/version.c rename to version.c