Return some error codes
A starter for #20.
I've only tested ADDFILE.
Awesome! This was super annoying while using in build scripts that should fail early but no way to tell.
The other code paths all have good error-handling code, but don't return int.
It should be easy to change.
Ok, I did EXTRACTFILE in 5 minutes - but not tested! ; - )
Look at the existing error handling in AddFile.
If there's an error:
- Update the current image, i.e. current_image->nb_add_error++ or nb_extract_error++;
- Free memory if it won't be used again (e.g. you're returning now) e.g. mem_free_file(current_file);
- In general return(1), though if there's an error variable it's better to return(error); IMO.
The other ones get a bit more involved because there are loops etc. (Damn I wish this was in C++.)
I'll try to do a more complex one later and see how hard it gets.
Cheers, Nick.
I'll do some testing this evening 👍
(Damn I wish this was in C++.)
I was playing around with the idea of using Go with Cgo to write a niftier CLI tool while using all of the existing ProDOS code as a library.
Ok, I have no idea what's going in my fork anymore. No time for this nonsense. ; - )
Oh, what happened to this one? Sorry, Git was pissing me off and I haven't had time to get back to it.
Hi there! I reopened it, thought it was abandoned because of the merge conflicts. I think this feature is necessary if people want to use this in any kind of script. Do we want to just do 0/1 or come up with more granular code semantics? I'm happy to help rebase + do stuff for this branch if you would welcome that! 😸