Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / c / shellcommands / Get.c
blob64a5620156553ad40e1e1099ed60e629363452a7
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
21 Workbench:c
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];
77 IPTR Display_Args[1];
80 Var_Length = GetVar(SHArg(NAME), &Var_Value[0], BUFFER_SIZE,
81 GVF_LOCAL_ONLY);
83 if (Var_Length != -1)
85 Display_Args[0] = (IPTR)Var_Value;
86 VPrintf("%s\n", Display_Args);
88 return RETURN_OK;
91 SetIoErr(ERROR_OBJECT_NOT_FOUND);
92 PrintFault(IoErr(), "Get");
94 return RETURN_WARN;
96 AROS_SHCOMMAND_EXIT
97 } /* main */