Files
lotherkandClaude Sonnet 5.5 d53ea094e7 licence: CNCL for what Makronix wrote itself
LICENSE at the root; the 103 files new in ext/src/mcde (none was in the CDE
import) carry the CNCL line instead of the LGPL notice.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 11:48:02 +00:00

63 lines
1.9 KiB
C

/*
* Profiles.h -- MCDE: terminal profiles for dtterm (Profiles.c)
*
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
*
* C99 and POSIX only, no X: the parser has its own tests (test_profiles.c,
* make check). Tabs.c and DtTermMain.c turn a profile into a view.
*/
#ifndef _Dtterm_Profiles_h
#define _Dtterm_Profiles_h
#include <stddef.h>
#include <stdio.h>
#define MCDE_PROFILES_MAX 32
typedef struct {
char name[64]; /* as the menu shows it */
char font[96]; /* fontconfig family, "" = the default */
int fontSize; /* points, 0 = the default */
char foreground[32]; /* an X colour, "" = the default */
char background[32];
char command[512]; /* a shell command line, "" = the shell */
} McdeProfile;
/*
* Read profiles from FP into OUT (at most MAX). Returns the number read, or
* -1 with a message "LINE: what" in ERR. The format:
*
* # comment
* profile Dark
* font Hack 12
* foreground #d8d8d8
* background #1c1c1c
* command ksh -l
*
* A key before the first "profile" line, an unknown key, a repeated profile
* name or a font size outside 4..96 is an error.
*/
extern int McdeProfilesParse(FILE *fp, McdeProfile *out, int max,
char *err, size_t errlen);
/*
* The profiles of the user: the first of HOME/.dt/dtterm.profiles and the
* files in SYSFILES (NULL-terminated) that can be opened. An error is
* reported on stderr and gives no profiles.
*/
extern int McdeProfilesLoad(const char *home, const char *const *sysfiles,
McdeProfile *out, int max);
extern const McdeProfile *McdeProfileFind(const McdeProfile *p, int n,
const char *name);
/*
* The widget name of a view with profile NAME: "profile_" and NAME with
* every character outside [A-Za-z0-9_] as '_', so that it is one name in a
* resource specification. False if it does not fit.
*/
extern int McdeProfileWidgetName(const char *name, char *buf, size_t len);
#endif /* _Dtterm_Profiles_h */