Skip to content

Commit

Permalink
Merge pull request #68 from mitchblank/strtonum-symbol-clash
Browse files Browse the repository at this point in the history
Fix symbol name clash on BSD systems with strtonum(). Closes #65
  • Loading branch information
P403n1x87 authored Dec 30, 2020
2 parents 3e85f79 + 95a1803 commit f92c6d7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/argparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static int exec_arg = 0;

// ----------------------------------------------------------------------------
static int
strtonum(char * str, long * num) {
str_to_num(char * str, long * num) {
char * p_err;

*num = strtol(str, &p_err, 10);
Expand Down Expand Up @@ -288,7 +288,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;

case 'p':
if (strtonum(arg, &l_pid) == 1 || l_pid <= 0)
if (str_to_num(arg, &l_pid) == 1 || l_pid <= 0)
argp_error(state, "invalid PID");
pargs.attach_pid = (pid_t) l_pid;
break;
Expand All @@ -307,7 +307,7 @@ parse_opt (int key, char *arg, struct argp_state *state)

case 'x':
if (
strtonum(arg, (long *) &(pargs.exposure)) == 1 ||
str_to_num(arg, (long *) &(pargs.exposure)) == 1 ||
pargs.exposure > LONG_MAX
)
argp_error(state, "the exposure must be a positive integer");
Expand Down Expand Up @@ -574,7 +574,7 @@ cb(const char opt, const char * arg) {

case 'p':
if (
strtonum((char *) arg, (long *) &pargs.attach_pid) == 1 ||
str_to_num((char *) arg, (long *) &pargs.attach_pid) == 1 ||
pargs.attach_pid <= 0
) {
arg_error("invalid PID");
Expand All @@ -596,7 +596,7 @@ cb(const char opt, const char * arg) {

case 'x':
if (
strtonum((char *) arg, (long *) &(pargs.exposure)) == 1 ||
str_to_num((char *) arg, (long *) &(pargs.exposure)) == 1 ||
pargs.exposure > LONG_MAX
) {
arg_error("the exposure must be a positive integer");
Expand Down

0 comments on commit f92c6d7

Please sign in to comment.