Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : MINICOFF.C

 
Output of file : MINICOFF.C contained in archive : PCCAPP.ZIP
/*
* This file is part of the Choices Operating System
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992
* The University of Illinois Board of Trustees.
* All Rights Reserved.
* Distribution restricted under license agreement.
*
* Author: Dave Kohr ([email protected])
* Project Manager and Principal Investigator: Roy Campbell ([email protected])
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*/
/**********************************************************************
$Id: minicoff.c,v 1.3 1992/02/21 16:37:05 lup Exp lup $

$Source: /home/guests/pcc/Loadcoff/RCS/minicoff.c,v $

$Log: minicoff.c,v $
* Revision 1.3 1992/02/21 16:37:05 lup
* *** empty log message ***
*
* Revision 1.2 92/01/21 16:29:48 lup
* *** empty log message ***
*
Revision 1.1.1.1 91/12/04 16:08:03 drk
First revision.

Revision 1.1 91/12/04 16:07:33 drk
First branch.


Functions for the COFF file data structures defined in minicoff.h.
**********************************************************************/


#include
#include "minicoff.h"


/*
Since the byte-order of data generated by the cross-compiler for the kernel
and the IBM PC are assumed to be identical, I assume throughout that no
byte-swapping is needed for any of the fields in the COFF headers.
*/

/*
Macro for calling fread(3) to read "field", a single field of a COFF header
structure, from the input file "file".
*/

#define FREAD_FIELD(file, field) \
fread((void *) &(field), sizeof((field)), 1, (file))


/*
I/O functions for different types of COFF headers. Each returns 1 if
successful, or returns 0 if header could not be read (in that case, eof()
and ferror() should be checked on the input file).
*/

int read_file_hdr(FILE *f, FILEHDR *fhdr)
{
if (!FREAD_FIELD(f, fhdr->f_magic) ||
!FREAD_FIELD(f, fhdr->f_nscns) ||
!FREAD_FIELD(f, fhdr->f_timdat) ||
!FREAD_FIELD(f, fhdr->f_symptr) ||
!FREAD_FIELD(f, fhdr->f_nsyms) ||
!FREAD_FIELD(f, fhdr->f_opthdr) ||
!FREAD_FIELD(f, fhdr->f_flags))
return 0;
else
return 1;
}

int read_aout_hdr(FILE *f, AOUTHDR *ahdr)
{
if (!FREAD_FIELD(f, ahdr->magic) ||
!FREAD_FIELD(f, ahdr->vstamp) ||
!FREAD_FIELD(f, ahdr->tsize) ||
!FREAD_FIELD(f, ahdr->dsize) ||
!FREAD_FIELD(f, ahdr->bsize) ||
!FREAD_FIELD(f, ahdr->entry) ||
!FREAD_FIELD(f, ahdr->text_start) ||
!FREAD_FIELD(f, ahdr->data_start))
return 0;
else
return 1;
}

int read_scn_hdr(FILE *f, SCNHDR *shdr)
{
if (!FREAD_FIELD(f, shdr->s_name) ||
!FREAD_FIELD(f, shdr->s_paddr) ||
!FREAD_FIELD(f, shdr->s_vaddr) ||
!FREAD_FIELD(f, shdr->s_size) ||
!FREAD_FIELD(f, shdr->s_scnptr) ||
!FREAD_FIELD(f, shdr->s_relptr) ||
!FREAD_FIELD(f, shdr->s_lnnoptr) ||
!FREAD_FIELD(f, shdr->s_nreloc) ||
!FREAD_FIELD(f, shdr->s_nlnno) ||
!FREAD_FIELD(f, shdr->s_flags))
return 0;
else
return 1;
}


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : MINICOFF.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/