aboutsummaryrefslogtreecommitdiff
path: root/ch6/6-05_undef.c
diff options
context:
space:
mode:
authorzlg <zlg@zlg.space>2015-12-05 21:46:57 -0800
committerzlg <zlg@zlg.space>2015-12-05 21:46:57 -0800
commit45b8159cc39792ddc4e989b11036f026d49f33e7 (patch)
tree08efc8f468ff8c3461fc32735b7d4423c9def272 /ch6/6-05_undef.c
parentSolve Exercise 6-5: undef() (diff)
downloadknr-45b8159cc39792ddc4e989b11036f026d49f33e7.tar.gz
knr-45b8159cc39792ddc4e989b11036f026d49f33e7.tar.bz2
knr-45b8159cc39792ddc4e989b11036f026d49f33e7.tar.xz
knr-45b8159cc39792ddc4e989b11036f026d49f33e7.zip
Solve Exercise 6-6: A simple `#define` processor
This exercise is probably the most challenging "function puzzle" thus far. Modifying getword(), using various states, and the hashtable all create an example of how small building blocks can work together to make something. The implementation is very simple and nowhere near completely supporting '#define', but that's not the point. To properly support it, you'd need to build an entire preprocessor/parser, and that's far beyond the scope of both the exercise and book.
Diffstat (limited to 'ch6/6-05_undef.c')
-rw-r--r--ch6/6-05_undef.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ch6/6-05_undef.c b/ch6/6-05_undef.c
index 9ffd248..d65f435 100644
--- a/ch6/6-05_undef.c
+++ b/ch6/6-05_undef.c
@@ -5,7 +5,7 @@
/* The C Programming Language: 2nd Edition
*
* Exercise 6-5: Write a function `undef` that will remove a name and
- * definition from the table maintai\ed by lookup() and install().
+ * definition from the table maintained by lookup() and install().
*
* Notes: since undef() operates on the same data structure as lookup()
* and install(), I chose to depend on lookup() to find the correct node
@@ -27,7 +27,6 @@ unsigned hash(char *);
struct nlist *install(char *, char *);
struct nlist *lookup(char *);
int undef(char *);
-void print_table(struct nlist *);
int main(int argc, char **argv) {
/* Install a few words */