KNF, SPDX and some other cleanups

Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
Masanori Ogino 2023-12-07 20:24:34 +09:00
commit 6fa42826a9
4 changed files with 152 additions and 175 deletions

22
.gitmodules vendored
View file

@ -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"] [submodule "dict"]
path = dict path = dict
url = ../sj3-dict url = ../sj3-dict

34
Const.h
View file

@ -1,4 +1,6 @@
/* /*-
* SPDX-License-Identifier: MIT-open-group
*
* Copyright (c) 1991-1994 Sony Corporation * Copyright (c) 1991-1994 Sony Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
@ -24,24 +26,10 @@
* shall not be used in advertising or otherwise to promote the sale, use * shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization * or other dealings in this Software without prior written authorization
* from Sony Corporation. * from Sony Corporation.
*
*/ */
/* #ifndef SJ3_CONST_H_
* $SonyRCSfile: Const.h,v $ #define SJ3_CONST_H_
* $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
#include "Paths.h" #include "Paths.h"
@ -70,17 +58,7 @@
#define MaxClientNum 512 #define MaxClientNum 512
#define LogOutFile ErrorOutFile #define LogOutFile ErrorOutFile
#define PortName "sj3" #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 #define PortNumber 3086
#else /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ __DragonFly__ */
#define PortNumber 3000
#endif /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ __DragonFly__ */
#endif
#define DirectryMode 0755 #define DirectryMode 0755
#define DictFileMode 0644 #define DictFileMode 0644
#define MODE_MASK 0777 #define MODE_MASK 0777
@ -101,4 +79,4 @@
# define FALSE (!TRUE) # define FALSE (!TRUE)
#endif #endif
#endif /* _Const_H_ */ #endif /* SJ3_Const_H_ */

21
Dict.h
View file

@ -1,4 +1,6 @@
/* /*-
* SPDX-License-Identifier: MIT-open-group
*
* Copyright (c) 1991-1994 Sony Corporation * Copyright (c) 1991-1994 Sony Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
@ -24,24 +26,16 @@
* shall not be used in advertising or otherwise to promote the sale, use * shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization * or other dealings in this Software without prior written authorization
* from Sony Corporation. * from Sony Corporation.
*
*/ */
/* #ifndef SJ3_DICT_H_
* $SonyRCSfile: Dict.h,v $ #define SJ3_DICT_H_
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:55 $
*/
#define VersionPos 0 #define VersionPos 0
#define PasswdPos 16 #define PasswdPos 16
#define PasswdLen 16 #define PasswdLen 16
#define StdyNormPos 32 #define StdyNormPos 32
#define StdyNormLen 36 #define StdyNormLen 36
#define StdyNormNum 40 #define StdyNormNum 40
@ -54,7 +48,6 @@
#define StdyClSegPos 64 #define StdyClSegPos 64
#define StdyClSegLen 68 #define StdyClSegLen 68
#define DictIdxPos 32 #define DictIdxPos 32
#define DictIdxLen 36 #define DictIdxLen 36
@ -69,14 +62,14 @@
#define DictASegPos 80 #define DictASegPos 80
#define DictASegLen 84 #define DictASegLen 84
#define HeaderPos 0 #define HeaderPos 0
#define HeaderLength 128 #define HeaderLength 128
#define CommentPos 128 #define CommentPos 128
#define CommentLength 128 #define CommentLength 128
#define Byte2Long(c3,c2,c1,c0) (((c3) << (8*3)) | ((c2) << (8*2)) | \ #define Byte2Long(c3,c2,c1,c0) (((c3) << (8*3)) | ((c2) << (8*2)) | \
((c1) << (8*1)) | ((c0) << (8*0))) ((c1) << (8*1)) | ((c0) << (8*0)))
#define StdyVersion Byte2Long('S', 2, 0, 0) #define StdyVersion Byte2Long('S', 2, 0, 0)
#define DictVersion Byte2Long('D', 2, 0, 0) #define DictVersion Byte2Long('D', 2, 0, 0)
#endif /* SJ3_DICT_H_ */

View file

@ -1,4 +1,6 @@
/* /*-
* SPDX-License-Identifier: MIT-open-group
*
* Copyright (c) 1991-1994 Sony Corporation * Copyright (c) 1991-1994 Sony Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
@ -24,19 +26,10 @@
* shall not be used in advertising or otherwise to promote the sale, use * shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization * or other dealings in this Software without prior written authorization
* from Sony Corporation. * from Sony Corporation.
*
*/ */
/* #ifndef SJ3_STRUCT_H_
* $SonyRCSfile: Struct.h,v $ #define SJ3_STRUCT_H_
* $SonyRevision: 1.3 $
* $SonyDate: 1994/10/21 05:13:34 $
*
* $Id$
*/
#ifndef _Struct_H_
#define _Struct_H_ 1
#include <sys/select.h> #include <sys/select.h>
#include <sys/types.h> #include <sys/types.h>
@ -64,8 +57,8 @@ typedef struct global {
u_char *Jcnvstart; u_char *Jcnvstart;
short Jcnvlen; short Jcnvlen;
u_char *Jystart; u_char *Jystart;
u_char Jhyomi[MaxPhInputLen+1]; u_char Jhyomi[MaxPhInputLen + 1];
u_char Jorgyomi[MaxClInputLen*2+1]; u_char Jorgyomi[MaxClInputLen*2 + 1];
u_char Jkanjibuf[MinPhOutputLen]; u_char Jkanjibuf[MinPhOutputLen];
u_char *Jkanjipos; u_char *Jkanjipos;
@ -122,10 +115,8 @@ typedef struct global {
u_char *Jpeephptr; u_char *Jpeephptr;
u_char *Jpeepkptr; u_char *Jpeepkptr;
TypeDicSeg Jpeepidx; TypeDicSeg Jpeepidx;
} Global; } Global;
typedef struct dictfile { typedef struct dictfile {
DICT dict; DICT dict;
int refcnt; int refcnt;
@ -144,7 +135,6 @@ typedef struct dictfile {
struct dictfile *link; struct dictfile *link;
} DictFile; } DictFile;
typedef struct stdyfile { typedef struct stdyfile {
STDY stdy; STDY stdy;
int refcnt; int refcnt;
@ -157,7 +147,6 @@ typedef struct stdyfile {
struct stdyfile *link; struct stdyfile *link;
} StdyFile; } StdyFile;
typedef struct workarea { typedef struct workarea {
int refcnt; int refcnt;
int lock; int lock;
@ -167,7 +156,6 @@ typedef struct workarea {
Global global; Global global;
} WorkArea; } WorkArea;
typedef struct client { typedef struct client {
int fd; int fd;
char host[HostNameLen]; char host[HostNameLen];
@ -178,12 +166,8 @@ typedef struct client {
StdyFile *stdy; StdyFile *stdy;
short version; short version;
u_char def_char[2]; u_char def_char[2];
#if (defined(TLI) && defined(SOCK_UNIX))
int unix_flag;
#endif
uid_t uid; uid_t uid;
struct client *next; struct client *next;
} Client; } Client;
#endif /* _Struct_H_ */ #endif /* SJ3_STRUCT_H_ */