2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: TTFile.C /main/2 1995/07/17 14:10:04 drk $ */
24 /*******************************************************************
25 ** (c) Copyright Hewlett-Packard Company, 1990, 1991, 1992, 1993.
26 ** All rights are reserved. Copying or other reproduction of this
27 ** program except for archival purposes is prohibited without prior
28 ** written consent of Hewlett-Packard Company.
29 ********************************************************************
30 ****************************<+>*************************************/
40 ) : CString(), status(TT_OK)
42 char * temp = tt_host_file_netfile(host.data(), path.data());
44 if ((status = tt_ptr_error(temp)) != TT_OK)
45 Throw (TT_Exception(temp));
47 contents = tt_netfile_file(temp);
50 if ((status = tt_ptr_error(contents)) != TT_OK)
51 Throw (TT_Exception(contents));
59 contents = new char [file.length() + 1];
60 strcpy(contents,file.data());
70 #ifndef HAS_EXCEPTIONS
71 void TTFile::TT_Exception
77 cerr << tt_status_message(tt_pointer_error(str)) << endl;
79 fprintf(stderr, "%s\n", tt_status_message(tt_pointer_error(str)));
84 TTFile & TTFile::operator=
91 contents = new char [file.length() + 1];
92 strcpy(contents,file.data());
98 #if defined(linux) || defined(CSRG_BASED)
99 std::ostream & operator<<
112 if (file.ttFileOpFailed())
113 #if defined(linux) || defined(CSRG_BASED)
114 return os << "Error in filename mapping; status = "
115 << file.getStatus() << std::endl;
117 return os << "Error in filename mapping; status = "
118 << file.getStatus() << endl;
121 #if defined(linux) || defined(CSRG_BASED)
122 return os << file.data() << std::endl;
124 return os << file.data() << endl;