void dogechat_backtrace () { #ifdef HAVE_BACKTRACE void *trace[BACKTRACE_MAX]; int trace_size, i; char **symbols; #endif /* HAVE_BACKTRACE */ dogechat_backtrace_printf ("======= DogeChat backtrace ======="); dogechat_backtrace_printf ("(written by DogeChat %s, compiled on %s %s)", version_get_version_with_git (), version_get_compilation_date (), version_get_compilation_time ()); #ifdef HAVE_BACKTRACE trace_size = backtrace (trace, BACKTRACE_MAX); symbols = backtrace_symbols (trace, trace_size); for (i = 0; i < trace_size; i++) { dogechat_backtrace_addr2line (i + 1, trace[i], symbols[i]); } #else dogechat_backtrace_printf (" No backtrace info (no debug info available " "or no backtrace possible on your system)."); #endif /* HAVE_BACKTRACE */ dogechat_backtrace_printf ("======= End of backtrace ======="); }
void weechat_display_copyright () { string_iconv_fprintf (stdout, "\n"); string_iconv_fprintf (stdout, /* TRANSLATORS: "%s %s" after "compiled on" is date and time */ _("WeeChat %s Copyright %s, compiled on %s %s\n" "Developed by Sébastien Helleu <*****@*****.**> " "- %s"), version_get_version_with_git (), WEECHAT_COPYRIGHT_DATE, version_get_compilation_date (), version_get_compilation_time (), WEECHAT_WEBSITE); string_iconv_fprintf (stdout, "\n"); }
void log_init () { if (!log_open (NULL, "w")) { string_iconv_fprintf (stderr, _("Error: unable to create/append to log file (weechat.log)\n" "If another WeeChat process is using this file, try to run WeeChat\n" "with another home using \"--dir\" command line option.\n")); exit (1); } log_printf ("WeeChat %s (%s %s %s)", version_get_version_with_git (), _("compiled on"), version_get_compilation_date (), version_get_compilation_time ()); }
const char * plugin_api_info_get_internal (void *data, const char *info_name, const char *arguments) { time_t inactivity; static char value[32], version_number[32] = { '\0' }; static char weechat_dir_absolute_path[PATH_MAX] = { '\0' }; int rgb, limit; char *pos, *color; /* make C compiler happy */ (void) data; if (!info_name) return NULL; if (string_strcasecmp (info_name, "version") == 0) { return version_get_version (); } else if (string_strcasecmp (info_name, "version_number") == 0) { if (!version_number[0]) { snprintf (version_number, sizeof (version_number), "%d", util_version_number (version_get_version ())); } return version_number; } else if (string_strcasecmp (info_name, "version_git") == 0) { return version_get_git (); } else if (string_strcasecmp (info_name, "date") == 0) { return version_get_compilation_date (); } else if (string_strcasecmp (info_name, "dir_separator") == 0) { return DIR_SEPARATOR; } else if (string_strcasecmp (info_name, "weechat_dir") == 0) { if (!weechat_dir_absolute_path[0]) { if (!realpath (weechat_home, weechat_dir_absolute_path)) return NULL; } return (weechat_dir_absolute_path[0]) ? weechat_dir_absolute_path : weechat_home; } else if (string_strcasecmp (info_name, "weechat_libdir") == 0) { return WEECHAT_LIBDIR; } else if (string_strcasecmp (info_name, "weechat_sharedir") == 0) { return WEECHAT_SHAREDIR; } else if (string_strcasecmp (info_name, "weechat_localedir") == 0) { return LOCALEDIR; } else if (string_strcasecmp (info_name, "weechat_site") == 0) { return WEECHAT_WEBSITE; } else if (string_strcasecmp (info_name, "weechat_site_download") == 0) { return WEECHAT_WEBSITE_DOWNLOAD; } else if (string_strcasecmp (info_name, "weechat_upgrading") == 0) { snprintf (value, sizeof (value), "%d", weechat_upgrading); return value; } else if (string_strcasecmp (info_name, "charset_terminal") == 0) { return weechat_local_charset; } else if (string_strcasecmp (info_name, "charset_internal") == 0) { return WEECHAT_INTERNAL_CHARSET; } else if (string_strcasecmp (info_name, "locale") == 0) { return setlocale (LC_MESSAGES, NULL); } else if (string_strcasecmp (info_name, "inactivity") == 0) { if (gui_key_last_activity_time == 0) inactivity = 0; else inactivity = time (NULL) - gui_key_last_activity_time; snprintf (value, sizeof (value), "%ld", (long int)inactivity); return value; } else if (string_strcasecmp (info_name, "filters_enabled") == 0) { snprintf (value, sizeof (value), "%d", gui_filters_enabled); return value; } else if (string_strcasecmp (info_name, "cursor_mode") == 0) { snprintf (value, sizeof (value), "%d", gui_cursor_mode); return value; } else if (string_strcasecmp (info_name, "term_width") == 0) { snprintf (value, sizeof (value), "%d", gui_window_get_width ()); return value; } else if (string_strcasecmp (info_name, "term_height") == 0) { snprintf (value, sizeof (value), "%d", gui_window_get_height ()); return value; } else if (string_strcasecmp (info_name, "color_ansi_regex") == 0) { return GUI_COLOR_REGEX_ANSI_DECODE; } else if (string_strcasecmp (info_name, "color_term2rgb") == 0) { if (arguments && arguments[0]) { snprintf (value, sizeof (value), "%d", gui_color_convert_term_to_rgb (atoi (arguments))); return value; } } else if (string_strcasecmp (info_name, "color_rgb2term") == 0) { if (arguments && arguments[0]) { limit = 256; pos = strchr (arguments, ','); if (pos) { color = string_strndup (arguments, pos - arguments); if (!color) return NULL; rgb = atoi (color); limit = atoi (pos + 1); free (color); } else rgb = atoi (arguments); snprintf (value, sizeof (value), "%d", gui_color_convert_rgb_to_term (rgb, limit)); return value; } } /* info not found */ return NULL; }