src/commands/simple/sed.c File Reference

#include <ctype.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  cmd_t
struct  label

Defines

#define MAXBUF   4000
#define MAXAPPENDS   20
#define MAXTAGS   9
#define EQCMD   0x01
#define ACMD   0x02
#define BCMD   0x03
#define CCMD   0x04
#define DCMD   0x05
#define CDCMD   0x06
#define GCMD   0x07
#define CGCMD   0x08
#define HCMD   0x09
#define CHCMD   0x0A
#define ICMD   0x0B
#define LCMD   0x0C
#define NCMD   0x0D
#define CNCMD   0x0E
#define PCMD   0x0F
#define CPCMD   0x10
#define QCMD   0x11
#define RCMD   0x12
#define SCMD   0x13
#define TCMD   0x14
#define CTCMD   0x15
#define WCMD   0x16
#define CWCMD   0x17
#define XCMD   0x18
#define YCMD   0x19
#define BAD   ((char *) -1)
#define STAR   1
#define CCHR   2
#define CDOT   4
#define CCL   6
#define CNL   8
#define CDOL   10
#define CBRA   12
#define CKET   14
#define CBACK   16
#define CLNUM   18
#define CEND   20
#define CEOF   22
#define CMASK   0xFF
#define MAXCMDS   500
#define MAXLINES   256
#define POOLSIZE   20000
#define WFILES   10
#define RELIMIT   256
#define MAXDEPTH   20
#define MAXLABS   50
#define SKIPWS(pc)   while ((*pc==' ') || (*pc=='\t')) pc++
#define ABORT(msg)   (fprintf(stderr, msg, linebuf), quit(2))
#define IFEQ(x, v)   if (*x == v) x++ ,
#define H   0x80
#define LOWCMD   56
#define MAXHOLD   MAXBUF
#define GENSIZ   MAXBUF
#define TRUE   1
#define FALSE   0

Typedefs

typedef struct cmd_t sedcmd

Functions

 _PROTOTYPE (int main,(int argc, char **argv))
 _PROTOTYPE (static void compile,(void))
 _PROTOTYPE (static int cmdcomp,(int cchar))
 _PROTOTYPE (static char *rhscomp,(char *rhsp, int delim))
 _PROTOTYPE (static char *recomp,(char *expbuf, int redelim))
 _PROTOTYPE (static int cmdline,(char *cbuf))
 _PROTOTYPE (static char *address,(char *expbuf))
 _PROTOTYPE (static char *gettext,(char *txp))
 _PROTOTYPE (static label *search,(label *ptr))
 _PROTOTYPE (static char *ycomp,(char *ep, int delim))
 _PROTOTYPE (void quit,(int n))
 _PROTOTYPE (void execute,(void))
 _PROTOTYPE (static int selected,(sedcmd *ipc))
 _PROTOTYPE (static int match,(char *expbuf, int gf))
 _PROTOTYPE (static int advance,(char *lp, char *ep))
 _PROTOTYPE (static void dosub,(char *rhsbuf))
 _PROTOTYPE (static char *place,(char *asp, char *al1, char *al2))
 _PROTOTYPE (static void listto,(char *p1, FILE *fp))
 _PROTOTYPE (static void truncated,(int h))
 _PROTOTYPE (static void command,(sedcmd *ipc))
 _PROTOTYPE (static void openfile,(char *file))
 _PROTOTYPE (static char *getline,(char *buf))
 _PROTOTYPE (static int Memcmp,(char *a, char *b, int count))
int main (int argc, argv)
void quit (int n)
void execute ()

Variables

char linebuf [MAXBUF+1]
sedcmd cmds [MAXCMDS+1]
long linenum [MAXLINES]
int nflag
int eargc
char ** eargv
char bits [] = {1, 2, 4, 8, 16, 32, 64, 128}


Define Documentation

#define ABORT ( msg   )     (fprintf(stderr, msg, linebuf), quit(2))

Definition at line 159 of file sed.c.

#define ACMD   0x02

Definition at line 39 of file sed.c.

#define BAD   ((char *) -1)

Definition at line 83 of file sed.c.

#define BCMD   0x03

Definition at line 40 of file sed.c.

#define CBACK   16

Definition at line 97 of file sed.c.

#define CBRA   12

Definition at line 95 of file sed.c.

#define CCHR   2

Definition at line 89 of file sed.c.

#define CCL   6

Definition at line 92 of file sed.c.

#define CCMD   0x04

Definition at line 41 of file sed.c.

#define CDCMD   0x06

Definition at line 43 of file sed.c.

#define CDOL   10

Definition at line 94 of file sed.c.

#define CDOT   4

Definition at line 91 of file sed.c.

#define CEND   20

Definition at line 99 of file sed.c.

#define CEOF   22

Definition at line 100 of file sed.c.

#define CGCMD   0x08

Definition at line 45 of file sed.c.

#define CHCMD   0x0A

Definition at line 47 of file sed.c.

#define CKET   14

Definition at line 96 of file sed.c.

#define CLNUM   18

Definition at line 98 of file sed.c.

#define CMASK   0xFF

Definition at line 105 of file sed.c.

#define CNCMD   0x0E

Definition at line 51 of file sed.c.

#define CNL   8

Definition at line 93 of file sed.c.

#define CPCMD   0x10

Definition at line 53 of file sed.c.

#define CTCMD   0x15

Definition at line 58 of file sed.c.

#define CWCMD   0x17

Definition at line 60 of file sed.c.

#define DCMD   0x05

Definition at line 42 of file sed.c.

#define EQCMD   0x01

Definition at line 38 of file sed.c.

#define FALSE   0

Definition at line 923 of file sed.c.

#define GCMD   0x07

Definition at line 44 of file sed.c.

#define GENSIZ   MAXBUF

Definition at line 920 of file sed.c.

#define H   0x80

Definition at line 301 of file sed.c.

#define HCMD   0x09

Definition at line 46 of file sed.c.

#define ICMD   0x0B

Definition at line 48 of file sed.c.

#define IFEQ ( x,
 )     if (*x == v) x++ ,

Definition at line 160 of file sed.c.

#define LCMD   0x0C

Definition at line 49 of file sed.c.

#define LOWCMD   56

Definition at line 303 of file sed.c.

#define MAXAPPENDS   20

Definition at line 34 of file sed.c.

#define MAXBUF   4000

Definition at line 33 of file sed.c.

#define MAXCMDS   500

Definition at line 136 of file sed.c.

#define MAXDEPTH   20

Definition at line 155 of file sed.c.

#define MAXHOLD   MAXBUF

Definition at line 919 of file sed.c.

#define MAXLABS   50

Definition at line 156 of file sed.c.

#define MAXLINES   256

Definition at line 137 of file sed.c.

#define MAXTAGS   9

Definition at line 35 of file sed.c.

#define NCMD   0x0D

Definition at line 50 of file sed.c.

#define PCMD   0x0F

Definition at line 52 of file sed.c.

#define POOLSIZE   20000

Definition at line 152 of file sed.c.

#define QCMD   0x11

Definition at line 54 of file sed.c.

#define RCMD   0x12

Definition at line 55 of file sed.c.

#define RELIMIT   256

Definition at line 154 of file sed.c.

#define SCMD   0x13

Definition at line 56 of file sed.c.

#define SKIPWS ( pc   )     while ((*pc==' ') || (*pc=='\t')) pc++

Definition at line 158 of file sed.c.

#define STAR   1

Definition at line 88 of file sed.c.

#define TCMD   0x14

Definition at line 57 of file sed.c.

#define TRUE   1

Definition at line 922 of file sed.c.

#define WCMD   0x16

Definition at line 59 of file sed.c.

#define WFILES   10

Definition at line 153 of file sed.c.

#define XCMD   0x18

Definition at line 61 of file sed.c.

#define YCMD   0x19

Definition at line 62 of file sed.c.


Typedef Documentation

typedef struct cmd_t sedcmd

Definition at line 81 of file sed.c.


Function Documentation

_PROTOTYPE ( static int  Memcmp,
(char *a, char *b, int count)   
)

_PROTOTYPE ( static char *  getline,
(char *buf  
)

_PROTOTYPE ( static void  openfile,
(char *file  
)

_PROTOTYPE ( static void  command,
(sedcmd *ipc)   
)

_PROTOTYPE ( static void  truncated,
(int h)   
)

_PROTOTYPE ( static void  listto,
(char *p1, FILE *fp  
)

_PROTOTYPE ( static char *  place,
(char *asp, char *al1, char *al2)   
)

_PROTOTYPE ( static void  dosub,
(char *rhsbuf)   
)

_PROTOTYPE ( static int  advance,
(char *lp, char *ep  
)

_PROTOTYPE ( static int  match,
(char *expbuf, int gf)   
)

_PROTOTYPE ( static int  selected,
(sedcmd *ipc)   
)

_PROTOTYPE ( void  execute,
(void)   
)

_PROTOTYPE ( void  quit,
(int n  
)

_PROTOTYPE ( static char *  ycomp,
(char *ep, int delim  
)

_PROTOTYPE ( static label search,
(label *ptr)   
)

_PROTOTYPE ( static char *  gettext,
(char *txp)   
)

_PROTOTYPE ( static char *  address,
(char *expbuf)   
)

_PROTOTYPE ( static int  cmdline,
(char *cbuf  
)

_PROTOTYPE ( static char *  recomp,
(char *expbuf, int redelim)   
)

_PROTOTYPE ( static char *  rhscomp,
(char *rhsp, int delim  
)

_PROTOTYPE ( static int  cmdcomp,
(int cchar)   
)

_PROTOTYPE ( static void  compile,
(void)   
)

_PROTOTYPE ( int  main,
(int argc, char **argv)   
)

void execute ( void   ) 

Definition at line 952 of file sed.c.

int main ( int argc  ,
argv   
)

Definition at line 243 of file sed.c.

void quit ( int  n  ) 

Definition at line 875 of file sed.c.


Variable Documentation

char bits[] = {1, 2, 4, 8, 16, 32, 64, 128}

Definition at line 148 of file sed.c.

Definition at line 141 of file sed.c.

int eargc

Definition at line 146 of file sed.c.

char ** eargv

Definition at line 147 of file sed.c.

char linebuf[]

Definition at line 140 of file sed.c.

long linenum[]

Definition at line 142 of file sed.c.

int nflag

Definition at line 145 of file sed.c.


Generated on Tue Mar 9 04:36:42 2010 for Minix by  doxygen 1.5.8