From: ehofman Date: Fri, 28 Nov 2003 10:25:33 +0000 (+0000) Subject: IRIX/MipsPro 7.2 doesn't have strndup. Work around it. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=06ce7ae9289a80165fe3b975d3e8e51f5aea57ae;p=flightgear.git IRIX/MipsPro 7.2 doesn't have strndup. Work around it. --- diff --git a/src/GUI/AirportList.cxx b/src/GUI/AirportList.cxx index 43cee70ab..3f97342de 100644 --- a/src/GUI/AirportList.cxx +++ b/src/GUI/AirportList.cxx @@ -18,7 +18,9 @@ AirportList::AirportList (int x, int y, int width, int height) snprintf(buf, 1023, "%s %s\n", airport->id.c_str(), airport->name.c_str()); - _content[i] = strndup(buf, 1023); + int str_len = strlen(buf); + _content[i] = new char[(str_len > 1023) ? 1024 : str_len]; + strncpy(_content[i], buf, 1023); } _content[_nAirports] = 0; newList(_content);