53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
/* platform.h - Platform-specific compatibility definitions */
|
|
#ifndef PLATFORM_H
|
|
#define PLATFORM_H
|
|
|
|
/* Platform detection */
|
|
#if defined(__MSDOS__) || defined(_MSDOS) || defined(__DOS__) || defined(MSDOS)
|
|
#define PLATFORM_DOS 1
|
|
#else
|
|
#define PLATFORM_UNIX 1
|
|
#endif
|
|
|
|
/* Include appropriate curses library */
|
|
#ifdef PLATFORM_DOS
|
|
#include <conio.h>
|
|
/* PDCurses on DOS uses curses.h */
|
|
#include <curses.h>
|
|
|
|
/* DOS path definitions */
|
|
#define PATH_SEP "\\"
|
|
#define WORDLIST_PATH_1 "wordlists"
|
|
#define WORDLIST_PATH_2 "C:\\CORDLE\\wordlists"
|
|
#define WORDLIST_PATH_3 NULL
|
|
|
|
/* DOS doesn't have HOME environment variable */
|
|
#define HAS_HOME_ENV 0
|
|
#else
|
|
/* Unix/Linux/macOS */
|
|
#include <curses.h>
|
|
|
|
/* Unix path definitions */
|
|
#define PATH_SEP "/"
|
|
#define WORDLIST_PATH_1 "wordlists"
|
|
#define WORDLIST_PATH_2 "/usr/local/share/cordle/wordlists"
|
|
#define WORDLIST_PATH_3_FMT "%s/.local/share/cordle/wordlists"
|
|
|
|
#define HAS_HOME_ENV 1
|
|
#endif
|
|
|
|
/* Color code compatibility */
|
|
#ifdef PLATFORM_DOS
|
|
/* PDCurses uses different color constants on some platforms */
|
|
#ifndef COLOR_WWHITE
|
|
#define COLOR_WWHITE COLOR_WHITE
|
|
#endif
|
|
#else
|
|
/* ncurses compatibility */
|
|
#ifndef COLOR_WWHITE
|
|
#define COLOR_WWHITE COLOR_WHITE
|
|
#endif
|
|
#endif
|
|
|
|
#endif /* PLATFORM_H */
|