Skip to content

REPLACEFILE don't error if file does not exist#19

Merged
mach-kernel merged 7 commits intomasterfrom
replacefile-no-error
Apr 15, 2018
Merged

REPLACEFILE don't error if file does not exist#19
mach-kernel merged 7 commits intomasterfrom
replacefile-no-error

Conversation

@mach-kernel
Copy link
Copy Markdown
Owner

@sicklittlemonkey
Copy link
Copy Markdown
Contributor

This might have been a good opportunity to change all the printf()s to some logging calls, and then have that use globals - rather than passing down a bool through APIs that are totally unrelated. Good old separation of concerns. Just an opinion. ; - )

@mach-kernel
Copy link
Copy Markdown
Owner Author

That's a great idea! I'll get on that and try to have it out soon. 👍

@sicklittlemonkey
Copy link
Copy Markdown
Contributor

Have a look around at some C logging APIs. E.g. just did a quick google and found this - not necessarily to use, but perhaps a good example of a simple logging API:
https://github.com/rxi/log.c

@mach-kernel mach-kernel force-pushed the replacefile-no-error branch from 870100c to f624678 Compare April 3, 2018 02:00
@mach-kernel
Copy link
Copy Markdown
Owner Author

mach-kernel commented Apr 3, 2018

I made a small delegator to vprintf. In the future we can probably make levels but IMO doesn't need it. I was playing around in my head with adding something to manage the number of spaces/tabs prefixed to the output so that they wouldn't have to be prepended in the strings passed to the logger.

@mach-kernel mach-kernel force-pushed the replacefile-no-error branch from f624678 to 7c56ee8 Compare April 3, 2018 02:36
@sicklittlemonkey
Copy link
Copy Markdown
Contributor

Nice! I like it. I see what you mean about the indentations. Tedious ...

The nice thing about log levels is differentiating between errors and other info. For instance when I now ask if you could squeeze in a -quiet (no logging (except errors?)) option into this release. ; - )

@mach-kernel
Copy link
Copy Markdown
Owner Author

The nice thing about log levels is differentiating between errors and other info. For instance when I now ask if you could squeeze in a -quiet (no logging (except errors?)) option into this release. ; - )

I knew I should have used a struct! I'll try to get to this tonight also. 👍

@mach-kernel
Copy link
Copy Markdown
Owner Author

@sicklittlemonkey will try to get this out by the end of the week. Haven't forgotten, work has been picking up. 🙈

@sicklittlemonkey
Copy link
Copy Markdown
Contributor

It's a lot of work.

Probably better to split this out to another issue and release the REPLACEFILE fix etc.

@mach-kernel
Copy link
Copy Markdown
Owner Author

I added support for quiet and cleaned up how we're parsing the flags. I think that barring any tweaks / bugs discovered this should cover it. 😸

@mach-kernel mach-kernel merged commit 1b528e3 into master Apr 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants