00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifdef HAVE_CONFIG_H
00032 #include <config.h>
00033 #endif
00034
00035
00036
00037
00038 #if ! defined (_XOPEN_SOURCE)
00039 #define _XOPEN_SOURCE
00040 #endif
00041
00042 #ifdef HAVE_UNISTD_H
00043 #ifdef HAVE_SYS_TYPES_H
00044 #include <sys/types.h>
00045 #endif
00046 #include <unistd.h>
00047 #endif
00048
00049 #include <stdlib.h>
00050 #include <string.h>
00051 #include <time.h>
00052
00053 void
00054 octave_qsort (void *base, size_t n, size_t size,
00055 int (*cmp) (const void *, const void *))
00056 {
00057 qsort (base, n, size, cmp);
00058 }
00059
00060 char *
00061 oct_strptime (const char *buf, const char *format, struct tm *tm)
00062 {
00063 return (char *) strptime (buf, format, tm);
00064 }
00065
00066 #if defined (__WIN32__) && ! defined (_POSIX_VERSION)
00067
00068 #include <winsock.h>
00069
00070 #elif ! defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
00071
00072 #include <sys/utsname.h>
00073
00074 int
00075 gethostname (char *name, int namelen)
00076 {
00077 int i;
00078 struct utsname ut;
00079
00080 --namelen;
00081
00082 uname (&ut);
00083 i = strlen (ut.nodename) + 1;
00084 strncpy (name, ut.nodename, i < namelen ? i : namelen);
00085 name[namelen] = '\0';
00086
00087 return 0;
00088 }
00089
00090 #endif
00091
00092 int
00093 octave_gethostname (char *name, int namelen)
00094 {
00095 return gethostname (name, namelen);
00096 }
00097
00098
00099
00100
00101
00102