mtools.h File Reference

#include "msdos.h"
#include "stream.h"

Include dependency graph for mtools.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  device

Defines

#define SCSI_FLAG   1
#define PRIV_FLAG   2
#define NOLOCK_FLAG   4
#define USE_XDF_FLAG   8
#define MFORMAT_ONLY_FLAG   16
#define VOLD_FLAG   32
#define FLOPPYD_FLAG   64
#define FILTER_FLAG   128
#define IS_SCSI(x)   ((x) && ((x)->misc_flags & SCSI_FLAG))
#define IS_PRIVILEGED(x)   ((x) && ((x)->misc_flags & PRIV_FLAG))
#define IS_NOLOCK(x)   ((x) && ((x)->misc_flags & NOLOCK_FLAG))
#define IS_MFORMAT_ONLY(x)   ((x) && ((x)->misc_flags & MFORMAT_ONLY_FLAG))
#define SHOULD_USE_VOLD(x)   ((x)&& ((x)->misc_flags & VOLD_FLAG))
#define SHOULD_USE_XDF(x)   ((x)&& ((x)->misc_flags & USE_XDF_FLAG))
#define BOOTSIZE   512
#define maximize(target, max)
#define minimize(target, min)
#define SET_INT(target, source)   if(source)target=source
#define New(type)   ((type*)(malloc(sizeof(type))))
#define Grow(adr, n, type)   ((type*)(realloc((char *)adr,n*sizeof(type))))
#define Free(adr)   (free((char *)adr));
#define NewArray(size, type)   ((type*)(calloc((size),sizeof(type))))
#define EXPAND_BUF   2048
#define ROUND_DOWN(value, grain)   ((value) - (value) % (grain))
#define ROUND_UP(value, grain)   ROUND_DOWN((value) + (grain)-1, (grain))

Typedefs

typedef device device_t

Functions

int init_geom (int fd, struct device *dev, struct device *orig_dev, struct stat *stat)
int readwrite_sectors (int fd, int *drive, int rate, int seektrack, int track, int head, int sector, int size, char *data, int bytes, int direction, int retries)
int lock_dev (int fd, int mode, struct device *dev)
char * unix_normalize (char *ans, char *name, char *ext)
char * dos_name (char *filename, int verbose, int *mangled, char *buffer)
directorymk_entry (const char *filename, char attr, unsigned int fat, size_t size, time_t date, struct directory *ndir)
int copyfile (Stream_t *Source, Stream_t *Target)
int getfreeMinClusters (Stream_t *Stream, size_t ref)
FILEopentty (int mode)
int is_dir (Stream_t *Dir, char *path)
void bufferize (Stream_t **Dir)
int dir_grow (Stream_t *Dir, int size)
int match (const char *, const char *, char *, int, int)
char * unix_name (char *name, char *ext, char Case, char *answer)
void * safe_malloc (size_t size)
Stream_topen_filter (Stream_t *Next)
void setup_signal (void)
 UNUSED (static inline int compare(long ref, long testee))
Stream_tGetFs (Stream_t *Fs)
char * label_name (char *filename, int verbose, int *mangled, char *ans)
void read_config (void)
void mattrib (int argc, char **argv, int type)
void mbadblocks (int argc, char **argv, int type)
void mcat (int argc, char **argv, int type)
void mcd (int argc, char **argv, int type)
void mcopy (int argc, char **argv, int type)
void mdel (int argc, char **argv, int type)
void mdir (int argc, char **argv, int type)
void mdoctorfat (int argc, char **argv, int type)
void mdu (int argc, char **argv, int type)
void mformat (int argc, char **argv, int type)
void minfo (int argc, char **argv, int type)
void mlabel (int argc, char **argv, int type)
void mmd (int argc, char **argv, int type)
void mmount (int argc, char **argv, int type)
void mmove (int argc, char **argv, int type)
void mpartition (int argc, char **argv, int type)
void mshowfat (int argc, char **argv, int mtype)
void mtoolstest (int argc, char **argv, int type)
void mzip (int argc, char **argv, int type)
void init_privs (void)
void reclaim_privs (void)
void drop_privs (void)
void destroy_privs (void)
uid_t get_real_uid (void)
void closeExec (int fd)
void precmd (struct device *dev)
void print_sector (char *message, unsigned char *data, int size)
time_t getTimeNow (time_t *now)
Stream_tOpenDir (Stream_t *Parent, const char *filename)
dirCache_t ** getDirCacheP (Stream_t *Stream)
int isRootDir (Stream_t *Stream)
unsigned int getStart (Stream_t *Dir, struct directory *dir)
unsigned int countBlocks (Stream_t *Dir, unsigned int block)
char * getDrive (Stream_t *Stream)
void printOom (void)
int ask_confirmation (const char *, const char *, const char *)
char * get_homedir (void)
const char * expand (const char *, char *)
const char * fix_mcwd (char *)
FILEopen_mcwd (const char *mode)
void unlink_mcwd (void)
char * skip_drive (const char *path)
char * get_drive (const char *path, const char *def)
int safePopenOut (char **command, char *output, int len)

Variables

const char * short_illegals
const char * long_illegals
int got_signal
unsigned int mtools_skip_check
unsigned int mtools_fat_compatibility
unsigned int mtools_ignore_short_case
unsigned int mtools_no_vfat
unsigned int mtools_numeric_tail
unsigned int mtools_dotted_dir
unsigned int mtools_twenty_four_hour_clock
char * mtools_date_string
unsigned int mtools_rate_0
unsigned int mtools_rate_any
int mtools_raw_tty
int batchmode
devicedevices
device const_devices []
const int nr_const_devices
int noPrivileges
const char * progname


Define Documentation

#define BOOTSIZE   512
 

Definition at line 63 of file mtools.h.

Referenced by read_boot().

#define EXPAND_BUF   2048
 

Definition at line 221 of file mtools.h.

#define FILTER_FLAG   128
 

Definition at line 19 of file mtools.h.

Referenced by finish_drive_clause().

#define FLOPPYD_FLAG   64
 

Definition at line 18 of file mtools.h.

#define Free adr   )     (free((char *)adr));
 

Definition at line 164 of file mtools.h.

Referenced by buf_init(), c_free(), Delmacro(), Delstr(), dir_free(), Field(), Findchar(), Findmacro(), Findstr(), free_ht(), free_stream(), fs_init(), Macro(), nr_it(), nr_UL(), OpenDir(), parse_one(), Pass3(), sfree(), and SimpleFileOpen().

#define Grow adr,
n,
type   )     ((type*)(realloc((char *)adr,n*sizeof(type))))
 

Definition at line 163 of file mtools.h.

Referenced by grow().

#define IS_MFORMAT_ONLY x   )     ((x) && ((x)->misc_flags & MFORMAT_ONLY_FLAG))
 

Definition at line 24 of file mtools.h.

Referenced by compare_geom(), mtoolstest(), and SimpleFileOpen().

#define IS_NOLOCK x   )     ((x) && ((x)->misc_flags & NOLOCK_FLAG))
 

Definition at line 23 of file mtools.h.

Referenced by lock_dev(), and SimpleFileOpen().

#define IS_PRIVILEGED x   )     ((x) && ((x)->misc_flags & PRIV_FLAG))
 

Definition at line 22 of file mtools.h.

Referenced by mtoolstest(), and SimpleFileOpen().

#define IS_SCSI x   )     ((x) && ((x)->misc_flags & SCSI_FLAG))
 

Definition at line 21 of file mtools.h.

Referenced by finish_drive_clause(), mtoolstest(), and SimpleFileOpen().

#define maximize target,
max   ) 
 

Value:

do { \
  if(max < 0) { \
    if(target > 0) \
      target = 0; \
  } else if(target > max) { \
    target = max; \
  } \
} while(0)

Definition at line 73 of file mtools.h.

Referenced by buf_read(), buf_write(), isInBuffer(), normal_map(), and root_map().

#define MFORMAT_ONLY_FLAG   16
 

Definition at line 16 of file mtools.h.

Referenced by finish_drive_clause().

#define minimize target,
min   ) 
 

Value:

do { \
  if(target < min) \
    target = min; \
} while(0)

Definition at line 82 of file mtools.h.

#define New type   )     ((type*)(malloc(sizeof(type))))
 

Definition at line 162 of file mtools.h.

Referenced by _internalFileOpen(), allocDirCache(), allocDirCacheEntry(), fs_init(), get_codepage(), make_ht(), open_filter(), OpenDir(), and SimpleFileOpen().

#define NewArray size,
type   )     ((type*)(calloc((size),sizeof(type))))
 

Definition at line 165 of file mtools.h.

Referenced by alloc_ht(), allocDirCache(), GetFatMap(), and read_config().

#define NOLOCK_FLAG   4
 

Definition at line 14 of file mtools.h.

#define PRIV_FLAG   2
 

Definition at line 13 of file mtools.h.

Referenced by finish_drive_clause().

#define ROUND_DOWN value,
grain   )     ((value) - (value) % (grain))
 

Definition at line 231 of file mtools.h.

Referenced by buf_write(), invalidate_buffer(), and isInBuffer().

#define ROUND_UP value,
grain   )     ROUND_DOWN((value) + (grain)-1, (grain))
 

Definition at line 232 of file mtools.h.

Referenced by buf_write(), and normal_map().

#define SCSI_FLAG   1
 

Definition at line 12 of file mtools.h.

#define SET_INT target,
source   )     if(source)target=source
 

Definition at line 129 of file mtools.h.

Referenced by file_geom(), mformat(), and minfo().

#define SHOULD_USE_VOLD x   )     ((x)&& ((x)->misc_flags & VOLD_FLAG))
 

Definition at line 25 of file mtools.h.

Referenced by mtoolstest().

#define SHOULD_USE_XDF x   )     ((x)&& ((x)->misc_flags & USE_XDF_FLAG))
 

Definition at line 26 of file mtools.h.

Referenced by mtoolstest().

#define USE_XDF_FLAG   8
 

Definition at line 15 of file mtools.h.

#define VOLD_FLAG   32
 

Definition at line 17 of file mtools.h.


Typedef Documentation

typedef struct device device_t
 


Function Documentation

int ask_confirmation const char *  ,
const char *  ,
const char * 
 

Definition at line 179 of file tty.c.

References fflush(), fgetc(), fgets(), fprintf(), fputs(), mtools_raw_tty, opentty(), and stderr.

Referenced by del_entry(), get_slots(), mlabel(), and unix_write().

void bufferize Stream_t **  Dir  ) 
 

Definition at line 14 of file subdir.c.

References buf_init(), FREE, MDIR_SIZE, and NULL.

Referenced by OpenFileByDirentry(), and OpenRoot().

void closeExec int  fd  ) 
 

Definition at line 161 of file privileges.c.

References F_SETFD, and fcntl.

Referenced by SimpleFileOpen().

int copyfile Stream_t Source,
Stream_t Target
 

Definition at line 11 of file copyfile.c.

References ENOSPC, errno, force_write(), fprintf(), GET_DATA, got_signal, max_off_t_31, perror(), pos, READS, stderr, and truncBytes32().

Referenced by unix_write().

unsigned int countBlocks Stream_t Dir,
unsigned int  block
 

Definition at line 136 of file file.c.

References _countBlocks(), DeclareThis, and GetFs().

Referenced by dir_mdu(), and file_mdu().

void destroy_privs void   ) 
 

Definition at line 83 of file privileges.c.

References drop_privs(), euid, print_privs(), ruid, seteuid, and setuid.

Referenced by main(), and safePopenOut().

int dir_grow Stream_t Dir,
int  size
 

Definition at line 34 of file directory.c.

References buflen, DeclareThis, force_write(), free, getfreeMinClusters(), GetFs(), malloc(), MDIR_SIZE, memset(), and perror().

Referenced by _mwrite_one(), and OpenFileByDirentry().

char* dos_name char *  filename,
int  verbose,
int *  mangled,
char *  buffer
 

Definition at line 81 of file file_name.c.

References _basename(), autorename_short(), BASECASE, EXTCASE, i, LOWER, memset(), mtools_no_vfat, skip_drive(), strrchr(), strspn(), and TranslateToDos().

Referenced by _mwrite_one(), and init_clash_handling().

void drop_privs void   ) 
 

Definition at line 76 of file privileges.c.

References print_privs(), rgid, ruid, setgid, and Setuid().

Referenced by destroy_privs(), init_privs(), main(), scsi_io(), and SimpleFileOpen().

const char* expand const char *  ,
char * 
 

Definition at line 48 of file expand.c.

References exit(), EXPAND_BUF, NULL, perror(), safePopenOut(), snprintf(), sprintf(), strncpy(), and strpbrk().

const char* fix_mcwd char *   ) 
 

Definition at line 110 of file misc.c.

References fclose(), fgets(), fp, MAX_PATH, open_mcwd(), s, skip_drive(), strcat(), strcpy(), strlen(), strncpy(), and toupper.

Referenced by init_mp().

char* get_drive const char *  path,
const char *  def
 

Definition at line 217 of file misc.c.

References drive, memcpy(), NULL, path, safe_malloc(), skip_drive(), and toupper.

Referenced by common_dos_loop(), mbadblocks(), mcat(), mformat(), minfo(), mlabel(), mmove(), mpartition(), and mtoolstest().

char* get_homedir void   ) 
 

Definition at line 17 of file misc.c.

References getenv(), geteuid, getlogin, getpwnam(), getpwuid(), homedir, passwd::pw_dir, uid, and username.

Referenced by get_mcwd_file_name(), and read_config().

uid_t get_real_uid void   ) 
 

Definition at line 111 of file privileges.c.

References ruid.

struct dirCache_t** getDirCacheP Stream_t Stream  ) 
 

Definition at line 54 of file file.c.

References File_t::dcp, and getUnbufferedFile().

Referenced by allocDirCache(), and freeDirCache().

char* getDrive Stream_t Stream  ) 
 

Definition at line 397 of file init.c.

References DeclareThis, FsClass, getDrive(), and GetFs().

int getfreeMinClusters Stream_t Stream,
size_t  ref
 

Definition at line 843 of file fat.c.

References batchmode, DeclareThis, fatDecode(), fprintf(), getfree(), GetFs(), got_signal, i, L, MAX32, stderr, and total.

Referenced by createDir(), dir_grow(), fsPreallocateClusters(), getfreeMinBytes(), and makeit().

Stream_t* GetFs Stream_t Fs  ) 
 

Definition at line 80 of file init.c.

References Stream_t::Class, FsClass, and Stream_t::Next.

Referenced by _internalFileOpen(), countBlocks(), countBytes(), dir_grow(), fat32RootCluster(), fat_error(), fat_free(), getDrive(), getfree(), getfreeMinBytes(), getfreeMinClusters(), getStart(), leaveDrive(), mbadblocks(), mlabel(), OpenRoot(), and print_volume_label().

unsigned int getStart Stream_t Dir,
struct directory dir
 

Definition at line 904 of file fat.c.

References dir, fat32RootCluster(), first, GetFs(), START, and STARTHI.

Referenced by dir_mdu(), file_mdu(), flush_file(), and OpenFileByDirentry().

time_t getTimeNow time_t now  ) 
 

Definition at line 192 of file misc.c.

References time, and time_t.

Referenced by createDirCallback(), labelit(), and open_mcwd().

int init_geom int  fd,
struct device dev,
struct device orig_dev,
struct stat stat
 

Definition at line 1100 of file devices.c.

References compare_geom(), and dev.

Referenced by SimpleFileOpen().

void init_privs void   ) 
 

Definition at line 116 of file privileges.c.

References drop_privs(), egid, euid, exit(), fprintf(), getegid, geteuid, getgid, getuid, print_privs(), rgid, ruid, setuid, and stderr.

Referenced by main().

int is_dir Stream_t Dir,
char *  path
 

int isRootDir Stream_t Stream  ) 
 

Definition at line 671 of file file.c.

References getUnbufferedFile(), File_t::map, and root_map().

Referenced by dir_mdu(), flush_file(), getAbsCluNr(), and lookupForInsert().

char* label_name char *  filename,
int  verbose,
int *  mangled,
char *  ans
 

Definition at line 13 of file mlabel.c.

References i, islower, isupper, strchr, strcpy(), strlen(), strncpy(), and toupper.

Referenced by format_root(), and mlabel().

int lock_dev int  fd,
int  mode,
struct device dev
 

Definition at line 45 of file plain_io.c.

References dev, EINVAL, errno, F_RDLCK, F_SETLK, F_WRLCK, fcntl, flock(), IS_NOLOCK, L, flock::l_len, flock::l_start, flock::l_type, flock::l_whence, LOCK_EX, LOCK_NB, and LOCK_SH.

Referenced by SimpleFileOpen().

int match const char *  ,
const char *  ,
char *  ,
int  ,
int 
 

Definition at line 131 of file match.c.

References _match(), a, b, casecmp(), and int().

void mattrib int  argc,
char **  argv,
int  type
 

Definition at line 152 of file mattrib.c.

References arg, c, concise, EOF, getopt(), letterToCode(), optind, ptr, and usage.

void mbadblocks int  argc,
char **  argv,
int  type
 

Definition at line 13 of file mbadblocks.c.

References exit(), fprintf(), FREE, get_drive(), GetFs(), i, init_mp(), malloc(), mdate, mp, mversion, NULL, O_RDWR, open_root_dir(), perror(), printOom(), READS, sectorsToBytes(), skip_drive(), start, and stderr.

void mcat int  argc,
char **  argv,
int  type
 

Definition at line 27 of file mcat.c.

References address(), BUF_SIZE, dev, devices, device::drive, drive, errmsg, expand, EXPAND_BUF, FREE, get_drive(), device::name, noPrivileges, NULL, O_RDONLY, O_WRONLY, SimpleFileOpen(), skip_drive(), sprintf(), strcmp, strcpy(), usage, device::use_2m, and XdfOpen().

void mcd int  argc,
char **  argv,
int  type
 

Definition at line 27 of file mcd.c.

References ACCEPT_DIR, exit(), fprintf(), init_mp(), main_loop(), mcd_callback(), mdate, mp, mversion, NO_DOTS, printf, and stderr.

void mcopy int  argc,
char **  argv,
int  type
 

Definition at line 464 of file mcopy.c.

References ACCEPT_DIR, ACCEPT_PLAIN, arg, batchmode, c, directory_dos_to_unix(), DO_OPEN, dos_copydir(), dos_to_dos(), dos_to_unix(), EOF, exit(), fprintf(), getopt(), handle_clash_options(), init_clash_handling(), init_mp(), main_loop(), NO_DOTS, O_RDONLY, optarg, optind, stderr, strcmp, strdup(), target, target_lookup(), unix_copydir(), unix_to_dos(), unix_to_unix(), and usage.

void mdel int  argc,
char **  argv,
int  type
 

Definition at line 127 of file mdel.c.

References ACCEPT_DIR, ACCEPT_PLAIN, arg, b, c, del_file(), EOF, getopt(), i, init_mp(), mp, NO_DOTS, O_RDWR, optind, skip_drive(), strlen(), and usage.

void mdir int  argc,
char **  argv,
int  type
 

Definition at line 501 of file mdir.c.

References ACCEPT_DIR, ACCEPT_PLAIN, all, c, concise, currentDir, currentDrive, debug, dirPath, DO_OPEN_DIRS, EOF, exit(), fast, getopt(), init_mp(), leaveDirectory(), leaveDrive(), list_file(), list_non_recurs_directory(), list_recurs_directory(), longname, main_loop(), mp, NO_DOTS, optind, recursive, RootDir, shortname, usage, and wide.

Referenced by do_mount().

void mdoctorfat int  argc,
char **  argv,
int  type
 

Definition at line 69 of file mdoctorfat.c.

References ACCEPT_DIR, ACCEPT_PLAIN, address(), arg, begin, c, DO_OPEN, dos_doctorfat(), EOF, exit(), getopt(), i, init_clash_handling(), init_mp(), j, main_loop(), number, O_RDWR, offset, optarg, optind, strtoul(), unix_doctorfat(), and usage.

void mdu int  argc,
char **  argv,
int  type
 

Definition at line 84 of file mdu.c.

References ACCEPT_DIR, ACCEPT_PLAIN, arg, c, dir_mdu(), DO_OPEN_DIRS, EOF, exit(), file_mdu(), fprintf(), getopt(), init_mp(), main_loop(), NO_DOTS, O_RDONLY, optind, stderr, and usage.

void mformat int  argc,
char **  argv,
int  type
 

Definition at line 571 of file mformat.c.

References atoi, device::blocksize, boot, c, Fs_t::Class, Fs_t::cluster_size, dev, devices, devname, Fs_t::dir_len, Fs_t::Direct, device::drive, drive, EOF, errmsg, exit(), expand, EXPAND_BUF, Fs_t::fat_len, fprintf(), FREE, FsClass, get_drive(), getopt(), device::heads, device::hidden, i, if(), info, isupper, max_off_t_31, MAX_SECTOR, memset(), mtools_rate_0, mtools_rate_any, device::name, NULL, O_CREAT, O_RDWR, old_dos_size_to_geom(), optarg, optind, r, Fs_t::refs, safe_malloc(), device::sectors, SET_INT, skip_drive(), sprintf(), device::ssize, stat, stderr, strchr, strcmp, strcpy(), strlen(), strncpy(), strtoul(), device::tracks, usage, device::use_2m, and VBUFSIZE.

void minfo int  argc,
char **  argv,
int  type
 

Definition at line 43 of file minfo.c.

References _DWORD, boot, c, dev, displayInfosector(), label_blk_t::dos4, drive, DWORD, EOF, exit(), EXPAND_BUF, label_blk_t::fat_type, find_device(), fprintf(), get_drive(), getopt(), device::heads, label_blk_t::label, malloc(), MAX32, NULL, O_RDONLY, optind, perror(), label_blk_t::physdrive, print_sector(), printf, READS, label_blk_t::reserved, device::sectors, label_blk_t::serial, SET_INT, size, skip_drive(), stderr, device::tracks, usage, verbose, and WORD.

struct directory* mk_entry const char *  filename,
char  attr,
unsigned int  fat,
size_t  size,
time_t  date,
struct directory ndir
 

Definition at line 75 of file directory.c.

References directory::attr, directory::cdate, directory::ctime, directory::ctime_ms, directory::date, day, directory::ext, localtime(), directory::name, now, directory::size, directory::start, directory::startHi, strncpy(), directory::time, and time_t.

Referenced by labelit(), makeit(), and OpenRoot().

void mlabel int  argc,
char **  argv,
int  type
 

Definition at line 73 of file mlabel.c.

References _WORD, ACCEPT_LABEL, ask_confirmation(), c, clear, DELMARK, entry::dir, dir_write(), drive, EACCES, entry, EOF, EPERM, errno, exit(), bootsector::ext, bootsector::fatlen, fgets(), force_read(), fprintf(), FREE, get_drive(), GetFs(), getopt(), ClashHandling_t::ignore_entry, init_clash_handling(), init_mp(), initializeDirentry(), interactive, isNotFound(), label_name(), oldboot_t::labelBlock, labelit(), longname, MATCH_ANY, mp, mwrite_one(), entry::name, ClashHandling_t::name_converter, NULL, O_RDONLY, O_RDWR, bootsector::old, open_root_dir(), optarg, optind, printf, r, random(), result, RootDir, shortname, show(), skip_drive(), srandom(), stderr, stdin, strlen(), strtol(), time, usage, VBUFSIZE, verbose, and vfat_lookup().

void mmd int  argc,
char **  argv,
int  type
 

Definition at line 139 of file mmd.c.

References arg, c, createDirCallback(), DO_OPEN_DIRS, EOF, exit(), getopt(), handle_clash_options(), init_clash_handling(), init_mp(), main_loop(), O_RDWR, OPEN_PARENT, optarg, optind, and usage.

void mmount int  argc,
char **  argv,
int  type
 

void mmove int  argc,
char **  argv,
int  type
 

Definition at line 219 of file mmove.c.

References arg, c, drive, EOF, exit(), fprintf(), get_drive(), getopt(), handle_clash_options(), i, init_clash_handling(), init_mp(), longname, NULL, O_RDWR, optarg, optind, shortname, skip_drive(), stderr, strcmp, usage, and VBUFSIZE.

void mpartition int  argc,
char **  argv,
int  type
 

Definition at line 259 of file mpartition.c.

References activate, atoi, begin, c, dev, devices, dirty, doprint(), device::drive, drive, EOF, errmsg, EXPAND_BUF, force, FREE, get_drive(), getopt(), if(), initialize(), j, length, NO_OFFSET, NO_PRIV, NULL, optarg, optind, device::partition, remove(), skip_drive(), sprintf(), strcmp, strtoul(), type, usage, and verbose.

void mshowfat int  argc,
char **  argv,
int  mtype
 

Definition at line 56 of file mshowfat.c.

References ACCEPT_DIR, ACCEPT_PLAIN, arg, c, DO_OPEN, dos_showfat(), EOF, exit(), getopt(), init_clash_handling(), init_mp(), main_loop(), optind, unix_showfat(), and usage.

void mtoolstest int  argc,
char **  argv,
int  type
 

Definition at line 698 of file config.c.

References device::cfg_filename, dev, devices, device::drive, drive, device::fat_bits, device::file_nr, get_drive(), device::heads, device::hidden, i, IS_MFORMAT_ONLY, IS_PRIVILEGED, IS_SCSI, j, device::misc_flags, device::mode, device::name, NULL, O_EXCL, device::offset, device::partition, path, device::precmd, printf, device::sectors, SHOULD_USE_VOLD, SHOULD_USE_XDF, skip_drive(), strcmp, and device::tracks.

void mzip int  argc,
char **  argv,
int  type
 

Stream_t* open_filter Stream_t Next  ) 
 

Definition at line 126 of file filter.c.

References Filter_t::Buffer, Filter_t::Class, Filter_t::dospos, FilterClass, New, Filter_t::Next, NULL, Filter_t::refs, Filter_t::rw, and Filter_t::unixpos.

Referenced by unix_write().

FILE* open_mcwd const char *  mode  ) 
 

Definition at line 79 of file misc.c.

References fopen(), fprintf(), get_mcwd_file_name(), getTimeNow(), MAXPATHLEN, now, NULL, sbuf, stat, stderr, time_t, and unlink.

Referenced by fix_mcwd(), and mcd_callback().

Stream_t* OpenDir Stream_t Parent,
const char *  filename
 

Definition at line 113 of file unixdir.c.

References Dir_t::Buffer, Dir_t::Class, Dir_t::dir, DirClass, Free, malloc(), New, Dir_t::Next, NULL, opendir, Dir_t::pathname, Dir_t::refs, stat, Dir_t::stat, strcpy(), and strlen().

Referenced by unix_loop().

FILE* opentty int  mode  ) 
 

Definition at line 154 of file tty.c.

References fdopen(), isatty, mtools_raw_tty, notty, NULL, O_RDONLY, open, stdin, tty, and ttyfd.

Referenced by ask_confirmation(), ask_namematch(), and ask_rename().

void precmd struct device dev  ) 
 

Definition at line 10 of file precmd.c.

References dev, execl, exit(), fork, perror(), pid, device::precmd, status, and wait.

Referenced by SimpleFileOpen().

void print_sector char *  message,
unsigned char *  data,
int  size
 

Definition at line 170 of file misc.c.

References col(), isprint, and printf.

Referenced by minfo().

void printOom void   ) 
 

Definition at line 12 of file misc.c.

References fprintf(), and stderr.

Referenced by grow(), mbadblocks(), parse_old_device_line(), read_config(), safe_malloc(), SimpleFileOpen(), unix_copydir(), and unix_write().

void read_config void   ) 
 

Definition at line 650 of file config.c.

References CFG_FILE1, CONF_FILE, const_devices, cur_devs, devices, exit(), file_nr, get_env_conf(), get_homedir(), getenv(), homedir, init_codepage(), LOCAL_CONF_FILE, MAXPATHLEN, memcpy(), memset(), mtools_fat_compatibility, mtools_skip_check, NewArray, nr_const_devices, nr_dev, OLD_CONF_FILE, OLD_LOCAL_CONF_FILE, parse(), printOom(), strcat(), strncpy(), and SYS_CONF_FILE.

Referenced by main().

int readwrite_sectors int  fd,
int *  drive,
int  rate,
int  seektrack,
int  track,
int  head,
int  sector,
int  size,
char *  data,
int  bytes,
int  direction,
int  retries
 

void reclaim_privs void   ) 
 

Definition at line 67 of file privileges.c.

References egid, euid, noPrivileges, print_privs(), setgid, and Setuid().

Referenced by main(), scsi_io(), and SimpleFileOpen().

void* safe_malloc size_t  size  ) 
 

Definition at line 158 of file misc.c.

References exit(), malloc(), p, and printOom().

Referenced by displayInfosector(), fat_32_read(), find_device(), format_root(), get_drive(), get_toupper(), and mformat().

int safePopenOut char **  command,
char *  output,
int  len
 

Definition at line 11 of file expand.c.

References close, destroy_privs(), dup, execvp, exit(), fork, kill, pid, pipe, read, status, and wait.

Referenced by expand().

void setup_signal void   ) 
 

Definition at line 28 of file signal.c.

References SIG_CAST, SIGHUP, SIGINT, signal(), signal_handler(), SIGQUIT, and SIGTERM.

Referenced by main().

char* skip_drive const char *  path  ) 
 

Definition at line 206 of file misc.c.

References NULL, p, and strchr.

Referenced by _mwrite_one(), common_dos_loop(), dos_name(), fix_mcwd(), get_drive(), main_loop(), mbadblocks(), mcat(), mdel(), mformat(), minfo(), mlabel(), mmove(), mpartition(), mtoolstest(), SimpleFileOpen(), and target_lookup().

char* unix_name char *  name,
char *  ext,
char  Case,
char *  answer
 

Definition at line 138 of file file_name.c.

References BASECASE, EXTCASE, i, mtools_ignore_short_case, strcat(), strchr, strcpy(), strncpy(), tname(), and tolower.

Referenced by lookupForInsert(), and vfat_lookup_loop_common().

char* unix_normalize char *  ans,
char *  name,
char *  ext
 

Definition at line 8 of file file_name.c.

References a, and j.

Referenced by ask_namematch().

void unlink_mcwd void   ) 
 

Definition at line 72 of file misc.c.

References get_mcwd_file_name(), MAXPATHLEN, and unlink.

Referenced by common_dos_loop().

UNUSED static inline int   compare(long ref, long testee)  ) 
 

Definition at line 133 of file mtools.h.


Variable Documentation

int batchmode
 

Definition at line 5 of file stream.c.

Referenced by flush_stream(), getfreeMinClusters(), mcopy(), normal_map(), and write_file().

struct device const_devices[]
 

Referenced by read_config().

struct device* devices
 

Definition at line 43 of file config.c.

int got_signal
 

Definition at line 6 of file signal.c.

Referenced by _dos_loop(), copyfile(), del_entry(), del_file(), getfreeMinClusters(), handle_leaf(), main_loop(), process_namematch(), recurs_dos_loop(), signal_handler(), unix_copydir(), unix_dir_loop(), and unix_write().

const char * long_illegals
 

Definition at line 16 of file vfat.c.

Referenced by autorename_long(), and get_slots().

char* mtools_date_string
 

Definition at line 55 of file config.c.

Referenced by print_date().

unsigned int mtools_dotted_dir
 

Definition at line 53 of file config.c.

Referenced by list_file().

unsigned int mtools_fat_compatibility
 

Definition at line 47 of file config.c.

Referenced by read_config().

unsigned int mtools_ignore_short_case
 

Definition at line 48 of file config.c.

Referenced by list_file(), and unix_name().

unsigned int mtools_no_vfat
 

Definition at line 51 of file config.c.

Referenced by dos_name().

unsigned int mtools_numeric_tail
 

Definition at line 52 of file config.c.

unsigned int mtools_rate_0
 

Definition at line 49 of file config.c.

Referenced by mformat().

unsigned int mtools_rate_any
 

Definition at line 50 of file config.c.

Referenced by mformat().

int mtools_raw_tty
 

Definition at line 10 of file tty.c.

Referenced by ask_confirmation(), ask_namematch(), and opentty().

unsigned int mtools_skip_check
 

Definition at line 46 of file config.c.

Referenced by check_fat(), check_media_type(), fs_init(), old_fat_read(), read_config(), and SimpleFileOpen().

unsigned int mtools_twenty_four_hour_clock
 

Definition at line 54 of file config.c.

Referenced by print_time().

int noPrivileges
 

Definition at line 27 of file privileges.c.

Referenced by mcat(), and reclaim_privs().

const int nr_const_devices
 

Definition at line 1114 of file devices.c.

Referenced by read_config().

const char* progname
 

Definition at line 101 of file archiver.c.

const char* short_illegals
 

Definition at line 15 of file vfat.c.

Referenced by autorename_short(), and get_slots().


Generated on Fri Apr 14 23:04:26 2006 for minix by  doxygen 1.4.6