blob: 19b559abf15508e39e14087e2261cbfa2361cfa9 [file] [log] [blame]
Simon Glassaf95f202019-08-01 09:46:40 -06001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Common environment functions
4 *
5 * (C) Copyright 2000-2009
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 */
8
9#ifndef __ENV_H
10#define __ENV_H
11
12#include <stdbool.h>
13
14/**
Simon Glassf1f0ae62019-08-01 09:46:41 -060015 * env_get_id() - Gets a sequence number for the environment
16 *
17 * This value increments every time the environment changes, so can be used an
18 * an indication of this
19 *
20 * @return environment ID
21 */
22int env_get_id(void);
23
24/**
Simon Glass3a7d5572019-08-01 09:46:42 -060025 * env_get_f() - Look up the value of an environment variable (early)
26 *
27 * This function is called from env_get() if the environment has not been
28 * loaded yet (GD_FLG_ENV_READY flag is 0). Some environment locations will
29 * support reading the value (slowly) and some will not.
30 *
31 * @varname: Variable to look up
32 * @return value of variable, or NULL if not found
33 */
34int env_get_f(const char *name, char *buf, unsigned int len);
35
36/**
Simon Glassaf95f202019-08-01 09:46:40 -060037 * env_complete() - return an auto-complete for environment variables
38 *
39 * @var: partial name to auto-complete
40 * @maxv: Maximum number of matches to return
41 * @cmdv: Returns a list of possible matches
42 * @maxsz: Size of buffer to use for matches
43 * @buf: Buffer to use for matches
44 * @dollar_comp: non-zero to wrap each match in ${...}
45 * @return number of matches found (in @cmdv)
46 */
47int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
48 bool dollar_comp);
49
50#endif