2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
8 /*****************************************************************************
26 NAME - The name of the local variable to unset.
30 Standard DOS error codes.
42 ******************************************************************************/
45 #include <proto/dos.h>
46 #include <proto/exec.h>
49 #include <dos/dosextens.h>
50 #include <dos/rdargs.h>
52 #include <exec/lists.h>
53 #include <exec/nodes.h>
54 #include <exec/types.h>
55 #include <aros/shcommands.h>
57 #define BUFFER_SIZE 160
59 static void GetNewString(STRPTR
, STRPTR
, LONG
);
62 AROS_SHA(STRPTR
, ,NAME
, ,NULL
))
66 struct Process
* UnsetProc
;
67 struct LocalVar
* UnsetNode
;
70 char Buffer1
[BUFFER_SIZE
];
71 char Buffer2
[BUFFER_SIZE
];
74 if (SHArg(NAME
) != NULL
)
76 /* Delete the local Var from the list.
79 if (!DeleteVar(SHArg(NAME
), GVF_LOCAL_ONLY
))
87 /* Display a list of local variables.
89 UnsetProc
= (struct Process
*)FindTask(NULL
);
91 ForeachNode(&(UnsetProc
->pr_LocalVars
), UnsetNode
)
93 if (UnsetNode
->lv_Node
.ln_Type
== LV_VAR
)
95 /* Get a clean variable with no excess
99 VarLength
= GetVar(UnsetNode
->lv_Node
.ln_Name
,
106 GetNewString(&Buffer1
[0], &Buffer2
[0], VarLength
);
108 Buffer2
[VarLength
] = NULL
;
110 OutArgs
[0] = (IPTR
)UnsetNode
->lv_Node
.ln_Name
;
111 OutArgs
[1] = (IPTR
)&Buffer2
[0];
112 OutArgs
[2] = (IPTR
)NULL
;
113 VPrintf("%-20s\t%-20s\n", &OutArgs
[0]);
125 static void GetNewString(STRPTR s
, STRPTR d
, LONG l
)
134 if (s
[i
] == '*' || s
[i
] == '\e')