use fgets to get a line instead of getline
function getline undefined when I compile it with MinGW
This commit is contained in:
parent
eac78225eb
commit
8e230e1dd6
@ -54,7 +54,6 @@
|
|||||||
|
|
||||||
//SLRE
|
//SLRE
|
||||||
#include "slre.h"
|
#include "slre.h"
|
||||||
#include "slre.c"
|
|
||||||
|
|
||||||
nfc_context *context;
|
nfc_context *context;
|
||||||
|
|
||||||
@ -120,9 +119,7 @@ int main(int argc, char *const argv[])
|
|||||||
|
|
||||||
//File pointers for the keyfile
|
//File pointers for the keyfile
|
||||||
FILE * fp;
|
FILE * fp;
|
||||||
char * line = NULL;
|
char line[20];
|
||||||
size_t len = 0;
|
|
||||||
ssize_t read;
|
|
||||||
|
|
||||||
//Regexp declarations
|
//Regexp declarations
|
||||||
static const char *regex = "([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])";
|
static const char *regex = "([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])";
|
||||||
@ -155,7 +152,7 @@ int main(int argc, char *const argv[])
|
|||||||
fprintf(stderr, "Cannot open keyfile: %s, exiting\n", optarg);
|
fprintf(stderr, "Cannot open keyfile: %s, exiting\n", optarg);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
while ((read = getline(&line, &len, fp)) != -1) {
|
while ( fgets(line, 20, fp)) {
|
||||||
int i, j = 0, str_len = strlen(line);
|
int i, j = 0, str_len = strlen(line);
|
||||||
|
|
||||||
while (j < str_len &&
|
while (j < str_len &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user