Subversion Repositories SvarDOS

Rev

Rev 397 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
361 mateuszvis 1
/*
2
 * routines used to manipulate the environment block
3
 * Copyright (C) 2021, Mateusz Viste
4
 */
5
 
6
#ifndef ENV_H
7
#define ENV_H
8
 
9
/* looks for varname in environment block and returns a far ptr to it if
10
 * found, NULL otherwise. varname MUST be in upper-case and MUST be terminated
11
 * by either a = sign or a NULL terminator */
12
char far *env_lookup(unsigned short env_seg, const char *varname);
13
 
14
/* returns the size, in bytes, of the allocated environment block */
15
unsigned short env_allocsz(unsigned short env_seg);
16
 
17
/* remove a variable from environment, if present. returns 0 on success, non-zero if variable not found */
18
int env_dropvar(unsigned short env_seg, const char *varname);
19
 
20
#define ENV_SUCCESS  0
21
#define ENV_NOTENOM -1
22
#define ENV_INVSYNT -2
23
 
24
/* Writes a variable to environment block. The variable must in the form
25
 * "varname=value". If variable is already present in the environment block,
26
 * then the value will be updated. If the new value is empty, then the
27
 * existing variable (if any) is removed.
28
 *
29
 * This function returns:
30
 *   ENV_SUCCESS = success
31
 *   ENV_NOTENOM = not enough available space in memory block
32
 *   ENV_INVSYNT = invalid syntax
33
 */
34
int env_setvar(unsigned short env_seg, const char *v);
35
 
36
#endif