Skip to content
1 change: 1 addition & 0 deletions models.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Dataplus 3 EW-H6000 gy131,ON,0101 gy331 07cf:6101
Dataplus 3 XD-SW4800 gy131,ON,0101 gy350 07cf:6101
Dataplus 3 XD-SW9400 gy131,ON,0101 gy352 07cf:6101
Dataplus 3 XD-SW6400 gy131,ON,0101 gy355 07cf:6101
Dataplus 3 XD-SW6500 gy131,ON,0200 gy356 07cf:6101
Dataplus 3 XD-GW9600 gy131,ON,0101 gy392 07cf:6101
Dataplus 4 EV-SP2900 gy131,ON,0100 gy808 07cf:6101
Dataplus 4 EV-SP3900 gy131,ON,0100 gy809 07cf:6101
Expand Down
7 changes: 6 additions & 1 deletion src/exword.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
*
*/

#include <arpa/inet.h>
#if defined(__MINGW32__)
# include <WinSock2.h>
#else
# include <arpa/inet.h>
#endif

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down
4 changes: 3 additions & 1 deletion src/list.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef __LIST_H
#define __LIST_H

#include <stddef.h>

/* This file is from Linux Kernel (include/linux/list.h)
* and modified by simply removing hardware prefetching of list items.
* Here by copyright, credits attributed to wherever they belong.
Expand Down Expand Up @@ -187,7 +189,7 @@ static inline void list_splice_init(struct list_head *list,
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
((type *)((void *)(ptr)-offsetof(type, member)))

/**
* list_for_each - iterate over a list
Expand Down
13 changes: 10 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ void content(struct state *s)
if (peek_arg(&(s->cmd_list)) == NULL) {
printf("No sub-function specified.\n");
} else {
subfunc = xmalloc(strlen(peek_arg(&(s->cmd_list)) + 1));
subfunc = xmalloc(strlen(peek_arg(&(s->cmd_list))) + 1);
strcpy(subfunc, peek_arg(&(s->cmd_list)));
dequeue_arg(&(s->cmd_list));
if (strcmp(subfunc, "list") == 0) {
Expand Down Expand Up @@ -535,13 +535,20 @@ void content(struct state *s)
int rsp = exword_get_file(s->device, "user.inf", &buffer, &len);
if (rsp == EXWORD_SUCCESS) {
user = xmalloc(len+1);
sscanf(buffer, "%s\n", user);
for (int i = 0; i < len; i++) {
user[i + 1] = 0;
if (buffer[i] > ' ') {
user[i] = buffer[i];
} else {
break;
}
}
free(buffer);
} else {
printf("No username specified.\n");
}
} else {
user = xmalloc(strlen(peek_arg(&(s->cmd_list)) + 1));
user = xmalloc(strlen(peek_arg(&(s->cmd_list))) + 1);
strcpy(user, peek_arg(&(s->cmd_list)));
dequeue_arg(&(s->cmd_list));
}
Expand Down
7 changes: 6 additions & 1 deletion src/obex.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
*
*/

#include <arpa/inet.h>
#if defined(__MINGW32__)
# include <Winsock2.h>
#else
# include <arpa/inet.h>
#endif

#include <stdlib.h>
#include <string.h>

Expand Down
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define _UTIL_H

#if defined(__MINGW32__)
# include <direct.h>
# define mkdir(path, mode) _mkdir(path)
# define PATH_SEP "\\"
#else
Expand Down