You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Action: -fprintf file format
True; like ‘-printf’ but write to file like ‘-fprint’.
The output file is always created, even if no output is ever sent to it.
The general structure of find starts from src/find, with main.rs as the entry point, and then to src/find/matcher/mod.rs to parse the command line parameters. Then other files in src/find/matcher are responsible for processing and determining whether a file meets the requirements of the command line parameters, and finally using the write! macro to output.
Use the write! macro for output.
letmut out = matcher_io.deps.get_output().borrow_mut();write!(out,"content").unwrap();
Activity
keys-i commentedon Jun 29, 2024
is print in printer.rs?
hanbings commentedon Jun 29, 2024
Oh, I'm sorry for overlooking this.
-printfhas been implemented. thanks :)[-]Implement `-printf` and `-fprintf`[/-][+]Implement `-fprintf`[/+]keys-i commentedon Jun 29, 2024
Could you point me where because from what I read they seem to have similar implementation
keys-i commentedon Jun 29, 2024
I would to try and improve cuz I want more rust in Debian
cakebaker commentedon Jun 29, 2024
Have a look at
matchers/printf.rs.hanbings commentedon Jun 29, 2024
Sorry for the late reply.
In simple terms,
-fprintfis an implementation of-printfthat directs output to a file and-printfis implemented inprintf.rs(https://github.com/uutils/findutils/blob/main/src/find/matchers/printf.rs).Here is a detailed description of
-fprintf: Print File NameSome information that might be helpful:
The general structure of
findstarts fromsrc/find, withmain.rsas the entry point, and then tosrc/find/matcher/mod.rsto parse the command line parameters. Then other files insrc/find/matcherare responsible for processing and determining whether a file meets the requirements of the command line parameters, and finally using thewrite!macro to output.Use the
write!macro for output.keys-i commentedon Jul 1, 2024
the thing im confused about is
keys-i commentedon Jul 1, 2024
should i make a new file for fprintf or just have a function since most the functionaluity is the same
hanbings commentedon Jul 1, 2024
I guess yes, making the modification in the
printf.rsfile might use less code. For example, add anOption<Path>field to thePrintf(https://github.com/uutils/findutils/blob/main/src/find/matchers/printf.rs#L600) structure and switch different outputs in write!() depending on whether Option has data.What are your thoughts on this? :) @cakebaker