38 lines
636 B
C
38 lines
636 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <stdint.h>
|
|
|
|
#include "options.h"
|
|
|
|
static uint32_t m_flags;
|
|
|
|
int options_parse(int argc, char **argv)
|
|
{
|
|
int opt;
|
|
int nparsed = 0;
|
|
while((opt = getopt(argc, argv, "c")) != -1) {
|
|
switch(opt) {
|
|
case 'c':
|
|
m_flags |= (1 << OPTIONS_FLAG_IS_CENTRAL_NODE);
|
|
break;
|
|
|
|
default:
|
|
fprintf(stderr,
|
|
"Usage: %s [-c]\n\n"
|
|
" -c Makes this node a central node (base station).\n",
|
|
argv[0]);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
nparsed++;
|
|
}
|
|
|
|
return nparsed;
|
|
}
|
|
|
|
bool options_is_flag_set(options_flag_t flag)
|
|
{
|
|
return (m_flags & (1 << flag)) != 0;
|
|
}
|