// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.cc,v 1.38 2001/04/22 05:42:52 jgg Exp $
+// $Id: fileutl.cc,v 1.42 2002/09/14 05:29:22 jgg Exp $
/* ######################################################################
File Utilities
GetLock - dpkg compatible lock file manipulation (fcntl)
This source is placed in the Public Domain, do with it what you will
- It was originally written by Jason Gunthorpe.
+ It was originally written by Jason Gunthorpe <jgg@debian.org>.
##################################################################### */
/*}}}*/
#include <apti18n.h>
+#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
/*}}}*/
+using namespace std;
+
// CopyFile - Buffered copy of a file /*{{{*/
// ---------------------------------------------------------------------
/* The caller is expected to set things so that failure causes erasure */
/*}}}*/
// flNotFile - Strip the file from the directory name /*{{{*/
// ---------------------------------------------------------------------
-/* */
+/* Result ends in a / */
string flNotFile(string File)
{
string::size_type Res = File.rfind('/');
if (Res == string::npos)
- return File;
+ return "./";
Res++;
return string(File,0,Res);
}
/*}}}*/
// ExecWait - Fancy waitpid /*{{{*/
// ---------------------------------------------------------------------
-/* Waits for the given sub process. If Reap is set the no errors are
+/* Waits for the given sub process. If Reap is set then no errors are
generated. Otherwise a failed subprocess will generate a proper descriptive
message */
bool ExecWait(int Pid,const char *Name,bool Reap)