KNF, SPDX and some other cleanups
Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
parent
f7a724a077
commit
6fa42826a9
4 changed files with 152 additions and 175 deletions
22
.gitmodules
vendored
22
.gitmodules
vendored
|
|
@ -1,3 +1,25 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Copyright (c) 2023 Masanori Ogino
|
||||
#
|
||||
# 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 THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
|
||||
[submodule "dict"]
|
||||
path = dict
|
||||
url = ../sj3-dict
|
||||
|
|
|
|||
42
Const.h
42
Const.h
|
|
@ -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,29 +21,15 @@
|
|||
* 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: Const.h,v $
|
||||
* $SonyRevision: 1.4 $
|
||||
* $SonyDate: 1997/01/23 11:20:52 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Change some default values.
|
||||
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
|
||||
*/
|
||||
|
||||
#ifndef _Const_H_
|
||||
#define _Const_H_ 1
|
||||
#ifndef SJ3_CONST_H_
|
||||
#define SJ3_CONST_H_
|
||||
|
||||
#include "Paths.h"
|
||||
|
||||
|
|
@ -70,17 +58,7 @@
|
|||
#define MaxClientNum 512
|
||||
#define LogOutFile ErrorOutFile
|
||||
#define PortName "sj3"
|
||||
#ifdef TLI
|
||||
#define LocalHost "localhost"
|
||||
#define ProtoName "tcp"
|
||||
#define PortNumber "3000"
|
||||
#else
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#define PortNumber 3086
|
||||
#else /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ __DragonFly__ */
|
||||
#define PortNumber 3000
|
||||
#endif /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ __DragonFly__ */
|
||||
#endif
|
||||
#define DirectryMode 0755
|
||||
#define DictFileMode 0644
|
||||
#define MODE_MASK 0777
|
||||
|
|
@ -101,4 +79,4 @@
|
|||
# define FALSE (!TRUE)
|
||||
#endif
|
||||
|
||||
#endif /* _Const_H_ */
|
||||
#endif /* SJ3_Const_H_ */
|
||||
|
|
|
|||
29
Dict.h
29
Dict.h
|
|
@ -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,29 +21,21 @@
|
|||
* 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: Dict.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:00:55 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef SJ3_DICT_H_
|
||||
#define SJ3_DICT_H_
|
||||
|
||||
#define VersionPos 0
|
||||
|
||||
#define PasswdPos 16
|
||||
#define PasswdLen 16
|
||||
|
||||
|
||||
#define StdyNormPos 32
|
||||
#define StdyNormLen 36
|
||||
#define StdyNormNum 40
|
||||
|
|
@ -54,7 +48,6 @@
|
|||
#define StdyClSegPos 64
|
||||
#define StdyClSegLen 68
|
||||
|
||||
|
||||
#define DictIdxPos 32
|
||||
#define DictIdxLen 36
|
||||
|
||||
|
|
@ -69,14 +62,14 @@
|
|||
#define DictASegPos 80
|
||||
#define DictASegLen 84
|
||||
|
||||
|
||||
#define HeaderPos 0
|
||||
#define HeaderLength 128
|
||||
#define CommentPos 128
|
||||
#define CommentLength 128
|
||||
|
||||
|
||||
#define Byte2Long(c3,c2,c1,c0) (((c3) << (8*3)) | ((c2) << (8*2)) | \
|
||||
((c1) << (8*1)) | ((c0) << (8*0)))
|
||||
#define StdyVersion Byte2Long('S', 2, 0, 0)
|
||||
#define DictVersion Byte2Long('D', 2, 0, 0)
|
||||
|
||||
#endif /* SJ3_DICT_H_ */
|
||||
|
|
|
|||
212
Struct.h
212
Struct.h
|
|
@ -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,24 +21,15 @@
|
|||
* 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: Struct.h,v $
|
||||
* $SonyRevision: 1.3 $
|
||||
* $SonyDate: 1994/10/21 05:13:34 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _Struct_H_
|
||||
#define _Struct_H_ 1
|
||||
#ifndef SJ3_STRUCT_H_
|
||||
#define SJ3_STRUCT_H_
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -48,142 +41,133 @@
|
|||
#include "Const.h"
|
||||
|
||||
typedef struct global {
|
||||
JREC *Jmaxjptr;
|
||||
CLREC *Jmaxclptr;
|
||||
JREC *Jjrt1st;
|
||||
CLREC *Jclt1st;
|
||||
JREC *Jjrt2nd;
|
||||
CLREC *Jclt2nd;
|
||||
CLREC *Jselcl;
|
||||
JREC *Jmaxjptr;
|
||||
CLREC *Jmaxclptr;
|
||||
JREC *Jjrt1st;
|
||||
CLREC *Jclt1st;
|
||||
JREC *Jjrt2nd;
|
||||
CLREC *Jclt2nd;
|
||||
CLREC *Jselcl;
|
||||
|
||||
short Jselectid;
|
||||
short Jtrank;
|
||||
short Jnrank;
|
||||
short Jselectid;
|
||||
short Jtrank;
|
||||
short Jnrank;
|
||||
|
||||
u_char *Jinputyomi;
|
||||
u_char *Jcnvstart;
|
||||
short Jcnvlen;
|
||||
u_char *Jystart;
|
||||
u_char Jhyomi[MaxPhInputLen+1];
|
||||
u_char Jorgyomi[MaxClInputLen*2+1];
|
||||
u_char *Jinputyomi;
|
||||
u_char *Jcnvstart;
|
||||
short Jcnvlen;
|
||||
u_char *Jystart;
|
||||
u_char Jhyomi[MaxPhInputLen + 1];
|
||||
u_char Jorgyomi[MaxClInputLen*2 + 1];
|
||||
|
||||
u_char Jkanjibuf[MinPhOutputLen];
|
||||
u_char *Jkanjipos;
|
||||
u_char *Jkanjitmp;
|
||||
short Jkanjilen;
|
||||
u_char Jkanjibuf[MinPhOutputLen];
|
||||
u_char *Jkanjipos;
|
||||
u_char *Jkanjitmp;
|
||||
short Jkanjilen;
|
||||
|
||||
u_char Jdicinl;
|
||||
u_char Jdicsaml;
|
||||
TypeDicSeg Jprevseg;
|
||||
u_char Jdicinl;
|
||||
u_char Jdicsaml;
|
||||
TypeDicSeg Jprevseg;
|
||||
|
||||
u_char Jfzkcount;
|
||||
u_char Jfzk_ka_flg;
|
||||
FREC Jfzktbl[MAXFREC];
|
||||
u_char Jfzkcount;
|
||||
u_char Jfzk_ka_flg;
|
||||
FREC Jfzktbl[MAXFREC];
|
||||
|
||||
u_char Jheadcode;
|
||||
u_char Jheadlen;
|
||||
u_char Jheadcode;
|
||||
u_char Jheadlen;
|
||||
|
||||
u_char Jgobilen;
|
||||
u_char Jgobilen;
|
||||
|
||||
TypeGram Jprevclgrm;
|
||||
TypeCnct Jprevclrow;
|
||||
u_char Jnextcllen;
|
||||
TypeGram Jprevclgrm;
|
||||
TypeCnct Jprevclrow;
|
||||
u_char Jnextcllen;
|
||||
|
||||
short Jkhcount;
|
||||
short Jnkhcount;
|
||||
KHREC Jkouhotbl[MaxKouhoNumber];
|
||||
STDYIN *Jstdytop;
|
||||
short Jkhcount;
|
||||
short Jnkhcount;
|
||||
KHREC Jkouhotbl[MaxKouhoNumber];
|
||||
STDYIN *Jstdytop;
|
||||
|
||||
DICT *Jcurdict;
|
||||
DICTL *Jdictlist;
|
||||
DICT *Jcurdict;
|
||||
DICTL *Jdictlist;
|
||||
u_char *Jdicbuf;
|
||||
u_char *Jidxbuf;
|
||||
TypeIdxOfs *Jidxofs;
|
||||
u_char *Jaskknj[MaxKnjAskNumber];
|
||||
u_char *Jaskknj_k[MaxKnjAskNumber];
|
||||
u_char *Jaskknj[MaxKnjAskNumber];
|
||||
u_char *Jaskknj_k[MaxKnjAskNumber];
|
||||
|
||||
STDY *Jcurstdy;
|
||||
STDY *Jcurstdy;
|
||||
|
||||
u_short Jsuuji_wbuf[NumWordBuf];
|
||||
u_char Jsuuji_ubuf[NumKetaLength];
|
||||
TypeClass Jsuuji_class;
|
||||
u_char Jsuuji_comma;
|
||||
u_char Jsuuji_keta;
|
||||
u_short Jsuuji_wbuf[NumWordBuf];
|
||||
u_char Jsuuji_ubuf[NumKetaLength];
|
||||
TypeClass Jsuuji_class;
|
||||
u_char Jsuuji_comma;
|
||||
u_char Jsuuji_keta;
|
||||
u_char *Jsuuji_yptr;
|
||||
u_char Jsuuji_len;
|
||||
u_char Jsuuji_exit;
|
||||
u_char Jsuuji_len;
|
||||
u_char Jsuuji_exit;
|
||||
u_short *Jsuuji_wkeep;
|
||||
u_char *Jsuuji_ukeep;
|
||||
|
||||
u_char Jpeepyomi[MaxWdYomiLen * 2 + 1];
|
||||
u_char Jpeepknj[MaxWdKanjiLen + 1];
|
||||
TypeGram Jpeepgrm;
|
||||
u_char Jpeepyomi[MaxWdYomiLen * 2 + 1];
|
||||
u_char Jpeepknj[MaxWdKanjiLen + 1];
|
||||
TypeGram Jpeepgrm;
|
||||
u_char *Jpeepdptr;
|
||||
u_char *Jpeephptr;
|
||||
u_char *Jpeepkptr;
|
||||
TypeDicSeg Jpeepidx;
|
||||
|
||||
TypeDicSeg Jpeepidx;
|
||||
} Global;
|
||||
|
||||
typedef struct dictfile {
|
||||
DICT dict;
|
||||
int refcnt;
|
||||
fd_set lock;
|
||||
FILE *fp;
|
||||
int fd;
|
||||
|
||||
typedef struct dictfile {
|
||||
DICT dict;
|
||||
int refcnt;
|
||||
fd_set lock;
|
||||
FILE *fp;
|
||||
int fd;
|
||||
u_char *buffer;
|
||||
long bufsiz;
|
||||
|
||||
u_char *buffer;
|
||||
long bufsiz;
|
||||
long idxstrt;
|
||||
long segstrt;
|
||||
|
||||
long idxstrt;
|
||||
long segstrt;
|
||||
TypeIdxOfs *ofsptr;
|
||||
|
||||
TypeIdxOfs *ofsptr;
|
||||
|
||||
struct dictfile *link;
|
||||
struct dictfile *link;
|
||||
} DictFile;
|
||||
|
||||
typedef struct stdyfile {
|
||||
STDY stdy;
|
||||
int refcnt;
|
||||
ino_t inode;
|
||||
FILE *fp;
|
||||
int fd;
|
||||
|
||||
typedef struct stdyfile {
|
||||
STDY stdy;
|
||||
int refcnt;
|
||||
ino_t inode;
|
||||
FILE *fp;
|
||||
int fd;
|
||||
u_char *header;
|
||||
|
||||
u_char *header;
|
||||
|
||||
struct stdyfile *link;
|
||||
struct stdyfile *link;
|
||||
} StdyFile;
|
||||
|
||||
typedef struct workarea {
|
||||
int refcnt;
|
||||
int lock;
|
||||
|
||||
typedef struct workarea {
|
||||
int refcnt;
|
||||
int lock;
|
||||
struct workarea *link;
|
||||
|
||||
struct workarea *link;
|
||||
|
||||
Global global;
|
||||
Global global;
|
||||
} WorkArea;
|
||||
|
||||
typedef struct client {
|
||||
int fd;
|
||||
char host[HostNameLen];
|
||||
char user[UserNameLen];
|
||||
char prog[ProgNameLen];
|
||||
|
||||
typedef struct client {
|
||||
int fd;
|
||||
char host[HostNameLen];
|
||||
char user[UserNameLen];
|
||||
char prog[ProgNameLen];
|
||||
|
||||
WorkArea *work;
|
||||
StdyFile *stdy;
|
||||
short version;
|
||||
u_char def_char[2];
|
||||
#if (defined(TLI) && defined(SOCK_UNIX))
|
||||
int unix_flag;
|
||||
#endif
|
||||
uid_t uid;
|
||||
struct client *next;
|
||||
WorkArea *work;
|
||||
StdyFile *stdy;
|
||||
short version;
|
||||
u_char def_char[2];
|
||||
uid_t uid;
|
||||
struct client *next;
|
||||
} Client;
|
||||
|
||||
#endif /* _Struct_H_ */
|
||||
|
||||
#endif /* SJ3_STRUCT_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue