ARTS  2.3.1285(git:92a29ea9-dirty)
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 
42 void 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";
48  cleanup_output_file(report_file,
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 cleanup_output_file(ofstream &, const String &)
Closes the file.
Definition: file.cc:136
void arts_exit(int status)
This is the exit function of ARTS.
Definition: arts.cc:42
Declarations having to do with the four output streams.
String out_basename
The basename for the report file and for all other output files.
Definition: messages.cc:42
This file contains basic functions to handle ASCII files.
The global header file for ARTS.
_CS_string_type str() const
Definition: sstream.h:491
const Verbosity & get_verbosity() const
Definition: messages.h:92
ofstream report_file
The report file.
Definition: messages.cc:45
void arts_exit_with_error_message(const String &m, ArtsOut &out)
Print error message and exit.
Definition: arts.cc:64
Index get_file_verbosity() const
Definition: messages.h:67
String add_basedir(const String &path)
Definition: file.cc:499
Index get_screen_verbosity() const
Definition: messages.h:66