pass env from main and check FreeBSD for endian include (fix #650)
This commit is contained in:
+5
-4
@@ -1334,15 +1334,16 @@ bool parseMessage(const string& arg, bool onlyMasterSlave, MasterSymbolString* m
|
|||||||
* Main function.
|
* Main function.
|
||||||
* @param argc the number of command line arguments.
|
* @param argc the number of command line arguments.
|
||||||
* @param argv the command line arguments.
|
* @param argv the command line arguments.
|
||||||
|
* @param envp the environment variables.
|
||||||
* @return the exit code.
|
* @return the exit code.
|
||||||
*/
|
*/
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[], char* envp[]) {
|
||||||
struct argp aargp = { argpoptions, parse_opt, nullptr, argpdoc, datahandler_getargs(), nullptr, nullptr };
|
struct argp aargp = { argpoptions, parse_opt, nullptr, argpdoc, datahandler_getargs(), nullptr, nullptr };
|
||||||
setenv("ARGP_HELP_FMT", "no-dup-args-note", 0);
|
setenv("ARGP_HELP_FMT", "no-dup-args-note", 0);
|
||||||
|
|
||||||
char envname[32] = "--"; // needs to cover at least max length of any option name plus "--"
|
char envname[32] = "--"; // needs to cover at least max length of any option name plus "--"
|
||||||
char* envopt = envname+2;
|
char* envopt = envname+2;
|
||||||
for (char ** env = environ; *env; env++) {
|
for (char ** env = envp; *env; env++) {
|
||||||
char* pos = strchr(*env, '=');
|
char* pos = strchr(*env, '=');
|
||||||
if (!pos || strncmp(*env, "EBUSD_", sizeof("EBUSD_")-1) != 0) {
|
if (!pos || strncmp(*env, "EBUSD_", sizeof("EBUSD_")-1) != 0) {
|
||||||
continue;
|
continue;
|
||||||
@@ -1569,6 +1570,6 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
} // namespace ebusd
|
} // namespace ebusd
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[], char* envp[]) {
|
||||||
return ebusd::main(argc, argv);
|
return ebusd::main(argc, argv, envp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,11 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <machine/endian.h>
|
||||||
|
#else
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
|
#endif
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|||||||
Reference in New Issue
Block a user