Mercurial > hg > toybox
comparison toys/sed.c @ 233:d4176f3f3835
Zap toys/Config.in and instead create generated/Config.in from contents of
toys/*.c. Move relevant info into comment at the top of each toys/*.c. Also
convert more of Makefile into a thin wrapper around shell scripts that actually
do the work. (Makefile is only still there for the user interface.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 19 Jan 2008 17:08:39 -0600 |
parents | 31dc682c18ad |
children | 163498bf547b |
comparison
equal
deleted
inserted
replaced
232:cd4d5630c978 | 233:d4176f3f3835 |
---|---|
1 /* vi: set sw=4 ts=4: */ | 1 /* vi: set sw=4 ts=4: |
2 /* | 2 * |
3 * sed.c - Stream editor. | 3 * sed.c - Stream editor. |
4 * | 4 * |
5 * Copyright 2008 Rob Landley <rob@landley.net> | |
6 * | |
5 * See http://www.opengroup.org/onlinepubs/009695399/utilities/sed.c | 7 * See http://www.opengroup.org/onlinepubs/009695399/utilities/sed.c |
6 */ | 8 |
9 config SED | |
10 bool "sed" | |
11 default n | |
12 help | |
13 usage: sed [-irn] {command | [-e command]...} [FILE...] | |
14 | |
15 Stream EDitor, transforms text by appling commands to each line | |
16 of input. | |
17 */ | |
7 | 18 |
8 #include "toys.h" | 19 #include "toys.h" |
9 #include "lib/xregcomp.h" | 20 #include "lib/xregcomp.h" |
10 | |
11 #define TT toy.sed | |
12 | 21 |
13 struct sed_command { | 22 struct sed_command { |
14 // Doubly linked list of commands. | 23 // Doubly linked list of commands. |
15 struct sed_command *next, *prev; | 24 struct sed_command *next, *prev; |
16 | 25 |
33 | 42 |
34 // Which command letter is this? | 43 // Which command letter is this? |
35 char command; | 44 char command; |
36 }; | 45 }; |
37 | 46 |
47 #define TT toy.sed | |
48 | |
38 void sed_main(void) | 49 void sed_main(void) |
39 { | 50 { |
40 struct arg_list *test; | 51 struct arg_list *test; |
41 | 52 |
42 for (test = TT.commands; test; test = test->next) | 53 for (test = TT.commands; test; test = test->next) |