monotone

monotone Mtn Source Tree

Root/unix/get_system_flavour.cc

1// copyright (C) 2004 graydon hoare <graydon@pobox.com>
2// all rights reserved.
3// licensed to the public under the terms of the GNU GPL (>= 2)
4// see the file COPYING for details
5
6#include "base.hh"
7#include <sys/utsname.h>
8#include "sanity.hh"
9
10void get_system_flavour(std::string & ident)
11{
12 struct utsname n;
13 /* Solaris has >= 0 as success, while
14 Linux only knows 0 - as >0 is not an
15 error condition there, relax a bit */
16 I(uname(&n) >= 0);
17 ident = (FL("%s %s %s %s")
18 % n.sysname
19 % n.release
20 % n.version
21 % n.machine).str();
22}
23
24// Local Variables:
25// mode: C++
26// fill-column: 76
27// c-file-style: "gnu"
28// indent-tabs-mode: nil
29// End:
30// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status