GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
file-ops.cc File Reference
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include "canonicalize-file-name-wrapper.h"
#include "areadlink-wrapper.h"
#include "dir-ops.h"
#include "file-ops.h"
#include "file-stat.h"
#include "gen-tempname-wrapper.h"
#include "lo-sysdep.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "oct-password.h"
#include "quit.h"
#include "stat-wrappers.h"
#include "str-vec.h"
#include "unistd-wrappers.h"
Include dependency graph for file-ops.cc:

Go to the source code of this file.

Functions

std::string canonicalize_file_name (const std::string &name)
 
std::string canonicalize_file_name (const std::string &name, std::string &msg)
 
std::string concat (const std::string &dir, const std::string &file)
 
char dev_sep_char (void)
 
char dir_sep_char (void)
 
std::string dir_sep_chars (void)
 
std::string dir_sep_str (void)
 
std::string dirname (const std::string &path)
 
bool is_dev_sep (char c)
 
bool is_dir_sep (char c)
 
static std::string isolate_tilde_prefix (const std::string &fname)
 
int link (const std::string &old_name, const std::string &new_name)
 
int link (const std::string &old_name, const std::string &new_name, std::string &msg)
 
int mkdir (const std::string &name, mode_t mode, std::string &msg)
 
int mkdir (const std::string &nm, mode_t md)
 
int mkfifo (const std::string &name, mode_t mode, std::string &msg)
 
int mkfifo (const std::string &nm, mode_t md)
 
std::string native_separator_path (const std::string &path)
 
int readlink (const std::string &path, std::string &result)
 
int readlink (const std::string &path, std::string &result, std::string &msg)
 
int recursive_mkdir (const std::string &name, mode_t mode)
 
int recursive_mkdir (const std::string &name, mode_t mode, std::string &msg)
 
int recursive_rmdir (const std::string &name)
 
int recursive_rmdir (const std::string &name, std::string &msg)
 
int rename (const std::string &from, const std::string &to)
 
int rename (const std::string &from, const std::string &to, std::string &msg)
 
int rmdir (const std::string &name)
 
int rmdir (const std::string &name, std::string &msg)
 
int symlink (const std::string &old_name, const std::string &new_name)
 
int symlink (const std::string &old_name, const std::string &new_name, std::string &msg)
 
std::string tail (const std::string &path)
 
std::string tempnam (const std::string &dir, const std::string &pfx)
 
std::string tempnam (const std::string &dir, const std::string &pfx, std::string &msg)
 
std::string tilde_expand (const std::string &name)
 
string_vector tilde_expand (const string_vector &names)
 
static std::string tilde_expand_word (const std::string &filename)
 
static std::size_t tilde_find_prefix (const std::string &s, std::size_t &len)
 
static std::size_t tilde_find_suffix (const std::string &s)
 
int umask (mode_t mode)
 
int unlink (const std::string &name)
 
int unlink (const std::string &name, std::string &msg)
 

Variables

static const char * default_prefixes [] = { " ~", "\t~", ":~", nullptr }
 
static const char * default_suffixes [] = { " ", "\n", ":", nullptr }
 
string_vector tilde_additional_prefixes = default_prefixes
 
string_vector tilde_additional_suffixes = default_suffixes
 
tilde_expansion_hook tilde_expansion_failure_hook = nullptr
 
tilde_expansion_hook tilde_expansion_preexpansion_hook = nullptr
 

Function Documentation

◆ canonicalize_file_name() [1/2]

◆ canonicalize_file_name() [2/2]

std::string canonicalize_file_name ( const std::string &  name,
std::string &  msg 
)

◆ concat()

std::string concat ( const std::string &  dir,
const std::string &  file 
)

Definition at line 351 of file file-ops.cc.

References dir_sep_char(), and is_dir_sep().

◆ dev_sep_char()

char dev_sep_char ( void  )

Definition at line 222 of file file-ops.cc.

Referenced by is_dev_sep().

◆ dir_sep_char()

char dir_sep_char ( void  )

Definition at line 231 of file file-ops.cc.

Referenced by concat(), native_separator_path(), and tempnam().

◆ dir_sep_chars()

std::string dir_sep_chars ( void  )

Definition at line 249 of file file-ops.cc.

References dir_sep_str().

Referenced by canonicalize_file_name(), dirname(), is_dir_sep(), recursive_mkdir(), and tail().

◆ dir_sep_str()

◆ dirname()

◆ is_dev_sep()

bool is_dev_sep ( char  c)

Definition at line 266 of file file-ops.cc.

References dev_sep_char().

◆ is_dir_sep()

bool is_dir_sep ( char  c)

◆ isolate_tilde_prefix()

static std::string isolate_tilde_prefix ( const std::string &  fname)
static

Definition at line 142 of file file-ops.cc.

References is_dir_sep(), and len.

Referenced by tilde_expand_word().

◆ link() [1/2]

int link ( const std::string &  old_name,
const std::string &  new_name 
)

Definition at line 491 of file file-ops.cc.

Referenced by documentation::documentation(), Flink(), and octave_link_wrapper().

◆ link() [2/2]

int link ( const std::string &  old_name,
const std::string &  new_name,
std::string &  msg 
)

Definition at line 497 of file file-ops.cc.

References octave_link_wrapper().

◆ mkdir() [1/2]

int mkdir ( const std::string &  name,
mode_t  mode,
std::string &  msg 
)

Definition at line 408 of file file-ops.cc.

References octave_mkdir_wrapper().

◆ mkdir() [2/2]

int mkdir ( const std::string &  nm,
mode_t  md 
)

◆ mkfifo() [1/2]

int mkfifo ( const std::string &  name,
mode_t  mode,
std::string &  msg 
)

Definition at line 479 of file file-ops.cc.

References octave_mkfifo_wrapper().

◆ mkfifo() [2/2]

int mkfifo ( const std::string &  nm,
mode_t  md 
)

Definition at line 473 of file file-ops.cc.

Referenced by Fmkfifo(), and octave_mkfifo_wrapper().

◆ native_separator_path()

std::string native_separator_path ( const std::string &  path)

Definition at line 379 of file file-ops.cc.

References dir_sep_char(), and n.

Referenced by F__fltk_uigetfile__().

◆ readlink() [1/2]

int readlink ( const std::string &  path,
std::string &  result 
)

Definition at line 533 of file file-ops.cc.

Referenced by Freadlink().

◆ readlink() [2/2]

int readlink ( const std::string &  path,
std::string &  result,
std::string &  msg 
)

Definition at line 539 of file file-ops.cc.

References free(), and octave_areadlink_wrapper().

◆ recursive_mkdir() [1/2]

int recursive_mkdir ( const std::string &  name,
mode_t  mode 
)

Definition at line 420 of file file-ops.cc.

◆ recursive_mkdir() [2/2]

int recursive_mkdir ( const std::string &  name,
mode_t  mode,
std::string &  msg 
)

Definition at line 426 of file file-ops.cc.

References dir_sep_chars(), is_dir_sep(), and mkdir().

◆ recursive_rmdir() [1/2]

int recursive_rmdir ( const std::string &  name)

◆ recursive_rmdir() [2/2]

int recursive_rmdir ( const std::string &  name,
std::string &  msg 
)

◆ rename() [1/2]

int rename ( const std::string &  from,
const std::string &  to 
)

◆ rename() [2/2]

int rename ( const std::string &  from,
const std::string &  to,
std::string &  msg 
)

Definition at line 565 of file file-ops.cc.

References rename(), and u8_to_wstring().

◆ rmdir() [1/2]

int rmdir ( const std::string &  name)

Definition at line 586 of file file-ops.cc.

Referenced by Frmdir(), octave_rmdir_wrapper(), and recursive_rmdir().

◆ rmdir() [2/2]

int rmdir ( const std::string &  name,
std::string &  msg 
)

Definition at line 592 of file file-ops.cc.

References octave_rmdir_wrapper().

◆ symlink() [1/2]

int symlink ( const std::string &  old_name,
const std::string &  new_name 
)

Definition at line 512 of file file-ops.cc.

Referenced by Freadlink(), Fsymlink(), and octave_symlink_wrapper().

◆ symlink() [2/2]

int symlink ( const std::string &  old_name,
const std::string &  new_name,
std::string &  msg 
)

Definition at line 518 of file file-ops.cc.

References octave_symlink_wrapper().

◆ tail()

std::string tail ( const std::string &  path)

Definition at line 367 of file file-ops.cc.

References dir_sep_chars().

Referenced by bp_file_info::bp_file_info().

◆ tempnam() [1/2]

std::string tempnam ( const std::string &  dir,
const std::string &  pfx 
)

◆ tempnam() [2/2]

std::string tempnam ( const std::string &  dir,
const std::string &  pfx,
std::string &  msg 
)

◆ tilde_expand() [1/2]

◆ tilde_expand() [2/2]

string_vector tilde_expand ( const string_vector names)

Definition at line 339 of file file-ops.cc.

References n, string_vector::numel(), and tilde_expand().

◆ tilde_expand_word()

static std::string tilde_expand_word ( const std::string &  filename)
static

◆ tilde_find_prefix()

static std::size_t tilde_find_prefix ( const std::string &  s,
std::size_t &  len 
)
static

Definition at line 76 of file file-ops.cc.

References string_vector::empty(), len, string_vector::numel(), and tilde_additional_prefixes.

Referenced by tilde_expand().

◆ tilde_find_suffix()

static std::size_t tilde_find_suffix ( const std::string &  s)
static

◆ umask()

int umask ( mode_t  mode)

Definition at line 672 of file file-ops.cc.

References octave_umask_wrapper().

Referenced by Fumask(), and octave_umask_wrapper().

◆ unlink() [1/2]

◆ unlink() [2/2]

int unlink ( const std::string &  name,
std::string &  msg 
)

Definition at line 683 of file file-ops.cc.

References octave_unlink_wrapper().

Variable Documentation

◆ default_prefixes

const char* default_prefixes[] = { " ~", "\t~", ":~", nullptr }
static

Definition at line 68 of file file-ops.cc.

◆ default_suffixes

const char* default_suffixes[] = { " ", "\n", ":", nullptr }
static

Definition at line 73 of file file-ops.cc.

◆ tilde_additional_prefixes

string_vector tilde_additional_prefixes = default_prefixes

Definition at line 262 of file file-ops.cc.

Referenced by tilde_find_prefix().

◆ tilde_additional_suffixes

string_vector tilde_additional_suffixes = default_suffixes

Definition at line 264 of file file-ops.cc.

Referenced by tilde_find_suffix().

◆ tilde_expansion_failure_hook

tilde_expansion_hook tilde_expansion_failure_hook = nullptr

Definition at line 260 of file file-ops.cc.

Referenced by tilde_expand_word().

◆ tilde_expansion_preexpansion_hook

tilde_expansion_hook tilde_expansion_preexpansion_hook = nullptr

Definition at line 258 of file file-ops.cc.

Referenced by tilde_expand_word().