Line 1... |
Line 1... |
1 |
/* This file is part of the SvarCOM project and is published under the terms
|
1 |
/* This file is part of the SvarCOM project and is published under the terms
|
2 |
* of the MIT license.
|
2 |
* of the MIT license.
|
3 |
*
|
3 |
*
|
4 |
* Copyright (C) 2021 Mateusz Viste
|
4 |
* Copyright (C) 2021-2022 Mateusz Viste
|
5 |
*
|
5 |
*
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
7 |
* copy of this software and associated documentation files (the "Software"),
|
7 |
* copy of this software and associated documentation files (the "Software"),
|
8 |
* to deal in the Software without restriction, including without limitation
|
8 |
* to deal in the Software without restriction, including without limitation
|
9 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
9 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
Line 22... |
Line 22... |
22 |
* DEALINGS IN THE SOFTWARE.
|
22 |
* DEALINGS IN THE SOFTWARE.
|
23 |
*/
|
23 |
*/
|
24 |
|
24 |
|
25 |
/*
|
25 |
/*
|
26 |
* routines used to manipulate the environment block
|
26 |
* routines used to manipulate the environment block
|
27 |
* Copyright (C) 2021, Mateusz Viste
|
- |
|
28 |
*/
|
27 |
*/
|
29 |
|
28 |
|
30 |
#ifndef ENV_H
|
29 |
#ifndef ENV_H
|
31 |
#define ENV_H
|
30 |
#define ENV_H
|
32 |
|
31 |
|
Line 38... |
Line 37... |
38 |
/* almost identical to env_lookup(), but instead of returning a pointer
|
37 |
/* almost identical to env_lookup(), but instead of returning a pointer
|
39 |
* to the 'NAME=value' string, it returns a pointer to value (or NULL if
|
38 |
* to the 'NAME=value' string, it returns a pointer to value (or NULL if
|
40 |
* var not found) */
|
39 |
* var not found) */
|
41 |
char far *env_lookup_val(unsigned short env_seg, const char *varname);
|
40 |
char far *env_lookup_val(unsigned short env_seg, const char *varname);
|
42 |
|
41 |
|
- |
|
42 |
/* locates the value of env variable varname and copies it to result, up to
|
- |
|
43 |
* ressz bytes (incl. the NULL terminator). returns the length of the value on
|
- |
|
44 |
* success, 0 if var not found or couldn't fit in ressz). */
|
- |
|
45 |
unsigned short env_lookup_valcopy(char *res, unsigned short ressz, unsigned short env_seg, const char *varname);
|
- |
|
46 |
|
43 |
/* returns the size, in bytes, of the allocated environment block */
|
47 |
/* returns the size, in bytes, of the allocated environment block */
|
44 |
unsigned short env_allocsz(unsigned short env_seg);
|
48 |
unsigned short env_allocsz(unsigned short env_seg);
|
45 |
|
49 |
|
46 |
/* remove a variable from environment, if present. returns 0 on success, non-zero if variable not found */
|
50 |
/* remove a variable from environment, if present. returns 0 on success, non-zero if variable not found */
|
47 |
int env_dropvar(unsigned short env_seg, const char *varname);
|
51 |
int env_dropvar(unsigned short env_seg, const char *varname);
|