-
Notifications
You must be signed in to change notification settings - Fork 49
Add -R, -F, and -v flags to grep #76
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 code review |
|
I like this project a lot; super useful and well implemented! You have everything and it seems to work exactly as expected. (Unfortunately xv6 being awful with directories makes using the shell for file navigation equally awful, so testing it isn’t the most fun. I imagine it was even more insufferable trying to test your own code for this). Only things I might consider:
High Level Checks:
Code Checks:
|
|
I concur with my code review partner's comments, and in addition:
Testing
For -R flag it seems to work up to 2 nested directories but crashes on the third:
I tried some other really ugly/gnarly combinations of directory structures and grep worked really well.
Documentation
Coding
High Level Checks:
Code Checks:
|
Fixes an issue that caused a trap when recursing down at least 3 levels. It was caused by allocating 1024 bytes for a path, despite the max path length being 128.
|
Confirmed: code fix resolved nested directory crashes. |
The exit codes aren't going to be too useful in current FogOS, but should prove useful once sh matures. The documentation is in markdown, though it's formatted to be viewed in the terminal.
|
Doc looks fantastic. |
|
Will review this. Similar to own project, flags. |
|
Nicely done project. Namely:
Suggestion:
High Level Checks:
Code Checks:
Also notice that effort was made to handle crash fixes already, nice! |
|
This was well reviewed and corrections were already made, awesome! I agree regarding adding a man page, supporting multiple flags in a single arg, and defaulting to The code is nicely structured. I know the original had a global Nice work! |
For Issue #54
Overview
This pull request adds the
-R,-F, and-vflags togrep, which matches against files in a directory recursively, matches against fixed strings, and inverts matching respectively. A limitation is that the flags must be specified before the pattern or paths, and they must be specified separately.Additionally, if the
-Rflag is passed or if multiple paths are specified, matches will be printed with the path prefixed in red.Examples
grep -R pattern dirmatchespatternagainst all files indirand its subdirectories (that can be opened).grep -F F.g README.mdmatches README.md against the fixed stringF.g. The pattern is not interpreted as a regular expression, soFogdoes not match.grep -v Fog README.mdmatches README.md and prints the lines that don't match the patternFog.Files changed
user/grep.c