cnotes/include/config.h

78 lines
1.8 KiB
C
Raw Normal View History

2026-01-30 12:37:28 +00:00
/*
* config.h - Configuration settings for cnotes
*
* Platform-specific defaults for notes file location.
* Users can override at compile time with -DCNOTES_DIR="path"
* or at runtime via CNOTES_PATH environment variable.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "platform.h"
/*
* CNOTES_FILE - The filename for the notes database
* This is the same across all platforms (8.3 compatible for DOS)
*/
#ifndef CNOTES_FILE
#define CNOTES_FILE "cnotes.csv"
#endif
/*
* CNOTES_DIR - Default directory path (relative to home)
*
* Can be overridden at compile time:
* gcc -DCNOTES_DIR=\".cnotes\" ...
* tcc -DCNOTES_DIR=".cnotes" ...
*
* Platform defaults:
* DOS: Current directory (empty string)
* Windows: .cnotes (in USERPROFILE)
* Unix: .local/share/cnotes (XDG-style)
*/
#ifndef CNOTES_DIR
#if defined(__MSDOS__) || defined(__DOS__)
#define CNOTES_DIR ""
#elif defined(_WIN32)
#define CNOTES_DIR ".cnotes"
#else
#define CNOTES_DIR ".local/share/cnotes"
#endif
#endif
/*
* CNOTES_PATH_ENV - Environment variable to override notes location
*
* If set, this environment variable provides the full path to the
* notes directory, overriding both CNOTES_DIR and HOME_ENV.
*
* Example:
* export CNOTES_PATH=/custom/path/to/notes
* set CNOTES_PATH=C:\NOTES
*/
#define CNOTES_PATH_ENV "CNOTES_PATH"
/*
* Field lengths and limits
*/
#define CATEGORY_LENGTH 10
#define FREETEXT_MAX_LENGTH 125
#define DEFAULT_CATEGORY "General"
/*
* MAX_ENTRIES - Maximum number of entries dumpnotes can load
*
* DOS has limited memory, so we use a smaller default there.
* Can be overridden at compile time: -DMAX_ENTRIES=500
*/
#ifndef MAX_ENTRIES
#if defined(__MSDOS__) || defined(__DOS__)
#define MAX_ENTRIES 500
#else
#define MAX_ENTRIES 5000
#endif
#endif
#endif /* CONFIG_H */