The DT_COMMAND type is unnecessary; it behaves exactly the same as DT_STRING.
Only the NeoMutt code needs to make the distinction, so use a subclass
of DT_STRING instead of a separate type.
###############################################################################
# libconfig
LIBCONFIG= libconfig.a
-LIBCONFIGOBJS= config/address.o config/bool.o config/command.o config/dump.o \
+LIBCONFIGOBJS= config/address.o config/bool.o config/dump.o \
config/long.o config/magic.o config/mbtable.o config/number.o \
config/quad.o config/regex.o config/set.o \
config/sort.o config/string.o
+++ /dev/null
-/**
- * @file
- * Type representing a command
- *
- * @authors
- * Copyright (C) 2018 Richard Russon <rich@flatcap.org>
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * @page config_command Type: Command
- *
- * Type representing a command.
- */
-
-#include "config.h"
-#include <stddef.h>
-#include <limits.h>
-#include <stdint.h>
-#include "mutt/mutt.h"
-#include "set.h"
-#include "types.h"
-
-/**
- * command_destroy - Destroy a Command
- * @param cs Config items
- * @param var Variable to destroy
- * @param cdef Variable definition
- */
-static void command_destroy(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef)
-{
- if (!cs || !var || !cdef)
- return; /* LCOV_EXCL_LINE */
-
- const char **str = (const char **) var;
- if (!*str)
- return;
-
- /* Don't free strings from the var definition */
- if (*(char **) var == (char *) cdef->initial)
- {
- *(char **) var = NULL;
- return;
- }
-
- FREE(var);
-}
-
-/**
- * command_string_set - Set a Command by string
- * @param cs Config items
- * @param var Variable to set
- * @param cdef Variable definition
- * @param value Value to set
- * @param err Buffer for error messages
- * @retval num Result, e.g. #CSR_SUCCESS
- *
- * If var is NULL, then the config item's initial value will be set.
- */
-static int command_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef,
- const char *value, struct Buffer *err)
-{
- if (!cs || !cdef)
- return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
-
- /* Store empty strings as NULL */
- if (value && (value[0] == '\0'))
- value = NULL;
-
- if (!value && (cdef->type & DT_NOT_EMPTY))
- {
- mutt_buffer_printf(err, "Option %s may not be empty", cdef->name);
- return CSR_ERR_INVALID | CSR_INV_VALIDATOR;
- }
-
- int rc = CSR_SUCCESS;
-
- if (var)
- {
- if (mutt_str_strcmp(value, (*(char **) var)) == 0)
- return CSR_SUCCESS | CSR_SUC_NO_CHANGE;
-
- if (cdef->validator)
- {
- rc = cdef->validator(cs, cdef, (intptr_t) value, err);
-
- if (CSR_RESULT(rc) != CSR_SUCCESS)
- return rc | CSR_INV_VALIDATOR;
- }
-
- command_destroy(cs, var, cdef);
-
- const char *str = mutt_str_strdup(value);
- if (!str)
- rc |= CSR_SUC_EMPTY;
-
- *(const char **) var = str;
- }
- else
- {
- /* we're already using the initial value */
- if (*(char **) cdef->var == (char *) cdef->initial)
- *(char **) cdef->var = mutt_str_strdup((char *) cdef->initial);
-
- if (cdef->type & DT_INITIAL_SET)
- FREE(&cdef->initial);
-
- cdef->type |= DT_INITIAL_SET;
- cdef->initial = IP mutt_str_strdup(value);
- }
-
- return rc;
-}
-
-/**
- * command_string_get - Get a Command as a string
- * @param cs Config items
- * @param var Variable to get
- * @param cdef Variable definition
- * @param result Buffer for results or error messages
- * @retval num Result, e.g. #CSR_SUCCESS
- *
- * If var is NULL, then the config item's initial value will be returned.
- */
-static int command_string_get(const struct ConfigSet *cs, void *var,
- const struct ConfigDef *cdef, struct Buffer *result)
-{
- if (!cs || !cdef)
- return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
-
- const char *str = NULL;
-
- if (var)
- str = *(const char **) var;
- else
- str = (char *) cdef->initial;
-
- if (!str)
- return CSR_SUCCESS | CSR_SUC_EMPTY; /* empty string */
-
- mutt_buffer_addstr(result, str);
- return CSR_SUCCESS;
-}
-
-/**
- * command_native_set - Set a Command config item by string
- * @param cs Config items
- * @param var Variable to set
- * @param cdef Variable definition
- * @param value Native pointer/value to set
- * @param err Buffer for error messages
- * @retval num Result, e.g. #CSR_SUCCESS
- */
-static int command_native_set(const struct ConfigSet *cs, void *var,
- const struct ConfigDef *cdef, intptr_t value,
- struct Buffer *err)
-{
- if (!cs || !var || !cdef)
- return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
-
- const char *str = (const char *) value;
-
- /* Store empty strings as NULL */
- if (str && (str[0] == '\0'))
- value = 0;
-
- if ((value == 0) && (cdef->type & DT_NOT_EMPTY))
- {
- mutt_buffer_printf(err, "Option %s may not be empty", cdef->name);
- return CSR_ERR_INVALID | CSR_INV_VALIDATOR;
- }
-
- if (mutt_str_strcmp((const char *) value, (*(char **) var)) == 0)
- return CSR_SUCCESS | CSR_SUC_NO_CHANGE;
-
- int rc;
-
- if (cdef->validator)
- {
- rc = cdef->validator(cs, cdef, value, err);
-
- if (CSR_RESULT(rc) != CSR_SUCCESS)
- return rc | CSR_INV_VALIDATOR;
- }
-
- command_destroy(cs, var, cdef);
-
- str = mutt_str_strdup(str);
- rc = CSR_SUCCESS;
- if (!str)
- rc |= CSR_SUC_EMPTY;
-
- *(const char **) var = str;
- return rc;
-}
-
-/**
- * command_native_get - Get a string from a Command config item
- * @param cs Config items
- * @param var Variable to get
- * @param cdef Variable definition
- * @param err Buffer for error messages
- * @retval intptr_t Command string
- * @retval INT_MIN Error
- */
-static intptr_t command_native_get(const struct ConfigSet *cs, void *var,
- const struct ConfigDef *cdef, struct Buffer *err)
-{
- if (!cs || !var || !cdef)
- return INT_MIN; /* LCOV_EXCL_LINE */
-
- const char *str = *(const char **) var;
-
- return (intptr_t) str;
-}
-
-/**
- * command_reset - Reset a Command to its initial value
- * @param cs Config items
- * @param var Variable to reset
- * @param cdef Variable definition
- * @param err Buffer for error messages
- * @retval num Result, e.g. #CSR_SUCCESS
- */
-static int command_reset(const struct ConfigSet *cs, void *var,
- const struct ConfigDef *cdef, struct Buffer *err)
-{
- if (!cs || !var || !cdef)
- return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
-
- int rc = CSR_SUCCESS;
-
- const char *cmd = (const char *) cdef->initial;
- if (!cmd)
- rc |= CSR_SUC_EMPTY;
-
- if (mutt_str_strcmp(cmd, (*(char **) var)) == 0)
- return rc | CSR_SUC_NO_CHANGE;
-
- if (cdef->validator)
- {
- rc = cdef->validator(cs, cdef, cdef->initial, err);
-
- if (CSR_RESULT(rc) != CSR_SUCCESS)
- return rc | CSR_INV_VALIDATOR;
- }
-
- command_destroy(cs, var, cdef);
-
- if (!cmd)
- rc |= CSR_SUC_EMPTY;
-
- *(const char **) var = cmd;
- return rc;
-}
-
-/**
- * command_init - Register the Command config type
- * @param cs Config items
- */
-void command_init(struct ConfigSet *cs)
-{
- const struct ConfigSetType cst_command = {
- "command", command_string_set, command_string_get,
- command_native_set, command_native_get, command_reset,
- command_destroy,
- };
- cs_register_type(cs, DT_COMMAND, &cst_command);
-}
+++ /dev/null
-/**
- * @file
- * Type representing a command
- *
- * @authors
- * Copyright (C) 2018 Richard Russon <rich@flatcap.org>
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MUTT_CONFIG_COMMAND_H
-#define MUTT_CONFIG_COMMAND_H
-
-struct ConfigSet;
-
-void command_init(struct ConfigSet *cs);
-
-#endif /* MUTT_CONFIG_COMMAND_H */
* | :------------------ | :------------------------- |
* | config/address.c | @subpage config_address |
* | config/bool.c | @subpage config_bool |
- * | config/command.c | @subpage config_command |
* | config/dump.c | @subpage config_dump |
* | config/long.c | @subpage config_long |
* | config/magic.c | @subpage config_magic |
#include "address.h"
#include "bool.h"
-#include "command.h"
#include "dump.h"
#include "inheritance.h"
#include "long.h"
/* Data Types */
#define DT_ADDRESS 1 ///< e-mail address
#define DT_BOOL 2 ///< boolean option
-#define DT_COMMAND 3 ///< a command
#define DT_ENUM 4 ///< an enumeration
#define DT_HCACHE 5 ///< header cache backend
#define DT_LONG 6 ///< a number (long)
#define DT_MAILBOX (1 << 8) ///< Don't perform path expansions
#define DT_SENSITIVE (1 << 9) ///< Contains sensitive value, e.g. password
#define DT_PATH (1 << 10) ///< A pathname
+#define DT_COMMAND (1 << 11) ///< A command
#define IS_SENSITIVE(x) (((x).type & DT_SENSITIVE) == DT_SENSITIVE)
#define IS_PATH(x) (((x)->type & (DT_STRING | DT_PATH)) == (DT_STRING | DT_PATH))
+#define IS_COMMAND(x) (((x)->type & (DT_STRING | DT_COMMAND)) == (DT_STRING | DT_COMMAND))
/* subtypes for... */
#define DT_SUBTYPE_MASK 0x0FE0 ///< Mask for the Data Subtype
}
}
}
- else if (DTYPE(he->type) == DT_COMMAND)
+ else if (IS_COMMAND(he))
{
char scratch[PATH_MAX];
mutt_str_strfcpy(scratch, buf->data, sizeof(scratch));
address_init(cs);
bool_init(cs);
- command_init(cs);
long_init(cs);
magic_init(cs);
mbtable_init(cs);
** If this option is \fIset\fP, NeoMutt's received-attachments menu will not show the subparts of
** individual messages in a multipart/digest. To see these subparts, press "v" on that menu.
*/
- { "display_filter", DT_COMMAND|R_PAGER, &C_DisplayFilter, 0 },
+ { "display_filter", DT_STRING|DT_COMMAND|R_PAGER, &C_DisplayFilter, 0 },
/*
** .pp
** When set, specifies a command used to filter messages. When a message
** \fBNote\fP that changes made to the References: and Date: headers are
** ignored for interoperability reasons.
*/
- { "editor", DT_COMMAND, &C_Editor, IP "vi" },
+ { "editor", DT_STRING|DT_COMMAND, &C_Editor, IP "vi" },
/*
** .pp
** This variable specifies which editor is used by NeoMutt.
** .pp
** Escape character to use for functions in the built-in editor.
*/
- { "external_search_command", DT_COMMAND, &C_ExternalSearchCommand, 0 },
+ { "external_search_command", DT_STRING|DT_COMMAND, &C_ExternalSearchCommand, 0 },
/*
** .pp
** If set, contains the name of the external program used by "~I" patterns.
** ``$save-hook'', ``$fcc-hook'' and ``$fcc-save-hook'', too.
*/
#ifdef USE_NNTP
- { "inews", DT_COMMAND, &C_Inews, 0 },
+ { "inews", DT_STRING|DT_COMMAND, &C_Inews, 0 },
/*
** .pp
** If set, specifies the program and arguments used to deliver news posted
** .te
*/
#endif
- { "ispell", DT_COMMAND, &C_Ispell, IP ISPELL },
+ { "ispell", DT_STRING|DT_COMMAND, &C_Ispell, IP ISPELL },
/*
** .pp
** How to invoke ispell (GNU's spell-checking software).
** is Usenet article, because MIME for news is nonstandard feature.
*/
#endif
- { "mime_type_query_command", DT_COMMAND, &C_MimeTypeQueryCommand, 0 },
+ { "mime_type_query_command", DT_STRING|DT_COMMAND, &C_MimeTypeQueryCommand, 0 },
/*
** .pp
** This specifies a command to run, to determine the mime type of a
** .dt %s .dd The remailer's short name
** .de
*/
- { "mixmaster", DT_COMMAND, &C_Mixmaster, IP MIXMASTER },
+ { "mixmaster", DT_STRING|DT_COMMAND, &C_Mixmaster, IP MIXMASTER },
/*
** .pp
** This variable contains the path to the Mixmaster binary on your
** See also $$read_inc, $$write_inc and $$net_inc.
*/
#endif
- { "new_mail_command", DT_COMMAND, &C_NewMailCommand, 0 },
+ { "new_mail_command", DT_STRING|DT_COMMAND, &C_NewMailCommand, 0 },
/*
** .pp
** If \fIset\fP, NeoMutt will call this command after a new message is received.
** connect to news server.
*/
#endif
- { "pager", DT_COMMAND, &C_Pager, IP "builtin" },
+ { "pager", DT_STRING|DT_COMMAND, &C_Pager, IP "builtin" },
/*
** .pp
** This variable specifies which pager you would like to use to view
** against $$pgp_decryption_okay.
** (PGP only)
*/
- { "pgp_clearsign_command", DT_COMMAND, &C_PgpClearsignCommand, 0 },
+ { "pgp_clearsign_command", DT_STRING|DT_COMMAND, &C_PgpClearsignCommand, 0 },
/*
** .pp
** This format is used to create an old-style "clearsigned" PGP
** one or more quoted values such as email address, name, or keyid.
** (PGP only)
*/
- { "pgp_decode_command", DT_COMMAND, &C_PgpDecodeCommand, 0 },
+ { "pgp_decode_command", DT_STRING|DT_COMMAND, &C_PgpDecodeCommand, 0 },
/*
** .pp
** This format strings specifies a command which is used to decode
** alongside the documentation.
** (PGP only)
*/
- { "pgp_decrypt_command", DT_COMMAND, &C_PgpDecryptCommand, 0 },
+ { "pgp_decrypt_command", DT_STRING|DT_COMMAND, &C_PgpDecryptCommand, 0 },
/*
** .pp
** This command is used to decrypt a PGP encrypted message.
** (PGP only)
*/
#ifdef CRYPT_BACKEND_CLASSIC_PGP
- { "pgp_encrypt_only_command", DT_COMMAND, &C_PgpEncryptOnlyCommand, 0 },
+ { "pgp_encrypt_only_command", DT_STRING|DT_COMMAND, &C_PgpEncryptOnlyCommand, 0 },
/*
** .pp
** This command is used to encrypt a body part without signing it.
** one or more quoted values such as email address, name, or keyid.
** (PGP only)
*/
- { "pgp_encrypt_sign_command", DT_COMMAND, &C_PgpEncryptSignCommand, 0 },
+ { "pgp_encrypt_sign_command", DT_STRING|DT_COMMAND, &C_PgpEncryptSignCommand, 0 },
/*
** .pp
** This command is used to both sign and encrypt a body part.
** (PGP only)
*/
#ifdef CRYPT_BACKEND_CLASSIC_PGP
- { "pgp_export_command", DT_COMMAND, &C_PgpExportCommand, 0 },
+ { "pgp_export_command", DT_STRING|DT_COMMAND, &C_PgpExportCommand, 0 },
/*
** .pp
** This command is used to export a public key from the user's
** possible \fCprintf(3)\fP-like sequences.
** (PGP only)
*/
- { "pgp_getkeys_command", DT_COMMAND, &C_PgpGetkeysCommand, 0 },
+ { "pgp_getkeys_command", DT_STRING|DT_COMMAND, &C_PgpGetkeysCommand, 0 },
/*
** .pp
** This command is invoked whenever NeoMutt needs to fetch the public key associated with
** (PGP only)
*/
#ifdef CRYPT_BACKEND_CLASSIC_PGP
- { "pgp_import_command", DT_COMMAND, &C_PgpImportCommand, 0 },
+ { "pgp_import_command", DT_STRING|DT_COMMAND, &C_PgpImportCommand, 0 },
/*
** .pp
** This command is used to import a key from a message into
** possible \fCprintf(3)\fP-like sequences.
** (PGP only)
*/
- { "pgp_list_pubring_command", DT_COMMAND, &C_PgpListPubringCommand, 0 },
+ { "pgp_list_pubring_command", DT_STRING|DT_COMMAND, &C_PgpListPubringCommand, 0 },
/*
** .pp
** This command is used to list the public key ring's contents. The
** possible \fCprintf(3)\fP-like sequences.
** (PGP only)
*/
- { "pgp_list_secring_command", DT_COMMAND, &C_PgpListSecringCommand, 0 },
+ { "pgp_list_secring_command", DT_STRING|DT_COMMAND, &C_PgpListSecringCommand, 0 },
/*
** .pp
** This command is used to list the secret key ring's contents. The
** (PGP only)
*/
#ifdef CRYPT_BACKEND_CLASSIC_PGP
- { "pgp_sign_command", DT_COMMAND, &C_PgpSignCommand, 0 },
+ { "pgp_sign_command", DT_STRING|DT_COMMAND, &C_PgpSignCommand, 0 },
/*
** .pp
** This command is used to create the detached PGP signature for a
** \fIunset\fP this variable.
** (PGP only)
*/
- { "pgp_verify_command", DT_COMMAND, &C_PgpVerifyCommand, 0 },
+ { "pgp_verify_command", DT_STRING|DT_COMMAND, &C_PgpVerifyCommand, 0 },
/*
** .pp
** This command is used to verify PGP signatures.
** possible \fCprintf(3)\fP-like sequences.
** (PGP only)
*/
- { "pgp_verify_key_command", DT_COMMAND, &C_PgpVerifyKeyCommand, 0 },
+ { "pgp_verify_key_command", DT_STRING|DT_COMMAND, &C_PgpVerifyKeyCommand, 0 },
/*
** .pp
** This command is used to verify key information from the key selection
** This is set to "ask-no" by default, because some people
** accidentally hit "p" often.
*/
- { "print_command", DT_COMMAND, &C_PrintCommand, IP "lpr" },
+ { "print_command", DT_STRING|DT_COMMAND, &C_PrintCommand, IP "lpr" },
/*
** .pp
** This specifies the command pipe that should be used to print messages.
** than returning to the index menu. If \fIunset\fP, NeoMutt will return to the
** index menu when the external pager exits.
*/
- { "query_command", DT_COMMAND, &C_QueryCommand, 0 },
+ { "query_command", DT_STRING|DT_COMMAND, &C_QueryCommand, 0 },
/*
** .pp
** This specifies the command NeoMutt will use to make external address
** In case the text can't be converted into one of these exactly,
** NeoMutt uses $$charset as a fallback.
*/
- { "sendmail", DT_COMMAND, &C_Sendmail, IP SENDMAIL " -oem -oi" },
+ { "sendmail", DT_STRING|DT_COMMAND, &C_Sendmail, IP SENDMAIL " -oem -oi" },
/*
** .pp
** Specifies the program and arguments used to deliver mail sent by NeoMutt.
** process will be put in a temporary file. If there is some error, you
** will be informed as to where to find the output.
*/
- { "shell", DT_COMMAND, &C_Shell, IP "/bin/sh" },
+ { "shell", DT_STRING|DT_COMMAND, &C_Shell, IP "/bin/sh" },
/*
** .pp
** Command to use when spawning a subshell.
** the location of the certificates.
** (S/MIME only)
*/
- { "smime_decrypt_command", DT_COMMAND, &C_SmimeDecryptCommand, 0 },
+ { "smime_decrypt_command", DT_STRING|DT_COMMAND, &C_SmimeDecryptCommand, 0 },
/*
** .pp
** This format string specifies a command which is used to decrypt
** (S/MIME only)
*/
#ifdef CRYPT_BACKEND_CLASSIC_SMIME
- { "smime_encrypt_command", DT_COMMAND, &C_SmimeEncryptCommand, 0 },
+ { "smime_encrypt_command", DT_STRING|DT_COMMAND, &C_SmimeEncryptCommand, 0 },
/*
** .pp
** This command is used to create encrypted S/MIME messages.
** (S/MIME only)
*/
#ifdef CRYPT_BACKEND_CLASSIC_SMIME
- { "smime_get_cert_command", DT_COMMAND, &C_SmimeGetCertCommand, 0 },
+ { "smime_get_cert_command", DT_STRING|DT_COMMAND, &C_SmimeGetCertCommand, 0 },
/*
** .pp
** This command is used to extract X509 certificates from a PKCS7 structure.
** possible \fCprintf(3)\fP-like sequences.
** (S/MIME only)
*/
- { "smime_get_cert_email_command", DT_COMMAND, &C_SmimeGetCertEmailCommand, 0 },
+ { "smime_get_cert_email_command", DT_STRING|DT_COMMAND, &C_SmimeGetCertEmailCommand, 0 },
/*
** .pp
** This command is used to extract the mail address(es) used for storing
** possible \fCprintf(3)\fP-like sequences.
** (S/MIME only)
*/
- { "smime_get_signer_cert_command", DT_COMMAND, &C_SmimeGetSignerCertCommand, 0 },
+ { "smime_get_signer_cert_command", DT_STRING|DT_COMMAND, &C_SmimeGetSignerCertCommand, 0 },
/*
** .pp
** This command is used to extract only the signers X509 certificate from a S/MIME
** possible \fCprintf(3)\fP-like sequences.
** (S/MIME only)
*/
- { "smime_import_cert_command", DT_COMMAND, &C_SmimeImportCertCommand, 0 },
+ { "smime_import_cert_command", DT_STRING|DT_COMMAND, &C_SmimeImportCertCommand, 0 },
/*
** .pp
** This command is used to import a certificate via smime_keys.
** edited. This option points to the location of the private keys.
** (S/MIME only)
*/
- { "smime_pk7out_command", DT_COMMAND, &C_SmimePk7outCommand, 0 },
+ { "smime_pk7out_command", DT_STRING|DT_COMMAND, &C_SmimePk7outCommand, 0 },
/*
** .pp
** This command is used to extract PKCS7 structures of S/MIME signatures,
** (S/MIME only)
*/
#ifdef CRYPT_BACKEND_CLASSIC_SMIME
- { "smime_sign_command", DT_COMMAND, &C_SmimeSignCommand, 0 },
+ { "smime_sign_command", DT_STRING|DT_COMMAND, &C_SmimeSignCommand, 0 },
/*
** .pp
** This command is used to created S/MIME signatures of type
** not used.
** (S/MIME only)
*/
- { "smime_verify_command", DT_COMMAND, &C_SmimeVerifyCommand, 0 },
+ { "smime_verify_command", DT_STRING|DT_COMMAND, &C_SmimeVerifyCommand, 0 },
/*
** .pp
** This command is used to verify S/MIME signatures of type \fCmultipart/signed\fP.
** possible \fCprintf(3)\fP-like sequences.
** (S/MIME only)
*/
- { "smime_verify_opaque_command", DT_COMMAND, &C_SmimeVerifyOpaqueCommand, 0 },
+ { "smime_verify_opaque_command", DT_STRING|DT_COMMAND, &C_SmimeVerifyOpaqueCommand, 0 },
/*
** .pp
** This command is used to verify S/MIME signatures of type
** mailbox descriptions as a value.
*/
#endif
- { "visual", DT_COMMAND, &C_Visual, IP "vi" },
+ { "visual", DT_STRING|DT_COMMAND, &C_Visual, IP "vi" },
/*
** .pp
** Specifies the visual editor to invoke when the "\fC~v\fP" command is
case DT_ADDRESS:
case DT_MBTABLE:
case DT_REGEX:
- case DT_COMMAND:
case DT_SORT:
case DT_STRING:
case DT_MAGIC:
switch (DTYPE(cdef->type))
{
case DT_ADDRESS:
- case DT_COMMAND:
case DT_MAGIC:
case DT_MBTABLE:
case DT_REGEX:
compress.c
config/address.c
config/bool.c
-config/command.c
config/dump.c
config/long.c
config/magic.c
CONFIG_OBJS = test/config/account.o \
test/config/address.o \
test/config/bool.o \
- test/config/command.o \
test/config/common.o \
test/config/dump.o \
test/config/initial.o \
+++ /dev/null
-/**
- * @file
- * Test code for the Command object
- *
- * @authors
- * Copyright (C) 2017-2018 Richard Russon <rich@flatcap.org>
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#define TEST_NO_MAIN
-#include "acutest.h"
-#include "config.h"
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdio.h>
-#include "mutt/mutt.h"
-#include "config/common.h"
-#include "config/lib.h"
-#include "account.h"
-
-static char *VarApple;
-static char *VarBanana;
-static char *VarCherry;
-static char *VarDamson;
-static char *VarElderberry;
-static char *VarFig;
-static char *VarGuava;
-static char *VarHawthorn;
-static char *VarIlama;
-static char *VarJackfruit;
-static char *VarKumquat;
-static char *VarLemon;
-static char *VarMango;
-static char *VarNectarine;
-static char *VarOlive;
-static char *VarPapaya;
-static char *VarQuince;
-static char *VarRaspberry;
-static char *VarStrawberry;
-
-// clang-format off
-static struct ConfigDef Vars[] = {
- { "Apple", DT_COMMAND, &VarApple, IP "/apple", 0, NULL }, /* test_initial_values */
- { "Banana", DT_COMMAND, &VarBanana, IP "/banana", 0, NULL },
- { "Cherry", DT_COMMAND, &VarCherry, IP "/cherry", 0, NULL },
- { "Damson", DT_COMMAND, &VarDamson, 0, 0, NULL }, /* test_string_set */
- { "Elderberry", DT_COMMAND, &VarElderberry, IP "/elderberry", 0, NULL },
- { "Fig", DT_COMMAND|DT_NOT_EMPTY, &VarFig, IP "fig", 0, NULL },
- { "Guava", DT_COMMAND, &VarGuava, 0, 0, NULL }, /* test_string_get */
- { "Hawthorn", DT_COMMAND, &VarHawthorn, IP "/hawthorn", 0, NULL },
- { "Ilama", DT_COMMAND, &VarIlama, 0, 0, NULL },
- { "Jackfruit", DT_COMMAND, &VarJackfruit, 0, 0, NULL }, /* test_native_set */
- { "Kumquat", DT_COMMAND, &VarKumquat, IP "/kumquat", 0, NULL },
- { "Lemon", DT_COMMAND|DT_NOT_EMPTY, &VarLemon, IP "lemon", 0, NULL },
- { "Mango", DT_COMMAND, &VarMango, 0, 0, NULL }, /* test_native_get */
- { "Nectarine", DT_COMMAND, &VarNectarine, IP "/nectarine", 0, NULL }, /* test_reset */
- { "Olive", DT_COMMAND, &VarOlive, IP "/olive", 0, validator_fail },
- { "Papaya", DT_COMMAND, &VarPapaya, IP "/papaya", 0, validator_succeed }, /* test_validator */
- { "Quince", DT_COMMAND, &VarQuince, IP "/quince", 0, validator_warn },
- { "Raspberry", DT_COMMAND, &VarRaspberry, IP "/raspberry", 0, validator_fail },
- { "Strawberry", DT_COMMAND, &VarStrawberry, 0, 0, NULL }, /* test_inherit */
- { NULL },
-};
-// clang-format on
-
-static bool test_initial_values(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
- TEST_MSG("Apple = %s\n", VarApple);
- TEST_MSG("Banana = %s\n", VarBanana);
-
- if (!TEST_CHECK(mutt_str_strcmp(VarApple, "/apple") == 0))
- {
- TEST_MSG("Error: initial values were wrong\n");
- return false;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(VarBanana, "/banana") == 0))
- {
- TEST_MSG("Error: initial values were wrong\n");
- return false;
- }
-
- cs_str_string_set(cs, "Apple", "/etc", err);
- cs_str_string_set(cs, "Banana", NULL, err);
-
- struct Buffer value;
- mutt_buffer_init(&value);
- value.dsize = 256;
- value.data = mutt_mem_calloc(1, value.dsize);
- mutt_buffer_reset(&value);
-
- int rc;
-
- mutt_buffer_reset(&value);
- rc = cs_str_initial_get(cs, "Apple", &value);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", value.data);
- FREE(&value.data);
- return false;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(value.data, "/apple") == 0))
- {
- TEST_MSG("Apple's initial value is wrong: '%s'\n", value.data);
- FREE(&value.data);
- return false;
- }
- TEST_MSG("Apple = '%s'\n", VarApple);
- TEST_MSG("Apple's initial value is '%s'\n", value.data);
-
- mutt_buffer_reset(&value);
- rc = cs_str_initial_get(cs, "Banana", &value);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", value.data);
- FREE(&value.data);
- return false;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(value.data, "/banana") == 0))
- {
- TEST_MSG("Banana's initial value is wrong: '%s'\n", value.data);
- FREE(&value.data);
- return false;
- }
- TEST_MSG("Banana = '%s'\n", VarBanana);
- TEST_MSG("Banana's initial value is '%s'\n", NONULL(value.data));
-
- mutt_buffer_reset(&value);
- rc = cs_str_initial_set(cs, "Cherry", "/tmp", &value);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", value.data);
- FREE(&value.data);
- return false;
- }
-
- mutt_buffer_reset(&value);
- rc = cs_str_initial_set(cs, "Cherry", "/usr", &value);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", value.data);
- FREE(&value.data);
- return false;
- }
-
- mutt_buffer_reset(&value);
- rc = cs_str_initial_get(cs, "Cherry", &value);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", value.data);
- FREE(&value.data);
- return false;
- }
-
- TEST_MSG("Cherry = '%s'\n", VarCherry);
- TEST_MSG("Cherry's initial value is '%s'\n", NONULL(value.data));
-
- FREE(&value.data);
- log_line(__func__);
- return true;
-}
-
-static bool test_string_set(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
-
- const char *valid[] = { "hello", "world", "world", "", NULL };
- const char *name = "Damson";
-
- int rc;
- for (unsigned int i = 0; i < mutt_array_size(valid); i++)
- {
- mutt_buffer_reset(err);
- rc = cs_str_string_set(cs, name, valid[i], err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- if (rc & CSR_SUC_NO_CHANGE)
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- continue;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(VarDamson, valid[i]) == 0))
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- return false;
- }
- TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarDamson), NONULL(valid[i]));
- short_line();
- }
-
- name = "Fig";
- mutt_buffer_reset(err);
- rc = cs_str_string_set(cs, name, "", err);
- if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS))
- {
- TEST_MSG("Expected error: %s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- name = "Elderberry";
- for (unsigned int i = 0; i < mutt_array_size(valid); i++)
- {
- short_line();
- mutt_buffer_reset(err);
- rc = cs_str_string_set(cs, name, valid[i], err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- if (rc & CSR_SUC_NO_CHANGE)
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- continue;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(VarElderberry, valid[i]) == 0))
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- return false;
- }
- TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarElderberry), NONULL(valid[i]));
- }
-
- log_line(__func__);
- return true;
-}
-
-static bool test_string_get(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
- const char *name = "Guava";
-
- mutt_buffer_reset(err);
- int rc = cs_str_string_get(cs, name, err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("Get failed: %s\n", err->data);
- return false;
- }
- TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarGuava), err->data);
-
- name = "Hawthorn";
- mutt_buffer_reset(err);
- rc = cs_str_string_get(cs, name, err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("Get failed: %s\n", err->data);
- return false;
- }
- TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarHawthorn), err->data);
-
- name = "Ilama";
- rc = cs_str_string_set(cs, name, "ilama", err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- return false;
-
- mutt_buffer_reset(err);
- rc = cs_str_string_get(cs, name, err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("Get failed: %s\n", err->data);
- return false;
- }
- TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarIlama), err->data);
-
- log_line(__func__);
- return true;
-}
-
-static bool test_native_set(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
-
- const char *valid[] = { "hello", "world", "world", "", NULL };
- const char *name = "Jackfruit";
-
- int rc;
- for (unsigned int i = 0; i < mutt_array_size(valid); i++)
- {
- mutt_buffer_reset(err);
- rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- if (rc & CSR_SUC_NO_CHANGE)
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- continue;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(VarJackfruit, valid[i]) == 0))
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- return false;
- }
- TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarJackfruit), NONULL(valid[i]));
- short_line();
- }
-
- name = "Lemon";
- mutt_buffer_reset(err);
- rc = cs_str_native_set(cs, name, (intptr_t) "", err);
- if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS))
- {
- TEST_MSG("Expected error: %s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- name = "Kumquat";
- for (unsigned int i = 0; i < mutt_array_size(valid); i++)
- {
- short_line();
- mutt_buffer_reset(err);
- rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- if (rc & CSR_SUC_NO_CHANGE)
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- continue;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(VarKumquat, valid[i]) == 0))
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- return false;
- }
- TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarKumquat), NONULL(valid[i]));
- }
-
- log_line(__func__);
- return true;
-}
-
-static bool test_native_get(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
- const char *name = "Mango";
-
- int rc = cs_str_string_set(cs, name, "mango", err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- return false;
-
- mutt_buffer_reset(err);
- intptr_t value = cs_str_native_get(cs, name, err);
- if (!TEST_CHECK(mutt_str_strcmp(VarMango, (char *) value) == 0))
- {
- TEST_MSG("Get failed: %s\n", err->data);
- return false;
- }
- TEST_MSG("%s = '%s', '%s'\n", name, VarMango, (char *) value);
-
- log_line(__func__);
- return true;
-}
-
-static bool test_reset(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
-
- const char *name = "Nectarine";
- mutt_buffer_reset(err);
-
- TEST_MSG("Initial: %s = '%s'\n", name, VarNectarine);
- int rc = cs_str_string_set(cs, name, "hello", err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- return false;
- TEST_MSG("Set: %s = '%s'\n", name, VarNectarine);
-
- rc = cs_str_reset(cs, name, err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(VarNectarine, "/nectarine") == 0))
- {
- TEST_MSG("Value of %s wasn't changed\n", name);
- return false;
- }
-
- TEST_MSG("Reset: %s = '%s'\n", name, VarNectarine);
-
- rc = cs_str_reset(cs, name, err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- name = "Olive";
- mutt_buffer_reset(err);
-
- TEST_MSG("Initial: %s = '%s'\n", name, VarOlive);
- dont_fail = true;
- rc = cs_str_string_set(cs, name, "hello", err);
- if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- return false;
- TEST_MSG("Set: %s = '%s'\n", name, VarOlive);
- dont_fail = false;
-
- rc = cs_str_reset(cs, name, err);
- if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS))
- {
- TEST_MSG("Expected error: %s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
-
- if (!TEST_CHECK(mutt_str_strcmp(VarOlive, "hello") == 0))
- {
- TEST_MSG("Value of %s changed\n", name);
- return false;
- }
-
- TEST_MSG("Reset: %s = '%s'\n", name, VarOlive);
-
- log_line(__func__);
- return true;
-}
-
-static bool test_validator(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
-
- const char *name = "Papaya";
- mutt_buffer_reset(err);
- int rc = cs_str_string_set(cs, name, "hello", err);
- if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
- TEST_MSG("Command: %s = %s\n", name, VarPapaya);
-
- mutt_buffer_reset(err);
- rc = cs_str_native_set(cs, name, IP "world", err);
- if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
- TEST_MSG("Native: %s = %s\n", name, VarPapaya);
-
- name = "Quince";
- mutt_buffer_reset(err);
- rc = cs_str_string_set(cs, name, "hello", err);
- if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
- TEST_MSG("Command: %s = %s\n", name, VarQuince);
-
- mutt_buffer_reset(err);
- rc = cs_str_native_set(cs, name, IP "world", err);
- if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
- {
- TEST_MSG("%s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
- TEST_MSG("Native: %s = %s\n", name, VarQuince);
-
- name = "Raspberry";
- mutt_buffer_reset(err);
- rc = cs_str_string_set(cs, name, "hello", err);
- if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS))
- {
- TEST_MSG("Expected error: %s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
- TEST_MSG("Command: %s = %s\n", name, VarRaspberry);
-
- mutt_buffer_reset(err);
- rc = cs_str_native_set(cs, name, IP "world", err);
- if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS))
- {
- TEST_MSG("Expected error: %s\n", err->data);
- }
- else
- {
- TEST_MSG("%s\n", err->data);
- return false;
- }
- TEST_MSG("Native: %s = %s\n", name, VarRaspberry);
-
- log_line(__func__);
- return true;
-}
-
-static void dump_native(struct ConfigSet *cs, const char *parent, const char *child)
-{
- intptr_t pval = cs_str_native_get(cs, parent, NULL);
- intptr_t cval = cs_str_native_get(cs, child, NULL);
-
- TEST_MSG("%15s = %s\n", parent, (char *) pval);
- TEST_MSG("%15s = %s\n", child, (char *) cval);
-}
-
-static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
-{
- log_line(__func__);
- bool result = false;
-
- const char *account = "fruit";
- const char *parent = "Strawberry";
- char child[128];
- snprintf(child, sizeof(child), "%s:%s", account, parent);
-
- const char *AccountVarStr[] = {
- parent,
- NULL,
- };
-
- struct Account *a = account_new();
- account_add_config(a, cs, account, AccountVarStr);
-
- // set parent
- mutt_buffer_reset(err);
- int rc = cs_str_string_set(cs, parent, "hello", err);
- if (CSR_RESULT(rc) != CSR_SUCCESS)
- {
- TEST_MSG("Error: %s\n", err->data);
- goto ti_out;
- }
- dump_native(cs, parent, child);
-
- // set child
- mutt_buffer_reset(err);
- rc = cs_str_string_set(cs, child, "world", err);
- if (CSR_RESULT(rc) != CSR_SUCCESS)
- {
- TEST_MSG("Error: %s\n", err->data);
- goto ti_out;
- }
- dump_native(cs, parent, child);
-
- // reset child
- mutt_buffer_reset(err);
- rc = cs_str_reset(cs, child, err);
- if (CSR_RESULT(rc) != CSR_SUCCESS)
- {
- TEST_MSG("Error: %s\n", err->data);
- goto ti_out;
- }
- dump_native(cs, parent, child);
-
- // reset parent
- mutt_buffer_reset(err);
- rc = cs_str_reset(cs, parent, err);
- if (CSR_RESULT(rc) != CSR_SUCCESS)
- {
- TEST_MSG("Error: %s\n", err->data);
- goto ti_out;
- }
- dump_native(cs, parent, child);
-
- log_line(__func__);
- result = true;
-ti_out:
- account_free(&a);
- return result;
-}
-
-void config_command(void)
-{
- struct Buffer err;
- mutt_buffer_init(&err);
- err.dsize = 256;
- err.data = mutt_mem_calloc(1, err.dsize);
- mutt_buffer_reset(&err);
-
- struct ConfigSet *cs = cs_new(30);
-
- command_init(cs);
- dont_fail = true;
- if (!cs_register_variables(cs, Vars, 0))
- return;
- dont_fail = false;
-
- notify_observer_add(cs->notify, NT_CONFIG, 0, log_observer, 0);
-
- set_list(cs);
-
- TEST_CHECK(test_initial_values(cs, &err));
- TEST_CHECK(test_string_set(cs, &err));
- TEST_CHECK(test_string_get(cs, &err));
- TEST_CHECK(test_native_set(cs, &err));
- TEST_CHECK(test_native_get(cs, &err));
- TEST_CHECK(test_reset(cs, &err));
- TEST_CHECK(test_validator(cs, &err));
- TEST_CHECK(test_inherit(cs, &err));
-
- cs_free(&cs);
- FREE(&err.data);
-}
+++ /dev/null
-/**
- * @file
- * Test code for the Command object
- *
- * @authors
- * Copyright (C) 2017-2018 Richard Russon <rich@flatcap.org>
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _TEST_COMMAND_H
-#define _TEST_COMMAND_H
-
-#include <stdbool.h>
-
-void config_command(void);
-
-#endif /* _TEST_COMMAND_H */
// clang-format off
static struct ConfigDef Vars[] = {
- { "Apple", DT_BOOL, &VarApple, false, 0, NULL },
- { "Banana", DT_BOOL, &VarBanana, true, 0, NULL },
- { "Cherry", DT_NUMBER, &VarCherry, 0, 0, NULL },
- { "Damson", DT_SYNONYM, NULL, IP "Cherry", 0, NULL },
- { "Elderberry", DT_ADDRESS, &VarElderberry, IP "elderberry@example.com", 0, NULL },
- { "Fig", DT_COMMAND|DT_NOT_EMPTY, &VarFig, IP "fig", 0, NULL },
- { "Guava", DT_LONG, &VarGuava, 0, 0, NULL },
- { "Hawthorn", DT_MAGIC, &VarHawthorn, 1, 0, NULL },
- { "Ilama", DT_MBTABLE, &VarIlama, 0, 0, NULL },
- { "Jackfruit", DT_STRING|DT_PATH, &VarJackfruit, IP "/etc/passwd", 0, NULL },
- { "Kumquat", DT_QUAD, &VarKumquat, 0, 0, NULL },
- { "Lemon", DT_REGEX, &VarLemon, 0, 0, NULL },
- { "Mango", DT_SORT, &VarMango, 1, 0, NULL },
- { "Nectarine", DT_STRING|DT_SENSITIVE, &VarNectarine, IP "nectarine", 0, NULL },
+ { "Apple", DT_BOOL, &VarApple, false, 0, NULL },
+ { "Banana", DT_BOOL, &VarBanana, true, 0, NULL },
+ { "Cherry", DT_NUMBER, &VarCherry, 0, 0, NULL },
+ { "Damson", DT_SYNONYM, NULL, IP "Cherry", 0, NULL },
+ { "Elderberry", DT_ADDRESS, &VarElderberry, IP "elderberry@example.com", 0, NULL },
+ { "Fig", DT_STRING|DT_COMMAND|DT_NOT_EMPTY, &VarFig, IP "fig", 0, NULL },
+ { "Guava", DT_LONG, &VarGuava, 0, 0, NULL },
+ { "Hawthorn", DT_MAGIC, &VarHawthorn, 1, 0, NULL },
+ { "Ilama", DT_MBTABLE, &VarIlama, 0, 0, NULL },
+ { "Jackfruit", DT_STRING|DT_PATH, &VarJackfruit, IP "/etc/passwd", 0, NULL },
+ { "Kumquat", DT_QUAD, &VarKumquat, 0, 0, NULL },
+ { "Lemon", DT_REGEX, &VarLemon, 0, 0, NULL },
+ { "Mango", DT_SORT, &VarMango, 1, 0, NULL },
+ { "Nectarine", DT_STRING|DT_SENSITIVE, &VarNectarine, IP "nectarine", 0, NULL },
{ NULL },
};
// clang-format on
address_init(cs);
bool_init(cs);
- command_init(cs);
long_init(cs);
magic_init(cs);
mbtable_init(cs);
NEOMUTT_TEST_ITEM(config_synonym) \
NEOMUTT_TEST_ITEM(config_address) \
NEOMUTT_TEST_ITEM(config_bool) \
- NEOMUTT_TEST_ITEM(config_command) \
NEOMUTT_TEST_ITEM(config_long) \
NEOMUTT_TEST_ITEM(config_magic) \
NEOMUTT_TEST_ITEM(config_mbtable) \