Skip to content

Commit be574f1

Browse files
committed
pass env from main and check FreeBSD for endian include (fix #650)
1 parent d6854ff commit be574f1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/ebusd/main.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1334,15 +1334,16 @@ bool parseMessage(const string& arg, bool onlyMasterSlave, MasterSymbolString* m
13341334
* Main function.
13351335
* @param argc the number of command line arguments.
13361336
* @param argv the command line arguments.
1337+
* @param envp the environment variables.
13371338
* @return the exit code.
13381339
*/
1339-
int main(int argc, char* argv[]) {
1340+
int main(int argc, char* argv[], char* envp[]) {
13401341
struct argp aargp = { argpoptions, parse_opt, nullptr, argpdoc, datahandler_getargs(), nullptr, nullptr };
13411342
setenv("ARGP_HELP_FMT", "no-dup-args-note", 0);
13421343

13431344
char envname[32] = "--"; // needs to cover at least max length of any option name plus "--"
13441345
char* envopt = envname+2;
1345-
for (char ** env = environ; *env; env++) {
1346+
for (char ** env = envp; *env; env++) {
13461347
char* pos = strchr(*env, '=');
13471348
if (!pos || strncmp(*env, "EBUSD_", sizeof("EBUSD_")-1) != 0) {
13481349
continue;
@@ -1569,6 +1570,6 @@ int main(int argc, char* argv[]) {
15691570

15701571
} // namespace ebusd
15711572

1572-
int main(int argc, char* argv[]) {
1573-
return ebusd::main(argc, argv);
1573+
int main(int argc, char* argv[], char* envp[]) {
1574+
return ebusd::main(argc, argv, envp);
15741575
}

src/lib/knx/knxnet.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
#include <fcntl.h>
3232
#include <errno.h>
3333
#include <string.h>
34-
#include <endian.h>
34+
#ifdef __FreeBSD__
35+
#include <machine/endian.h>
36+
#else
37+
#include <endian.h>
38+
#endif
3539
#include <string>
3640
#include <cstdio>
3741
#include <ctime>

0 commit comments

Comments
 (0)