lftp  4.4.6
About: lftp is a command line ftp client (FTP, HTTP, ssl support, background transfer, reget, reput, ...)
  Fossies Dox: lftp-4.4.6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
misc.h File Reference
#include "trio.h"
#include <sys/types.h>
#include <sys/time.h>
#include <stdarg.h>
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  subst_t
 

Macros

#define find_char(buf, len, ch)   ((const char *)memchr(buf,ch,len))
 
#define ListAdd(type, chain, this, next)
 
#define ListScan(type, chain, next)   for(type *scan=chain; scan; scan=scan->next)
 
#define ListScanPtr(type, chain, next)   for(type **scan=&chain; *scan; scan=&scan[0]->next)
 
#define ListDel(type, chain, this, next)
 

Functions

const char * expand_home_relative (const char *)
 
const char * basename_ptr (const char *)
 
const char * dir_file (const char *dir, const char *file)
 
const char * url_file (const char *url, const char *file)
 
const char * output_file_name (const char *src, const char *dst, bool dst_local, const char *dst_base, bool make_dirs)
 
const char * squeeze_file_name (const char *name, int w)
 
int create_directories (char *)
 
void truncate_file_tree (const char *dir)
 
int fd_width (int fd)
 
bool in_foreground_pgrp ()
 
char * xgetcwd ()
 
int percent (off_t offset, off_t size)
 
int parse_month (const char *)
 
int parse_perms (const char *)
 
const char * format_perms (int p)
 
int parse_year_or_time (const char *year_or_time, int *year, int *hour, int *minute)
 
int guess_year (int month, int day, int hour, int minute)
 
time_t mktime_from_utc (const struct tm *)
 
time_t mktime_from_tz (struct tm *, const char *tz)
 
bool re_match (const char *line, const char *a, int flags=0)
 
char * Subst (const char *txt, const subst_t *s)
 
void xgettimeofday (time_t *sec, int *usec)
 
char * xstrftime (const char *format, const struct tm *tm)
 
void strip_trailing_slashes (xstring &fn)
 
xstringdirname_modify (xstring &fn)
 
xstringdirname (const char *path)
 
char last_char (const char *str)
 
int base64_length (int len)
 
void base64_encode (const char *s, char *store, int length)
 
bool temporary_network_error (int e)
 
CDECL const char * get_home ()
 
CDECL const char * get_lftp_config_dir ()
 
CDECL const char * get_lftp_data_dir ()
 
CDECL const char * get_lftp_cache_dir ()
 
const char * memrchr (const char *buf, char c, size_t len)
 
const xstringshell_encode (const char *)
 
void remove_tags (char *buf)
 
void rtrim (char *s)
 
void random_init ()
 
double random01 ()
 
const char * get_nodename ()
 

Variables

const char month_names [][4]
 

Macro Definition Documentation

#define find_char (   buf,
  len,
  ch 
)    ((const char *)memchr(buf,ch,len))
#define ListAdd (   type,
  chain,
  this,
  next 
)
Value:
do { \
this->next=chain; \
chain=this; \
} while(0)

Definition at line 133 of file misc.h.

Referenced by ResClient::ResClient().

#define ListDel (   type,
  chain,
  this,
  next 
)
Value:
do { \
ListScanPtr(type,chain,next) \
if(*scan==this) \
{ \
*scan=scan[0]->next; \
break; \
} \
} while(0)

Definition at line 145 of file misc.h.

Referenced by Job::PrepareToDie(), FileAccess::~FileAccess(), and ResClient::~ResClient().

#define ListScanPtr (   type,
  chain,
  next 
)    for(type **scan=&chain; *scan; scan=&scan[0]->next)

Definition at line 142 of file misc.h.

Function Documentation

void base64_encode ( const char *  s,
char *  store,
int  length 
)

Definition at line 705 of file misc.cc.

References p.

int base64_length ( int  len)

Definition at line 696 of file misc.cc.

int create_directories ( char *  )

Definition at line 188 of file misc.cc.

References strchr, and strerror().

xstring& dirname ( const char *  path)
xstring& dirname_modify ( xstring fn)

Definition at line 671 of file misc.cc.

References strip_trailing_slashes(), strrchr, and xstring::truncate().

Referenced by FileAccess::Path::Change(), LsCache::Changed(), and dirname().

const char* expand_home_relative ( const char *  )
int fd_width ( int  fd)

Definition at line 251 of file misc.cc.

Referenced by OutputJob::OutputJob(), and CmdExec::print_cmd_index().

const char* format_perms ( int  p)

Definition at line 361 of file misc.cc.

References s.

Referenced by FileInfo::MakeLongName().

CDECL const char* get_home ( )

Definition at line 771 of file misc.cc.

References NULL.

Referenced by get_lftp_dir(), and get_lftp_home_nocreate().

CDECL const char* get_lftp_cache_dir ( )

Definition at line 862 of file misc.cc.

References get_lftp_dir().

CDECL const char* get_lftp_config_dir ( )

Definition at line 852 of file misc.cc.

References get_lftp_dir().

Referenced by main().

CDECL const char* get_lftp_data_dir ( )

Definition at line 857 of file misc.cc.

References get_lftp_dir().

const char* get_nodename ( )

Definition at line 985 of file misc.cc.

Referenced by AcceptTermFD::get_sock_path().

int guess_year ( int  month,
int  day,
int  hour,
int  minute 
)

Definition at line 409 of file misc.cc.

References now, SMTask::now, and tm.

Referenced by FileInfo::parse_ls_line().

bool in_foreground_pgrp ( )

Definition at line 953 of file misc.cc.

References open().

Referenced by CmdExec::Done(), and ReadlineFeeder::NextCmd().

const char* memrchr ( const char *  buf,
char  c,
size_t  len 
)

Definition at line 868 of file misc.cc.

Referenced by FileCopy::Do().

time_t mktime_from_tz ( struct tm ,
const char *  tz 
)

Definition at line 522 of file misc.cc.

References mktime(), mktime_from_utc(), snprintf(), strcasecmp(), and string_alloca.

Referenced by FileInfo::parse_ls_line().

time_t mktime_from_utc ( const struct tm )

Definition at line 464 of file misc.cc.

References memcpy, mktime(), and tm.

Referenced by Http::atotm(), Ftp::ConvertFtpDate(), and mktime_from_tz().

const char* output_file_name ( const char *  src,
const char *  dst,
bool  dst_local,
const char *  dst_base,
bool  make_dirs 
)
int parse_month ( const char *  )

Definition at line 385 of file misc.cc.

References month_names, and strcasecmp().

Referenced by FileInfo::parse_ls_line().

int parse_perms ( const char *  )

Definition at line 285 of file misc.cc.

References p, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, and S_IXUSR.

Referenced by FileInfo::parse_ls_line().

int parse_year_or_time ( const char *  year_or_time,
int *  year,
int *  hour,
int *  minute 
)

Definition at line 393 of file misc.cc.

int percent ( off_t  offset,
off_t  size 
)

Definition at line 418 of file misc.cc.

Referenced by FileCopy::GetPercentDone().

double random01 ( )

Definition at line 979 of file misc.cc.

Referenced by Range::Random().

void random_init ( )

Definition at line 970 of file misc.cc.

References NULL.

Referenced by Range::Random().

bool re_match ( const char *  line,
const char *  a,
int  flags = 0 
)

Definition at line 542 of file misc.cc.

References REG_EXTENDED, REG_NOSUB, regcomp(), regexec(), and regfree().

void remove_tags ( char *  buf)

Definition at line 921 of file misc.cc.

References strchr, and strstr().

void rtrim ( char *  s)

Definition at line 946 of file misc.cc.

const xstring& shell_encode ( const char *  )

Definition at line 877 of file misc.cc.

References c, xstring0::get_non_const(), xstring::get_space(), xstring::null, r, s, and xstring::set_length().

Referenced by LocalAccess::Do(), and Fish::Do().

void strip_trailing_slashes ( xstring fn)

Definition at line 661 of file misc.cc.

References xstring::length(), and xstring::truncate().

Referenced by FileAccess::Path::Change(), and dirname_modify().

char* Subst ( const char *  txt,
const subst_t s 
)
bool temporary_network_error ( int  e)

Definition at line 739 of file misc.cc.

References ECONNABORTED, and ENETRESET.

Referenced by SMTask::TemporaryNetworkError().

void truncate_file_tree ( const char *  dir)

Definition at line 228 of file misc.cc.

References SignalHook::Ignore(), and NULL.

const char* url_file ( const char *  url,
const char *  file 
)
void xgettimeofday ( time_t *  sec,
int *  usec 
)

Definition at line 619 of file misc.cc.

References gettimeofday(), timeval::tv_sec, and timeval::tv_usec.

Referenced by Time::SetToCurrentTime().

char* xstrftime ( const char *  format,
const struct tm tm 
)

Definition at line 632 of file misc.cc.

References NULL, and xrealloc().

Referenced by FileSetOutput::print().

Variable Documentation

const char month_names[][4]

Definition at line 380 of file misc.cc.

Referenced by parse_month().