sj3serv: Cleanup

Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
Masanori Ogino 2023-12-08 12:16:44 +09:00
commit 6751cd55df
5 changed files with 20 additions and 158 deletions

View file

@ -65,7 +65,7 @@ SJ3MKDIC_OBJS = char.o cnvhinsi.o file.o global.o hindo.o knjcvt.o makedict.o \
SJ3STAT_OBJS = sj3stat.o
# Server daemon
SJ3SERV_OBJS = comuni.o error.o execute.o main.o setup.o time_stamp.o version.o
SJ3SERV_OBJS = comuni.o error.o execute.o main.o setup.o
ALL_OBJS = $(SJ3LIB_OBJS) $(KANAKAN_OBJS) $(SJ3RKCV_OBJS) $(SJ3_OBJS) \
$(SJ3DIC_OBJS) $(SJ3MKDIC_OBJS) $(SJ3STAT_OBJS) $(SJ3SERV_OBJS)

View file

@ -118,8 +118,8 @@ knjcvt.o: knjcvt.c sj_const.h sj_euc.h sj_sysvdef.h sj_struct.h \
level1.o: level1.c config.h Const.h Paths.h sj3cmd.h sj3err.h sj3lib.h
libif.o: libif.c sj_sysvdef.h wchar16.h key.h kctype.h common.h \
conversion.h sj2.h sj3libsj3.h sj3lib.h henkan.h
main.o: main.c sj_sysvdef.h Const.h Paths.h server.h Struct.h sj_const.h \
sj_euc.h sj_dict.h sj_struct.h sj_typedef.h sj_var.h
main.o: main.c config.h sj_sysvdef.h Const.h Paths.h server.h Struct.h \
sj_const.h sj_euc.h sj_dict.h sj_struct.h sj_typedef.h sj_var.h
makedict.o: makedict.c sj_const.h sj_euc.h sj_sysvdef.h dicttool.h \
sj_struct2.h sj_const2.h
makelist.o: makelist.c sj_struct.h sj_typedef.h dicttool.h sj_struct2.h \
@ -263,10 +263,8 @@ terminat.o: terminat.c sj_kcnv.h sj_typedef.h sj_rename.h sj_const.h \
termtbl.o: termtbl.c sj_rename.h sj_typedef.h sj_const.h sj_euc.h \
sj_sysvdef.h sj_prty.h
tests.o: tests.c
time_stamp.o: time_stamp.c
toroku.o: toroku.c common.h conversion.h sj2.h wchar16.h key.h \
sj_sysvdef.h sj3libsj3.h sj3lib.h henkan.h
version.o: version.c
version2.o: version2.c sj2.h wchar16.h key.h sj_sysvdef.h
wakachi.o: wakachi.c sj_kcnv.h sj_typedef.h sj_rename.h sj_const.h \
sj_euc.h sj_sysvdef.h sj_var.h sj_dict.h sj_study.h sj_table.h \

91
main.c
View file

@ -1,6 +1,8 @@
/*
/*-
* SPDX-License-Identifier: MIT-open-group
*
* Copyright (c) 1991-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
@ -8,10 +10,10 @@
* 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.
@ -19,60 +21,40 @@
* 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: main.c,v $
* $SonyRevision: 1.3 $
* $SonyDate: 1995/02/03 07:38:44 $
*
* $Id$
*/
#include "config.h"
#include "sj_sysvdef.h"
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef SVR4
#include <sys/fcntl.h>
#include <sys/termios.h>
#endif
#include "Const.h"
#include "server.h"
#ifndef lint
static char rcsid_sony[] = "$Header: /export/work/contrib/sj3/server/RCS/main.c,v 1.12 1994/06/03 07:41:30 notanaka Exp $ SONY;";
#endif
#ifdef SVR4
#define signal sigset
#endif
extern int fork_flag;
extern char *lock_file;
char *version_number = "2.08C";
char *time_stamp = "Mon Mar 23 16:42:59 JST 1998";
static void
opening (void)
{
extern char *version_number;
extern char *time_stamp;
printf("Kana-Kanji Conversion Server Version %s\r\n", version_number);
printf("Copyright (c) 1990-1995 Sony Corporation\r\n");
printf("Created at %s\r\n", time_stamp);
@ -100,10 +82,6 @@ erase_lockfile (void)
}
#endif
#if !defined(__sony_news) || defined(SVR4)
static int
signal_handler (int sig)
{
@ -121,31 +99,6 @@ terminate_handler (int sig)
exit(0);
}
#else /* __sony_news && !SVR4 */
static int
signal_handler (sig, code, scp)
int sig;
int code;
struct sigcontext *scp;
{
warning_out("signal %d, code %d catched.", sig, code);
}
static int terminate_handler(sig, code, scp)
int sig;
int code;
struct sigcontext *scp;
{
close_socket();
sj_closeall();
#ifdef LOCK_FILE
erase_lockfile();
#endif
exit(0);
}
#endif /* __sony_news && !SVR4 */
void
server_terminate (void)
{
@ -157,8 +110,6 @@ server_terminate (void)
exit(0);
}
static void
exec_fork (void)
{
@ -207,9 +158,6 @@ leave_tty (void)
if (!tmp) fclose(stderr);
if (fork_flag) {
#ifdef SVR4
(void) setsid();
#else
if ((tmp = open("/dev/tty", O_RDWR)) >= 0) {
ioctl(tmp, TIOCNOTTY, 0);
close(tmp);
@ -223,9 +171,6 @@ leave_tty (void)
int
main (int argc, char **argv)
{
#ifdef __sony_news
(void) setlocale(LC_CTYPE, "ja_JP.EUC");
#endif
opening();
#ifndef __NetBSD__
if (setuid(geteuid())) {

View file

@ -1,41 +0,0 @@
/*
* Copyright (c) 1991-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: time_stamp.c,v $
* $SonyRevision: 1.6 $
* $SonyDate: 1998/04/08 13:11:10 $
*/
char *time_stamp = "Mon Mar 23 16:42:59 JST 1998";

View file

@ -1,40 +0,0 @@
/*
* Copyright (c) 1991-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: version.c,v $
* $SonyRevision: 1.9 $
* $SonyDate: 1998/04/08 13:11:10 $
*/
char *version_number = "2.08C";