Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

lx.c File Reference

BrickOS executable file support. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <netinet/in.h>
#include <string.h>
#include <lx.h>

Go to the source code of this file.

Defines

#define ASSURED_WRITE(fd, buf, len)
#define ASSURED_READ(fd, buf, len)

Functions

int lx_write (const lx_t *lx, const unsigned char *filename)
 write a BrickOS exectutable to a file
int lx_read (lx_t *lx, const unsigned char *filename)
 read a BrickOS executable from a file
void lx_relocate (lx_t *lx, unsigned short base)
 relocate a BrickOS executable to a new base address (may be called repeatedly).


Detailed Description

BrickOS executable file support.

Author:
Markus L. Noga <markus@noga.de>

Definition in file lx.c.


Define Documentation

#define ASSURED_READ fd,
buf,
len   ) 
 

Value:

if((rc=read(fd,buf,len))!=(len)) { \
    close(fd); \
    return rc; \
  }

Definition at line 44 of file lx.c.

Referenced by lx_read().

#define ASSURED_WRITE fd,
buf,
len   ) 
 

Value:

if((rc=write(fd,buf,len))!=(len)) { \
    close(fd); \
    return rc; \
  }

Definition at line 38 of file lx.c.

Referenced by lx_write().


Function Documentation

int lx_read lx_t lx,
const unsigned char *  filename
 

read a BrickOS executable from a file

Definition at line 87 of file lx.c.

References ASSURED_READ, lx_t::data_size, malloc(), lx_t::num_relocs, lx_t::reloc, strcmp(), lx_t::text, and lx_t::text_size.

Referenced by main().

void lx_relocate lx_t lx,
unsigned short  base
 

relocate a BrickOS executable to a new base address (may be called repeatedly).

Definition at line 139 of file lx.c.

References lx_t::base, lx_t::num_relocs, lx_t::reloc, and lx_t::text.

Referenced by main().

int lx_write const lx_t lx,
const unsigned char *  filename
 

write a BrickOS exectutable to a file

Definition at line 51 of file lx.c.

References ASSURED_WRITE, lx_t::data_size, lx_t::num_relocs, lx_t::reloc, lx_t::text, and lx_t::text_size.

Referenced by main().


Generated on Fri Feb 25 08:02:45 2005 for brickos by  doxygen 1.3.9.1