NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
dump.c
Go to the documentation of this file.
1
30
36
37
#include "config.h"
38
#include <stdio.h>
39
#include "
mutt/lib.h
"
40
#include "
config/lib.h
"
41
#include "
core/lib.h
"
42
#include "
dump.h
"
43
#include "
pager/lib.h
"
44
54
enum
CommandResult
set_dump
(
enum
GetElemListFlags
flags
,
struct
Buffer
*err)
55
{
56
struct
Buffer
*tempfile =
buf_pool_get
();
57
buf_mktemp
(tempfile);
58
59
FILE *fp_out =
mutt_file_fopen
(
buf_string
(tempfile),
"w"
);
60
if
(!fp_out)
61
{
62
// L10N: '%s' is the file name of the temporary file
63
buf_printf
(err,
_
(
"Could not create temporary file %s"
),
buf_string
(tempfile));
64
buf_pool_release
(&tempfile);
65
return
MUTT_CMD_ERROR
;
66
}
67
68
struct
ConfigSet
*cs =
NeoMutt
->
sub
->
cs
;
69
struct
HashElemArray hea =
get_elem_list
(cs, flags);
70
dump_config
(cs, &hea,
CS_DUMP_NONE
, fp_out);
71
ARRAY_FREE
(&hea);
72
73
mutt_file_fclose
(&fp_out);
74
75
struct
PagerData
pdata = { 0 };
76
struct
PagerView
pview = { &
pdata
};
77
78
pdata
.
fname
=
buf_string
(tempfile);
79
80
pview.
banner
=
"set"
;
81
pview.
flags
=
MUTT_PAGER_NONE
;
82
pview.
mode
=
PAGER_MODE_OTHER
;
83
84
mutt_do_pager
(&pview, NULL);
85
buf_pool_release
(&tempfile);
86
87
return
MUTT_CMD_SUCCESS
;
88
}
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition
array.h:209
buf_printf
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition
buffer.c:168
buf_string
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition
buffer.h:96
CommandResult
CommandResult
Error codes for command_t parse functions.
Definition
command.h:37
MUTT_CMD_SUCCESS
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition
command.h:40
MUTT_CMD_ERROR
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition
command.h:38
dump_config
bool dump_config(struct ConfigSet *cs, struct HashElemArray *hea, ConfigDumpFlags flags, FILE *fp)
Write all the config to a file.
Definition
dump.c:198
CS_DUMP_NONE
@ CS_DUMP_NONE
No flags are set.
Definition
dump.h:40
lib.h
Convenience wrapper for the config headers.
lib.h
Convenience wrapper for the core headers.
mutt_do_pager
int mutt_do_pager(struct PagerView *pview, struct Email *e)
Display some page-able text to the user (help or attachment).
Definition
do_pager.c:122
mutt_file_fclose
#define mutt_file_fclose(FP)
Definition
file.h:144
mutt_file_fopen
#define mutt_file_fopen(PATH, MODE)
Definition
file.h:143
lib.h
Convenience wrapper for the library headers.
_
#define _(a)
Definition
message.h:28
lib.h
GUI display a file/email/help in a viewport with paging.
MUTT_PAGER_NONE
#define MUTT_PAGER_NONE
No flags are set.
Definition
lib.h:63
PAGER_MODE_OTHER
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition
lib.h:143
set_dump
enum CommandResult set_dump(enum GetElemListFlags flags, struct Buffer *err)
Dump list of config variables into a file/pager.
Definition
dump.c:54
dump.h
Functions to parse commands in a config file.
buf_pool_get
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition
pool.c:91
buf_pool_release
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition
pool.c:111
Buffer
String manipulation buffer.
Definition
buffer.h:36
ConfigSet
Container for lots of config items.
Definition
set.h:251
ConfigSubset::cs
struct ConfigSet * cs
Parent ConfigSet.
Definition
subset.h:50
NeoMutt
Container for Accounts, Notifications.
Definition
neomutt.h:41
NeoMutt::sub
struct ConfigSubset * sub
Inherited config items.
Definition
neomutt.h:49
PagerData
Data to be displayed by PagerView.
Definition
lib.h:162
PagerData::fname
const char * fname
Name of the file to read.
Definition
lib.h:166
PagerView
Paged view into some data.
Definition
lib.h:173
PagerView::pdata
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition
lib.h:174
PagerView::mode
enum PagerMode mode
Pager mode.
Definition
lib.h:175
PagerView::flags
PagerFlags flags
Additional settings to tweak pager's function.
Definition
lib.h:176
PagerView::banner
const char * banner
Title to display in status bar.
Definition
lib.h:177
get_elem_list
struct HashElemArray get_elem_list(struct ConfigSet *cs, enum GetElemListFlags flags)
Create a sorted list of all config items.
Definition
subset.c:81
GetElemListFlags
GetElemListFlags
Filtering modes for get_elem_list().
Definition
subset.h:80
buf_mktemp
#define buf_mktemp(buf)
Definition
tmp.h:33