DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T a

⟦dbfdcd823⟧ TextFile

    Length: 2750 (0xabe)
    Types: TextFile
    Names: »archive.h++«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/image/varc++/archive.h++« 

TextFile

/*
    This file contains definitions for archive manipulation routines
*/
/*
    Archive format definitions
*/
#include "ar.h"

/*
General Utility
*/
/*
Reads in a certain number of bytes from a file or fail with message
to stderr.  If at EOF returns a NULL pointer.  
*/
char *
ar_read_bytes_from_file_or_report_eof(const int file_descriptor , const int number_bytes );

/*
Writes out a certain number of bytes from a file or fail with message
to stderr.  If at EOF returns a NULL pointer.  
*/
void
ar_write_bytes_to_file_or_report_error( int file_descriptor , int buffer,  int number_bytes  );

/*
    Routines to access archives
*/
/*
    Checks that the archive is valid
    returns 1 if valid 0 otherwise
    should be run at begining of file
*/
char
ar_check_archive(FILE  *fptr );

/*
    Writes out the archive header to a file and checks for errors
*/
void
ar_write_archive_header( FILE *archive_file );

/*
    Reads in an archive header or reports that you are at eof
    by returning a NULL pointer.
*/
struct ar_hdr *
ar_read_header_or_report_eof(FILE *fptr );

/*
    Writes out the archive header for each file
*/
void
ar_write_header( FILE *archive_file, char *buffer, struct ar_hdr *header );

/*
    Reads a file into memory
*/
char *
ar_read_file(FILE * fptr , struct ar_hdr *header);

/*
    writes the contents of a file out to an archive
*/
void
ar_write_file( FILE *archive_file, char *buffer, struct ar_hdr * header );

/*
    Creates a header for an archive entry
*/
struct ar_hdr *
ar_create_header(const char * name , const int date , const int uid , const int gid , const int mode , const int size , const char * fmag );


/*
    Definitions of sizes for header elements
*/
#define AR_FILE_NAME_SIZE 16	/* the file name */
#define AR_FILE_PROTECTION_SIZE 8	/* the file protection */
#define AR_FILE_UID_SIZE 6	/* the file uid */
#define AR_FILE_GID_SIZE 6	/* the file gid */
#define AR_FILE_DATE_SIZE 12	/* the file date */
#define AR_FILE_SIZE_SIZE 10	/* the file size */

/*
    Routines to access entries from the archive header
*/

/*
    Get the file name
*/
char *
ar_file_name( struct  ar_hdr *header );

/*
    Get the protection
*/
char *
ar_file_protection( struct  ar_hdr *header );

/*
    Get the uid
*/
char *
ar_file_uid( struct ar_hdr *header );

/*
    Get the gid
*/
char *
ar_file_gid( struct ar_hdr *header );

/*
    Get the date
*/
char *
ar_file_date( struct ar_hdr *header );

/*
    Get the size
*/
char *
ar_file_size( struct ar_hdr *header );

/*
Copyright (C) 1986, David Sher in the University of Rochester
Permission is granted to any individual or institution to use, copy, or
redistribute this software so long as it is not sold for profit, provided
this copyright notice is retained.
*/