Path: blob/main/korean/engdic/files/patch-screen.c
16465 views
--- screen.c.orig 1999-09-05 22:48:35.000000000 -04001+++ screen.c 2013-08-30 13:56:48.000000000 -04002@@ -45,6 +45,8 @@34#include <stdio.h>5#include <string.h>6+#include <term.h>7+#include <unistd.h>89#define TERMIOS 11011@@ -53,7 +55,9 @@12#else13#if TERMIOS14#include <termios.h>15+#ifndef TAB316#define TAB3 017+#endif18#include <sys/ioctl.h>19#else20#include <sgtty.h>21@@ -75,6 +79,7 @@22#endif2324#include <setjmp.h>25+#include <stdlib.h>26#include "engdic.h"2728volatile int reading;29@@ -131,8 +136,12 @@30/*extern*/ char PC; /* Pad character */3132int back_scroll;33-char *tgetstr();34-char *tgoto();35+36+void bo_exit(void);37+void flush(void);38+int iread(int, char *, int);39+void so_exit(void);40+void ul_exit(void);4142/*43* Change terminal to "raw mode", or restore to "normal" mode.44@@ -145,8 +154,7 @@45* etc. are NOT disabled.46* It doesn't matter whether an input \n is mapped to \r, or vice versa.47*/48-raw_mode(on)49- int on;50+void raw_mode(int on)51{52#if TERMIO || TERMIOS5354@@ -245,7 +253,7 @@55/*56* Get terminal capabilities via termcap.57*/58-struct size_buf get_term()59+struct size_buf get_term(void)60{61char termbuf[2048];62char *sp;63@@ -260,8 +268,6 @@64#endif65static char sbuf[1024];6667- char *getenv(), *strcpy();68-69struct size_buf sz_buf ;7071/*72@@ -470,12 +476,12 @@73* terminal-specific screen manipulation.74*/7576-int putchr();77+int putchr(int);7879/*80* Initialize terminal81*/82-init()83+void init(void)84{85tputs(sc_init, sc_height, putchr);86}87@@ -483,7 +489,7 @@88/*89* Deinitialize terminal90*/91-deinit()92+void deinit(void)93{94tputs(sc_deinit, sc_height, putchr);95}96@@ -491,7 +497,7 @@97/*98* Home cursor (move to upper left corner of screen).99*/100-home()101+void home(void)102{103tputs(sc_home, 1, putchr);104}105@@ -500,13 +506,13 @@106* Add a blank line (called with cursor at home).107* Should scroll the display down.108*/109-add_line()110+void add_line(void)111{112tputs(sc_addline, sc_height, putchr);113}114115int short_file; /* if file less than a screen */116-lower_left()117+void lower_left(void)118{119if (short_file) {120putchr('\r');121@@ -517,17 +523,9 @@122}123124/*125- * Ring the terminal bell.126- */127-bell()128-{129- putchr('\7');130-}131-132-/*133* Clear the screen.134*/135-clear()136+void clear(void)137{138if (mode_flags & M_SO)139so_exit();140@@ -542,7 +540,7 @@141* Clear from the cursor to the end of the cursor's line.142* {{ This must not move the cursor. }}143*/144-clear_eol()145+void clear_eol(void)146{147if (mode_flags & M_SO)148so_exit();149@@ -556,7 +554,7 @@150/*151* Begin "standout" (bold, underline, or whatever).152*/153-so_enter()154+void so_enter(void)155{156tputs(sc_s_in, 1, putchr);157mode_flags |= M_SO;158@@ -565,7 +563,7 @@159/*160* End "standout".161*/162-so_exit()163+void so_exit(void)164{165tputs(sc_s_out, 1, putchr);166mode_flags &= ~M_SO;167@@ -575,7 +573,7 @@168* Begin "underline" (hopefully real underlining,169* otherwise whatever the terminal provides).170*/171-ul_enter()172+void ul_enter(void)173{174tputs(sc_u_in, 1, putchr);175mode_flags |= M_UL;176@@ -584,7 +582,7 @@177/*178* End "underline".179*/180-ul_exit()181+void ul_exit(void)182{183tputs(sc_u_out, 1, putchr);184mode_flags &= ~M_UL;185@@ -593,7 +591,7 @@186/*187* Begin "bold"188*/189-bo_enter()190+void bo_enter(void)191{192tputs(sc_b_in, 1, putchr);193mode_flags |= M_BO;194@@ -602,7 +600,7 @@195/*196* End "bold".197*/198-bo_exit()199+void bo_exit(void)200{201tputs(sc_b_out, 1, putchr);202mode_flags &= ~M_BO;203@@ -612,7 +610,7 @@204* Erase the character to the left of the cursor205* and move the cursor left.206*/207-backspace()208+void backspace(void)209{210/*211* Try to erase the previous character by overstriking with a space.212@@ -625,28 +623,27 @@213/*214* Output a plain backspace, without erasing the previous char.215*/216-putbs()217+void putbs(void)218{219tputs(sc_backspace, 1, putchr);220}221222-putchr(c)223- int c;224+int putchr(int c)225{226if (ob >= &obuf[sizeof(obuf)])227flush();228*ob++ = c;229+ return (c);230}231232-putstr(s)233- register char *s;234+void putstr(register char *s)235{236while (*s != '\0')237putchr(*s++);238}239240241-flush()242+void flush(void)243{244register int n;245246@@ -676,10 +673,7 @@247return ((unsigned char)c);248}249250-iread(fd, buf, len)251- int fd;252- char *buf;253- int len;254+int iread(int fd, char *buf, int len)255{256register int n;257258259260