1 /* vifm 2 * Copyright (C) 2012 xaizek. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19 #ifndef VIFM__ENGINE__VARIABLES_H__ 20 #define VIFM__ENGINE__VARIABLES_H__ 21 22 #include "var.h" 23 24 /* This module handles :let command */ 25 26 /* List of valid first characters in the name of an environment variable. */ 27 extern const char ENV_VAR_NAME_FIRST_CHAR[]; 28 29 /* List of valid non-first characters in the name of an environment variable. */ 30 extern const char ENV_VAR_NAME_CHARS[]; 31 32 /* Initializes variables module. Should be called before any other function. 33 * Builtin variables are not reinitialized. */ 34 void init_variables(void); 35 36 /* Gets cached value of environment variable envname. Returns empty string if 37 * requested variable doesn't exist. */ 38 const char * local_getenv(const char envname[]); 39 40 /* Gets variables value by its name. Returns the value (not a copy), which is 41 * var_error() in case requested variable doesn't exist. */ 42 var_t getvar(const char varname[]); 43 44 /* Sets/creates builtin variables. Variable is cloned. Returns non-zero on 45 * error, otherwise zero is returned. */ 46 int setvar(const char varname[], var_t var); 47 48 /* Removes all variables and resets environment variables to their initial 49 * values. Doesn't remove builtin variables. */ 50 void clear_variables(void); 51 52 /* Removes all defined environment variables and resets environment variables to 53 * their initial values. */ 54 void clear_envvars(void); 55 56 /* Processes :let command arguments. Returns non-zero on error, otherwise zero 57 * is returned. */ 58 int let_variables(const char cmd[]); 59 60 /* Processes :unlet command arguments. Returns non-zero on error, otherwise 61 * zero is returned. */ 62 int unlet_variables(const char cmd[]); 63 64 /* Performs :let command completion. var should point to beginning of a 65 * variable's name. *start is set to completion insertion position in var. */ 66 void complete_variables(const char var[], const char **start); 67 68 #endif /* VIFM__ENGINE__VARIABLES_H__ */ 69 70 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ 71 /* vim: set cinoptions+=t0 filetype=c : */ 72