tChange _p9strsig to return nil if tmp==nil. - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 3a9dccd76ee6916d5586a3fba49cb8e0edb3ca5d
(DIR) parent 85117729d01e8f911beef396040eb2e739e5cc65
(HTM) Author: rsc <devnull@localhost>
Date: Fri, 2 Apr 2004 22:57:49 +0000
Change _p9strsig to return nil if tmp==nil.
Add atoi, atol, atoll.
These versions call strtol/strtoll with base==0.
The Unix versions use base==10.
Diffstat:
A src/lib9/atoi.c | 9 +++++++++
A src/lib9/atol.c | 9 +++++++++
A src/lib9/atoll.c | 9 +++++++++
M src/lib9/await.c | 2 ++
M src/lib9/mkfile | 3 +++
5 files changed, 32 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/src/lib9/atoi.c b/src/lib9/atoi.c
t@@ -0,0 +1,9 @@
+#include <u.h>
+#include <libc.h>
+
+int
+atoi(char *s)
+{
+ return strtol(s, 0, 0);
+}
+
(DIR) diff --git a/src/lib9/atol.c b/src/lib9/atol.c
t@@ -0,0 +1,9 @@
+#include <u.h>
+#include <libc.h>
+
+long
+atol(char *s)
+{
+ return strtol(s, 0, 0);
+}
+
(DIR) diff --git a/src/lib9/atoll.c b/src/lib9/atoll.c
t@@ -0,0 +1,9 @@
+#include <u.h>
+#include <libc.h>
+
+vlong
+atoll(char *s)
+{
+ return strtoll(s, 0, 0);
+}
+
(DIR) diff --git a/src/lib9/await.c b/src/lib9/await.c
t@@ -56,6 +56,8 @@ _p9sigstr(int sig, char *tmp)
for(i=0; i<nelem(tab); i++)
if(tab[i].sig == sig)
return tab[i].str;
+ if(tmp == nil)
+ return nil;
sprint(tmp, "sys: signal %d", sig);
return tmp;
}
(DIR) diff --git a/src/lib9/mkfile b/src/lib9/mkfile
t@@ -72,6 +72,9 @@ LIB9OFILES=\
announce.$O\
argv0.$O\
atexit.$O\
+ atoi.$O\
+ atol.$O\
+ atoll.$O\
atnotify.$O\
await.$O\
cistrcmp.$O\