mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
(_GNU_MAX_HOST_NAMELEN): Macro removed; using MAXHOSTNAMELEN from
<sys/param.h> instead. All users changed. (_gnu_process_args): Malloc and fill NSArgv; assignment of char** from *char[] isn't right. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@692 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cc256506a8
commit
da91b29ed2
1 changed files with 8 additions and 11 deletions
|
@ -52,6 +52,8 @@
|
||||||
* - To the NEXTSTEP/GNUStep community
|
* - To the NEXTSTEP/GNUStep community
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include <sys/param.h> /* for MAXHOSTNAMELEN */
|
||||||
|
|
||||||
#ifdef NeXT
|
#ifdef NeXT
|
||||||
#ifdef SCITOOLS
|
#ifdef SCITOOLS
|
||||||
#import <basekit/LibobjectsMain.h>
|
#import <basekit/LibobjectsMain.h>
|
||||||
|
@ -79,13 +81,6 @@
|
||||||
#include <Foundation/NSProcessInfo.h>
|
#include <Foundation/NSProcessInfo.h>
|
||||||
#endif /* NeXT */
|
#endif /* NeXT */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* This is the longest max host name allowed for all different systems
|
|
||||||
* I had a chance to read the man pages.
|
|
||||||
*/
|
|
||||||
#define _GNU_MAX_HOST_NAMELEN 256
|
|
||||||
|
|
||||||
/* This error message should be called only if the private main function
|
/* This error message should be called only if the private main function
|
||||||
* was not executed successfully. This may heppen ONLY if onother library
|
* was not executed successfully. This may heppen ONLY if onother library
|
||||||
* or kit defines its own main function (as libobjects does).
|
* or kit defines its own main function (as libobjects does).
|
||||||
|
@ -153,11 +148,13 @@ const char **NSArgv;
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gnu_process_args(int argc, char **argv, char *env[])
|
_gnu_process_args(int argc, char *argv[], char *env[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
NSArgv = argv;
|
OBJC_MALLOC(NSArgv, const char*, argc);
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
NSArgv[i] = argv[i];
|
||||||
|
|
||||||
/* Getting the process name */
|
/* Getting the process name */
|
||||||
_gnu_processName = [[NSString alloc] initWithCString:argv[0]];
|
_gnu_processName = [[NSString alloc] initWithCString:argv[0]];
|
||||||
|
@ -327,9 +324,9 @@ int main(int argc, char *argv[], char *env[])
|
||||||
{
|
{
|
||||||
if (!_gnu_hostName)
|
if (!_gnu_hostName)
|
||||||
{
|
{
|
||||||
char hn[_GNU_MAX_HOST_NAMELEN];
|
char hn[MAXHOSTNAMELEN];
|
||||||
|
|
||||||
gethostname(hn, _GNU_MAX_HOST_NAMELEN);
|
gethostname(hn, MAXHOSTNAMELEN);
|
||||||
_gnu_hostName = [[NSString alloc] initWithCString:hn];
|
_gnu_hostName = [[NSString alloc] initWithCString:hn];
|
||||||
}
|
}
|
||||||
return _gnu_hostName;
|
return _gnu_hostName;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue