projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(jm_ICONV): Recommend GNU libiconv.
[gnulib.git]
/
lib
/
getloadavg.c
diff --git
a/lib/getloadavg.c
b/lib/getloadavg.c
index
52958d4
..
e9c4c08
100644
(file)
--- a/
lib/getloadavg.c
+++ b/
lib/getloadavg.c
@@
-98,8
+98,14
@@
extern int errno;
#endif
extern int errno;
#endif
-#ifndef HAVE_GETLOADAVG
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+#if !HAVE_SETLOCALE
+# define setlocale(Category, Locale) /* empty */
+#endif
+#ifndef HAVE_GETLOADAVG
/* The existing Emacs configuration files define a macro called
LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
/* The existing Emacs configuration files define a macro called
LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
@@
-281,7
+287,7
@@
extern int errno;
/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
above under #ifdef MIPS. But we want the sgi value. */
# undef FSCALE
/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
above under #ifdef MIPS. But we want the sgi value. */
# undef FSCALE
-# define
FSCALE 1000.0
+# define FSCALE 1000.0
# endif
# if defined (ardent) && defined (titan)
# endif
# if defined (ardent) && defined (titan)
@@
-299,7
+305,13
@@
extern int errno;
# endif /* Not FSCALE. */
# if !defined (LDAV_CVT) && defined (FSCALE)
# endif /* Not FSCALE. */
# if !defined (LDAV_CVT) && defined (FSCALE)
-# define LDAV_CVT(n) (((double) (n)) / FSCALE)
+# define LDAV_CVT(n) (((double) (n)) / FSCALE)
+# endif
+
+# ifndef NLIST_STRUCT
+# if HAVE_NLIST_H
+# define NLIST_STRUCT
+# endif
# endif
/* VAX C can't handle multi-line #ifs, or lines longer that 256 characters. */
# endif
/* VAX C can't handle multi-line #ifs, or lines longer that 256 characters. */
@@
-638,8
+650,11
@@
getloadavg (loadavg, nelem)
if (count <= 0)
return -1;
if (count <= 0)
return -1;
+ /* The following sscanf must use the C locale. */
+ setlocale (LC_NUMERIC, "C");
count = sscanf (ldavgbuf, "%lf %lf %lf",
&load_ave[0], &load_ave[1], &load_ave[2]);
count = sscanf (ldavgbuf, "%lf %lf %lf",
&load_ave[0], &load_ave[1], &load_ave[2]);
+ setlocale (LC_NUMERIC, "");
if (count < 1)
return -1;
if (count < 1)
return -1;