~ubuntu-branches/ubuntu/jaunty/cmake/jaunty-security

« back to all changes in this revision

Viewing changes to Utilities/cmtar/compat/gethostname.c

  • Committer: Bazaar Package Importer
  • Author(s): A. Maitland Bottoms
  • Date: 2006-06-18 16:34:11 UTC
  • mfrom: (1.4.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060618163411-pi234s3v6jwlcmof
Tags: 2.4.2-1
* New upstream release (Closes: #338324)
* Put cmake .vim files into /usr/share/vim/addons/plugin/
  where they can be used. (Closes: #366663)
* Install cmake-mode.el so it can be used. (Closes: #366664)
* Ensure cmake FindKDE locates KDE libraries on Debian
  based distributions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* gethostname.c: minimal substitute for missing gethostname() function
 
2
 * created 2000-Mar-02 jmk
 
3
 * requires SVR4 uname() and -lc
 
4
 *
 
5
 * by Jim Knoble <jmknoble@pobox.com>
 
6
 * Copyright ? 2000 Jim Knoble
 
7
 *
 
8
 * Permission to use, copy, modify, distribute, and sell this software
 
9
 * and its documentation for any purpose is hereby granted without fee,
 
10
 * provided that the above copyright notice appear in all copies and
 
11
 * that both that copyright notice and this permission notice appear in
 
12
 * supporting documentation.
 
13
 *
 
14
 * This software is provided "as is", without warranty of any kind,
 
15
 * express or implied, including but not limited to the warranties of
 
16
 * merchantability, fitness for a particular purpose and
 
17
 * noninfringement. In no event shall the author(s) be liable for any
 
18
 * claim, damages or other liability, whether in an action of contract,
 
19
 * tort or otherwise, arising from, out of or in connection with the
 
20
 * software or the use or other dealings in the software.
 
21
 */
 
22
 
 
23
#include <string.h>
 
24
#include <sys/utsname.h>
 
25
 
 
26
int gethostname(char *name, size_t len)
 
27
{
 
28
   struct utsname u;
 
29
   int status = uname(&u);
 
30
   if (-1 != status) {
 
31
      strncpy(name, u.nodename, len);
 
32
      name[len - 1] = '\0';
 
33
   }
 
34
   return(status);
 
35
}
 
36