Subversion Repositories DevTools

Rev

Rev 313 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 313 Rev 317
Line 29... Line 29...
29
#define FSTRING         0x01
29
#define FSTRING         0x01
30
#define FEMBEDDEDSPACES 0x02
30
#define FEMBEDDEDSPACES 0x02
31
 
31
 
32
static int              nextword( int, const char *, char *, int );
32
static int              nextword( int, const char *, char *, int );
33
 
33
 
-
 
34
/*----------------------------------------------------------------------------
-
 
35
** FUNCTION           : macro_from_env
-
 
36
**
-
 
37
** DESCRIPTION        : Get data from the users environment and process it
-
 
38
**                      as a macro
-
 
39
**
-
 
40
**
-
 
41
** INPUTS             : str     - output string
-
 
42
**                      s       - input arguments
-
 
43
**
-
 
44
** RETURNS            : length of arguments consumed
-
 
45
**
-
 
46
----------------------------------------------------------------------------*/
-
 
47
 
-
 
48
int
-
 
49
macro_from_env(String_t *str, const char *s)
-
 
50
{
-
 
51
    char varname[ 32 ];
-
 
52
    int len = 0, len2;
-
 
53
    char *sp;
-
 
54
 
-
 
55
    if (expected(s++, ',') > 0 &&
-
 
56
            (len2 = argument(s, varname, sizeof(varname))) > 0)
-
 
57
    {
-
 
58
        len = 1+len2, s += len2;
-
 
59
        sp = getenv(varname);
-
 
60
        if ( ! sp )
-
 
61
            fatalerr( "Environment Variable not found: '%s'\n", varname );
-
 
62
 
-
 
63
        verbose( " MacroEnvVar %s  = %s", varname, sp );
-
 
64
        process_string (sp);
-
 
65
    }
-
 
66
    return (len);
-
 
67
}
34
 
68
 
35
int
69
int
36
macro( String_t *str, const char *s )
70
macro( String_t *str, const char *s )
37
{
71
{
38
    char name[ 128 ];                           /* macro name */
72
    char name[ 128 ];                           /* macro name */
Line 115... Line 149...
115
        len2 = do_path2url(str, s+len);
149
        len2 = do_path2url(str, s+len);
116
 
150
 
117
    else if (strcasecmp( "env", name ) == 0)
151
    else if (strcasecmp( "env", name ) == 0)
118
        len2 = from_env(str, s+len);
152
        len2 = from_env(str, s+len);
119
 
153
 
-
 
154
    else if (strcasecmp( "envmacro", name ) == 0)
-
 
155
        len2 = macro_from_env(str, s+len);
-
 
156
 
120
    else
157
    else
121
    {
158
    {
122
        warning( "unknown macro '%s' -- ignored", name );
159
        warning( "unknown macro '%s' -- ignored", name );
123
        len2 = 0;
160
        len2 = 0;
124
    }
161
    }