Hint added.
[AROS.git] / workbench / c / Shell / cliVarNum.c
blobc766379656dc60c5d6d2c681e380b9ec68a443a7
1 /*
2 Copyright (C) 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
7 #include "Shell.h"
9 LONG l2a(LONG x, STRPTR buf) /* long to ascii */
11 LONG a = (x < 0 ? -x : x);
12 LONG i = 31, j, len = 0;
13 TEXT tmp[32];
15 do {
16 tmp[i] = '0' + (a % 10);
17 ++len;
18 } while (i-- && (a /= 10));
20 if (x < 0)
22 tmp[i--] = '-';
23 ++len;
26 for (j = 0; j < len; ++j)
27 buf[j] = tmp[++i];
29 buf[j] = '\0';
30 return len;
33 void cliVarNum(ShellState *ss, CONST_STRPTR name, LONG value)
35 TEXT buf[32];
36 LONG len = l2a(value, buf);
37 SetVar(name, buf, len, GVF_LOCAL_ONLY);