2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
8 /*****************************************************************************
24 Deletes local variable.
28 NAME - The name of the local variable to unset.
32 Standard DOS error codes.
44 ******************************************************************************/
47 #include <proto/dos.h>
48 #include <proto/exec.h>
51 #include <dos/dosextens.h>
52 #include <dos/rdargs.h>
54 #include <exec/lists.h>
55 #include <exec/nodes.h>
56 #include <exec/types.h>
57 #include <aros/shcommands.h>
59 #define BUFFER_SIZE 160
61 static void GetNewString(STRPTR
, STRPTR
, LONG
);
64 AROS_SHA(STRPTR
, ,NAME
, ,NULL
))
68 struct Process
* UnsetProc
;
69 struct LocalVar
* UnsetNode
;
71 char Buffer1
[BUFFER_SIZE
];
72 char Buffer2
[BUFFER_SIZE
];
75 if (SHArg(NAME
) != NULL
)
77 /* Delete the local Var from the list.
80 if (!DeleteVar(SHArg(NAME
), GVF_LOCAL_ONLY
))
88 /* Display a list of local variables.
90 UnsetProc
= (struct Process
*)FindTask(NULL
);
92 ForeachNode(&(UnsetProc
->pr_LocalVars
), UnsetNode
)
94 if (UnsetNode
->lv_Node
.ln_Type
== LV_VAR
)
96 /* Get a clean variable with no excess
100 VarLength
= GetVar(UnsetNode
->lv_Node
.ln_Name
,
107 GetNewString(&Buffer1
[0], &Buffer2
[0], VarLength
);
109 Buffer2
[VarLength
] = 0;
111 Printf("%-20s\t%-20s\n", UnsetNode
->lv_Node
.ln_Name
, Buffer2
);
123 static void GetNewString(STRPTR s
, STRPTR d
, LONG l
)
132 if (s
[i
] == '*' || s
[i
] == '\e')