![]() |
advgetopt 2.0.49
Parse complex command line arguments and configuration files in C++.
|
Tool used to hide "Gtk-warning" messages from terminal. More...
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <limits.h>
#include <errno.h>
#include <regex.h>
#include <poll.h>
Go to the source code of this file.
Classes | |
struct | io_buf |
Macros | |
#define | _GNU_SOURCE |
#define | IN_OUT_BUFSIZ (64 * 1024) |
Functions | |
int | main (int argc, char *argv[], char *envp[]) |
void | output_data (FILE *out, regex_t const *regex, char *str, size_t len) |
void | read_pipe (int pipe, FILE *out, regex_t const *regex, struct io_buf *io) |
void | usage () |
Variables | |
struct io_buf | g_buf_err |
struct io_buf | g_buf_out |
int | g_case_sensitive = 0 |
char const *const | g_default_regex = "gtk-warning|gtk-critical|glib-gobject-warning|^$" |
int | g_filter_stdout = 0 |
char const * | g_progname = NULL |
char const * | g_regex = NULL |
char const *const | g_version = "1.0" |
This tool can be used to hide certain errors and warnings from your console. Many of us really do not care about those Gtk-WARNINGS, which we cannot really do anything about, except parse out with such a tool.
To use, create an alias in your ~/.bashrc file:
If you want to parse out other things, you may change the default regex ('gtk-wanring|gtk-critical|glib-gobject-warning|^$') with whatever you want. Use the –regex command line option for that purpose:
If your command starts with a dash (-), then use – on the command line before your command:
Definition in file hide_warnings.cpp.
#define _GNU_SOURCE |
Definition at line 58 of file hide_warnings.cpp.
#define IN_OUT_BUFSIZ (64 * 1024) |
Definition at line 88 of file hide_warnings.cpp.
int main | ( | int | argc, |
char * | argv[], | ||
char * | envp[] | ||
) |
Definition at line 200 of file hide_warnings.cpp.
References g_buf_err, g_buf_out, g_case_sensitive, g_default_regex, g_filter_stdout, g_progname, g_regex, g_version, read_pipe(), and usage().
void output_data | ( | FILE * | out, |
regex_t const * | regex, | ||
char * | str, | ||
size_t | len | ||
) |
void read_pipe | ( | int | pipe, |
FILE * | out, | ||
regex_t const * | regex, | ||
struct io_buf * | io | ||
) |
Definition at line 150 of file hide_warnings.cpp.
References io_buf::f_buf, io_buf::f_pos, g_progname, IN_OUT_BUFSIZ, and output_data().
Referenced by main().
void usage | ( | ) |
Definition at line 98 of file hide_warnings.cpp.
References g_progname.
Referenced by main(), and advgetopt::getopt::process_system_options().
struct io_buf g_buf_err |
Definition at line 95 of file hide_warnings.cpp.
Referenced by main().
struct io_buf g_buf_out |
Definition at line 94 of file hide_warnings.cpp.
Referenced by main().
int g_case_sensitive = 0 |
Definition at line 85 of file hide_warnings.cpp.
Referenced by main().
char const* const g_default_regex = "gtk-warning|gtk-critical|glib-gobject-warning|^$" |
Definition at line 81 of file hide_warnings.cpp.
Referenced by main().
int g_filter_stdout = 0 |
Definition at line 86 of file hide_warnings.cpp.
Referenced by main().
char const* g_progname = NULL |
Definition at line 83 of file hide_warnings.cpp.
Referenced by main(), output_data(), read_pipe(), and usage().
char const* g_regex = NULL |
Definition at line 84 of file hide_warnings.cpp.
Referenced by main().
char const* const g_version = "1.0" |
Definition at line 80 of file hide_warnings.cpp.
Referenced by main().
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.