/usr/include/wvstreams/wvfileutils.h is in libwvstreams-dev 4.6.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /* -*- Mode: C++ -*-
* Worldvisions Weaver Software:
* Copyright (C) 1997-2005 Net Integration Technologies, Inc.
*
* Various little file functions...
*
*/
#ifndef __WVFILEUTILS_H
#define __WVFILEUTILS_H
#include "wvstring.h"
#include "wvstringlist.h"
/**
* Like mkdir(), but has the same parameters in both Unix and Windows.
*/
int wvmkdir(WvStringParm _dir, int create_mode = 0700);
/**
* Create a directory and any subdirectories required along the way.
* (Equivalent to mkdir -p).
*
* The default permissions on created directories is 0700, but this can be
* changed at will.
*/
int mkdirp(WvStringParm _dir, int create_mode = 0700);
/**
* Safely remove an entire filesystem directory hierarchy.
* (Equivalent to rm -rf). Just like "rm -rf", it may or may not successfully
* delete everything. It's your job to check that afterwards.
*/
void rm_rf(WvStringParm _dir);
/**
* Copy from src to dst preserving permissions and time stamp. This does not
* preserve ownership, however.
*
* Two versions of this are provided. One for giving two filenames/paths, and
* another for giving two starting directories and a relative path from there.
*/
bool fcopy(WvStringParm src, WvStringParm dst);
bool fcopy(WvStringParm srcdir, WvStringParm dstdir, WvStringParm relname);
/**
* Create the file if it doesn't exist, or update the file's modification and
* access times if it does.
* (Equivalent to touch).
*/
bool ftouch(WvStringParm file, time_t mtime = 0);
/**
* Reads the contents of a symlink. Returns the contents, or
* WvString::null on error.
*/
WvString wvreadlink(WvStringParm path);
/**
* Check whether two files have the same date/time stamp. This can be used as a
* quick check whether files are unchanged / the same, though obviously it
* doesn't verify that they are indeed the same file.
*
* Two versions are provided, one for giving two files, and another for giving
* two starting directories and a relative path from there.
*/
bool samedate(WvStringParm file1, WvStringParm file2);
bool samedate(WvStringParm dir1, WvStringParm dir2, WvStringParm relname);
/**
* Runs fnmatch against everything in the patterns list. We also interpret
* .cvsignore-style '!' patterns, which makes us very fancy.
*/
#ifndef _WIN32
bool wvfnmatch(WvStringList &patterns, WvStringParm name, int flags = 0);
#endif
/**
* Replacement for tmpfile() that works correctly in win32 as well as Unix.
*/
FILE *wvtmpfile();
/* Returns a unique filename suitable for a temporary file. Obviously there is
* the caveat that someone else may claim this file name before you open it:
* do not use this routine where that race may be a real concern (this would
* apply only to security-sensitive code)
*/
WvString wvtmpfilename(WvStringParm prefix);
#ifndef _WIN32
/**
* Basically our own implementation of the NetBSD lchmod() call.
*/
int wvchmod(const char *path, mode_t mode);
#endif
/**
* A simple helper function to get the current umask.
*/
#ifndef _WIN32
mode_t get_umask();
#endif
#endif // __WVFILEUTILS_H
|