mined1.c File Reference

#include "mined.h"
#include <signal.h>
#include <termios.h>
#include <limits.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <varargs.h>

Include dependency graph for mined1.c:

Go to the source code of this file.

Defines

#define UNDEF   _POSIX_VDISABLE

Functions

void FS ()
void VI ()
int WT ()
void XWT ()
void SH ()
LINEproceed (LINE *line, int count)
int bottom_line (FLAG revfl, char *s1, char *s2, char *inbuf, FLAG statfl)
int count_chars (LINE *line)
void move (int new_x, char *new_address, int new_y)
int find_x (LINE *line, char *address)
char * find_address (LINE *line, int x_coord, int *old_x)
int length_of (char *string)
void copy_string (char *to, char *from)
void reset (LINE *head_line, int screen_y)
void set_cursor (int nx, int ny)
void open_device ()
int getchar ()
void display (int x_coord, int y_coord, LINE *line, int count)
int write_char (int fd, char c)
int writeline (int fd, char *text)
void put_line (LINE *line, int offset, FLAG clear_line)
int flush_buffer (int fd)
void bad_write (int fd)
void catch (int sig)
void abort_mined ()
void raw_mode (FLAG state)
void panic (char *message)
char * alloc (int bytes)
void free_space (char *p)
void initialize ()
char * basename (char *path)
void load_file (char *file)
int get_line (int fd, char *buffer)
LINEinstall_line (char *buffer, int length)
void main (int argc, argv)
void RD ()
void I ()
void XT ()

Variables

int errno
int ymax = YMAX
int screenmax = SCREENMAX
void(* key_map [256])()
int nlines
LINEheader
LINEtail
LINEcur_line
LINEtop_line
LINEbot_line
char * cur_text
int last_y
char screen [SCREEN_SIZE]
int x
int y
FLAG modified = FALSE
FLAG stat_visible
FLAG writable
FLAG loading
FLAG quit = FALSE
FLAG rpipe = FALSE
int input_fd = 0
int out_count
char file_name [LINE_LEN]
char text_buffer [MAX_CHARS]
char * enter_string = "\033[H\033[J"
char * pos_string = "\033[%d;%dH"
char * rev_scroll = "\033M"
char * rev_video = "\033[7m"
char * normal_video = "\033[m"
char * blank_line = "\033[K"
FLAG yank_status = NOT_VALID
char yank_file [] = "/tmp/mined.XXXXXX"
long chars_saved
void(*)() escfunc (c)
register long count
char * file
int lines
FLAG writefl
FLAG changed
fmt
int * result
FLAG clearfl
file


Define Documentation

#define UNDEF   _POSIX_VDISABLE
 

Definition at line 1104 of file mined1.c.

Referenced by _new(), printtable(), and raw_mode().


Function Documentation

void abort_mined  ) 
 

Definition at line 1081 of file mined1.c.

References abort(), clear_status, exit(), FALSE, flush, getchar, NIL_PTR, OFF, putchar, quit, raw_mode(), set_cursor(), status_line, and ymax.

Referenced by main().

char* alloc int  bytes  ) 
 

Definition at line 1169 of file mined1.c.

References loading, malloc(), NIL_PTR, p, panic, and TRUE.

void bad_write int  fd  ) 
 

Definition at line 1054 of file mined1.c.

References build_string(), clear_buffer, ENOSPC, errno, error, exit(), NIL_PTR, STD_OUT, and text_buffer.

Referenced by flush_buffer(), and WB().

char* basename char *  path  ) 
 

Definition at line 1280 of file mined1.c.

References basename, NIL_PTR, and ptr.

int bottom_line FLAG  revfl,
char *  s1,
char *  s2,
char *  inbuf,
FLAG  statfl
 

Definition at line 593 of file mined1.c.

References blank_line, CE, clear_status, FALSE, FINE, flush, input, LINE_LEN, NIL_PTR, normal_video, ON, p, rev_video, SE, set_cursor(), SO, stat_visible, string_print, tputs(), TRUE, x, y, and ymax.

void catch int  sig  ) 
 

Definition at line 1070 of file mined1.c.

References quit, signal(), SIGQUIT, and TRUE.

void copy_string char *  to,
char *  from
 

Definition at line 819 of file mined1.c.

Referenced by change(), delete(), get_expression(), insert(), install_line(), load_file(), substitute(), and WT().

int count_chars LINE line  ) 
 

Definition at line 654 of file mined1.c.

References cnt, get_shift, is_tab, SHIFT_SIZE, and tab.

Referenced by delete().

void display int  x_coord,
int  y_coord,
LINE line,
int  count
 

Definition at line 903 of file mined1.c.

References blank_line, CE, FALSE, line_print, loading, proceed(), putchar, set_cursor(), string_print, tail, and tputs().

char* find_address LINE line,
int  x_coord,
int *  old_x
 

Definition at line 775 of file mined1.c.

References get_shift, is_tab, SHIFT_SIZE, and tab.

Referenced by move().

int find_x LINE line,
char *  address
 

Definition at line 755 of file mined1.c.

References get_shift, is_tab, SHIFT_SIZE, and tab.

Referenced by move(), and yank().

int flush_buffer int  fd  ) 
 

Definition at line 1031 of file mined1.c.

References _flush(), bad_write(), clear_buffer, ERRORS, FINE, out_count, printf, screen, STD_OUT, and write.

Referenced by write_char(), WT(), and yank().

void free_space char *  p  ) 
 

Definition at line 1183 of file mined1.c.

References free.

Referenced by delete(), initialize(), insert(), line_delete(), and substitute().

void FS  ) 
 

Definition at line 428 of file mined1.c.

References file_name, fstatus, and L.

int get_line int  fd,
char *  buffer
 

Definition at line 1369 of file mined1.c.

References begin, cur_pos, ERRORS, NIL_PTR, NO_LINE, read, SCREEN_SIZE, and TRUE.

int getchar void   ) 
 

Definition at line 883 of file mined1.c.

References c, FALSE, input_fd, panic, quit, and read.

void I  ) 
 

Definition at line 1519 of file mined1.c.

Referenced by BlinkRow(), FindMove(), and ResetGame().

void initialize void   ) 
 

Definition at line 1260 of file mined1.c.

References FALSE, free_space(), header, line, and tail.

LINE* install_line char *  buffer,
int  length
 

Definition at line 1411 of file mined1.c.

References alloc(), copy_string(), and new_line().

Referenced by line_insert().

int length_of char *  string  ) 
 

Definition at line 803 of file mined1.c.

References count, and NIL_PTR.

Referenced by delete(), DLN(), file_insert(), insert(), panic(), substitute(), and WT().

void load_file char *  file  ) 
 

Definition at line 1305 of file mined1.c.

References access, clear_buffer, close, copy_string(), cur_line, display(), ERRORS, FALSE, flush, fstatus, get_line(), header, L, line, line_insert(), long(), move_to, NIL_PTR, open, reset, status_line, and TRUE.

Referenced by main(), and VI().

void main int  argc,
argv 
 

Definition at line 1424 of file mined1.c.

References abort_mined(), alloc(), clear_status, exit(), FALSE, flush, get_file(), getchar, header, index(), ioctl, isatty, key_map, load_file(), NIL_PTR, ON, open_device(), Line::prev, raw_mode(), screenmax, STD_OUT, string_print, tail, TIOCGWINSZ, tputs(), TRUE, winsize, write, winsize::ws_row, and ymax.

void move int  new_x,
char *  new_address,
int  new_y
 

Definition at line 689 of file mined1.c.

References cur_line, cur_text, find_address(), find_x(), last_y, line, line_print, NIL_PTR, set_cursor(), shift, SHIFT_SIZE, x, XBREAK, and y.

void open_device  ) 
 

Definition at line 873 of file mined1.c.

References input_fd, open, and panic.

Referenced by main().

void panic char *  message  ) 
 

Definition at line 1143 of file mined1.c.

References abort(), build_string(), CL, enter_string, errno, exit(), FALSE, length_of(), loading, OFF, raw_mode(), STD_OUT, text_buffer, tputs(), unlink, write, XT(), and yank_file.

LINE* proceed LINE line,
int  count
 

Definition at line 575 of file mined1.c.

References header, and tail.

Referenced by display(), EF(), find_y(), GOTO(), HO(), and reset().

void put_line LINE line,
int  offset,
FLAG  clear_line
 

Definition at line 967 of file mined1.c.

References blank_line, CE, count, get_shift, is_tab, normal_video, putchar, rev_video, SE, SHIFT_MARK, SHIFT_SIZE, SO, string_print, tab, tputs(), TRUE, and XBREAK.

Referenced by delete(), print(), S(), and uniq_lines().

void raw_mode FLAG  state  ) 
 

Definition at line 1110 of file mined1.c.

References termios::c_cc, termios::c_iflag, termios::c_lflag, ECHO, ECHONL, ICANON, input_fd, IXOFF, IXON, new_tty, OFF, signal(), SIGQUIT, tcgetattr, TCSANOW, tcsetattr, UNDEF, VINTR, VQUIT, and VSUSP.

Referenced by abort_mined(), main(), panic(), SH(), and XT().

void RD  ) 
 

Definition at line 1493 of file mined1.c.

References blank_line, CE, CL, display(), enter_string, last_y, move_to, set_cursor(), string_print, top_line, tputs(), x, y, and ymax.

Referenced by EF(), HO(), and SH().

void reset LINE head_line,
int  screen_y
 

Definition at line 832 of file mined1.c.

References bot_line, cur_line, last_y, line, nlines, proceed(), screenmax, tail, top_line, and y.

void set_cursor int  nx,
int  ny
 

Definition at line 855 of file mined1.c.

References build_string(), CM, pos_string, string_print, text_buffer, tgoto(), and tputs().

void SH  ) 
 

Definition at line 529 of file mined1.c.

References close, error, execl, exit(), flush, fork, getenv(), NIL_PTR, OFF, ON, open, pid, putchar, raw_mode(), RD(), rpipe, set_cursor(), shell, SIG_IGN, SIGINT, signal(), SIGQUIT, status, wait, and ymax.

void VI  ) 
 

Definition at line 437 of file mined1.c.

References ask_save, CL, enter_string, ERRORS, get_file(), initialize(), LINE_LEN, load_file(), modified, new_file, NIL_PTR, string_print, tputs(), and TRUE.

int write_char int  fd,
char  c
 

Definition at line 938 of file mined1.c.

References FINE, flush_buffer(), out_count, screen, and SCREEN_SIZE.

Referenced by writeline(), and yank().

int writeline int  fd,
char *  text
 

Definition at line 951 of file mined1.c.

References ERRORS, FINE, and write_char().

Referenced by WT().

int WT  ) 
 

Definition at line 461 of file mined1.c.

References clear_buffer, close, copy_string(), count, creat, DUMMY, error, ERRORS, FALSE, file_name, FINE, flush_buffer(), fstatus, get_file(), header, L, length_of(), line, LINE_LEN, long(), modified, NIL_PTR, rpipe, status_line, tail, TRUE, writable, and writeline().

Referenced by XWT().

void XT  ) 
 

Definition at line 1526 of file mined1.c.

References ask_save, ERRORS, exit(), flush, modified, OFF, putchar, raw_mode(), set_cursor(), TRUE, unlink, yank_file, and ymax.

Referenced by panic().

void XWT  ) 
 

Definition at line 519 of file mined1.c.

References WT().


Variable Documentation

char* blank_line = "\033[K"
 

Definition at line 1246 of file mined1.c.

Referenced by bottom_line(), display(), PU(), put_line(), RD(), and SU().

LINE* bot_line
 

Definition at line 1220 of file mined1.c.

Referenced by DN(), dummy_line(), EF(), file_insert(), find_y(), forward_scroll(), reset(), and reverse_scroll().

FLAG changed
 

Definition at line 1710 of file mined1.c.

Referenced by adjust(), chkdev(), devwrite(), initvars(), and scribble_region().

long chars_saved
 

Definition at line 1254 of file mined1.c.

Referenced by set_up(), WB(), and yank().

FLAG clearfl
 

Definition at line 1860 of file mined1.c.

register long count
 

Definition at line 1706 of file mined1.c.

Referenced by __flushbuf(), _do_compare(), _do_sub(), _ext_str_cvt(), allocate_itemsets(), asciisize(), atapi_transfer(), bc_divide(), bf_memreq(), check_for_tc(), check_sig(), chkcount(), chkdots(), chkentry(), chkinode(), close_alot(), cons_write(), copylink(), counterror(), countmatch(), decode(), delay(), delete(), descend(), descendtree(), display(), distribute(), div_ext(), dns_tell(), dns_ttl(), do_case(), do_diagnostics(), do_escape(), do_read(), do_sdevio(), do_umap(), do_vread(), do_vwrite(), dp_pkt2user(), egets(), emit(), endofgame(), eth_send(), f_transfer(), fflush(), fgets(), fill(), Find_Deleted_Entry(), find_y(), flush(), freecount(), fxp_readv(), fxp_writev(), get_sector(), getcomm(), getcount(), getwords(), handle_events(), in_transfer(), inflate_table(), inflate_table9(), is_zero(), job_read_query(), job_read_reply(), job_write_query(), job_write_reply(), keyboard(), length_of(), List_len(), log_transfer(), m_match(), m_transfer(), main(), make_bootable(), match(), ne_reset(), onabrt(), p_count(), p_ere_exp(), p_simp_re(), print(), print_shifts(), put(), put_line(), r_transfer(), DotZLib::GZipStream::Read(), read_clock(), regrepeat(), regular(), Remove(), reprint(), rl_readv(), rl_writev(), save_column(), save_reductions(), scan_tree(), scrollb(), Search(), send_tree(), setattr(), sink(), sole_reduction(), sort(), Strcspn(), Timed_Get_Char(), tmpnam(), unmount(), vi(), w_other(), w_transfer(), and WT().

LINE* cur_line
 

Definition at line 1218 of file mined1.c.

Referenced by change(), checkmark(), DCC(), DLN(), DPC(), DPW(), file_insert(), forward_scroll(), LF(), load_file(), MA(), match(), move(), move_next_word(), move_previous_word(), reset(), reverse_scroll(), RT(), S(), and set_up().

char* cur_text
 

Definition at line 1221 of file mined1.c.

Referenced by checkmark(), DCC(), DLN(), DNW(), DPW(), file_insert(), MA(), move(), move_next_word(), move_previous_word(), RT(), S(), search(), and set_up().

char* enter_string = "\033[H\033[J"
 

Definition at line 1241 of file mined1.c.

Referenced by panic(), RD(), and VI().

int errno
 

Definition at line 70 of file rcp.c.

void(*)() escfunc(c)
 

Definition at line 1539 of file mined1.c.

* file
 

Definition at line 1921 of file mined1.c.

char* file
 

Definition at line 1708 of file mined1.c.

char file_name[LINE_LEN]
 

Definition at line 1234 of file mined1.c.

* fmt
 

Definition at line 1750 of file mined1.c.

Referenced by display(), doprint(), format(), and main().

LINE* header
 

Definition at line 1216 of file mined1.c.

int input_fd = 0
 

Definition at line 1232 of file mined1.c.

Referenced by getchar(), open_device(), and raw_mode().

void(* key_map[256])()
 

Initial value:

 {       
    MA, BL, MP, YA, SD, RD, MN, IF, DPC, S, S, DT, LR, S, DNW,LIB,
    DPW, WB, GR, SH, DLN, SU, VI, XWT, XT, PT, EL, ESC, I, GOTO,
                 HIGH, LOW,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, DCC,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
    S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S,
}

Definition at line 1195 of file mined1.c.

Referenced by main().

int last_y
 

Definition at line 1222 of file mined1.c.

Referenced by delete(), DN(), dummy_line(), EF(), LOW(), move(), RD(), reset(), reverse_scroll(), and S().

int lines
 

Definition at line 1709 of file mined1.c.

Referenced by change(), cmd_read(), comm(), cpycol(), doread(), dowrite(), encode(), format(), getsize(), print(), readline(), showtop(), and split().

FLAG loading
 

Definition at line 1229 of file mined1.c.

Referenced by alloc(), display(), and panic().

FLAG modified = FALSE
 

Definition at line 1226 of file mined1.c.

Referenced by delete(), insert(), substitute(), VI(), WT(), and XT().

int nlines
 

Definition at line 1215 of file mined1.c.

char* normal_video = "\033[m"
 

Definition at line 1245 of file mined1.c.

Referenced by bottom_line(), and put_line().

int out_count
 

Definition at line 1233 of file mined1.c.

char* pos_string = "\033[%d;%dH"
 

Definition at line 1242 of file mined1.c.

Referenced by set_cursor().

FLAG quit = FALSE
 

Definition at line 1230 of file mined1.c.

int* result
 

Definition at line 1795 of file mined1.c.

Referenced by alphabeta(), arp_getdata(), arp_ioctl(), arp_main(), arp_putdata(), authenticate(), casematch(), cidr2a(), cidr_ntoa(), cif4(), cif8(), clock_task(), close1(), cmd_at(), con_loadfont(), cons_write(), crypt(), cuf4(), dev_ioctl(), div_ext(), do_devctl(), do_diagnostics(), do_eth_read(), do_fkey_ctl(), do_option(), do_segctl(), doit(), dos_write(), el3_read_eeprom(), eth_ioctl(), evalbackcmd(), ftell(), DotZLib::CircularBuffer::Get(), get_eth_data(), get_ipconf(), getfp(), getoct(), icmp_getdata(), icmp_main(), icmp_putdata(), icmp_read(), icmp_write(), ip_cancel(), ip_checkopt(), ip_init(), ip_ioctl(), ip_packet2user(), ipeth_main(), ipps_get(), ipps_init(), ipps_send(), ipr_destunrch(), ipr_gateway_down(), ipr_mtu(), ipr_redirect(), ipr_ttl_exc(), kbd_loadmap(), ListHosts(), lock_notify(), lock_send(), main(), mlabel(), mul_ext(), netfinger(), packet2user(), process_opt(), process_req_q(), promisc_restart_read(), psip_cancel(), psip_ioctl(), psip_read(), psip_send(), push_constant(), put_eth_data(), rcmd(), DotZLib::GZipStream::Read(), read_id(), read_ip_packets(), rename_file(), rename_oldsyntax(), reply_thr_get(), reply_thr_put(), restart_write_fd(), sb_termtype(), set_hostaddr(), set_mtu(), set_netmask(), setfiletime(), setup_read(), setup_write(), slash(), sr_cancel(), sr_get_userdata(), sr_put_userdata(), sr_rec(), sr_repl_queue(), sr_reply_(), sr_status(), strrchr(), strtime(), sys_call(), sys_endksig(), sys_getksig(), sys_in(), sys_int86(), sys_sdevio(), sys_sigreturn(), sys_sigsend(), sys_task(), sys_umap(), sys_vm_map(), sys_vm_setbuf(), tcp_bytesavailable(), tcp_connect(), tcp_fd_read(), tcp_get_data(), tcp_ioctl(), tcp_main(), tcp_put_data(), test_read(), udp_conf(), udp_get_data(), udp_ioctl(), udp_main(), udp_packet2user(), udp_peek(), udp_put_data(), udp_rd_enqueue(), udp_sel_read(), gzfilebuf::underflow(), vfat_lookup(), walk_queue(), was_blk_special(), will_option(), DotZLib::GZipStream::Write(), writeall(), and DotZLib::GZipStream::WriteByte().

char* rev_scroll = "\033M"
 

Definition at line 1243 of file mined1.c.

Referenced by reverse_scroll().

char* rev_video = "\033[7m"
 

Definition at line 1244 of file mined1.c.

Referenced by bottom_line(), and put_line().

FLAG rpipe = FALSE
 

Definition at line 1231 of file mined1.c.

char screen[SCREEN_SIZE]
 

Definition at line 1223 of file mined1.c.

int screenmax = SCREENMAX
 

Definition at line 422 of file mined1.c.

Referenced by change(), dummy_line(), EF(), file_insert(), find_y(), HO(), main(), PD(), PU(), reset(), reverse_scroll(), S(), and SU().

FLAG stat_visible
 

Definition at line 1227 of file mined1.c.

Referenced by bottom_line().

LINE* tail
 

Definition at line 1217 of file mined1.c.

char text_buffer[MAX_CHARS]
 

Definition at line 1235 of file mined1.c.

Referenced by bad_write(), delete(), insert(), panic(), set_cursor(), substitute(), and WB().

LINE* top_line
 

Definition at line 1219 of file mined1.c.

Referenced by delete(), file_insert(), find_y(), forward_scroll(), HO(), RD(), reset(), reverse_scroll(), S(), and SU().

FLAG writable
 

Definition at line 1228 of file mined1.c.

FLAG writefl
 

Definition at line 1710 of file mined1.c.

int x
 

Definition at line 1225 of file mined1.c.

int y
 

Definition at line 1225 of file mined1.c.

Referenced by Arith(), ask(), Assign(), BL(), bottom_line(), change(), Cond(), d_fgoloff(), delete(), DN(), EL(), f(), file_insert(), LF(), LIB(), main(), Mathfun(), move(), move_next_word(), PD(), PU(), RD(), reset(), RT(), S(), SD(), sinh_cosh(), sinus(), SU(), tan(), touchwin(), UP(), upd_curs(), update(), user_interface(), v_popup(), waddch(), wclrtobot(), wclrtoeol(), wdelch(), wdeleteln(), werase(), winsch(), and winsertln().

char yank_file[] = "/tmp/mined.XXXXXX"
 

Definition at line 1253 of file mined1.c.

Referenced by panic(), scratch_file(), and XT().

FLAG yank_status = NOT_VALID
 

Definition at line 1252 of file mined1.c.

Referenced by scratch_file(), set_up(), and yank().

int ymax = YMAX
 

Definition at line 421 of file mined1.c.

Referenced by abort_mined(), bottom_line(), change(), forward_scroll(), main(), PU(), RD(), search(), SH(), SU(), and XT().


Generated on Fri Apr 14 23:05:31 2006 for minix by  doxygen 1.4.6