/*
 *      fhist - file history and comparison tools
 *      Copyright (C) 2000, 2002, 2008, 2010 Peter Miller
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 3 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program. If not, see
 *      <http://www.gnu.org/licenses/>.
 */

#include <common/ac/string.h>

#include <common/error_intl.h>
#include <common/fcheck.h>
#include <common/str.h>


void
fatal_with_filename(const char *filename, sub_context_ty *scp, const char *text)
{
    string_ty       *s;

    if (!scp)
        scp = sub_context_new();
    s = subst_intl(scp, (char *)text);
    sub_var_set_charstar(scp, "File_Name", filename);
    sub_var_set_string(scp, "MeSsaGe", s);
    str_free(s);
    fatal_intl(scp, i18n("$filename: $message"));
}


void
warning_last_line_unterminated(const char *filename)
{
    sub_context_ty  *scp;

    scp = sub_context_new();
    sub_var_set_charstar(scp, "File_Name", filename);
    error_intl(scp, i18n("$filename: warning: last line unterminated"));
    sub_context_delete(scp);
}
