-
Notifications
You must be signed in to change notification settings - Fork 49
Enhance "wc" command #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I'd be happy to code review |
|
The original issue opened for enhancing wc proposes to enhance wc to include flags: This implementation is missing -c, -L and -w flags. In addition, the -l flag now counts lower-case letters and not lines where lines is a very common use case so losing that functionality is an issue. I would also suggest adding a -h flag to print some simple help explaining what each flag does: Adding a test-count program is a really nice touch. It might be helpful if the test program indicated how many tests passed and how many failed but otherwise it's great. I did some manually testing and there's an edge case if you try to run wc on a directory: However, this is how wc works originally so I don't know if it's important to fix. Calling fstat to determine file type (T_DIR) would allow you to exclude directories. A second issue is that pipes no longer work. Here's how the original FogOS looks: And with the current version of wc: I think this line might be an issue: The code looks great, it's easy to understand what you are doing and the javadoc style comment is really excellent. I really liked how you cleaned up the bad formatting in the old version of wc, it's much easier to read now. High Level Checks:
Code Checks:
|
|
I can code review this |
|
Code review: Enhance Flags: Code Style: Edge Cases: Testing: High Level Checks:
Code Checks:
|
|
It looks like the main functionality got added to this, but several regressions have happened as well. I immediately noticed I could no longer pipe data into If you fix the pipe issue, directory check, add help message, and update the flags to reflect the features you implemented you can earn +1 to your project. |
Description: This pull request enhances the wc command by adding new features to count punctuation, digits, and uppercase/lowercase letters in a file.
Features:
Character Type Counting: Alongside the standard counts (lines, words, characters), this enhancement introduces the ability to count:
Punctuation marks (e.g., ., ,, !, ?).
Digits (0-9).
Uppercase letters (A-Z).
Lowercase letters (a-z).
Options:
-p: Count punctuation marks.
-d: Count digits.
-u: Count uppercase letters.
-l: Count lowercase letters.
Testing: test_count.c is added to test wc on count_sample.txt