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
;
72 char Buffer1
[BUFFER_SIZE
];
73 char Buffer2
[BUFFER_SIZE
];
76 if (SHArg(NAME
) != NULL
)
78 /* Delete the local Var from the list.
81 if (!DeleteVar(SHArg(NAME
), GVF_LOCAL_ONLY
))
89 /* Display a list of local variables.
91 UnsetProc
= (struct Process
*)FindTask(NULL
);
93 ForeachNode(&(UnsetProc
->pr_LocalVars
), UnsetNode
)
95 if (UnsetNode
->lv_Node
.ln_Type
== LV_VAR
)
97 /* Get a clean variable with no excess
101 VarLength
= GetVar(UnsetNode
->lv_Node
.ln_Name
,
108 GetNewString(&Buffer1
[0], &Buffer2
[0], VarLength
);
110 Buffer2
[VarLength
] = 0;
112 OutArgs
[0] = (IPTR
)UnsetNode
->lv_Node
.ln_Name
;
113 OutArgs
[1] = (IPTR
)&Buffer2
[0];
114 OutArgs
[2] = (IPTR
)NULL
;
115 VPrintf("%-20s\t%-20s\n", &OutArgs
[0]);
127 static void GetNewString(STRPTR s
, STRPTR d
, LONG l
)
136 if (s
[i
] == '*' || s
[i
] == '\e')