メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

lo-cutils.c

解説を見る。
00001 /*
00002 
00003 Copyright (C) 2000 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 2, or (at your option) any
00010 later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 */
00022 
00023 /*
00024 
00025 The function gethostname was adapted from a similar function from GNU
00026 Bash, the Bourne Again SHell, copyright (C) 1987, 1989, 1991 Free
00027 Software Foundation, Inc.
00028 
00029 */
00030 
00031 #ifdef HAVE_CONFIG_H
00032 #include <config.h>
00033 #endif
00034 
00035 /* This gives us a better chance of finding a prototype for strptime
00036    on some systems.  */
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 ;;; Local Variables: ***
00100 ;;; mode: C++ ***
00101 ;;; End: ***
00102 */

Wed Dec 29 11:51:39 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送