prism2.device: Compiler delint
[AROS.git] / workbench / c / shellcommands / Getenv.c
blob8f46506ba2a18186d76e7ed5138994ba304f5ee3
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Getenv CLI command
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME
13 Getenv
15 SYNOPSIS
17 NAME/A
19 LOCATION
23 FUNCTION
25 Retrieves the information stored in the given global variable.
27 INPUTS
29 NAME - The name of the global variable.
31 RESULT
33 Standard DOS error codes.
35 NOTES
37 EXAMPLE
39 Getenv Kickstart
41 This will retrieve the version of the Kickstart ROM.
43 BUGS
45 SEE ALSO
47 Setenv, Unsetenv
49 INTERNALS
51 HISTORY
53 30-Jul-1997 laguest Corrected a few things in the source
54 27-Jul-1997 laguest Initial inclusion into the AROS tree
56 ******************************************************************************/
58 #include <proto/dos.h>
60 #include <dos/dos.h>
61 #include <dos/rdargs.h>
62 #include <dos/var.h>
63 #include <exec/types.h>
65 #include <aros/shcommands.h>
67 #define BUFFER_SIZE 256
69 AROS_SH1(Getenv, 41.1,
70 AROS_SHA(STRPTR, ,NAME,/A,NULL))
72 AROS_SHCOMMAND_INIT
74 LONG Var_Length;
75 char Var_Value[BUFFER_SIZE];
76 IPTR Display_Args[1];
79 Var_Length = GetVar(SHArg(NAME),
80 &Var_Value[0],
81 BUFFER_SIZE,
82 GVF_GLOBAL_ONLY | LV_VAR
85 if (Var_Length != -1)
87 Display_Args[0] = (IPTR)Var_Value;
88 VPrintf("%s\n", Display_Args);
90 return RETURN_OK;
93 SetIoErr(ERROR_OBJECT_NOT_FOUND);
94 PrintFault(IoErr(), "Getenv");
96 return RETURN_WARN;
98 AROS_SHCOMMAND_EXIT
99 } /* main */