mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-21 22:54:40 +08:00
strndup fixes for mingw
This commit is contained in:
parent
bad5b92ec9
commit
712ee2b10e
2 changed files with 9 additions and 6 deletions
|
@ -12,8 +12,8 @@ This version
|
|||
- Iceman
|
||||
|
||||
Note:
|
||||
This file is used as a helper script to generate the rl_vocabulory.h file need.
|
||||
It also needs a working proxmark3 client to extract the help text.
|
||||
This script is used as a helper script to generate the rl_vocabulory.h file.
|
||||
It need a working proxmark3 client to extract the help text.
|
||||
|
||||
Ie: this script can't be used inside the normal build sequence.
|
||||
"""
|
||||
|
@ -69,6 +69,7 @@ extern "C" {
|
|||
#include <string.h>
|
||||
#include <readline/readline.h>
|
||||
#include "ui.h" // g_session
|
||||
#include "util.h" // str_ndup
|
||||
|
||||
char* rl_command_generator(const char *text, int state);
|
||||
char **rl_command_completion(const char *text, int start, int end);
|
||||
|
@ -124,9 +125,9 @@ char* rl_command_generator(const char *text, int state) {
|
|||
const char *next = command + (rlen - len);
|
||||
const char *space = strstr(next, " ");
|
||||
if (space != NULL) {
|
||||
return strndup(next, space - next);
|
||||
return str_ndup(next, space - next);
|
||||
}
|
||||
return strdup(next);
|
||||
return str_dup(next);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ extern "C" {
|
|||
#include <string.h>
|
||||
#include <readline/readline.h>
|
||||
#include "ui.h" // g_session
|
||||
#include "util.h" // str_ndup
|
||||
|
||||
char* rl_command_generator(const char *text, int state);
|
||||
char **rl_command_completion(const char *text, int start, int end);
|
||||
|
@ -76,6 +77,7 @@ const static vocabulory_t vocabulory[] = {
|
|||
{ 1, "data fsktonrz" },
|
||||
{ 1, "data manrawdecode" },
|
||||
{ 1, "data modulation" },
|
||||
{ 1, "data pwmdemod" },
|
||||
{ 1, "data rawdemod" },
|
||||
{ 1, "data askedgedetect" },
|
||||
{ 1, "data autocorr" },
|
||||
|
@ -734,9 +736,9 @@ char* rl_command_generator(const char *text, int state) {
|
|||
const char *next = command + (rlen - len);
|
||||
const char *space = strstr(next, " ");
|
||||
if (space != NULL) {
|
||||
return strndup(next, space - next);
|
||||
return str_ndup(next, space - next);
|
||||
}
|
||||
return strdup(next);
|
||||
return str_dup(next);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue