/****************************************************************************
- * Copyright (c) 1998-2000,2012 Free Software Foundation, Inc. *
+ * Copyright 2018,2020 Thomas E. Dickey *
+ * Copyright 1998-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
-MODULE_ID("$Id: getenv_num.c,v 1.4 2012/07/14 21:17:19 tom Exp $")
+MODULE_ID("$Id: getenv_num.c,v 1.8 2020/02/02 23:34:34 tom Exp $")
NCURSES_EXPORT(int)
_nc_getenv_num(const char *name)
if (name != 0 && value >= 0) {
char buffer[128];
#if HAVE_SETENV
- sprintf(buffer, "%d", value);
+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%d", value);
setenv(name, buffer, 1);
#elif HAVE_PUTENV
char *s;
- sprintf(buffer, "%s=%d", name, value);
+ _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%s=%d", name, value);
if ((s = strdup(buffer)) != 0)
putenv(s);
+#else
+#error expected setenv/putenv functions
#endif
}
}