Revision 900cea42

View differences:

CREDITS
1 1
CREDITS AND ACKNOWLEDGEMENTS
2 2

  
3
* Paul Martin for Fedora Core compatibilty testing and fixes.
4

  
3 5
* Ren? Rebe ROCK linux and T2 packaging. 
4 6
  7MHz dvb-t patch.
5 7

  
ChangeLog
1
2004-10-11  John Knottenbelt  <jak@users.sourceforge.net>
2
	Added some Fedora Core compatibility fixes. Removed
3
	ofstream from dvb-cat (used file descriptors instead)
4

  
1 5
2004-08-21  John Knottenbelt  <jak@users.sourceforge.net>
2 6
	Added 7MHZ bandwidth option for dvb-t
3 7
	More flexible channel finding in dvbdguide/tv.cgi
configure.ac
1
AC_INIT(dvbd, 0.7.4)
1
AC_INIT(dvbd, 0.7.5)
2 2
AC_CONFIG_SRCDIR(src/dvbd.cpp)
3 3
AM_INIT_AUTOMAKE
4 4
AM_CONFIG_HEADER(config.h)
src/dvbcat.cpp
30 30
#include <getopt.h>
31 31
#include <cerrno>
32 32
#include <fstream>
33

  
34
// Unfortunately, large file support (LFS) in gcc 3.2, 3.3 is broken
35
// on Debian sarge/sid. Work around with LFS_WORKAROUND
36

  
37
#define LFS_WORKAROUND
38

  
39
#ifdef LFS_WORKAROUND
40 33
#include <fcntl.h>
41
#include <ext/stdio_filebuf.h>
42
#endif
43 34

  
44 35
void usage(const char *progname);
45 36
time_t convertTime(const char *theTime);
46
std::ostream *openOutputFile(std::string &outputfile);
47
void closeOutputFile(std::ostream *o);
37
int openOutputFile(std::string &outputfile);
38
void closeOutputFile(int fd);
48 39

  
49 40
int main(int argc, char *argv[])
50 41
{
......
115 106
  }
116 107

  
117 108
  // Open the output file
118
  std::ostream *output = openOutputFile(outputFile);
119
  if (output == NULL || !*output) {
109
  int outputFd = openOutputFile(outputFile);
110
  if (outputFd < 0) {
120 111
    std::cerr << "Fatal error: failed to open " << outputFile << " for output"
121 112
	      << std::endl;
122 113
    return 1;
......
163 154
      int bytesRead = data.read(buffer, 1024);
164 155

  
165 156
      if (bytesRead > 0) 
166
	output->write(buffer, bytesRead);
157
	write(outputFd, buffer, bytesRead);
167 158
    }
168 159
    else if (control.isReady(s)) {
169 160
      if (!control.processReady(s)) {
......
177 168
    }
178 169
  } while (true);
179 170

  
180
  closeOutputFile(output);
171
  closeOutputFile(outputFd);
181 172
  return 0;
182 173
}
183 174

  
184
std::ostream *openOutputFile(std::string &outputFile)
175
int openOutputFile(std::string &outputFile)
185 176
{
186 177
  if (outputFile == "-") 
187
    return &std::cout;
178
    return 0;
188 179

  
189
#ifndef LFS_WORKAROUND
190
  return = new std::ofstream(outputFile.c_str());
191
#else
192 180
  int openMode = O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE;
193 181

  
194 182
  // Don't bother caching if possible
......
196 184
  openMode |= O_STREAMING;
197 185
#endif
198 186
  
199
  int fd = open(outputFile.c_str(), openMode, 0644);
200
  if (fd < 0) 
201
    return NULL;
202
  return new std::ostream(new __gnu_cxx::stdio_filebuf<char>(fd, std::ios_base::out, true, BUFSIZ));
203
#endif // LFS_WORKAROUND
187
  return open(outputFile.c_str(), openMode, 0644);
204 188
}
205 189

  
206
void closeOutputFile(std::ostream *o)
190
void closeOutputFile(int fd)
207 191
{
208
  if (o != &std::cout)
209
    delete o;
192
  if (fd > 0)
193
    close(fd);
210 194
}
211 195

  
212 196
void usage(const char *progname) {
src/dvbsched.cpp
32 32
#include <cerrno>
33 33
#include <fstream>
34 34

  
35
// Unfortunately, large file support (LFS) in gcc 3.2, 3.3 is broken
36
// on Debian sarge/sid. Work around with LFS_WORKAROUND
37

  
38
#define LFS_WORKAROUND
39

  
40
#ifdef LFS_WORKAROUND
41
#include <fcntl.h>
42
#include <ext/stdio_filebuf.h>
43
#endif
44

  
45 35
void usage(const char *progname);
46 36
time_t convertTime(const char *theTime);
47 37

  
src/utils.cpp
25 25
#include <unistd.h>
26 26
#include <iostream>
27 27
#include <cctype>
28
#include <cerrno>
28 29

  
29 30
void setNonBlocking(int fd)
30 31
{

Also available in: Unified diff