SysUtil.h File Reference

#include <X11/Xfuncproto.h>

Include dependency graph for SysUtil.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

_XFUNCPROTOBEGIN int XmuGetHostname (char *buf_return, int maxlen)
int XmuSnprintf (char *str, int size, _Xconst char *fmt,...)


Function Documentation

_XFUNCPROTOBEGIN int XmuGetHostname ( char *  buf_return,
int  maxlen 
)

Definition at line 55 of file GetHost.c.

References len, and void().

Referenced by XmuConvertStandardSelection().

00056 {
00057     int len;
00058 #ifdef WIN32
00059     static WSADATA wsadata;
00060 
00061     if (!wsadata.wVersion && WSAStartup(MAKEWORD(1,1), &wsadata))
00062         return -1;
00063 #endif
00064 
00065 #ifdef NEED_UTSNAME
00066     /*
00067      * same host name crock as in server and xinit.
00068      */
00069     struct utsname name;
00070 
00071     uname (&name);
00072     len = strlen (name.nodename);
00073     if (len >= maxlen) len = maxlen - 1;
00074     strncpy (buf, name.nodename, len);
00075     buf[len] = '\0';
00076 #else
00077     buf[0] = '\0';
00078     (void) gethostname (buf, maxlen);
00079     buf [maxlen - 1] = '\0';
00080     len = strlen(buf);
00081 #endif /* hpux */
00082     return len;
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:

int XmuSnprintf ( char *  str,
int  size,
_Xconst char *  fmt,
  ... 
)

Definition at line 138 of file Lower.c.

00139 {
00140   va_list ap;
00141   int retval;
00142 
00143   if (size <= 0)
00144     return (size);
00145 
00146   va_start(ap, fmt);
00147 
00148 #if 1
00149   retval = vsprintf(str, fmt, ap);
00150   if (retval >= size)
00151     {
00152       fprintf(stderr, "WARNING: buffer overflow detected!\n");
00153       fflush(stderr);
00154       abort();
00155     }
00156 #else
00157   retval = vsnprintf(str, size, fmt, ap);
00158 #endif
00159 
00160   va_end(ap);
00161 
00162   return (retval);
00163 }


Generated on Sun Mar 4 16:04:26 2007 for Scilab [trunk] by  doxygen 1.5.1