3
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007 John W. Eaton
5
This file is part of Octave.
7
Octave is free software; you can redistribute it and/or modify it
8
under the terms of the GNU General Public License as published by the
9
Free Software Foundation; either version 3 of the License, or (at your
10
option) any later version.
12
Octave is distributed in the hope that it will be useful, but WITHOUT
13
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17
You should have received a copy of the GNU General Public License
18
along with Octave; see the file COPYING. If not, see
19
<http://www.gnu.org/licenses/>.
25
The function gethostname was adapted from a similar function from GNU
26
Bash, the Bourne Again SHell, copyright (C) 1987, 1989, 1991 Free
27
Software Foundation, Inc.
35
/* This gives us a better chance of finding a prototype for strptime
38
#if ! defined (_XOPEN_SOURCE)
43
#ifdef HAVE_SYS_TYPES_H
44
#include <sys/types.h>
56
octave_qsort (void *base, size_t n, size_t size,
57
int (*cmp) (const void *, const void *))
59
qsort (base, n, size, cmp);
63
oct_strptime (const char *buf, const char *format, struct tm *tm)
65
return (char *) strptime (buf, format, tm);
68
#if defined (__WIN32__) && ! defined (_POSIX_VERSION)
72
#elif ! defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
74
#include <sys/utsname.h>
77
gethostname (char *name, int namelen)
85
i = strlen (ut.nodename) + 1;
86
strncpy (name, ut.nodename, i < namelen ? i : namelen);
95
octave_strcasecmp (const char *s1, const char *s2)
97
return strcasecmp (s1, s2);
101
octave_strncasecmp (const char *s1, const char *s2, size_t n)
103
return strncasecmp (s1, s2, n);
107
octave_gethostname (char *name, int namelen)
109
return gethostname (name, namelen);
112
#ifdef HAVE_LOADLIBRARY_API
115
/* Need this since in C++ can't cast from int(*)() to void* */
117
octave_w32_library_search (HINSTANCE handle, const char * name)
119
return (GetProcAddress (handle, name));
124
octave_waitpid (pid_t pid, int *status, int options)
126
return WAITPID (pid, status, options);
130
;;; Local Variables: ***