src/commands/ibm/dosread.c File Reference

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/times.h>
#include <unistd.h>

Go to the source code of this file.

Classes

struct  dir_entry

Defines

#define MAX_CLUSTER_SIZE   4096
#define MAX_ROOT_ENTRIES   512
#define FAT_START   512L
#define ROOTADDR   (FAT_START + 2L * fat_size)
#define clus_add(cl_no)
#define NOT_USED   0x00
#define ERASED   0xE5
#define DIR   0x2E
#define DIR_SIZE   (sizeof (struct dir_entry))
#define SUB_DIR   0x10
#define NIL_DIR   ((DIRECTORY *) 0)
#define LAST_CLUSTER12   0xFFF
#define LAST_CLUSTER   0xFFFF
#define FREE   0x000
#define BAD   0xFF0
#define BAD16   0xFFF0
#define TRUE   1
#define FALSE   0
#define NIL_PTR   ((char *) 0)
#define DOS_TIME   315532800L
#define READ   0
#define WRITE   1
#define FIND   3
#define LABEL   4
#define ENTRY   5
#define find_entry(d, e, p)   directory(d, e, FIND, p)
#define list_dir(d, e, f)   (void) directory(d, e, f, NIL_PTR)
#define label()   directory(root, root_entries, LABEL, NIL_PTR)
#define new_entry(d, e)   directory(d, e, ENTRY, NIL_PTR)
#define is_dir(d)   ((d)->d_attribute & SUB_DIR)
#define STD_OUT   1
#define DRIVE_NR   (sizeof (drive) - 2)
#define COOKED_SIZE   8192
#define SEC_MIN   60L
#define SEC_HOUR   (60L * SEC_MIN)
#define SEC_DAY   (24L * SEC_HOUR)
#define SEC_YEAR   (365L * SEC_DAY)
#define SEC_LYEAR   (366L * SEC_DAY)
#define HOUR   0xF800
#define MIN   0x07E0
#define YEAR   0xFE00
#define MONTH   0x01E0
#define DAY   0x01F

Typedefs

typedef struct dir_entry DIRECTORY
typedef int BOOL

Functions

 _PROTOTYPE (void usage,(char *prog_name))
 _PROTOTYPE (unsigned c2u2,(unsigned char *ucarray))
 _PROTOTYPE (unsigned long c4u4,(unsigned char *ucarray))
 _PROTOTYPE (void determine,(void))
 _PROTOTYPE (int main,(int argc, char *argv[]))
 _PROTOTYPE (DIRECTORY *directory,(DIRECTORY *dir, int entries, BOOL function, char *pathname))
 _PROTOTYPE (void extract,(DIRECTORY *entry))
 _PROTOTYPE (void make_file,(DIRECTORY *dir_ptr, int entries, char *name))
 _PROTOTYPE (char *make_name,(DIRECTORY *dir_ptr, int dir_fl))
 _PROTOTYPE (int fill,(char *buffer, size_t size))
 _PROTOTYPE (void xmodes,(int mode))
 _PROTOTYPE (void show,(DIRECTORY *dir_ptr, char *name))
 _PROTOTYPE (DIRECTORY *read_cluster,(unsigned int cluster))
 _PROTOTYPE (unsigned short free_cluster,(BOOL leave_fl))
 _PROTOTYPE (void link_fat,(unsigned int cl_1, unsigned int cl_2))
 _PROTOTYPE (unsigned short next_cluster,(unsigned int cl_no))
 _PROTOTYPE (char *slash,(char *str))
 _PROTOTYPE (void add_path,(char *file, BOOL slash_fl))
 _PROTOTYPE (void disk_io,(BOOL op, unsigned long seek, void *address, unsigned bytes))
 _PROTOTYPE (void read_fat,(unsigned int cl_no))
 _PROTOTYPE (BOOL free_range,(unsigned short *first, unsigned short *last))
 _PROTOTYPE (long lmin,(long a, long b))
void usage (char *prog_name)
unsigned c2u2 (unsigned char *ucarray)
unsigned long c4u4 (unsigned char *ucarray)
void determine ()
int main (int argc, argv)
DIRECTORYdirectory (DIRECTORY *dir, int entries, int function, char *pathname)
void extract (DIRECTORY *entry)
long lmin (long a, long b)
void make_file (DIRECTORY *dir_ptr, int entries, char *name)
void fill_date (DIRECTORY *entry)
char * make_name (DIRECTORY *dir_ptr, short dir_fl)
int fill (char *buffer, size_t size)
void xmodes (int mode)
void show (DIRECTORY *dir_ptr, char *name)
void free_blocks ()
DIRECTORYread_cluster (unsigned int cluster)
BOOL free_range (unsigned short *first, unsigned short *last)
unsigned short free_cluster (BOOL leave_fl)
void read_fat (unsigned int cl_no)
void flush_fat ()
void link_fat (unsigned int cl_1, unsigned int cl_2)
unsigned short next_cluster (unsigned int cl_no)
char * slash (char *str)
void add_path (char *file, BOOL slash_fl)
void disk_io (BOOL op, unsigned long seek, void *address, unsigned bytes)

Variables

char * cmnd
unsigned short mon_len [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
char * month []
char dosread_c_rcs_id []


Define Documentation

#define BAD   0xFF0

Definition at line 60 of file dosread.c.

#define BAD16   0xFFF0

Definition at line 61 of file dosread.c.

#define clus_add ( cl_no   ) 

Value:

((long) (((long) cl_no - 2L) \
                                 * (long) cluster_size \
                                 + data_start \
                                ))

Definition at line 33 of file dosread.c.

#define COOKED_SIZE   8192

Definition at line 106 of file dosread.c.

#define DAY   0x01F

Definition at line 795 of file dosread.c.

#define DIR   0x2E

Definition at line 52 of file dosread.c.

#define DIR_SIZE   (sizeof (struct dir_entry))

Definition at line 53 of file dosread.c.

#define DOS_TIME   315532800L

Definition at line 69 of file dosread.c.

#define DRIVE_NR   (sizeof (drive) - 2)

Definition at line 93 of file dosread.c.

#define ENTRY   5

Definition at line 76 of file dosread.c.

#define ERASED   0xE5

Definition at line 51 of file dosread.c.

#define FALSE   0

Definition at line 66 of file dosread.c.

#define FAT_START   512L

Definition at line 31 of file dosread.c.

#define FIND   3

Definition at line 74 of file dosread.c.

#define find_entry ( d,
e,
p   )     directory(d, e, FIND, p)

Definition at line 77 of file dosread.c.

#define FREE   0x000

Definition at line 59 of file dosread.c.

#define HOUR   0xF800

Definition at line 791 of file dosread.c.

#define is_dir ( d   )     ((d)->d_attribute & SUB_DIR)

Definition at line 82 of file dosread.c.

 
#define label (  )     directory(root, root_entries, LABEL, NIL_PTR)

Definition at line 79 of file dosread.c.

#define LABEL   4

Definition at line 75 of file dosread.c.

#define LAST_CLUSTER   0xFFFF

Definition at line 58 of file dosread.c.

#define LAST_CLUSTER12   0xFFF

Definition at line 57 of file dosread.c.

#define list_dir ( d,
e,
f   )     (void) directory(d, e, f, NIL_PTR)

Definition at line 78 of file dosread.c.

#define MAX_CLUSTER_SIZE   4096

Definition at line 29 of file dosread.c.

#define MAX_ROOT_ENTRIES   512

Definition at line 30 of file dosread.c.

#define MIN   0x07E0

Definition at line 792 of file dosread.c.

#define MONTH   0x01E0

Definition at line 794 of file dosread.c.

#define new_entry ( d,
 )     directory(d, e, ENTRY, NIL_PTR)

Definition at line 80 of file dosread.c.

#define NIL_DIR   ((DIRECTORY *) 0)

Definition at line 55 of file dosread.c.

#define NIL_PTR   ((char *) 0)

Definition at line 67 of file dosread.c.

#define NOT_USED   0x00

Definition at line 50 of file dosread.c.

#define READ   0

Definition at line 71 of file dosread.c.

#define ROOTADDR   (FAT_START + 2L * fat_size)

Definition at line 32 of file dosread.c.

#define SEC_DAY   (24L * SEC_HOUR)

Definition at line 690 of file dosread.c.

#define SEC_HOUR   (60L * SEC_MIN)

Definition at line 689 of file dosread.c.

#define SEC_LYEAR   (366L * SEC_DAY)

Definition at line 692 of file dosread.c.

#define SEC_MIN   60L

Definition at line 688 of file dosread.c.

#define SEC_YEAR   (365L * SEC_DAY)

Definition at line 691 of file dosread.c.

#define STD_OUT   1

Definition at line 84 of file dosread.c.

#define SUB_DIR   0x10

Definition at line 54 of file dosread.c.

#define TRUE   1

Definition at line 65 of file dosread.c.

#define WRITE   1

Definition at line 72 of file dosread.c.

#define YEAR   0xFE00

Definition at line 793 of file dosread.c.


Typedef Documentation

typedef int BOOL

Definition at line 63 of file dosread.c.

typedef struct dir_entry DIRECTORY

Definition at line 48 of file dosread.c.


Function Documentation

_PROTOTYPE ( long  lmin,
(long a, long b  
)

_PROTOTYPE ( BOOL  free_range,
(unsigned short *first, unsigned short *last  
)

_PROTOTYPE ( void  read_fat,
(unsigned int cl_no)   
)

_PROTOTYPE ( void  disk_io,
(BOOL op, unsigned long seek, void *address, unsigned bytes)   
)

_PROTOTYPE ( void  add_path,
(char *file, BOOL slash_fl)   
)

_PROTOTYPE ( char *  slash,
(char *str  
)

_PROTOTYPE ( unsigned short  next_cluster,
(unsigned int cl_no)   
)

_PROTOTYPE ( void  link_fat,
(unsigned int cl_1, unsigned int cl_2)   
)

_PROTOTYPE ( unsigned short  free_cluster,
(BOOL leave_fl)   
)

_PROTOTYPE ( DIRECTORY read_cluster,
(unsigned int cluster)   
)

_PROTOTYPE ( void  show,
(DIRECTORY *dir_ptr, char *name  
)

_PROTOTYPE ( void  xmodes,
(int mode  
)

_PROTOTYPE ( int  fill,
(char *buffer, size_t size)   
)

_PROTOTYPE ( char *  make_name,
(DIRECTORY *dir_ptr, int dir_fl)   
)

_PROTOTYPE ( void  make_file,
(DIRECTORY *dir_ptr, int entries, char *name  
)

_PROTOTYPE ( void  extract,
(DIRECTORY *entry  
)

_PROTOTYPE ( DIRECTORY directory,
(DIRECTORY *dir, int entries, BOOL function, char *pathname  
)

_PROTOTYPE ( int  main,
(int argc, char *argv[])   
)

_PROTOTYPE ( void  determine,
(void)   
)

_PROTOTYPE ( unsigned long  c4u4,
(unsigned char *ucarray)   
)

_PROTOTYPE ( unsigned  c2u2,
(unsigned char *ucarray)   
)

_PROTOTYPE ( void  usage,
(char *prog_name  
)

void add_path ( char *  file,
BOOL  slash_fl 
)

Definition at line 1074 of file dosread.c.

unsigned c2u2 ( unsigned char *  ucarray  ) 

Definition at line 157 of file dosread.c.

unsigned long c4u4 ( unsigned char *  ucarray  ) 

Definition at line 163 of file dosread.c.

void determine (  ) 

Definition at line 171 of file dosread.c.

DIRECTORY* directory ( DIRECTORY dir,
int  entries,
int  function,
char *  pathname 
)

Definition at line 441 of file dosread.c.

void disk_io ( BOOL  op,
unsigned long  seek,
void *  address,
unsigned  bytes 
)

Definition at line 1094 of file dosread.c.

void extract ( DIRECTORY entry  ) 

Definition at line 567 of file dosread.c.

int fill ( char *  buffer,
size_t  size 
)

Definition at line 763 of file dosread.c.

void fill_date ( DIRECTORY entry  ) 

Definition at line 696 of file dosread.c.

void flush_fat (  ) 

Definition at line 1002 of file dosread.c.

void free_blocks (  ) 

Definition at line 840 of file dosread.c.

unsigned short free_cluster ( BOOL  leave_fl  ) 

Definition at line 905 of file dosread.c.

BOOL free_range ( unsigned short *  first,
unsigned short *  last 
)

Definition at line 882 of file dosread.c.

void link_fat ( unsigned int  cl_1,
unsigned int  cl_2 
)

Definition at line 1040 of file dosread.c.

long lmin ( long  a,
long  b 
)

Definition at line 617 of file dosread.c.

int main ( int argc  ,
argv   
)

Definition at line 295 of file dosread.c.

void make_file ( DIRECTORY dir_ptr,
int  entries,
char *  name 
)

Definition at line 625 of file dosread.c.

char* make_name ( DIRECTORY dir_ptr,
short  dir_fl 
)

Definition at line 736 of file dosread.c.

unsigned short next_cluster ( unsigned int  cl_no  ) 

Definition at line 1053 of file dosread.c.

DIRECTORY* read_cluster ( unsigned int  cluster  ) 

Definition at line 859 of file dosread.c.

void read_fat ( unsigned int  cl_no  ) 

Definition at line 921 of file dosread.c.

void show ( DIRECTORY dir_ptr,
char *  name 
)

Definition at line 810 of file dosread.c.

char* slash ( char *  str  ) 

Definition at line 1063 of file dosread.c.

void usage ( char *  prog_name  ) 

Definition at line 149 of file dosread.c.

void xmodes ( int  mode  ) 

Definition at line 802 of file dosread.c.


Variable Documentation

char* cmnd

Definition at line 86 of file dosread.c.

Initial value:

 
        "$Id: dosread.c 5628 2009-11-09 10:26:00Z thruby $"

Definition at line 1119 of file dosread.c.

unsigned short mon_len[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}

Definition at line 694 of file dosread.c.

char* month[]

Initial value:

 {
         "Jan", "Feb", "Mar", "Apr", "May", "Jun",
         "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}

Definition at line 797 of file dosread.c.


Generated on Tue Mar 9 04:36:34 2010 for Minix by  doxygen 1.5.8