From 41f50664c1ce0233c93ccd579dab50d0c497e017 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 6 Oct 2018 11:59:20 +0200 Subject: [PATCH] mescc: Mes C Library: Add ltoa. * lib/mes/ltoa.c: New file. * lib/libmes.c: Include it. * include/libmes.h: Declare ltoa. --- include/libmes.h | 1 + lib/libmes.c | 1 + lib/mes/ltoa.c | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 lib/mes/ltoa.c diff --git a/include/libmes.h b/include/libmes.h index 1a311da5..18764668 100644 --- a/include/libmes.h +++ b/include/libmes.h @@ -27,6 +27,7 @@ int __mes_debug (); long abtol (char const** p, int base); char const* ntoab (long number, int base, int signed_p); char const* itoa (int number); +char const* ltoa (long number); char const* utoa (unsigned long number); char const* ltoab (long x, int base); int atoi (char const *s); diff --git a/lib/libmes.c b/lib/libmes.c index e8ca8af3..fcf333cb 100644 --- a/lib/libmes.c +++ b/lib/libmes.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/mes/ltoa.c b/lib/mes/ltoa.c new file mode 100644 index 00000000..82bed4d9 --- /dev/null +++ b/lib/mes/ltoa.c @@ -0,0 +1,27 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include + +char const* +ltoa (long x) +{ + return ntoab (x, 10, 1); +}