Convert K&R definitions to ANSI C

This commit is contained in:
Nishi 2026-06-18 14:01:01 +09:00
commit a2161ba1b0
45 changed files with 521 additions and 1073 deletions

View file

@ -45,8 +45,8 @@ int status_line;
char * CM, *US, *UE, *SO, *SE, *CE, *CS, *BEL, *RP, *AP, *TS, *FS, *DS, *I2;
char * SC, *RC, *SR, *DO;
static int keyboard = OTHER_KB;
checkterm() {
int checkterm(void)
{
char * kb, *area, *tgetstr(), *tmp;
int val;
Conversion* cv;
@ -142,8 +142,7 @@ checkterm() {
strcpy(cmove, CM);
}
void outc(c) char c;
void outc(char c)
{
putchar(c);
}
@ -151,32 +150,31 @@ void outc(c) char c;
void erroutc(c) {
fputc(c, stderr);
}
start_guideline() {
int start_guideline(void)
{
if(status_line && I2)
tputs(I2, 1, erroutc);
}
end_guideline() {
int end_guideline(void)
{
if(status_line) {
tputs(DS, 1, outc);
fflush(stdout);
}
}
put_space(n) int n;
int put_space(int n)
{
int i;
for(i = 0; i < n; i++)
putchar(' ');
}
Backspace() {
int Backspace(void)
{
putchar(BS);
}
master_flush() {
int master_flush(void)
{
SELECT_FD ifds;
int nc;
struct timeval t;
@ -203,8 +201,8 @@ master_flush() {
} while(nc > 0);
return (0);
}
ThroughIntr() {
int ThroughIntr(void)
{
wchar16_t s[2];
SJ_read(s, 1);
@ -217,35 +215,33 @@ ThroughIntr() {
return (0);
}
}
under_in() {
int under_in(void)
{
tputs(US, 1, outc);
}
under_out() {
int under_out(void)
{
tputs(UE, 1, outc);
}
reverse_in() {
int reverse_in(void)
{
tputs(SO, 1, outc);
}
reverse_out() {
int reverse_out(void)
{
tputs(SE, 1, outc);
}
beep() {
int beep(void)
{
tputs(BEL, 1, outc);
Flush();
}
CursorSet(row, col) unsigned short row, col;
int CursorSet(unsigned short row, unsigned short col)
{
tputs(tgoto(CM, col - 1, row - 1), 1, outc);
Flush();
}
RegionSet(row1, row2) int row1, row2;
int RegionSet(int row1, int row2)
{
tputs(SC, 1, outc);
@ -264,8 +260,7 @@ RegionSet(row1, row2) int row1, row2;
#define CRLIMIT 4
int master_flush_flag = 1;
CursorRead(row, col) unsigned short* row, *col;
int CursorRead(unsigned short * row, unsigned short * col)
{
int count;
@ -298,9 +293,7 @@ CursorRead(row, col) unsigned short* row, *col;
#define BACKLIM 16
#define MARKER '%'
#define SEPARA ';'
CRP(row, col)
int *row, *col;
int CRP(int * row, int * col)
{
char * sa, *sd;
int c;
@ -364,10 +357,7 @@ top:
return (SUCC);
}
unget_inkey2(s, n)
wchar16_t* s;
int n;
int unget_inkey2(wchar16_t * s, int n)
{
extern wchar16_t ibuf[];
extern int buf_count;
@ -378,28 +368,26 @@ int n;
ibuf[buf_count++] = *(s++);
}
}
unget_key(c) int c;
int unget_key(int c)
{
wchar16_t tmp[2];
tmp[0] = c;
unget_inkey2(tmp, 1);
}
CRI() {
int CRI(void)
{
wchar16_t c;
SJ_read(&c, 1);
return (c);
}
Clear_EOL() {
int Clear_EOL(void)
{
reverse_out();
tputs(CE, 1, outc);
}
StartGuide(row, col) unsigned short* row, *col;
int StartGuide(unsigned short * row, unsigned short * col)
{
Conversion* cv;
@ -413,8 +401,7 @@ StartGuide(row, col) unsigned short* row, *col;
}
Flush();
}
EndGuide(row, col) unsigned short row, col;
int EndGuide(unsigned short row, unsigned short col)
{
if(status_line) {
tputs(FS, 1, outc);
@ -424,12 +411,12 @@ EndGuide(row, col) unsigned short row, col;
Flush();
master_flush_flag = 1;
}
Flush() {
int Flush(void)
{
fflush(stdout);
}
Cscroll() {
int Cscroll(void)
{
return (1);
}