2 Copyright (C) 1995-2011, The AROS Development Team. All rights reserved.
12 #include <aros/debug.h>
14 /* environment variables handling (locals and globals) */
15 LONG
convertVar(ShellState
*ss
, Buffer
*in
, Buffer
*out
, BOOL
*quoted
)
17 STRPTR p
= in
->buf
+ in
->cur
;
19 LONG bra
= (*s
== '{' ? 2 : 0);
27 for (i
= 0; i
< 256; ++i
)
31 if (*s
== '\0' || *s
== '}')
43 if (i
>= 256) /* FIXME setup a VAR_MAX constant */
44 return ERROR_LINE_TOO_LONG
;
56 if ((bra
!= 1) && (i
> 0) && ((len
= GetVar(varName
, varValue
, 256, LV_VAR
)) != -1))
58 D(bug("[Shell] found var: %s = %s\n", varName
, varValue
));
59 bufferAppend(varValue
, len
, out
, SysBase
);
63 D(bug("[Shell] var not found: %s\n", varName
));
64 bufferAppend(p
, ++i
+ bra
, out
, SysBase
);
67 in
->cur
= s
- in
->buf
;