update the platform header

This commit is contained in:
Gregory Gauthier 2026-01-30 11:44:41 +00:00
parent 34ef701f69
commit 9fdd8eea06
3 changed files with 15 additions and 9 deletions

View File

@ -1,8 +0,0 @@
cmake_minimum_required(VERSION 4.0)
project(cnotes C)
set(CMAKE_C_STANDARD 90)
add_executable(dumpnotes dumpnotes.c)
add_executable(addnote addnote.c platform.h)

BIN
dumpnotes

Binary file not shown.

View File

@ -1,14 +1,28 @@
#ifndef PLATFORM_H #ifndef PLATFORM_H
#define PLATFORM_H #define PLATFORM_H
#ifdef _WIN32 #if defined(__MSDOS__) || defined(__DOS__)
#include <dir.h>
#define mkdir_portable(path) mkdir(path) #define mkdir_portable(path) mkdir(path)
#define PATH_SEPARATOR '\\' #define PATH_SEPARATOR '\\'
#define HOME_ENV "CNOTES_HOME" /* Or use current dir */
#define PATH_SEP_STR "\\"
#define MAX_ENTRIES_DEFAULT 100 /* DOS memory constraint */
#elif defined(_WIN32)
#include <direct.h>
#define mkdir_portable(path) _mkdir(path)
#define PATH_SEPARATOR '\\'
#define HOME_ENV "USERPROFILE" #define HOME_ENV "USERPROFILE"
#define PATH_SEP_STR "\\"
#define MAX_ENTRIES_DEFAULT 5000
#else #else
#include <sys/stat.h>
#include <sys/types.h>
#define mkdir_portable(path) mkdir(path, 0755) #define mkdir_portable(path) mkdir(path, 0755)
#define PATH_SEPARATOR '/' #define PATH_SEPARATOR '/'
#define HOME_ENV "HOME" #define HOME_ENV "HOME"
#define PATH_SEP_STR "/"
#define MAX_ENTRIES_DEFAULT 5000
#endif #endif
#endif #endif