siiky / libccmd Goto Github PK
View Code? Open in Web Editor NEWA library for command handling in C
License: MIT License
A library for command handling in C
License: MIT License
libccmd This is libccmd, a library for command handling in C. This library allows you to easily implement commands in your software. These commands can be used to control your interface, either through keybindings, IPC, readline, or any other UI you can get command strings from. STATUS Currently polishing this for its initial release. API See include/ccmd.h, or refer to your system copy. ccmd_init Takes an array of ccmd_def_t and returns a ccmd_t * ccmd_free Frees a ccmd_t ccmd_exec/ccmd_execv/ccmd_execl Matches and executes commands, then returns a ccmd_res_t * ccmd_join/ccmd_split/ccmd_argv_free Utility functions for working with argument vectors ccmd_result Utility function to produce a ccmd_res_t in command handlers EXAMPLE This example uses ccmd_exec to run the cmd_echo function. #define _POSIX_C_SOURCE 200809L #include "ccmd.h" #include <stdlib.h> #include <stdio.h> #include <string.h> static ccmd_res_t *cmd_echo(int argc, char **argv) { for (int i = 0; i < argc; ++i) { printf("%s\n", argv[i]); } return ccmd_result(0, NULL); } ccmd_def_t commands[] = { { "echo", cmd_echo } }; int main(int argc, char **argv) { ccmd_t *ccmd = ccmd_init(ccmds(commands)); ccmd_res_t *res = ccmd_exec(ccmd, "echo foo bar baz"); if (!res) { fprintf(stderr, "No such command: %s\n", argv[1]); return 1; } int exit = res->exit; free(res); return exit; } INSTALLATION $ mkdir build && cd build $ ../configure $ make # make install Use ../configure --help for assistance.
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.