Added locale item (sysmon.cd)
[AROS.git] / workbench / c / shellcommands / Get.c
blobd07e828ed35d2e3638aa45c66b2e031073d00b07
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get CLI command
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME
13 Get
15 SYNOPSIS
17 NAME/A
19 LOCATION
23 FUNCTION
25 Retrieves the information stored in the given local variable.
27 INPUTS
29 NAME - The name of the local variable.
31 RESULT
33 Standard DOS error codes.
35 NOTES
37 EXAMPLE
39 Get Result2
41 This will retrieve the secondary return code of the last command
42 that was executed.
44 BUGS
46 SEE ALSO
48 Set, Unset
50 INTERNALS
52 HISTORY
54 30-Jul-1997 laguest Corrected a few things in the source
55 27-Jul-1997 laguest Initial inclusion into the AROS tree
57 ******************************************************************************/
59 #include <proto/dos.h>
61 #include <dos/dos.h>
62 #include <dos/rdargs.h>
63 #include <dos/var.h>
64 #include <exec/types.h>
66 #include <aros/shcommands.h>
68 #define BUFFER_SIZE 256
70 AROS_SH1(Get, 41.1,
71 AROS_SHA(STRPTR, ,NAME,/A,NULL))
73 AROS_SHCOMMAND_INIT
75 LONG Var_Length;
76 char Var_Value[BUFFER_SIZE];
79 Var_Length = GetVar(SHArg(NAME), &Var_Value[0], BUFFER_SIZE,
80 GVF_LOCAL_ONLY);
82 if (Var_Length != -1)
84 Printf("%s\n", Var_Value);
86 return RETURN_OK;
89 SetIoErr(ERROR_OBJECT_NOT_FOUND);
90 PrintFault(IoErr(), "Get");
92 return RETURN_WARN;
94 AROS_SHCOMMAND_EXIT
95 } /* main */