summaryrefslogtreecommitdiffstats
path: root/common/env.c
Commit message (Collapse)AuthorAgeFilesLines
* env: Add more context to error messageSascha Hauer2018-02-081-1/+1
| | | | | | | When setenv complains that it can't set a device parameter, then print which parameter it tried to set. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* device parameters: Allow dots in device names for setenv aswellSascha Hauer2018-01-101-19/+35
| | | | | | | | | | | | Since f5d77d80f5 Allow device parameters for devices with dots in name Devices can have dots in their name and we can still read its device parameters. Do the same change for writing parameters so they can be written aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Allow device parameters for devices with dots in nameSascha Hauer2016-10-071-14/+34
| | | | | | | | | | Devices can have a dot in the name, so we can't expect to find the full device name before the first dot. Currently parameters of devices with a dot in the name are inaccessible from the shell. Fix this by iterating over the possible device name / parameter name combinations to find a existing combination. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/include-cleanup'Sascha Hauer2016-05-091-1/+1
|\
| * string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | getenv_bool: use strtoboolSascha Hauer2016-04-291-11/+17
|/ | | | | | | We now have a library function to convert a string to a boolean type. Use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* setenv: Be more informative when device parameter setting failsSascha Hauer2015-05-041-5/+7
| | | | | | | | | When setting a device parameter fails not only the error code is of interest, but also what the parameter name is, what the device name is and whether a device was found for this name. Add this information to the error message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix bug in export 64 bit unsigned environment variable.Michael D. Burkey2014-04-301-1/+1
| | | | | | | | This patch corrects exporting unsigned 64-bit environment variables. I had left out a signed off line before. Signed-off-by: Michael Burkey <mdburkey at gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* environment variables: introduce new helpersSascha Hauer2013-09-301-5/+66
| | | | | | | | | | | | | | | | | | | | | | | | | This introduces some new environment variable helpers and updates the existing ones. Newly introduced are: getenv_bool: read a bool variable getenv_ul: read an unsigned long variable getenev_uint: read an unsigned int variable getenv_nonempty: like normal getenv, but does return NULL instead of an empty string All new helpers take a pointer to the value. This value is only modified when the variable exists. This allows the following programming scheme: unsigned int myvalue = sanedefault; getenv_uint("myvalue", &myvalue); So without checking the return value myvalue contains the best possible value. getenv_ull is updated to this scheme. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* environment variables: use linux listSascha Hauer2012-10-301-57/+64
| | | | | | | | This switches environment variables to use linux list. This is easier to read. An additional plus is that the environment variables no longer need an initcall, so malloc is the only requirement for them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-3/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Make errno a positive valueSascha Hauer2012-05-141-1/+1
| | | | | | | | | Normally errno contains a positive error value. A certain unnamed developer mixed this up while implementing U-Boot-v2. Also, normally errno is never set to zero by any library function. This patch fixes this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce some env helpersSascha Hauer2011-11-291-0/+22
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* export: do not fail on already exported variableSascha Hauer2011-11-091-2/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* put env_push_context into postcore_initcallSascha Hauer2011-08-171-1/+1
| | | | | | env_push_context only needs malloc, so initialize it earlier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* setenv: be robust against setenv(<var>, NULL)Peter Korsgaard2011-05-161-1/+1
| | | | | | | | Handle value == NULL similiar to how value == '' is currently handled. hush's builtin_getopt() seems to trigger this for OPTARG. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Init env context a bit earlier in initalization sequence.Marc Reilly2011-01-101-1/+1
| | | | | | | | Ensures subsequent init functions to export environment variables during init without having to rely on linking order being correct. Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common/env.c: sparse fixesSascha Hauer2010-10-211-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* get rid of device idsSascha Hauer2009-07-211-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* setenv: Fix warning introduced with last commitSascha Hauer2008-08-201-13/+23
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* separating environment commands, part 1Juergen Beisert2007-11-121-167/+11
| | | | Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
* adding various dokuJuergen Beisert2007-11-081-9/+9
|
* saving added docuJuergen Beisert2007-11-051-1/+1
|
* adding new docJuergen Beisert2007-10-191-8/+9
|
* doc added and some reorganisedJuergen Beisert2007-10-191-0/+68
|
* export symbolsSascha Hauer2007-10-071-0/+3
|
* Extend 'export' command to take the form export a=bSascha Hauer2007-09-281-6/+16
|
* remove u-boot command paramter flagSascha Hauer2007-09-241-3/+3
|
* introduce local and global variables, add export commandSascha Hauer2007-09-231-30/+162
|
* whitespace cleanupSascha Hauer2007-09-131-55/+55
|
* svn_rev_706Sascha Hauer2007-07-051-0/+22
| | | | add file headers
* svn_rev_613Sascha Hauer2007-07-051-1/+1
|
* svn_rev_481Sascha Hauer2007-07-051-3/+3
| | | | make more char * const, fix compiler warnings
* svn_rev_462Sascha Hauer2007-07-051-2/+2
| | | | | | | - Add help texts for many commands. - Let the linker sort the command table. - Add support for multiple argmuments in several commands (mkdir, rmdir, rm, cat)
* svn_rev_420Sascha Hauer2007-07-051-9/+14
| | | | | | | | | | | - do more POSIX: - use DIR instead of struct dirent - use (struct dirent)->d_name instead of (struct dirent)->name - switch to a new layout for U_BOOT_CMD: - use C99 initializers to be able to add more fields to the command struct - add aliases for commands (needed mainly for help -> ? and test -> [ - This is not done for all commands yet, but the compiler will tell you ;)
* svn_rev_386Sascha Hauer2007-07-051-177/+41
| | | | remove old saveenv, allow setenv/getenv to change device parameters
* svn_rev_369Sascha Hauer2007-07-051-1/+1
| | | | include asm-generic in errno.h instead of all other files
* svn_rev_268Sascha Hauer2007-07-051-3/+3
| | | | WIP
* svn_rev_219Sascha Hauer2007-07-051-3/+2
| | | | fix off-by-one error
* svn_rev_207Sascha Hauer2007-07-051-2/+2
| | | | move several config options to kconfig
* svn_rev_137Sascha Hauer2007-07-051-0/+296
new env functions