ARTS 2.5.4 (git: bcd8c674)
arts.cc
Go to the documentation of this file.
1/* Copyright (C) 2003-2012 Stefan Buehler <sbuehler@ltu.se>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
27#include "arts.h"
28#include <unistd.h>
29#include <cstdlib>
30#include <stdexcept>
31#include "file.h"
32#include "messages.h"
33
42void arts_exit(int status) {
43 extern ofstream report_file;
44 extern String out_basename; // Basis for file name
45 ostringstream report_file_ext;
46
47 report_file_ext << ".rep";
49 add_basedir(out_basename + report_file_ext.str()));
50
51 exit(status);
52}
53
55
65 ostringstream os;
66
67 os << m << "\n";
68
71 extern String out_basename;
72 char *buf = getcwd(nullptr, 0);
73 os << "Detailed report file: " << buf << "/"
74 << add_basedir(out_basename + ".rep") << "\n";
75 free(buf);
76 }
77
78 os << "Stopping ARTS execution.\n"
79 << "Goodbye.\n";
80 out << os.str();
81
82 arts_exit(); // No argument means failure.
83}
void arts_exit_with_error_message(const String &m, ArtsOut &out)
Print error message and exit.
Definition: arts.cc:64
void arts_exit(int status)
This is the exit function of ARTS.
Definition: arts.cc:42
The global header file for ARTS.
const Verbosity & get_verbosity() const
Definition: messages.h:91
Index get_screen_verbosity() const
Definition: messages.h:65
Index get_file_verbosity() const
Definition: messages.h:66
String add_basedir(const std::string_view path)
Definition: file.cc:459
void cleanup_output_file(ofstream &file, const std::string_view name)
Closes the file.
Definition: file.cc:112
This file contains basic functions to handle ASCII files.
String out_basename
The basename for the report file and for all other output files.
Definition: messages.cc:42
ofstream report_file
The report file.
Definition: messages.cc:45
Declarations having to do with the four output streams.