5 ms·
Show HN: Libcox – A C Library for Cross-Platform System Calls
- FreddyFreddy 11y agoThis library has an unfortunate name. When pronounced, it sounds like "libcocks". "Cock" is American slang for "penis". "Cocks" refers to multiple penises. I know it may seem minor or irrelevant to some here, but a name like that could cause problems for some users, ultimately preventing them from using this library, even if it were the best option available. These kinds of users are in environments where the use of the word "cock", or even a word that could be misconstrued as being "cock", are not considered acceptable.
- wlkr 11y agoI could very well be feeding a troll here but I found your point, frankly, ludicrous. Cox is itself a valid word [1] with meaning entirely unrelated to the male genitalia. I don't think the library was named after, for instance, a certain English apple but I find the idea of avoiding a library simply because its name happens to be a homophone of a crude word to be absurd; perhaps it is further indicative that one has a tendency to think of others as juvenile? [1] https://dictionary.cambridge.org/dictionary/english/cox https://dictionary.cambridge.org/dictionary/english/cox
- vezzy-fnord 11y agoCox is also a common English last name.
- DanBC 11y agoCocks is a much rarer English last name. Some relevance to an HN audience though: https://en.wikipedia.org/wiki/Clifford_Cocks https://en.wikipedia.org/wiki/Clifford_Cocks
- deleted 11y ago[deleted]
- cpplinuxdude 11y agoUnfortunately I agree with the comment; please rename. Other than that: fantastic work.
- zokier 11y ago> some users, ultimately preventing them from using this library their loss.
- beefhash 11y agoIt could be worse; like getting sued by an ISP named Cox[1]. [1] http://www.cox.com/ http://www.cox.com/
- flohofwoe 11y agoNothing wrong with the name. Almost any combination of letters is a slang for something 'inappropriate' somewhere in the world. [edit] e.g. this is absolutely hilarious to a German: http://de.wix.com/ http://de.wix.com/ (wix sounds like German slang for masturbating)
- forgotmypassw 11y agoJust before I went to read the comments I was almost 100% positive I'd see one like that, thanks for not disappointing me.
- deleted 11y ago[deleted]
- malft 11y agoAwesome! More of this. My competitors making suboptimal decisions based on immaturity or prudishness is free money.
- anta40 11y agoInitally I thought it was written by Russ Cox, one of golang contributors.
- k8tte 11y agoVery cool project! But I agree with the comments about the name is unfortunate
- kylequest 11y agoAside from being C and "lightweight" I wonder when you'd want to pick this instead of POCO or ACE...
- j_s 11y agoNot sure if climbing this high on HN on a U.S. holiday indicates a real need or clever marketing for this new project, but congratulations to them for getting the word out. Thanks also to you for sharing a couple well-established alternatives.
- geoff-codes 11y agoA few more (particularly nspr and apr): http://www.shlomifish.org/open-source/portability-libs/ http://www.shlomifish.org/open-source/portability-libs/
- norswap 11y agoAs it explains quite clearly, this is "portable system calls". Lightweight indeed, it's the whole point! So if you ask this question, you might as well ask why system calls are not more expansive in their capabilities. I think there's a reason, system calls are much simpler. They are building bricks. If you want to layer something complex on top, you're free to do so. About your suggestions, ACE's documentation is particularly bad. I wouldn't recommend it to anyone.
- geofft 11y agoThis project is using the phrase "system call" idiosyncratically / incorrectly: by it they mean "calls to the system() function", not "low-level OS facilities". POCO and ACE seem to be about actual system calls (network programming, threads, pipes, etc.) They're for very different purposes. libcox is for when your existing code would do something like system("uname") or system("ls") (... except not even with system(), with popen() or something), and you want it portable to Windows.
- st2p 11y agoThought it was either written by Russ Cox or it had something to do with Roosters. But seriously, it's more of a personal problem if someone can't make the minute mental leap to discriminate between cox and cocks-the name is perfectly fine and doesn't need to be changed.
- geofft 11y agorc = libcox_exec_fmt(pHandle,&pResult,"ls '%s'",zDir); /*Don't forget the single quotes around 'zDir' */ This is either insecure, or so different from a shell as to make it not worth using shell syntax. I really like the concept though. Took me to figure out what the concept is because "system calls" doesn't mean "shell commands" to me, but having figured that out, operating on shell commands has a lot of things going for it.
- symisc_devel 11y agoHi, this is due to the fact that zDir may contain spaces especially under windows which confuse the command processor to interpret it as multiple arguments and not a single one as with single or double quotes (http://libcox.net/arch.html http://libcox.net/arch.html)
- geofft 11y agoWhat happens if zDir contains single quotes?
- stefs 11y agoYou need to escape them, like in every other instance where strings may contain control characters. That'd be my guess, at least, but, i guess, single quotes aren't valid characters for zDir.
- geofft 11y agoSo what are the quote parsing rules for libcox, and given an arbitrary string, how do I correctly escape them? (In the absence of this, and certainly in the absence of official docs/examples that do the right thing, that's a security vulnerability waiting to happen.)
- symisc_devel 11y agoString escaping follows the same rules of C/C++ or you could use the str_escape command to do job for you.
- tedunangst 11y agoI don't know how they managed to do it, but on the mobile version of the site, none of the useful links are actually links...
- norswap 11y agoWhy use command processing (e.g. `libcox_exec(pHandle,&pResult,"uname",-1)`) rather than plain function (could be `libcox_uname(pHandle, &pResult)` for instance) ?
- symisc_devel 11y agono need to release a new version by a adding a new public API function each time a command is added. You would simply create a new foreign command in your application, register it via libcox_register_command()[1] without modifying the library core. [1]: http://libcox.net/c_api/libcox_register_command.html http://libcox.net/c_api/libcox_register_command.html