#include <sys/types.h>#include <signal.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h>#include <stdio.h>#include <setjmp.h>Include dependency graph for ed.c:

Go to the source code of this file.
Data Structures | |
| struct | token |
| struct | line |
| struct | tbl |
Defines | |
| #define | NUL 0x00 |
| #define | EOS 0x00 |
| #define | SOH 0x01 |
| #define | STX 0x02 |
| #define | ETX 0x03 |
| #define | EOT 0x04 |
| #define | ENQ 0x05 |
| #define | ACK 0x06 |
| #define | BEL 0x07 |
| #define | BS 0x08 |
| #define | HT 0x09 |
| #define | LF 0x0a |
| #define | NL '\n' |
| #define | VT 0x0b |
| #define | FF 0x0c |
| #define | CR 0x0d |
| #define | SO 0x0e |
| #define | SI 0x0f |
| #define | DLE 0x10 |
| #define | DC1 0x11 |
| #define | DC2 0x12 |
| #define | DC3 0x13 |
| #define | DC4 0x14 |
| #define | NAK 0x15 |
| #define | SYN 0x16 |
| #define | ETB 0x17 |
| #define | CAN 0x18 |
| #define | EM 0x19 |
| #define | SUB 0x1a |
| #define | ESC 0x1b |
| #define | FS 0x1c |
| #define | GS 0x1d |
| #define | RS 0x1e |
| #define | US 0x1f |
| #define | SP 0x20 |
| #define | DEL 0x7f |
| #define | TRUE 1 |
| #define | FALSE 0 |
| #define | ERR -2 |
| #define | BOL '^' |
| #define | EOL '$' |
| #define | ANY '.' |
| #define | LITCHAR 'L' |
| #define | ESCAPE '\\' |
| #define | CCL '[' |
| #define | CCLEND ']' |
| #define | NEGATE '^' |
| #define | NCCL '!' |
| #define | CLOSURE '*' |
| #define | OR_SYM '|' |
| #define | DITTO '&' |
| #define | OPEN '(' |
| #define | CLOSE ')' |
| #define | CLS_SIZE 128 |
| #define | TOKSIZE sizeof (TOKEN) |
| #define | MAXSTR 132 |
| #define | max(a, b) ((a>b)?a:b) |
| #define | min(a, b) ((a<b)?a:b) |
| #define | toupper(c) (c>='a'&&c<='z'?c-32:c) |
| #define | FATAL (ERR-1) |
| #define | LINFREE 1 |
| #define | LGLOB 2 |
| #define | MAXLINE (sizeof(int) == 2 ? 256 : 8192) |
| #define | MAXPAT 256 |
| #define | MAXFNAME (sizeof(int) == 2 ? 256 : 1024) |
| #define | nextln(l) ((l)+1 > lastln ? 0 : (l)+1) |
| #define | prevln(l) ((l)-1 < 0 ? lastln : (l)-1) |
| #define | FIRST 1 |
| #define | NOTFIRST 0 |
| #define | SHELL "/bin/sh" |
| #define | SHELL2 "/usr/bin/sh" |
Typedefs | |
| typedef char | BITMAP |
| typedef token | TOKEN |
| typedef line | LINE |
Functions | |
| _PROTOTYPE (int main,(int argc, char **argv)) | |
| _PROTOTYPE (static char *match,(char *lin, TOKEN *pat, char *boln)) | |
| _PROTOTYPE (char *amatch,(char *lin, TOKEN *pat, char *boln)) | |
| _PROTOTYPE (int append,(int line, int glob)) | |
| _PROTOTYPE (BITMAP *makebitmap,(unsigned size)) | |
| _PROTOTYPE (int setbit,(unsigned c, char *map, unsigned val)) | |
| _PROTOTYPE (int testbit,(unsigned c, char *map)) | |
| _PROTOTYPE (char *catsub,(char *from, char *to, char *sub, char *new, char *newend)) | |
| _PROTOTYPE (int ckglob,(void)) | |
| _PROTOTYPE (int deflt,(int def1, int def2)) | |
| _PROTOTYPE (int del,(int from, int to)) | |
| _PROTOTYPE (int docmd,(int glob)) | |
| _PROTOTYPE (int dolst,(int line1, int line2)) | |
| _PROTOTYPE (char *dodash,(int delim, char *src, char *map)) | |
| _PROTOTYPE (void prntln,(char *str, int vflg, int lin)) | |
| _PROTOTYPE (void putcntl,(int c, FILE *stream)) | |
| _PROTOTYPE (int doread,(int lin, char *fname)) | |
| _PROTOTYPE (int dowrite,(int from, int to, char *fname, int apflg)) | |
| _PROTOTYPE (void intr,(int sig)) | |
| _PROTOTYPE (int egets,(char *str, int size, FILE *stream)) | |
| _PROTOTYPE (int esc,(char **s)) | |
| _PROTOTYPE (int find,(TOKEN *pat, int dir)) | |
| _PROTOTYPE (char *getfn,(void)) | |
| _PROTOTYPE (int getnum,(int first)) | |
| _PROTOTYPE (TOKEN *getpat,(char *arg)) | |
| _PROTOTYPE (LINE *getptr,(int num)) | |
| _PROTOTYPE (int getrhs,(char *sub)) | |
| _PROTOTYPE (char *gettxt,(int num)) | |
| _PROTOTYPE (int ins,(char *str)) | |
| _PROTOTYPE (int System,(char *c)) | |
| _PROTOTYPE (int join,(int first, int last)) | |
| _PROTOTYPE (TOKEN *makepat,(char *arg, int delim)) | |
| _PROTOTYPE (char *maksub,(char *sub, int subsz)) | |
| _PROTOTYPE (char *matchs,(char *line, TOKEN *pat, int ret_endp)) | |
| _PROTOTYPE (int move,(int num)) | |
| _PROTOTYPE (int omatch,(char **linp, TOKEN *pat, char *boln)) | |
| _PROTOTYPE (TOKEN *optpat,(void)) | |
| _PROTOTYPE (void relink,(LINE *a, LINE *x, LINE *y, LINE *b)) | |
| _PROTOTYPE (void clrbuf,(void)) | |
| _PROTOTYPE (int subst,(TOKEN *pat, char *sub, int gflg, int pflag)) | |
| _PROTOTYPE (void unmakepat,(TOKEN *head)) | |
| char * | amatch (char *lin, TOKEN *pat, char *boln) |
| static char * | match (char *lin, TOKEN *pat, char *boln) |
| int | append (int line, int glob) |
| BITMAP * | makebitmap (unsigned size) |
| int | setbit (unsigned c, char *map, unsigned val) |
| int | testbit (unsigned c, char *map) |
| char * | catsub (char *from, char *to, char *sub, char *new, char *newend) |
| int | ckglob () |
| int | deflt (int def1, int def2) |
| int | del (int from, int to) |
| int | docmd (int glob) |
| int | dolst (int line1, int line2) |
| char * | dodash (int delim, char *src, char *map) |
| int | doglob () |
| int | doprnt (int from, int to) |
| void | prntln (char *str, int vflg, int lin) |
| void | putcntl (char c, FILE *stream) |
| int | doread (int lin, char *fname) |
| int | dowrite (int from, int to, char *fname, int apflg) |
| void | intr (int sig) |
| int | main (int argc, char **argv) |
| int | egets (char *str, int size, FILE *stream) |
| int | esc (char **s) |
| int | find (TOKEN *pat, int dir) |
| char * | getfn () |
| int | getlst () |
| int | getnum (int first) |
| int | getone () |
| TOKEN * | getpat (char *arg) |
| LINE * | getptr (int num) |
| int | getrhs (char *sub) |
| char * | gettxt (int num) |
| int | ins (char *str) |
| int | join (int first, int last) |
| TOKEN * | makepat (char *arg, int delim) |
| char * | maksub (char *sub, int subsz) |
| char * | matchs (char *line, TOKEN *pat, int ret_endp) |
| int | move (int num) |
| int | transfer (int num) |
| int | omatch (char **linp, TOKEN *pat, char *boln) |
| TOKEN * | optpat () |
| int | set () |
| int | show () |
| void | relink (LINE *a, LINE *x, LINE *y, LINE *b) |
| void | clrbuf () |
| void | set_buf () |
| int | subst (TOKEN *pat, char *sub, int gflg, int pflag) |
| int | System (char *c) |
| void | unmakepat (TOKEN *head) |
Variables | |
| LINE | line0 |
| int | curln |
| int | lastln |
| int | line1 |
| int | line2 |
| int | nlines |
| int | nflg |
| int | lflg |
| char * | inptr |
| char | linbuf [] |
| char * | linptr |
| int | truncflg |
| int | eightbit |
| int | nonascii |
| int | nullchar |
| int | truncated |
| int | fchanged |
| char * | paropen [9] |
| char * | parclose [9] |
| int | between |
| int | parnum |
| char * | paropen [9] |
| char * | parclose [9] |
| char | fname [MAXFNAME] |
| int | fchanged |
| int | nofname |
| int | mark [] |
| int | diag |
| jmp_buf | env |
| LINE | line0 |
| int | curln = 0 |
| int | lastln = 0 |
| char * | inptr |
| static char | inlin [MAXLINE] |
| int | nflg |
| int | lflg |
| int | line1 |
| int | line2 |
| int | nlines |
| int | version = 1 |
| int | diag = 1 |
| int | eightbit = 1 |
| int | nonascii |
| int | nullchar |
| int | truncated |
| char | fname [MAXFNAME] |
| int | nofname |
| int | fchanged |
| TOKEN * | oldpat |
| tbl * | t |
|
|
Definition at line 52 of file ed.c. Referenced by ack_emit_init(), ack_emit_instruction(), wcrx(), and wcrxpn(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 71 of file ed.c. Referenced by getnak(), wctx(), zdlread(), zgethdr(), and zsendfdata(). |
|
|
Definition at line 100 of file ed.c. Referenced by advance(), makepat(), omatch(), and unmakepat(). |
|
|
Definition at line 101 of file ed.c. Referenced by makepat(). |
|
|
|
|
|
|
|
|
Definition at line 113 of file ed.c. Referenced by makepat(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 103 of file ed.c. Referenced by makepat(), omatch(), and unmakepat(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1408 of file ed.c. Referenced by getone(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2154 of file ed.c. Referenced by System(). |
|
|
|
|
|
Definition at line 61 of file ed.c. Referenced by bottom_line(), ini_terminal(), put_line(), and starttcap(). |
|
|
Definition at line 47 of file ed.c. Referenced by wcputsec(). |
|
|
|
|
|
Definition at line 48 of file ed.c. Referenced by wcgetsec(), and wcputsec(). |
|
|
|
|
|
|
|
|
Definition at line 127 of file ed.c. Referenced by makepat(). |
|
|
|
|
|
|
|
|
Definition at line 78 of file ed.c. Referenced by ini_terminal(), and starttcap(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 248 of file ed.c. References match. |
|
||||||||||||
|
Definition at line 361 of file ed.c. References curln, EOF, ERR, fgets(), ins(), MAXLINE, nflg, NULL, printf, and stdin. |
|
||||||||||||||||||||||||
|
Definition at line 461 of file ed.c. References cp, DITTO, and EOS. Referenced by subst(). |
|
|
Definition at line 496 of file ed.c. References c, deflt(), delim, ERR, getptr(), if(), inptr, lastln, LGLOB, LINE, line1, line2, matchs(), MAXLINE, num(), optpat(), ptr, strcat(), and strcpy(). |
|
|
Definition at line 2088 of file ed.c. Referenced by docmd(). |
|
||||||||||||
|
Definition at line 539 of file ed.c. |
|
||||||||||||
|
Definition at line 555 of file ed.c. References curln, first, free, getptr(), lastln, LINE, line0, next, nextln, prevln, relink(), and tmp. |
|
|
Definition at line 586 of file ed.c. References append(), c, clrbuf(), curln, deflt(), del(), dolst(), doprnt(), doread(), dowrite(), EOF, ERR, err, FALSE, fptr, getfn(), getone(), getrhs(), gflag, HT, inptr, join(), lastln, line1, line2, MAXPAT, move, nextln, NL, nlines, NULL, optpat(), pflag, prevln, printf, set(), SP, strcpy(), subst, transfer(), and TRUE. Referenced by doglob(). |
|
||||||||||||||||
|
Definition at line 834 of file ed.c. References esc, first, setbit, and start. Referenced by makepat(). |
|
|
Definition at line 873 of file ed.c. References curln, docmd(), getlst(), getptr(), inptr, lastln, LGLOB, LINE, and ptr. |
|
||||||||||||
|
Definition at line 806 of file ed.c. References doprnt(), lflg, and p. Referenced by docmd(). |
|
||||||||||||
|
Definition at line 903 of file ed.c. References curln, getptr(), i, lastln, lflg, LINE, nflg, and prntln(). |
|
||||||||||||
|
Definition at line 970 of file ed.c. References bytes, curln, egets(), ERR, err, fopen(), fp, ins(), lines, MAXLINE, nonascii, NULL, nullchar, printf, strlen(), and truncated. |
|
||||||||||||||||||||
|
Definition at line 1015 of file ed.c. References bytes, EOF, ERR, err, fopen(), fp, fputs(), getptr(), LINE, lines, NULL, printf, and strlen(). Referenced by docmd(). |
|
||||||||||||||||
|
Definition at line 1171 of file ed.c. References c, count, cp, EOF, EOS, getc, and printf. Referenced by doread(). |
|
|
|
|
||||||||||||
|
Definition at line 1254 of file ed.c. References curln, getptr(), i, lastln, LINE, MAXLINE, nextln, num(), prevln, and ptr. |
|
|
Definition at line 1290 of file ed.c. References cp, FALSE, HT, inptr, NL, NULL, printf, SP, strcpy(), strlen(), and TRUE. Referenced by docmd(). |
|
|
Definition at line 1326 of file ed.c. References curln, getone(), inptr, line1, line2, nlines, and num(). Referenced by doglob(). |
|
|
|
|
|
Definition at line 1410 of file ed.c. References c, ERR, FIRST, HT, i, inptr, lastln, NOTFIRST, and SP. |
|
|
Definition at line 1439 of file ed.c. References makepat(). |
|
|
Definition at line 1452 of file ed.c. References j, lastln, LINE, line0, and ptr. Referenced by ckglob(), del(), doglob(), doprnt(), dowrite(), find(), gettxt(), ins(), and move(). |
|
|
Definition at line 1473 of file ed.c. References ERR, HT, inptr, maksub(), MAXPAT, NL, NULL, and SP. Referenced by docmd(). |
|
|
Definition at line 1496 of file ed.c. References getptr(), LINE, MAXLINE, strcat(), and strcpy(). Referenced by join(), subst(), and transfer(). |
|
|
Definition at line 1513 of file ed.c. References cp, EOS, ERR, getptr(), lastln, LINE, malloc(), MAXLINE, NL, NULL, relink(), strcpy(), and strlen(). Referenced by append(), doread(), main(), and transfer(). |
|
|
|
|
||||||||||||
|
Definition at line 1552 of file ed.c. References cp, ERR, gettxt(), lastln, MAXLINE, NL, printf, and str. Referenced by docmd(). |
|
||||||||||||
|
Definition at line 1092 of file ed.c. References doread(), i, isatty, set_buf(), strcmp, and strcpy(). |
|
|
|
|
||||||||||||
|
Definition at line 1604 of file ed.c. References ANY, token::bitmap, BOL, CCL, CCLEND, CLOSE, CLOSURE, CLS_SIZE, dodash(), EOL, error, esc, ESCAPE, fprintf(), head, token::lchar, LITCHAR, malloc(), NCCL, NEGATE, next, Line::next, token::next, NULL, OPEN, stderr, tail, token::tok, TOKSIZE, and unmakepat(). Referenced by getpat(). |
|
||||||||||||
|
Definition at line 1731 of file ed.c. References cp, delim, DITTO, inptr, NL, and size. Referenced by getrhs(). |
|
||||||||||||||||
|
Definition at line 267 of file ed.c. References CLOSE, CLOSURE, match, max, token::next, omatch(), OPEN, and token::tok. |
|
||||||||||||||||
|
Definition at line 1817 of file ed.c. References amatch(), BOL, c, line2, LITCHAR, ok(), pat2, and token::tok. Referenced by ckglob(). |
|
|
Definition at line 1886 of file ed.c. References curln, ERR, getptr(), lastln, LINE, line1, line2, nextln, prevln, and relink(). |
|
||||||||||||||||
|
Definition at line 1952 of file ed.c. References advance(), ANY, token::bitmap, BOL, CCL, EOL, token::lchar, LITCHAR, NCCL, testbit(), and token::tok. Referenced by match(). |
|
|
Definition at line 2002 of file ed.c. References cp, delim, EOS, ESCAPE, getpat(), MAXPAT, NL, oldpat, and unmakepat(). |
|
||||||||||||||||
|
Definition at line 923 of file ed.c. References DEL, NL, printf, putc, putcntl(), and stdout. Referenced by doprnt(). |
|
||||||||||||
|
Definition at line 955 of file ed.c. References putc. Referenced by prntln(). |
|
||||||||||||||||||||
|
|
|
|
Definition at line 2040 of file ed.c. References EOS, ERR, HT, i, NL, show(), SP, strcmp, t, tbl::t_ptr, tbl::t_str, and tbl::t_val. Referenced by catch4(), docmd(), dump_fdset(), evalvar(), sigreturn(), test37e(), test37f(), test37g(), test37h(), test37i(), test37j(), test7d(), test7e(), test7f(), test7g(), test7h(), test7i(), and test7j(). |
|
|
Definition at line 2093 of file ed.c. References curln, lastln, line0, and relink(). Referenced by main(). |
|
||||||||||||||||
|
|
|
|
|
|
||||||||||||||||||||
|
Definition at line 2104 of file ed.c. References amatch(), catsub(), ERR, gettxt(), line1, line2, m, MAXLINE, and txt. |
|
|
Definition at line 2156 of file ed.c. References execl, exit(), fork, pid, SHELL, SHELL2, status, and wait. |
|
||||||||||||
|
Definition at line 441 of file ed.c. Referenced by omatch(). |
|
|
Definition at line 1915 of file ed.c. References curln, ERR, gettxt(), ins(), line1, and line2. Referenced by docmd(). |
|
|
Definition at line 2178 of file ed.c. References CCL, free, NCCL, and token::next. |
|
|
|
|
|
Definition at line 1075 of file ed.c. Referenced by append(), del(), docmd(), doglob(), doprnt(), doread(), find(), getlst(), move(), set_buf(), and transfer(). |
|
|
Definition at line 1075 of file ed.c. Referenced by append(), del(), docmd(), doglob(), doprnt(), doread(), find(), getlst(), move(), set_buf(), and transfer(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 580 of file ed.c. Referenced by chk_dir(), cmdcomp(), cnvtfile(), efun(), iwritfile(), main(), netfinger(), openredirect(), recvfile(), sendfile(), set_profile(), and tar(). |
|
|
|
|
|
Definition at line 1077 of file ed.c. Referenced by ckglob(), docmd(), doglob(), getfn(), getlst(), getnum(), getone(), getrhs(), maksub(), and sbx_aout(). |
|
|
Definition at line 1077 of file ed.c. Referenced by ckglob(), docmd(), doglob(), getfn(), getlst(), getnum(), getone(), getrhs(), maksub(), and sbx_aout(). |
|
|
Definition at line 1076 of file ed.c. Referenced by ckglob(), clrbuf(), del(), docmd(), doglob(), doprnt(), find(), getone(), getptr(), ins(), join(), move(), and set_buf(). |
|
|
Definition at line 1076 of file ed.c. Referenced by ckglob(), clrbuf(), del(), docmd(), doglob(), doprnt(), find(), getone(), getptr(), ins(), join(), move(), and set_buf(). |
|
|
|
|
|
|
|
|
Definition at line 221 of file rz.c. Referenced by askerr(), dbg_diag(), and vfy_exer(). |
|
|
|
|
|
|
|
|
Definition at line 1080 of file ed.c. Referenced by ckglob(), cmp_fields(), deflt(), docmd(), getlst(), move(), subst(), and transfer(). |
|
|
Definition at line 1080 of file ed.c. Referenced by ckglob(), cmp_fields(), deflt(), docmd(), getlst(), move(), subst(), and transfer(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1170 of file ed.c. Referenced by doread(). |
|
|
Definition at line 1170 of file ed.c. Referenced by doread(). |
|
|
Definition at line 1999 of file ed.c. Referenced by optpat(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1170 of file ed.c. Referenced by command(), doread(), getline(), and res_send(). |
|
|
Definition at line 1170 of file ed.c. Referenced by command(), doread(), getline(), and res_send(). |
|
|
|
|
|
|
1.4.6