1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-28 01:35:32 +00:00

[cmdline] const return value

This commit is contained in:
Witold Filipczyk 2022-02-18 14:42:25 +01:00
parent ac485a429d
commit 29a84b5f44
5 changed files with 17 additions and 17 deletions

View File

@ -59,7 +59,7 @@ parse_options_(int argc, char *argv[], struct option *opt,
struct option *option;
char *argname = &argv[-1][1];
char *oname = stracpy(argname);
char *err;
const char *err;
if (!oname) continue;
@ -132,7 +132,7 @@ parse_options(int argc, char *argv[],
Options handlers
**********************************************************************/
static char *
static const char *
eval_cmd(struct option *o, char ***argv, int *argc)
{
if (*argc < 1) return gettext("Parameter expected");
@ -146,14 +146,14 @@ eval_cmd(struct option *o, char ***argv, int *argc)
return NULL;
}
static char *
static const char *
forcehtml_cmd(struct option *o, char ***argv, int *argc)
{
safe_strncpy(get_opt_str("mime.default_type", NULL), "text/html", MAX_STR_LEN);
return NULL;
}
static char *
static const char *
lookup_cmd(struct option *o, char ***argv, int *argc)
{
struct sockaddr_storage *addrs = NULL;
@ -242,7 +242,7 @@ struct remote_method {
enum remote_method_enum type;
};
static char *
static const char *
remote_cmd(struct option *o, char ***argv, int *argc)
{
struct remote_method remote_methods[] = {
@ -451,7 +451,7 @@ remote_cmd(struct option *o, char ***argv, int *argc)
return NULL;
}
static char *
static const char *
version_cmd(struct option *o, char ***argv, int *argc)
{
printf("%s\n", full_static_version);
@ -697,7 +697,7 @@ print_short_help(void)
#undef gettext_nonempty
static char *
static const char *
printhelp_cmd(struct option *option, char ***argv, int *argc)
{
char *lineend = strchr(full_static_version, '\n');
@ -724,7 +724,7 @@ printhelp_cmd(struct option *option, char ***argv, int *argc)
return "";
}
static char *
static const char *
redir_cmd(struct option *option, char ***argv, int *argc)
{
char *target;
@ -763,7 +763,7 @@ redir_cmd(struct option *option, char ***argv, int *argc)
return NULL;
}
static char *
static const char *
printconfigdump_cmd(struct option *option, char ***argv, int *argc)
{
char *config_string;

View File

@ -563,7 +563,7 @@ add_opt(struct option *tree, const char *path, const char *capt,
&option->value.color);
break;
case OPT_COMMAND:
option->value.command = (char * (*)(struct option_elinks *, char ***, int *))value;
option->value.command = (const char * (*)(struct option_elinks *, char ***, int *))value;
break;
case OPT_LANGUAGE:
break;

View File

@ -139,7 +139,7 @@ struct session; /* session/session.h */
*
* @return NULL if successful, or a localized error string that the
* caller will not free. */
typedef char *option_command_fn_T(struct option *option,
typedef const char *option_command_fn_T(struct option *option,
char ***argv, int *argc);
union option_value {

View File

@ -29,7 +29,7 @@
* since you will parse the commandline _TWO TIMES_! Remember! :-) */
int commandline = 0;
static char *
static const char *
gen_cmd(struct option *o, char ***argv, int *argc)
{
char *str;
@ -56,7 +56,7 @@ gen_cmd(struct option *o, char ***argv, int *argc)
/* If 0 follows, disable option and eat 0. If 1 follows, enable option and
* eat 1. If anything else follow, enable option and don't eat anything. */
static char *
static const char *
bool_cmd(struct option *o, char ***argv, int *argc)
{
o->value.number = 1;
@ -77,7 +77,7 @@ bool_cmd(struct option *o, char ***argv, int *argc)
return NULL;
}
static char *
static const char *
exec_cmd(struct option *o, char ***argv, int *argc)
{
return o->value.command(o, argv, argc);
@ -90,11 +90,11 @@ exec_cmd(struct option *o, char ***argv, int *argc)
* possibly changing ptr to structure containing target name and pointer to
* options list? --pasky */
static char *
static const char *
redir_cmd(struct option *opt, char ***argv, int *argc)
{
struct option *real = get_opt_rec(config_options, opt->value.string);
char * ret = NULL;
const char *ret = NULL;
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string);
if_assert_failed { return ret; }

View File

@ -10,7 +10,7 @@ extern "C" {
struct option_type_info {
char *name;
char *(*cmdline)(struct option *, char ***, int *);
const char *(*cmdline)(struct option *, char ***, int *);
char *(*read)(struct option *, char **, int *);
void (*write)(struct option *, struct string *);
void (*dup)(struct option *, struct option *, int);