-
Notifications
You must be signed in to change notification settings - Fork 49
Enhancing cat Utility (Add -n, -v, -b, and -E flags to cat) #79
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 can review this. |
|
I can code review this as well |
|
Code Review:
Code Checks:
Overall this looks pretty good, though there are a few changes you could make. I would recommend handling the case where no file is passed, though that is a problem with the original cat implementation in FogOS. I would also recommend fixing the cat -n to actually print line numbers instead of %6d. Additionally, you should probably make the -E option put the $ at the end of the line instead of the beginning of the next one, or change the description to match what it does. Finally, as a future direction, you could add a -h flag, to output what each flag actually does. |
|
This is a good attempt, though it has a few issues. As mentioned, That said, your variable names are descriptive and javadoc is helpful to understand the main cat function. The implementation is understandable, and the inclusion of the test program was nice, as it shows how the non-printing symbols are printed. Also, don't worry about fixing what happens when you pass in no arguments to cat. It's standard behavior. :) High Level Checks:
Code Checks:
Suggestions
|
|
In this particular case the CRs above did all the work for me, mostly.
Overall, solid, but this needed to be tested more. You can earn +0.5 by fixing the suggestions in the CRs above. |
This pull request enhances the [cat] utility by implementing additional flags and improving the handling of non-printing characters. The following changes have been made:
support four new flags:
-n for adding line numbers and
-v for displaying non-printing characters in a visible format. The utility will read from files or standard input and process the content based on the provided flags.
-b flag to number non-blank lines only.
-E flag to display $ at the end of each line.
Testing for flag -v is done externally through the OS/user program as detailed in the cat.c program.
High Level Checks:
Code Checks: