fixes
This commit is contained in:
parent
29a19692fe
commit
18a23222a9
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
extern int ansi_write(FILE* fp, const char* buf, int len);
|
extern int ansi_write(FILE* fp, const char* buf, int len);
|
||||||
|
12
MD_Getc.c
12
MD_Getc.c
@ -2,10 +2,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(_MSC_VER) || defined(WIN32)
|
#if defined(_MSC_VER) || defined(WIN32)
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#define STDIN_FILENO 1
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "MagiDoor.h"
|
#include "MagiDoor.h"
|
||||||
@ -17,7 +18,7 @@ extern time_t mdtimeremaining;
|
|||||||
|
|
||||||
char md_getc() {
|
char md_getc() {
|
||||||
char c;
|
char c;
|
||||||
ssize_t ret;
|
int ret;
|
||||||
|
|
||||||
int stage = 0;
|
int stage = 0;
|
||||||
|
|
||||||
@ -43,9 +44,16 @@ char md_getc() {
|
|||||||
md_printf("\r\nOut of time!\r\n");
|
md_printf("\r\nOut of time!\r\n");
|
||||||
md_exit(0);
|
md_exit(0);
|
||||||
}
|
}
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
Sleep(1);
|
||||||
|
#else
|
||||||
usleep(100);
|
usleep(100);
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (ret < 0) {
|
||||||
|
md_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (mdcontrol.socket != -1) {
|
if (mdcontrol.socket != -1) {
|
||||||
if ((unsigned char)c == IAC && stage == 0) {
|
if ((unsigned char)c == IAC && stage == 0) {
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(WIN32) || defined(_MSC_VER)
|
#if defined(WIN32) || defined(_MSC_VER)
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#define strcasecmp stricmp
|
||||||
#else
|
#else
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "MagiDoor.h"
|
#include "MagiDoor.h"
|
||||||
|
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#if defined(_MSC_VER) || defined(WIN32)
|
#if defined(_MSC_VER) || defined(WIN32)
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include "MD_AnsiCons.h"
|
#include "MD_AnsiCons.h"
|
||||||
|
|
||||||
|
#define STDOUT_FILENO 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include "MagiDoor.h"
|
#include "MagiDoor.h"
|
||||||
|
|
||||||
|
12
MagiDoor.h
12
MagiDoor.h
@ -23,14 +23,16 @@ typedef struct MDDoorControl {
|
|||||||
|
|
||||||
extern MDDoorControl_t mdcontrol;
|
extern MDDoorControl_t mdcontrol;
|
||||||
|
|
||||||
extern void md_init(const char *dropfile, int socket);
|
|
||||||
|
|
||||||
|
extern void md_init(const char* dropfile, int socket);
|
||||||
extern void md_exit(int exitcode);
|
extern void md_exit(int exitcode);
|
||||||
extern void md_putchar(char c);
|
extern void md_putchar(char c);
|
||||||
extern void md_printf(const char *fmt, ...);
|
extern void md_printf(const char* fmt, ...);
|
||||||
extern char md_getc();
|
extern char md_getc();
|
||||||
extern int md_getstring(char *ptr, int maxlen, char minchar, char maxchar);
|
extern int md_getstring(char* ptr, int maxlen, char minchar, char maxchar);
|
||||||
extern void md_sendfile(const char *filename, int pause);
|
extern void md_sendfile(const char* filename, int pause);
|
||||||
extern void md_clr_scr();
|
extern void md_clr_scr();
|
||||||
extern void md_set_cursor(int y, int x);
|
extern void md_set_cursor(int y, int x);
|
||||||
extern char md_get_answer(char *options);
|
extern char md_get_answer(char* options);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user