libexplain  1.4.D001
libexplain/buffer/termio.c
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2009, 2011, 2013 Peter Miller
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU Lesser General Public License as
00007  * published by the Free Software Foundation; either version 3 of the
00008  * License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include <libexplain/ac/termio.h>
00020 
00021 #include <libexplain/buffer/termio.h>
00022 #include <libexplain/buffer/termio_baud.h>
00023 #include <libexplain/buffer/termio_cc.h>
00024 #include <libexplain/buffer/termio_cflag.h>
00025 #include <libexplain/buffer/termio_iflag.h>
00026 #include <libexplain/buffer/termio_lflag.h>
00027 #include <libexplain/buffer/termio_oflag.h>
00028 #include <libexplain/buffer/line_discipline.h>
00029 #include <libexplain/buffer/pointer.h>
00030 #include <libexplain/is_efault.h>
00031 #include <libexplain/parse_bits.h>
00032 #include <libexplain/sizeof.h>
00033 
00034 
00035 #ifdef HAVE_TERMIO_H
00036 
00037 void
00038 explain_buffer_termio(explain_string_buffer_t *sb, const struct termio *data)
00039 {
00040     if (explain_is_efault_pointer(data, sizeof(*data)))
00041     {
00042         explain_buffer_pointer(sb, data);
00043         return;
00044     }
00045 
00046     explain_string_buffer_puts(sb, "{ c_iflag = ");
00047     explain_buffer_termio_iflag(sb, data->c_iflag);
00048     explain_string_buffer_puts(sb, ", c_oflag = ");
00049     explain_buffer_termio_oflag(sb, data->c_oflag);
00050     explain_string_buffer_puts(sb, ", c_cflag = ");
00051     explain_buffer_termio_cflag(sb, data->c_cflag);
00052     explain_string_buffer_puts(sb, ", c_lflag = ");
00053     explain_buffer_termio_lflag(sb, data->c_lflag);
00054     explain_string_buffer_puts(sb, ", c_line = ");
00055     explain_buffer_line_discipline(sb, data->c_line);
00056     explain_string_buffer_puts(sb, ", c_cc = ");
00057     explain_buffer_termio_cc(sb, data->c_cc, sizeof(data->c_cc));
00058     explain_string_buffer_puts(sb, " }");
00059 }
00060 
00061 #else
00062 
00063 void
00064 explain_buffer_termio(explain_string_buffer_t *sb, const struct termio *data)
00065 {
00066     explain_buffer_pointer(sb, data);
00067 }
00068 
00069 #endif
00070 
00071 
00072 /* vim: set ts=8 sw=4 et : */