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#include <ostream> // for operator<<
10
11void get_system_flavour(std::string & ident)
12{
13 struct utsname n;
14 /* Solaris has >= 0 as success, while
15 Linux only knows 0 - as >0 is not an
16 error condition there, relax a bit */
17 I(uname(&n) >= 0);
18 ident = (FL("%s %s %s %s")
19 % n.sysname
20 % n.release
21 % n.version
22 % n.machine).str();
23}
24
25// Local Variables:
26// mode: C++
27// fill-column: 76
28// c-file-style: "gnu"
29// indent-tabs-mode: nil
30// End:
31// 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