• This repository has been archived on 31/Jul/2020
  • Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    C
  • License
    Other
  • Created over 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross Platform UNIX commands & System Calls

Symisc Libcox - Cross Platform System Calls & Utilities

libcox.symisc.net Version 1.7.0

Note: For production build, please rely only on the amalgamation build-release available at the libcox download page here.

Libcox is an ANSI-C Library which permit cross platform system calls and standard utilities among different operating systems via a system of commands similar to the standard UNIX one and backed by the native OS API (Refer to Libcox architecture).

Think of Libcox as an embedded shell to your application (without any external process execution) where you can perform your traditional system tasks such as listing directory entries, gathering file informations, interacting with the OS regardless of the underlying operating system.

Libcox features includes:

  • Cross platform system calls & utilities backed by native host OS API.
  • Built with over 145 commands similar to the standard UNIX one.
  • Libcox is built-up on layers using a VFS approach.
  • Libcox is a Self-Contained ANSI C library without dependency.
  • Thread safe and full re-entrant.
  • Simple, Clean and easy to use API.
  • Highly available online support.

###Libcox Programming Interfaces

Here is what you do to start experimenting with Libcox without having to do a lot of tedious reading and configuration. Get a copy of the last public release of Libcox. Visit the download page for additional information. The following are Some C/C++ samples to start experimenting with:

####Usefull Links to start with

Below is a simple C program that demonstrates how to use the Command Execution C/C++ interface to Libcox.

#include "libcox.h"
int main(int argc, char **argv){
		
		libcox *pHandle;            /* Libcox handle */
		libcox_value *pResult;     /* Return value of the last executed command */
		
		const char *zValue;           /* Cast the 'libcox_value' to a string */
		int rc;
	
		/* Obtain a new libcox handle*/
		rc = libcox_init(&pHandle);
		if( rc != LIBCOX_OK ){
			/* Handle error */
			return -1;
		}

		/* Execute the simplest command - uname: Get the underlying OS info (name, version, etc.) */
		rc = libcox_exec(pHandle,&pResult,"uname",-1);
		if( rc != LIBCOX_OK ){ /* Handle error */	}
		
		
		/* Get as a string representation and output the result */
		zValue = libcox_value_to_string(pResult,0);
		/* Output */
		printf("OS Info: %s\n\n",zValue); /* Should output something similar to: Windows 8.1 x64 localhost Build 85746... */

		/* Destroy the libcox_value */
		libcox_exec_result_destroy(pHandle,pResult);
		
		/* Finally, release the libcox handle */
		libcox_release(pHandle);
	}