This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -o run_inferior run_inferior.c -W -Wall | |
/* A function to execute a child program and feed the input line-by-line back | |
* to the calling program. The function mst be called with a callback function | |
* that will receive each line as it is read in, a program to execute and the | |
* command line arguments for that program. | |
* | |
* There are two versions of this function: one that takes the command line | |
* arguments as variadic parameters delimited with a NULL pointer and one that | |
* takes an array of parameters with a length specified for the array. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> | |
/* ******************************************************************** | |
* An even more comprehensive command-line parsing mechanism. This method | |
* allows the program to have long options (--name=value) short options | |
* (-n value or -nvalue or -abcnvalue) mixed with non-options (arguments | |
* without a '-' or '--'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> | |
/* ***************************************************************** | |
* A more robust command-line handling function than I normally use. | |
* There are only two functions, so this is suitable for copying and | |
* pasting into the file containing main(). |
NewerOlder