output.cc (2665:a124942bacb8) output.cc (4840:ad2beb0f9fd8)
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 73 unchanged lines hidden (view full) ---

82
83string
84OutputDirectory::resolve(const string &name)
85{
86 return (name[0] != '/') ? dir + name : name;
87}
88
89ostream *
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 73 unchanged lines hidden (view full) ---

82
83string
84OutputDirectory::resolve(const string &name)
85{
86 return (name[0] != '/') ? dir + name : name;
87}
88
89ostream *
90OutputDirectory::create(const string &name)
90OutputDirectory::create(const string &name, bool binary)
91{
92 if (name == "cerr" || name == "stderr")
93 return &cerr;
94
95 if (name == "cout" || name == "stdout")
96 return &cout;
97
91{
92 if (name == "cerr" || name == "stderr")
93 return &cerr;
94
95 if (name == "cout" || name == "stdout")
96 return &cout;
97
98 ofstream *file = new ofstream(resolve(name).c_str(), ios::trunc);
98 ofstream *file = new ofstream(resolve(name).c_str(),
99 ios::trunc | binary ? ios::binary : (ios::openmode)0);
99 if (!file->is_open())
100 panic("Cannot open file %s", name);
101
102 return file;
103}
104
105ostream *
106OutputDirectory::find(const string &name)

--- 25 unchanged lines hidden ---
100 if (!file->is_open())
101 panic("Cannot open file %s", name);
102
103 return file;
104}
105
106ostream *
107OutputDirectory::find(const string &name)

--- 25 unchanged lines hidden ---