HP85 GPIB Disk Emulator
1.0
HP85GPIBDiskEmulator
|
LIF file utilities. More...
#include "user_config.h"
Go to the source code of this file.
Data Structures | |
struct | lifvol_t |
Disk Layout. More... | |
struct | lifdir_t |
Directory layout. More... | |
struct | lif_t |
Master LIF data structure Contains image file name Volume Structure Current Directory Entry read/write flag. More... | |
Macros | |
#define | LIF_SECTOR_SIZE 256 |
Depends on how much free ram we have. More... | |
#define | LIF_DIR_SIZE 32 |
LIF directory entry size. More... | |
#define | LIF_DIR_RECORDS_PER_SECTOR (LIF_SECTOR_SIZE/LIF_DIR_SIZE) |
Typedefs | |
typedef struct stat | stat_t |
Functions | |
MEMSPACE void | lif_help (int full) |
Help Menu for User invoked GPIB functions and tasks See: int gpib_tests(char *str) More... | |
MEMSPACE int | lif_tests (int argc, char *argv[]) |
LIF user tests. More... | |
MEMSPACE void * | lif_calloc (long size) |
Allocate and clear memory Displays message on errors. More... | |
MEMSPACE void | lif_free (void *p) |
Free allocated memory Displays message on errors. More... | |
MEMSPACE char * | lif_stralloc (char *str) |
Allocate and copy a string Displays message on errors. More... | |
MEMSPACE FILE * | lif_open (char *name, char *mode) |
Open a file that must exist Displays message on errors. More... | |
MEMSPACE stat_t * | lif_stat (char *name, stat_t *p) |
Stat a file Displays message on errors. More... | |
MEMSPACE int | lif_seek_msg (FILE *fp, long offset, char *msg) |
MEMSPACE long | lif_read (lif_t *LIF, void *buf, long offset, int bytes) |
Read data from a LIF image Displays message on errors. More... | |
MEMSPACE int | lif_write (lif_t *LIF, void *buf, long offset, int bytes) |
Write data to an LIF image Displays message on errors. More... | |
MEMSPACE int | lif_chars (int c, int index __attribute__((unused))) |
Check if characters in a LIF volume or LIF file name are valid. More... | |
MEMSPACE int | lif_B2S (uint8_t *B, uint8_t *name, int size) |
Convert LIF space padded string name into normal string. More... | |
MEMSPACE int | lif_checkname (char *name) |
Check volume LIF name or directory name is valid. More... | |
MEMSPACE void | lif_S2B (uint8_t *B, uint8_t *name, int size) |
Convert string to LIF directory record. More... | |
MEMSPACE int | lif_fixname (uint8_t *B, char *name, int size) |
Convert name into a valid LIF name Only use the basename() part of the string and remove any file name extentions LIF names may have only these characters: [A-Z][A-Z0-09_]+ LIF names are converted to upper case LIF names are padded at the end with spaces Any invalid input characters are converted into spaces. More... | |
MEMSPACE void | lif_vol2str (lif_t *LIF, uint8_t *B) |
Convert LIF volume records into byte vector. More... | |
MEMSPACE void | lif_str2vol (uint8_t *B, lif_t *LIF) |
Convert byte vector into LIF volume records. More... | |
MEMSPACE void | lif_dir2str (lif_t *LIF, uint8_t *B) |
Convert LIF directory records into byte vector. More... | |
MEMSPACE void | lif_str2dir (uint8_t *B, lif_t *LIF) |
Convert byte vector into byte vector. More... | |
MEMSPACE uint8_t | lif_BIN2BCD (uint8_t data) |
Convert number >= 0 and <= 99 to BCD. More... | |
MEMSPACE int | lif_BCD2BIN (uint8_t bin) |
Convert BCD in the range 0 and <= 99 to BIN BCD format: each hex nibble has a digit 0 .. 9. More... | |
MEMSPACE void | lif_time2lifbcd (time_t t, uint8_t *bcd) |
UNIX time to LIF BCD time format The BCD year is only the lower 2 digits of the year So We assume that values <= 70 are years >= 2000 BCD Day and Month start at 1 Note: If t == 0 we set ALL BCD digits to 0. More... | |
MEMSPACE time_t | lif_lifbcd2time (uint8_t *bcd) |
convert BCD date into time_t value The BCD year is only the lower 2 digits of the year So We assume that values <= 70 are years >= 2000 BCD Day and Month start at 1 If ALL BCD digits are 0 we return 0 More... | |
MEMSPACE char * | lif_ctime_gmt (time_t *tp) |
GMT version of POSIX ctime(). More... | |
MEMSPACE char * | lif_lifbcd2timestr (uint8_t *bcd) |
MEMSPACE void | lif_image_clear (lif_t *LIF) |
File seek with error message. More... | |
MEMSPACE void | lif_dir_clear (lif_t *LIF) |
Clear DIR part of LIF structure. More... | |
MEMSPACE void | lif_vol_clear (lif_t *LIF) |
Clear VOL part of LIF structure. More... | |
MEMSPACE void | lif_dump_vol (lif_t *LIF, char *msg) |
Dump LIF struture data for debugging. More... | |
MEMSPACE int | lif_check_volume (lif_t *LIF) |
Check Volume Table for values in range. More... | |
MEMSPACE int | lif_check_dir (lif_t *LIF) |
Validate Directory record values We only do basic out of bounds tests for this record Purged or EOF directory records are NOT checked and always return 1. More... | |
MEMSPACE lif_t * | lif_create_volume (char *imagename, char *liflabel, long dirstart, long dirsectors, long filesectors) |
Create LIF image with Volume, Directory and optional empty filespace. More... | |
MEMSPACE void | lif_close_volume (lif_t *LIF) |
Free LIF structure and close any files. More... | |
MEMSPACE uint32_t | lif_bytes2sectors (uint32_t bytes) |
Convert bytes into used sectors. More... | |
MEMSPACE void | lif_rewinddir (lif_t *LIF) |
Rewind LIF directory Note readdir pre-increments the directory pointer index so we start at -1. More... | |
MEMSPACE void | lif_closedir (lif_t *LIF) |
Close LIF directory clear and free lif_t structure. More... | |
MEMSPACE int | lif_checkdirindex (lif_t *LIF, int index) |
Check directory index limits. More... | |
MEMSPACE int | lif_readdirindex (lif_t *LIF, int index) |
Read LIF directory record number N. More... | |
MEMSPACE int | lif_writedirindex (lif_t *LIF, int index) |
Write LIF drectory record number N. More... | |
MEMSPACE int | lif_writedirEOF (lif_t *LIF, int index) |
Write LIF drectory EOF. More... | |
MEMSPACE lifdir_t * | lif_readdir (lif_t *LIF) |
Read a directory records from LIF image advancind directory index. More... | |
MEMSPACE lif_t * | lif_updatefree (lif_t *LIF) |
Update free space @parameter[in] *LIF: LIF structure. More... | |
MEMSPACE int | lif_newdir (lif_t *LIF, long sectors) |
Allocate index of free directory record. More... | |
MEMSPACE lif_t * | lif_open_volume (char *name, char *mode) |
Open LIF directory for reading. More... | |
MEMSPACE void | lif_dir (char *lifimagename) |
Display a LIF image file directory. More... | |
MEMSPACE int | lif_find_file (lif_t *LIF, char *liflabel) |
Find a LIF image file by name. More... | |
MEMSPACE int | lif_e010_pad_sector (long offset, uint8_t *wbuf) |
HP85 E010 ASCII LIF records ef [ff]* = no more data in this sector df size [ASCII] = data must fit inside this sector cf size [ASCII] = split data accross sector boundry, "6f" record continues at start of next sector Note: The 6f header is INSIDE the "cf" record and not included in the "cf" size value (yuck!) 6f size [ASCII] = split continue (always starts at sector boundry) df 00 00 ef [ff]* = EOF (df size = 0) pad with "ef" and "ff" until sector end size = 16 bits LSB MSB. More... | |
MEMSPACE int | lif_ascii_string_to_e010 (char *str, long offset, uint8_t *wbuf) |
Convert an ASCII string into HP85 E010 format. More... | |
MEMSPACE long | lif_add_ascii_file_as_e010_wrapper (lif_t *LIF, uint32_t offset, char *username) |
Add ASCII file as E010 data to LIF image - or compute converted data size To find size of formatted result only, without writting, set LIF to NULL. More... | |
MEMSPACE long | lif_add_ascii_file_as_e010 (char *lifimagename, char *lifname, char *userfile) |
Convert and add ASCII file to the LIF image as type E010 format The basename of the lifname, without extensions, is used as the LIF file name. More... | |
MEMSPACE int | lif_extract_e010_as_ascii (char *lifimagename, char *lifname, char *username) |
Extract E010 type file from LIF image and save as user ASCII file. More... | |
MEMSPACE int | lif_extract_lif_as_lif (char *lifimagename, char *lifname, char *username) |
Extract a file from LIF image entry as standalone LIF image. More... | |
MEMSPACE long | lif_add_lif_file (char *lifimagename, char *lifname, char *userfile) |
Add LIF file from another LIF image. More... | |
MEMSPACE int | lif_del_file (char *lifimagename, char *lifname) |
Delete LIF file in LIF image. More... | |
MEMSPACE int | lif_rename_file (char *lifimagename, char *oldlifname, char *newlifname) |
Rename LIF file in LIF image. More... | |
MEMSPACE int | lif_rename_volume (char *lifimagename, char *volname) |
Rename LIF VOLUME NAME. More... | |
MEMSPACE long | lif_create_image (char *lifimagename, char *liflabel, uint32_t dirsectors, uint32_t sectors) |
Create/Format a LIF new disk image This can take a while to run, about 1 min for 10,000,000 bytes. More... | |
LIF file utilities.
Definition in file lifutils.h.
#define LIF_DIR_RECORDS_PER_SECTOR (LIF_SECTOR_SIZE/LIF_DIR_SIZE) |
Definition at line 30 of file lifutils.h.
#define LIF_DIR_SIZE 32 |
LIF directory entry size.
Definition at line 29 of file lifutils.h.
#define LIF_SECTOR_SIZE 256 |
Depends on how much free ram we have.
Definition at line 26 of file lifutils.h.
Definition at line 23 of file lifutils.h.
MEMSPACE long lif_add_ascii_file_as_e010 | ( | char * | lifimagename, |
char * | lifname, | ||
char * | userfile | ||
) |
Convert and add ASCII file to the LIF image as type E010 format The basename of the lifname, without extensions, is used as the LIF file name.
[in] | lifimagename | LIF image name |
[in] | lifname | LIF file name |
[in] | userfile | userfile name |
Definition at line 2109 of file lifutils.c.
Referenced by lif_tests().
Add ASCII file as E010 data to LIF image - or compute converted data size To find size of formatted result only, without writting, set LIF to NULL.
[in] | userfile | User ASCII file source |
[in] | *LIF | Where to write file if set (not NULL) |
Definition at line 2012 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010().
MEMSPACE long lif_add_lif_file | ( | char * | lifimagename, |
char * | lifname, | ||
char * | userfile | ||
) |
Add LIF file from another LIF image.
[in] | lifimagename | LIF image name |
[in] | lifname | LIF file name to copy file to |
[in] | userfile | LIF mage name copy file from |
Definition at line 2491 of file lifutils.c.
Referenced by lif_tests().
MEMSPACE int lif_ascii_string_to_e010 | ( | char * | str, |
long | offset, | ||
uint8_t * | wbuf | ||
) |
Convert an ASCII string into HP85 E010 format.
[in] | str | ASCII string to write |
[in] | offset | E010 data sector offset, only used in formatting wbuf with headers |
[in] | wbuf | E010 data result |
We ALWAYS pad a sector if: There is no room for a 0xdf single header
Definition at line 1917 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010_wrapper().
MEMSPACE int lif_B2S | ( | uint8_t * | B, |
uint8_t * | name, | ||
int | size | ||
) |
Convert LIF space padded string name into normal string.
[in] | *B | LIF name space padded |
[out] | *name | string result with traling spaces removed |
[in] | size | max size of name @retrun 1 if string i ok or 0 if bad characters were found |
Definition at line 485 of file lifutils.c.
Referenced by lif_str2dir(), and lif_str2vol().
MEMSPACE int lif_BCD2BIN | ( | uint8_t | bin | ) |
Convert BCD in the range 0 and <= 99 to BIN BCD format: each hex nibble has a digit 0 .. 9.
[in] | data | number to convert to binary |
Definition at line 678 of file lifutils.c.
Referenced by lif_lifbcd2time().
MEMSPACE uint8_t lif_BIN2BCD | ( | uint8_t | data | ) |
Convert number >= 0 and <= 99 to BCD.
[in] | data | number to convert. |
Definition at line 668 of file lifutils.c.
Referenced by lif_time2lifbcd().
MEMSPACE uint32_t lif_bytes2sectors | ( | uint32_t | bytes | ) |
Convert bytes into used sectors.
[in] | bytes | size in bytes |
Definition at line 1247 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), lif_check_dir(), lif_checkdirindex(), lif_dir(), lif_extract_e010_as_ascii(), and lif_open_volume().
MEMSPACE void* lif_calloc | ( | long | size | ) |
Allocate and clear memory Displays message on errors.
[in] | size | size of memory to allocate |
Definition at line 293 of file lifutils.c.
Referenced by lif_create_volume(), lif_open_volume(), lif_stralloc(), and td02lif().
MEMSPACE int lif_chars | ( | int | c, |
int index | __attribute__(unused) | ||
) |
Check if characters in a LIF volume or LIF file name are valid.
[in] | c | character to test |
[in] | index | index of character in volume or file name @retrun c (optionally upper cased) or 0 if no match |
Definition at line 449 of file lifutils.c.
Referenced by lif_B2S(), lif_checkname(), and lif_fixname().
Validate Directory record values We only do basic out of bounds tests for this record Purged or EOF directory records are NOT checked and always return 1.
[in] | *LIF | Image structure |
[in] | debug | dispaly diagostice messages |
Definition at line 946 of file lifutils.c.
Referenced by lif_readdirindex(), lif_writedirindex(), and td0_save_lif_sector().
Check Volume Table for values in range.
[in] | *LIF | Image structure |
Definition at line 872 of file lifutils.c.
Referenced by lif_create_volume(), lif_open_volume(), lif_rename_volume(), and td0_save_lif_sector().
Check directory index limits.
[in] | *LIF | LIF Volume/Diractoy structure |
[in] | index | directory index |
Definition at line 1284 of file lifutils.c.
Referenced by lif_readdirindex(), and lif_writedirindex().
MEMSPACE int lif_checkname | ( | char * | name | ) |
Check volume LIF name or directory name is valid.
[in] | *name | name to test @retrun 1 if the string is ok or 0 if invalid LIF name characters on input string |
Definition at line 507 of file lifutils.c.
Referenced by lif_check_dir(), lif_check_volume(), lif_find_file(), lif_rename_file(), and lif_rename_volume().
Free LIF structure and close any files.
[in] | *LIF | pointer to LIF Volume/Directoy structure |
Definition at line 1220 of file lifutils.c.
Referenced by lif_closedir(), lif_create_image(), lif_create_volume(), lif_rename_volume(), and td02lif().
Close LIF directory clear and free lif_t structure.
[in] | *LIF | pointer to LIF Volume/Directoy structure |
Definition at line 1273 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), lif_add_lif_file(), lif_create_volume(), lif_del_file(), lif_dir(), lif_extract_e010_as_ascii(), lif_extract_lif_as_lif(), lif_open_volume(), lif_rename_file(), and lif_rename_volume().
MEMSPACE long lif_create_image | ( | char * | lifimagename, |
char * | liflabel, | ||
uint32_t | dirsectors, | ||
uint32_t | sectors | ||
) |
Create/Format a LIF new disk image This can take a while to run, about 1 min for 10,000,000 bytes.
[in] | lifimagename | LIF disk image name |
[in] | liflabel | LIF Volume Label name |
[in] | dirsectors | Number of LIF directory sectors |
[in] | sectors | total disk image size in sectors |
Definition at line 2798 of file lifutils.c.
Referenced by format_drives(), and lif_tests().
MEMSPACE lif_t* lif_create_volume | ( | char * | imagename, |
char * | liflabel, | ||
long | dirstart, | ||
long | dirsectors, | ||
long | filesectors | ||
) |
Create LIF image with Volume, Directory and optional empty filespace.
[in] | imagename | Image name |
[in] | liflabel | Volume Label |
[in] | dirstart | Directory start sector |
[in] | dirsectors | Directory sectors |
0 causes time to return the current date
Definition at line 1062 of file lifutils.c.
Referenced by lif_create_image(), and lif_extract_lif_as_lif().
GMT version of POSIX ctime().
[in] | tp | time_t * time input. |
Definition at line 766 of file lifutils.c.
Referenced by lif_lifbcd2timestr().
MEMSPACE int lif_del_file | ( | char * | lifimagename, |
char * | lifname | ||
) |
Delete LIF file in LIF image.
[in] | lifimagename | LIF image name |
[in] | lifname | LIF file name |
Definition at line 2609 of file lifutils.c.
Referenced by lif_tests().
MEMSPACE void lif_dir | ( | char * | lifimagename | ) |
Display a LIF image file directory.
[in] | lifimagename | LIF disk image name |
Definition at line 1734 of file lifutils.c.
Referenced by lif_tests(), and td02lif().
Convert LIF directory records into byte vector.
[in] | *LIF | LIF image pointer |
[out] | B | byte vector to pack data into |
Definition at line 631 of file lifutils.c.
Referenced by lif_create_volume(), lif_writedirindex(), and td0_save_lif_sector().
Clear DIR part of LIF structure.
[in] | *LIF | pointer to LIF structure |
Definition at line 816 of file lifutils.c.
Referenced by lif_create_volume(), lif_newdir(), and lif_writedirEOF().
Dump LIF struture data for debugging.
[in] | *LIF | pointer to LIF structure |
Definition at line 836 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), lif_checkdirindex(), lif_create_volume(), lif_open_volume(), lif_readdirindex(), lif_writedirindex(), and td0_save_lif_sector().
MEMSPACE int lif_e010_pad_sector | ( | long | offset, |
uint8_t * | wbuf | ||
) |
HP85 E010 ASCII LIF records ef [ff]* = no more data in this sector df size [ASCII] = data must fit inside this sector cf size [ASCII] = split data accross sector boundry, "6f" record continues at start of next sector Note: The 6f header is INSIDE the "cf" record and not included in the "cf" size value (yuck!) 6f size [ASCII] = split continue (always starts at sector boundry) df 00 00 ef [ff]* = EOF (df size = 0) pad with "ef" and "ff" until sector end size = 16 bits LSB MSB.
Example: 000080e0 : 4b 7c 22 0d cf 29 00 31 34 20 44 49 53 50 20 22 : K|"..).14 DISP " 000080f0 : 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f : _ 00008100 : 6f 10 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f : o.._____________ 00008110 : 5f 22 0d df 2b 00 31 35 20 44 49 53 50 20 22 20 : _"..+.15 DISP "
cf 29 00 (19 is to sector end) (new sector start with 6F 10 00 (10 is remainder) So 29 = 19 and 10 (yuck!)
PAD wbuf to sector boundry
[in] | offset | sector offset |
[in] | wbuf | E010 PAD data |
Definition at line 1877 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010_wrapper(), and lif_ascii_string_to_e010().
MEMSPACE int lif_extract_e010_as_ascii | ( | char * | lifimagename, |
char * | lifname, | ||
char * | username | ||
) |
Extract E010 type file from LIF image and save as user ASCII file.
[in] | lifimagename | LIF disk image name |
[in] | lifname | name of file in LIF image |
[in] | username | name to call the extracted image |
Definition at line 2213 of file lifutils.c.
Referenced by lif_tests().
MEMSPACE int lif_extract_lif_as_lif | ( | char * | lifimagename, |
char * | lifname, | ||
char * | username | ||
) |
Extract a file from LIF image entry as standalone LIF image.
[in] | lifimagename | LIF disk image name to extract file from |
[in] | lifname | name of file in LIF image we want to extract |
[in] | username | new LIF file to create |
Definition at line 2390 of file lifutils.c.
Referenced by lif_tests().
Find a LIF image file by name.
[in] | *LIF | directory pointer |
[in] | liflabel | File name in LIF image |
Definition at line 1815 of file lifutils.c.
Referenced by lif_add_lif_file(), lif_del_file(), lif_extract_e010_as_ascii(), lif_extract_lif_as_lif(), and lif_rename_file().
MEMSPACE int lif_fixname | ( | uint8_t * | B, |
char * | name, | ||
int | size | ||
) |
Convert name into a valid LIF name Only use the basename() part of the string and remove any file name extentions LIF names may have only these characters: [A-Z][A-Z0-09_]+ LIF names are converted to upper case LIF names are padded at the end with spaces Any invalid input characters are converted into spaces.
[out] | *B | output LIF string |
[in] | *name | input string |
[in] | size | maximum size of output string |
Definition at line 549 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), lif_create_volume(), lif_rename_file(), and lif_rename_volume().
MEMSPACE void lif_free | ( | void * | p | ) |
Free allocated memory Displays message on errors.
[in] | p | pointer to memory to free |
Definition at line 308 of file lifutils.c.
Referenced by lif_close_volume().
MEMSPACE void lif_help | ( | int | full | ) |
Help Menu for User invoked GPIB functions and tasks See: int gpib_tests(char *str)
Definition at line 111 of file lifutils.c.
Referenced by help(), and lif_tests().
File seek with error message.
Clear LIF structure
[in] | *LIF | pointer to LIF structure |
Definition at line 806 of file lifutils.c.
Referenced by lif_create_volume(), and td02lif().
convert BCD date into time_t value The BCD year is only the lower 2 digits of the year So We assume that values <= 70 are years >= 2000 BCD Day and Month start at 1 If ALL BCD digits are 0 we return 0
[in] | *bcd | packed 6 byte BCD LIF time YY MM DD HH MM SS |
Definition at line 724 of file lifutils.c.
Referenced by lif_extract_e010_as_ascii(), and lif_lifbcd2timestr().
MEMSPACE char* lif_lifbcd2timestr | ( | uint8_t * | bcd | ) |
@breif convert BCD time into a date string The BCD year is only the lower 2 digits of the year So We assume that values <= 70 are years >= 2000 BCD Day and Month start at 1 If BCD string is all zero we return <EMPTY>
[in] | *bcd | pcked 6 byte BCD LIF time YY MM DD HH MM SS |
Definition at line 786 of file lifutils.c.
Referenced by lif_dir(), lif_dump_vol(), and td0_save_lif_sector().
Allocate index of free directory record.
[in] | *LIF | LIF pointer |
[in] | sectors | try to find specified free space |
Definition at line 1507 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), and lif_add_lif_file().
Open a file that must exist Displays message on errors.
[in] | *name | file name of LIF image |
[in] | *mode | open mode - see fopen |
Definition at line 339 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010_wrapper(), lif_create_volume(), lif_extract_e010_as_ascii(), and lif_open_volume().
Open LIF directory for reading.
[in] | *name | file name of LIF image |
[in] | *mode | "rb" = read, "rb+" = read/write |
Definition at line 1644 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), lif_add_lif_file(), lif_del_file(), lif_dir(), lif_extract_e010_as_ascii(), lif_extract_lif_as_lif(), lif_rename_file(), and lif_rename_volume().
Read data from a LIF image Displays message on errors.
[in] | *LIF | lif_t structure with file pointers |
[out] | *buf | read buffer |
[in] | offset | read offset |
[in] | bytes | number of bytes to read |
Initial file position
Definition at line 396 of file lifutils.c.
Referenced by lif_add_lif_file(), lif_extract_e010_as_ascii(), lif_extract_lif_as_lif(), lif_open_volume(), and lif_readdirindex().
Read a directory records from LIF image advancind directory index.
[in] | *LIF | to LIF Volume/Diractoy structure |
Definition at line 1403 of file lifutils.c.
Read LIF directory record number N.
[in] | *LIF | to LIF Volume/Diractoy structure |
[in] | index | director record number |
Definition at line 1302 of file lifutils.c.
Referenced by lif_dir(), lif_find_file(), lif_newdir(), lif_readdir(), and lif_updatefree().
MEMSPACE int lif_rename_file | ( | char * | lifimagename, |
char * | oldlifname, | ||
char * | newlifname | ||
) |
Rename LIF file in LIF image.
[in] | lifimagename | LIF image name |
[in] | oldlifname | old LIF file name |
[in] | newlifname | new LIF file name |
Definition at line 2669 of file lifutils.c.
Referenced by lif_tests().
MEMSPACE int lif_rename_volume | ( | char * | lifimagename, |
char * | volname | ||
) |
Rename LIF VOLUME NAME.
[in] | lifimagename | LIF image name |
[in] | volname | new LIF Volume name |
Definition at line 2730 of file lifutils.c.
Referenced by lif_tests().
Rewind LIF directory Note readdir pre-increments the directory pointer index so we start at -1.
[in] | *LIF | pointer to LIF Volume/Directoy structure |
Definition at line 1261 of file lifutils.c.
Referenced by lif_create_volume(), and lif_updatefree().
MEMSPACE void lif_S2B | ( | uint8_t * | B, |
uint8_t * | name, | ||
int | size | ||
) |
Convert string to LIF directory record.
[out] | *B | LIF result with added trailing spaces |
[in] | *name | string |
[in] | size | max size of B @retrun 1 if the string is ok or 0 if invalid LIF name characters on input string |
Definition at line 526 of file lifutils.c.
Referenced by lif_dir2str(), and lif_vol2str().
Displays message on errors
[in] | *fp | FILE pointer |
[in] | offset | file offset |
[in] | mesg | user string as part of error message |
Definition at line 374 of file lifutils.c.
Referenced by lif_read(), and lif_write().
Stat a file Displays message on errors.
[in] | *name | file name of LIF image |
[in] | *p | start_t structure pointer for result |
Definition at line 357 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), and lif_open_volume().
Convert byte vector into byte vector.
[in] | B | byte vector to extract data from |
[out] | LIF | lifdir_t structure pointer |
Definition at line 649 of file lifutils.c.
Referenced by lif_readdirindex(), and td0_save_lif_sector().
Convert byte vector into LIF volume records.
[in] | B | byte vector |
[out] | *LIF | LIF image structure |
Definition at line 608 of file lifutils.c.
Referenced by lif_open_volume(), and td0_save_lif_sector().
MEMSPACE char* lif_stralloc | ( | char * | str | ) |
Allocate and copy a string Displays message on errors.
[in] | str | String to allocate and copy |
Definition at line 322 of file lifutils.c.
Referenced by lif_create_volume(), lif_open_volume(), td02lif(), and td0_open().
MEMSPACE int lif_tests | ( | int | argc, |
char * | argv[] | ||
) |
LIF user tests.
format LIF image
format LIF image
Definition at line 139 of file lifutils.c.
Referenced by user_task().
UNIX time to LIF BCD time format The BCD year is only the lower 2 digits of the year So We assume that values <= 70 are years >= 2000 BCD Day and Month start at 1 Note: If t == 0 we set ALL BCD digits to 0.
[in] | t | UNIX time_t time value |
[out] | *bcd | pcked 6 byte BCD LIF time YY MM DD HH MM SS |
Definition at line 694 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), and lif_create_volume().
Update free space @parameter[in] *LIF: LIF structure.
Update free
Definition at line 1430 of file lifutils.c.
Referenced by lif_create_volume(), lif_del_file(), lif_newdir(), and lif_open_volume().
Convert LIF volume records into byte vector.
[in] | *LIF | LIF image structure |
[out] | B | byte vector to pack data into |
Definition at line 586 of file lifutils.c.
Referenced by lif_create_volume(), and lif_rename_volume().
Clear VOL part of LIF structure.
[in] | *LIF | pointer to LIF structure |
Definition at line 826 of file lifutils.c.
Referenced by lif_close_volume().
Write data to an LIF image Displays message on errors.
[in] | *LIF | lif_t structure with file pointers |
[in] | *buf | write buffer |
[in] | offset | write offset |
[in] | bytes | number of bytes to write |
Initial file position
Definition at line 424 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010_wrapper(), lif_add_lif_file(), lif_create_volume(), lif_extract_lif_as_lif(), lif_rename_volume(), and lif_writedirindex().
Write LIF drectory EOF.
[in] | *LIF | LIF Volume/Diractoy structure |
[in] | index | director record number |
Definition at line 1387 of file lifutils.c.
Referenced by lif_extract_lif_as_lif(), lif_newdir(), and lif_updatefree().
Write LIF drectory record number N.
[in] | *LIF | LIF Volume/Diractoy structure |
[in] | index | director record number |
Definition at line 1349 of file lifutils.c.
Referenced by lif_add_ascii_file_as_e010(), lif_add_lif_file(), lif_del_file(), lif_extract_lif_as_lif(), lif_newdir(), lif_rename_file(), and lif_writedirEOF().