From 0ffdfb4f76e15602b1c8f2b125ab6ef9caefd671 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 13 Jan 1987 15:10:23 +0000 Subject: [PATCH] Added rd_fd and wr_fd. --- modules/src/object/object.3 | 31 +++++++++++++++++++++++++++++-- modules/src/object/rd.c | 6 ++++++ modules/src/object/wr.c | 11 +++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/modules/src/object/object.3 b/modules/src/object/object.3 index c0c4c5562..2124f8232 100644 --- a/modules/src/object/object.3 +++ b/modules/src/object/object.3 @@ -1,10 +1,10 @@ .TH OBJECT 3ACK "October 16, 1986" .SH NAME wr_open, wr_close, wr_ohead, wr_sect, wr_outsect, wr_emit, wr_putc, wr_relo, -wr_name, wr_string, wr_arhdr, wr_ranlib, wr_int2, wr_long, +wr_name, wr_string, wr_arhdr, wr_ranlib, wr_int2, wr_long, wr_bytes, wr_fd, rd_open, rd_fdopen, rd_close, rd_ohead, rd_sect, rd_outsect, rd_emit, rd_relo, rd_rew_relo, rd_name, rd_string, rd_arhdr, rd_ranlib, -rd_int2, rd_unsigned2, rd_long\ \-\ routines to read +rd_int2, rd_unsigned2, rd_long, rd_bytes, rd_fd\ \-\ routines to read and write ACK-object files and libraries .SH SYNOPSIS .B #include @@ -75,6 +75,14 @@ and write ACK-object files and libraries .br .B long l; .PP +.B wr_bytes(fd, buf, l) +.br +.B char *buf; +.br +.B long l; +.PP +.B int wr_fd() +.PP .B int rd_open(filename) .br .B char *filename; @@ -140,6 +148,14 @@ and write ACK-object files and libraries .B unsigned int rd_unsigned2(fd) .PP .B long rd_long(fd) +.PP +.B rd_bytes(fd, buf, l) +.br +.B char *buf; +.br +.B long l; +.PP +.B rd_fd() .SH DESCRIPTION These routines come in handy when reading or writing ACK-object files or libraries. No checking is performed. @@ -236,6 +252,17 @@ to file descriptor .IB fd , low order word first, low order byte first. .PP +.I Wr_bytes +writes +.I l +bytes from +.I buf +to file descriptor +.IB fd . +.PP +.I Wr_fd +returns the current output file descriptor. +.PP Most of the .I rd_ routines are the opposite of the diff --git a/modules/src/object/rd.c b/modules/src/object/rd.c index 52c1f718f..aae7db6c0 100644 --- a/modules/src/object/rd.c +++ b/modules/src/object/rd.c @@ -81,6 +81,12 @@ rd_close() { close(outfile); + outfile = -1; +} + +rd_fd() +{ + return outfile; } rd_ohead(head) diff --git a/modules/src/object/wr.c b/modules/src/object/wr.c index 5bcf55ca0..165a4dca8 100644 --- a/modules/src/object/wr.c +++ b/modules/src/object/wr.c @@ -108,13 +108,24 @@ wr_close() } #ifdef OUTSEEK close(outfile); + outfile = -1; #else not OUTSEEK for (fdp = &outfile[PARTEMIT]; fdp < &outfile[NPARTS]; fdp++) { close(*fdp); + *fdp = -1; } #endif not OUTSEEK } +wr_fd() +{ +#ifdef OUTSEEK + return outfile; +#else + return outfile[PARTEMIT]; +#endif +} + wr_ohead(head) register struct outhead *head; { -- 2.34.1