mach-kernel / cadius

A maintained fork of BrutalDeluxe's Cadius ProDOS disk imaging utility (used for making Apple II disk images).
GNU General Public License v3.0
30 stars 9 forks source link

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

Closed mach-kernel closed 6 years ago

mach-kernel commented 6 years ago
sicklittlemonkey commented 6 years ago

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 commented 6 years ago

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

sicklittlemonkey commented 6 years ago

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 commented 6 years ago

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.

sicklittlemonkey commented 6 years ago

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 commented 6 years ago

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. :+1:

mach-kernel commented 6 years ago

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

sicklittlemonkey commented 6 years ago

It's a lot of work.

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

mach-kernel commented 6 years ago

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. 😸