Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clude <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include "trim/trim.h"
- #include "asprintf/asprintf.h"
- #include "which/which.h"
- #include "str-flatten/str-flatten.h"
- #include "strdup/strdup.h"
- #include "debug/debug.h"
- #include "version.h"
- int main(int argc, const char **argv) {
- char *cmd = NULL;
- char *args = NULL;
- char *command = NULL;
- char *command_with_args = NULL;
- char *bin = NULL;
- int rc = 1;
- debug_init(&debugger, "clib");
- //usage
- if (NULL == argv[1]
- || 0 == strncmp(argv[1], "-h", 2
- printf("%s\n", CLIB_VERSION);
- return 0;
- }
- // unkown
- if (0 == strncmp(argv[1]);
- if (NULL == cmd) {
- fprintf(stderr, "Memory allocation failure\n");
- return 1;
- }
- cmd = trim(cmd);
- if (0 == strcmp(cmd, "help")) {
- if (argc >= 3){
- free(cmd);
- cmd = strdup(argv[2]);
- args = strdup("--help");
- } else {
- fprintf(stderr, "Help command required.\n");
- goto cleanup;
- }
- } else {
- if (argc >= 3) {
- args = str_flatten(argv, 2, argc);
- if (NULL == args) goto cleanup;
- }
- }
- debug(&debugger, "args: %s", args);
- #ifdef _WIN32
- format(&command, "");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement