aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-02-20Solve Exercise 7-8: Paged file print-outszlg1-0/+91
2016-11-21Solve Exercise 7-7: Match pattern in fileszlg1-0/+128
This one was tricky, but the solution was rather simple.
2016-11-21Remove unneeded function declaration in 7-06zlg1-1/+0
2016-11-17Solve Exercise 7-6: simple `diff` utilityzlg1-0/+81
2016-10-12Actually run astyle on the file...zlg1-23/+23
2016-10-12Solve Exercise 7-5: RPN calculator with scanf()zlg1-0/+114
This exercise was deceptively simple, and ended up simpler than the original! The *scanf series of functions is very useful, but you also have to be careful or you'll run into segfaults.
2016-06-30Solve Exercise 7-4: minscanf()zlg1-0/+70
This one wasn't too bad, either! There's a minor bug in the code, but I'm not sure how to fix it. It *technically* meets muster, though. :P
2016-06-26Solve Exercise 7-3: minprintf()zlg1-0/+75
2016-06-16The massive astyle sweep!zlg66-266/+72
Code style should be consistent now. All future commits will be run through astyle or they will be amended.
2016-06-16Solve Exercise 7-2: Format arbitrary inputzlg1-0/+101
The solution is technically not 100% correct, but good luck figuring out a robust solution inside Category-0 restrictions. Unicode characters like ¬ or ♥ show up as 64-bit hex codes and I couldn't find a way to shorten them. Then again, UTF-8 supports characters up to 8 bytes long. Use it with plain ASCII and it looks only minorly off.
2015-12-191-16 solution code and comment style cleanupzlg2-48/+51
Also of note is the length that the program reports includes the newline character at the end. This has been clarified in a comment. The exercise text does not specify whether to include newlines as part of the length, so it was left alone. Removed the contributor notice, since contributor acknowledgements are centralized.
2015-12-19Change license to GPLv3, add contributing guidezlg6-26/+834
* Improve README tone * Add `astylerc` for use with the astyle package * Add AUTHORS file to acknowledge contributors
2015-12-19Re-solve Exercise 1-16: arbitrarily long maxlineIsa Hassen1-44/+60
A completely rewritten solution which follows the spec given in the book exactly; make the program work for arbitrarily long input lines while modifying `main()` only. I've only changed the name of the macro MAXLINE to BUFFSIZE for clarity - otherwise the code is typed up exactly as found in the book. It demonstrates the use of a buffer without modifying any of the helper functions.
2015-12-08Solve Exercise 7-1: `upper` and `lower`zlg1-0/+52
Two cases, one file. This exercise was a welcome departure from the recent head-scratchers. It made me think about a solution for the pathname issue I realized would crop up, too. I'm roughly 75% done with the book! Maybe by the time I finish it, I'll have a Makefile ready for the project...
2015-12-05Solve Exercise 6-6: A simple `#define` processorzlg2-2/+200
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.
2015-11-20Solve Exercise 6-5: undef()zlg1-0/+107
We're getting close to more useful data structures! Wee!
2015-11-07Solve Exercise 6-4: Highest Word Frequencyzlg1-0/+177
This exercise was good practice to get back into the mindset of programming. It's not a pretty solution, but it works. I may end up coming back to this solution, because I feel like I've missed something that would make this exercise simpler.
2015-08-04Solve Exercise 6-03: Word cross-referencingzlg1-0/+190
2015-03-08Solve Exercise 6-02: Common prefix printingzlg1-0/+239
2015-03-03Solve Exercise 6-01: Enhanced `getword`zlg1-0/+170
This exercise improved my understanding of identifying comments and quotes by focusing on edge cases.
2015-02-20Solve Exercise 5-20: Expanded `dcl`zlg1-0/+215
This marks the end of chapter 5. Admittedly, the solution for 5-20 is terrible, but it does what it's supposed to do. I'm just excited to move onto chapter 6 and start learning structures!
2015-02-20Solve Exercise 5-19: Omit extra parens in `undcl`zlg1-0/+113
2015-01-30Solve Exercise 5-18: error-recovering `dcl`zlg1-0/+172
This exercise was a real pain in the ass. The original use of getch() and ungetch() was inferior to a line-based approach. It really doesn't seem like the way a parser should be built, but it taught me a little about the order of recursion. I'm convinced that a debugger is necessary if you want to build a good parser. This implementation doesn't recurse in a natural way, or even enough to stack data type prefixes. Hopefully by the time I get to 5-20 I'll have enough ideas to implement something that *does* recurse well.
2014-08-03Ensure 1-02's solution compileszlg1-1/+4
I'm preparing for build automation, so everything needs to build
2014-06-15Solve Exercise 5-17: field sortingzlg2-1/+268
2014-05-21Refactor flag handlingzlg3-24/+51
2014-05-20Solve Exercise 5-16: directory-ordered `tail`zlg1-0/+191
2014-04-08Remove line_tolower()zlg1-9/+0
2014-04-08Solve Exercise 5-15: Case-insensitive sortzlg2-1/+179
2014-03-20Solve Exercise 5-14: reverse sortzlg1-0/+152
2013-10-18Solve Exercise 5-13: tailzlg1-0/+106
This exercise was somewhat irritating until I caved and used the code in section 5.6 like the exercise suggested. The solution is not what I think is clean, but given that [mc]*alloc haven't been covered yet, it's probably the best one can muster. Once I used the code in §5.6, the program fell into place. Still, it was a neat exercise.
2013-10-13Solve Exercise 5-12: flexible `detab` and `entab`zlg2-0/+157
2013-09-26Solve Exercise 5-11: `entab` and `detab` remixed!zlg2-0/+137
This one was pretty rough. At first I wanted to include a bunch of error-catching and "smart" stuff. When I took a second look at it and realized `itoa` returns 0 on a string, things became a bit easier. I may have been able to outsource a few things to a function or two, but overall I think it worked out.
2013-09-24Clean up 5-10's printf() callszlg1-4/+0
2013-09-24Solve Exercise 5-10: exprzlg1-0/+107
2013-09-21Solve Exercise 5-9: day of year functions with pointerszlg1-0/+74
This exercise was fun and taught me a bit about initializing arrays and working with pointers.
2013-09-15Solve Exercise 5-8: Checking for errorszlg1-0/+83
2013-09-11Solve Exercise 5-7: Improved readlines()zlg1-0/+106
2013-09-08Solve Exercise 5-6: pointer-based functionszlg1-0/+154
This exercise was not very fun or interesting. While I somewhat enjoyed learning to use pointers, this was a bunch of busywork. It felt like homework, and that's terrible. It's the first exercise I've outright disliked. If you're writing a programming book, *don't* make exercises like this one!
2013-09-03Solve Exercise 5-5: strn{cpy|cat|cmp}zlg1-0/+76
This exercise seemed like it was designed to "pull it all together" with things learned in the previous few pages. Not much new in terms of techniques, but more a test to see how you could blend everything together.
2013-09-02Solve Exercise 5-4: strend()zlg1-0/+37
Detailed answers below the question will only occur now if I cannot explain myself well enough in code and nearby comments. I'm looking to learn how to write better comments so there's less need for prose.
2013-08-29Solve Exercise 5-3: pointer-powered strcat()zlg1-0/+42
2013-08-19Solve Exercise 5-2: getfloat()zlg1-0/+75
2013-08-13Solve Exercise 5-1: fixed getint()zlg2-13/+82
2013-08-08Solve Exercise 4-14: Swap Macrozlg1-0/+30
Thanks to ##c on Freenode for helping me understand what the text didn't clarify.
2013-07-23Correct Exercise 1-22's solutionzlg1-51/+64
Tabs are now handled properly and the instructions are better followed.
2013-07-22Solve Exercise 4-13: Recursive reverse()zlg1-0/+48
2013-07-15Solve Exercise 4-12: Recursive itoa()zlg1-0/+72
2013-07-03Solve Exercise 4-11: getop() without ungetch()zlg1-0/+263
2013-06-27Solve Exercise 4-10: getline()-based calculatorzlg1-0/+276