libexplain
1.4.D001
|
00001 /* 00002 * libexplain - a library of system-call-specific strerror replacements 00003 * Copyright (C) 2013, 2014 Peter Miller 00004 * Written by Peter Miller <pmiller@opensource.org.au> 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 3 of the License, or (at your 00009 * option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but WITHOUT 00012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00014 * License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #include <libexplain/ac/sys/utsname.h> 00021 00022 #include <libexplain/buffer/utsname.h> 00023 #include <libexplain/buffer/pointer.h> 00024 #include <libexplain/string_buffer.h> 00025 #include <libexplain/is_efault.h> 00026 00027 00028 void 00029 explain_buffer_utsname(explain_string_buffer_t *sb, const struct utsname *data) 00030 { 00031 if (explain_is_efault_pointer(data, sizeof(*data))) 00032 { 00033 explain_buffer_pointer(sb, data); 00034 return; 00035 } 00036 00037 explain_string_buffer_puts(sb, "{ sysname = "); 00038 explain_string_buffer_puts_quoted_n(sb, 00039 data->sysname, sizeof(data->sysname)); 00040 explain_string_buffer_puts(sb, ", nodename = "); 00041 explain_string_buffer_puts_quoted_n(sb, 00042 data->nodename, sizeof(data->nodename)); 00043 explain_string_buffer_puts(sb, ", release = "); 00044 explain_string_buffer_puts_quoted_n(sb, 00045 data->release, sizeof(data->release)); 00046 explain_string_buffer_puts(sb, ", version = "); 00047 explain_string_buffer_puts_quoted_n(sb, 00048 data->version, sizeof(data->version)); 00049 explain_string_buffer_puts(sb, ", machine = "); 00050 explain_string_buffer_puts_quoted_n(sb, 00051 data->machine, sizeof(data->machine)); 00052 #if HAVE_UTSNAME_DOMAINNAME 00053 explain_string_buffer_puts(sb, ", domainname = "); 00054 explain_string_buffer_puts_quoted_n(sb, 00055 data->domainname, sizeof(data->domainname)); 00056 #endif 00057 explain_string_buffer_puts(sb, " }"); 00058 } 00059 00060 00061 /* vim: set ts=8 sw=4 et : */