1c72fcc34Sopenharmony_ci/* 2c72fcc34Sopenharmony_ci * die.c - error handlers 3c72fcc34Sopenharmony_ci * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 4c72fcc34Sopenharmony_ci * 5c72fcc34Sopenharmony_ci * This program is free software: you can redistribute it and/or modify 6c72fcc34Sopenharmony_ci * it under the terms of the GNU General Public License as published by 7c72fcc34Sopenharmony_ci * the Free Software Foundation, either version 2 of the License, or 8c72fcc34Sopenharmony_ci * (at your option) any later version. 9c72fcc34Sopenharmony_ci * 10c72fcc34Sopenharmony_ci * This program is distributed in the hope that it will be useful, 11c72fcc34Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 12c72fcc34Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13c72fcc34Sopenharmony_ci * GNU General Public License for more details. 14c72fcc34Sopenharmony_ci * 15c72fcc34Sopenharmony_ci * You should have received a copy of the GNU General Public License 16c72fcc34Sopenharmony_ci * along with this program. If not, see <http://www.gnu.org/licenses/>. 17c72fcc34Sopenharmony_ci */ 18c72fcc34Sopenharmony_ci 19c72fcc34Sopenharmony_ci#include "aconfig.h" 20c72fcc34Sopenharmony_ci#include <stdio.h> 21c72fcc34Sopenharmony_ci#include <stdlib.h> 22c72fcc34Sopenharmony_ci#include <alsa/asoundlib.h> 23c72fcc34Sopenharmony_ci#include "gettext_curses.h" 24c72fcc34Sopenharmony_ci#include "mainloop.h" 25c72fcc34Sopenharmony_ci#include "die.h" 26c72fcc34Sopenharmony_ci 27c72fcc34Sopenharmony_civoid fatal_error(const char *msg) 28c72fcc34Sopenharmony_ci{ 29c72fcc34Sopenharmony_ci app_shutdown(); 30c72fcc34Sopenharmony_ci fprintf(stderr, "%s\n", msg); 31c72fcc34Sopenharmony_ci exit(EXIT_FAILURE); 32c72fcc34Sopenharmony_ci} 33c72fcc34Sopenharmony_ci 34c72fcc34Sopenharmony_civoid fatal_alsa_error(const char *msg, int err) 35c72fcc34Sopenharmony_ci{ 36c72fcc34Sopenharmony_ci app_shutdown(); 37c72fcc34Sopenharmony_ci fprintf(stderr, _("%s: %s\n"), msg, snd_strerror(err)); 38c72fcc34Sopenharmony_ci exit(EXIT_FAILURE); 39c72fcc34Sopenharmony_ci} 40