This commit is contained in:
Andrew Pamment 2021-03-12 19:14:22 +10:00
parent 29a19692fe
commit 18a23222a9
5 changed files with 24 additions and 10 deletions

View File

@ -1,4 +1,4 @@
#pragma once
#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);

View File

@ -2,10 +2,11 @@
#include <stdio.h>
#if defined(_MSC_VER) || defined(WIN32)
#include <winsock2.h>
#define STDIN_FILENO 1
#else
#include <sys/socket.h>
#endif
#include <unistd.h>
#endif
#include <time.h>
#include <string.h>
#include "MagiDoor.h"
@ -17,7 +18,7 @@ extern time_t mdtimeremaining;
char md_getc() {
char c;
ssize_t ret;
int ret;
int stage = 0;
@ -43,9 +44,16 @@ char md_getc() {
md_printf("\r\nOut of time!\r\n");
md_exit(0);
}
#if defined(_MSC_VER)
Sleep(1);
#else
usleep(100);
#endif
continue;
}
else if (ret < 0) {
md_exit(0);
}
if (mdcontrol.socket != -1) {
if ((unsigned char)c == IAC && stage == 0) {

View File

@ -1,13 +1,14 @@
#include <stdio.h>
#if defined(WIN32) || defined(_MSC_VER)
#include <winsock2.h>
#define strcasecmp stricmp
#else
#include <termios.h>
#include <signal.h>
#include <unistd.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "MagiDoor.h"

View File

@ -1,12 +1,15 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#if defined(_MSC_VER) || defined(WIN32)
#include <winsock2.h>
#include "MD_AnsiCons.h"
#define STDOUT_FILENO 0
#else
#include <sys/socket.h>
#include <unistd.h>
#endif
#include "MagiDoor.h"

View File

@ -23,14 +23,16 @@ typedef struct MDDoorControl {
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_putchar(char c);
extern void md_printf(const char *fmt, ...);
extern void md_printf(const char* fmt, ...);
extern char md_getc();
extern int md_getstring(char *ptr, int maxlen, char minchar, char maxchar);
extern void md_sendfile(const char *filename, int pause);
extern int md_getstring(char* ptr, int maxlen, char minchar, char maxchar);
extern void md_sendfile(const char* filename, int pause);
extern void md_clr_scr();
extern void md_set_cursor(int y, int x);
extern char md_get_answer(char *options);
extern char md_get_answer(char* options);
#endif