ronen25 / libcmdf Goto Github PK
View Code? Open in Web Editor NEWSingle-header library for writing CLI applications in C/C++
Single-header library for writing CLI applications in C/C++
I would like to point out that a prefix like “cmdf__
” does eventually not fit to the expected naming convention of the C++ language standard.
Would you like to adjust your selection for unique names?
Would you like to add more error handling for return values from functions like the following?
Looking at the following code in the main loop:
/* If the buffer wasn't allocated = out of memory, so exit with failure*/
if (!inputbuff)
exit(CMDF_ERROR_OUT_OF_MEMORY);
That assumption is not correct. If EOF is passed, readline will also return NULL
. I think the best way to handle it, is by treating it as if the exit
command was called. Failure to do so, makes libcmdf shutdown the whole application without any proper way of cleaning up.
See the readline manpage:
Return Value
readline returns the text of the line read. A blank line returns the empty string. If EOF is encountered while reading a line, and the line is empty, NULL is returned. If an EOF is read with a non-empty line, it is treated as a newline.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.