From: Kees van Reeuwijk Date: Sun, 4 Jul 2010 23:01:32 +0000 (+0000) Subject: Llvm-inspired code cleanup. X-Git-Tag: v3.1.8~289 X-Git-Url: http://zhaoyanbai.com/repos/doc/mandoc_char.7.html?a=commitdiff_plain;h=9fd2d72ce891005d7f923a28cf167e0da3529902;p=minix.git Llvm-inspired code cleanup. --- diff --git a/commands/aal/arch.h b/commands/aal/arch.h index 96d489f65..eefd12521 100644 --- a/commands/aal/arch.h +++ b/commands/aal/arch.h @@ -22,4 +22,7 @@ struct ar_hdr { #define AR_TOTAL 26 #define AR_SIZE 22 +extern int rd_arhdr(int fd, register struct ar_hdr arhdr[]); +extern void wr_arhdr(int fd, struct ar_hdr arhdr[]); + #endif /* __ARCH_H_INCLUDED */ diff --git a/commands/aal/archiver.c b/commands/aal/archiver.c index 9bd8cd3b4..f88841d50 100644 --- a/commands/aal/archiver.c +++ b/commands/aal/archiver.c @@ -4,7 +4,18 @@ */ /* ar - archiver Author: Michiel Huisjes */ /* Made into arch/aal by Ceriel Jacobs - */ +*/ + +#include +#include + +#include "rd.h" +#include "wr_bytes.h" +#include "wr_long.h" +#include "wr_int2.h" +#include "arch.h" +#include "archiver.h" +#include "print.h" static char RcsId[] = "$Header$"; @@ -26,6 +37,9 @@ static char RcsId[] = "$Header$"; */ #include +#include +#include +#include #include #include #ifndef S_IREAD @@ -101,35 +115,59 @@ char *temp_arch = &temp_buf[0]; extern char *mktemp(); extern char *ctime(); -usage() +/* Forward declarations. */ +static void enter_name(struct outname *namep); +static void do_names(struct outhead *headp); +static void do_object(int f, long size); +static void show(char *s, char *name); +static void write_symdef(void); +static void mwrite(int fd, char *address, int bytes); +static void extract(register MEMBER *member); +static void copy_member(MEMBER *member, int from, int to, int extracting); +static void add(char *name, int fd, char *mess); +static void get(int argc, char *argv[]); + +/*VARARGS2*/ +void error1(BOOL quit, char *str1) { - error(TRUE, "usage: %s %s archive [file] ...\n", - progname, -#ifdef AAL - "[acdrtxvlu]" -#else - "[acdprtxvlu]" -#endif - ); + fputs(str1,stderr); + if (quit) { + unlink(temp_arch); + _exit(1); + } } -/*VARARGS2*/ -error(quit, str1, str2, str3, str4) -BOOL quit; -char *str1, *str2, *str3, *str4; +void error2(BOOL quit, char *str1, char *str2) { - char errbuf[256]; + fprintf(stderr,str1,str2); + if (quit) { + unlink(temp_arch); + _exit(1); + } +} - sprint(errbuf, str1, str2, str3, str4); - write(2, errbuf, strlen(errbuf)); +void error3(BOOL quit, char *str1, char *str2, char *str3) +{ + fprintf(stderr,str1,str2,str3); if (quit) { unlink(temp_arch); _exit(1); } } -char *basename(path) -char *path; +void usage() +{ + error3(TRUE, "usage: %s %s archive [file] ...\n", + progname, +#ifdef AAL + "[acdrtxvlu]" +#else + "[acdprtxvlu]" +#endif + ); +} + +char *basename(char *path) { register char *ptr = path; register char *last = NULL; @@ -150,16 +188,14 @@ char *path; extern unsigned int rd_unsigned2(); -open_archive(name, mode) -register char *name; -register int mode; +int open_archive(char *name, int mode) { unsigned short magic = 0; int fd; if (mode == CREATE) { if ((fd = creat(name, 0666)) < 0) - error(TRUE, "cannot creat %s\n", name); + error2(TRUE, "cannot creat %s\n", name); magic = MAGIC_NUMBER; wr_int2(fd, magic); return fd; @@ -168,15 +204,15 @@ register int mode; if ((fd = open(name, mode)) < 0) { if (mode == APPEND) { close(open_archive(name, CREATE)); - if (!nocr_fl) error(FALSE, "%s: creating %s\n", progname, name); + if (!nocr_fl) error3(FALSE, "%s: creating %s\n", progname, name); return open_archive(name, APPEND); } - error(TRUE, "cannot open %s\n", name); + error2(TRUE, "cannot open %s\n", name); } lseek(fd, 0L, 0); magic = rd_unsigned2(fd); if (magic != AALMAG && magic != ARMAG) - error(TRUE, "%s is not in ar format\n", name); + error2(TRUE, "%s is not in ar format\n", name); return fd; } @@ -191,9 +227,7 @@ catch() _exit (2); } -main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { register char *ptr; int needs_arg = 0; @@ -280,7 +314,7 @@ char *argv[]; #ifdef AAL tab = (struct ranlib *) malloc(512 * sizeof(struct ranlib)); tstrtab = malloc(4096); - if (!tab || !tstrtab) error(TRUE,"Out of core\n"); + if (!tab || !tstrtab) error1(TRUE,"Out of core\n"); tabsz = 512; strtabsz = 4096; #endif @@ -300,7 +334,7 @@ again: if (rd_arhdr(ar_fd, &member) == 0) return NULL; if (member.ar_size < 0) { - error(TRUE, "archive has member with negative size\n"); + error1(TRUE, "archive has member with negative size\n"); } #ifdef AAL if (equal(SYMDEF, member.ar_name)) { @@ -313,9 +347,7 @@ again: char *get_mode(); -get(argc, argv) -int argc; -register char *argv[]; +static void get(int argc, char *argv[]) { register MEMBER *member; int i = 0; @@ -457,10 +489,7 @@ register char *argv[]; close(ar_fd); } -add(name, fd, mess) -char *name; -int fd; -char *mess; +static void add(char *name, int fd, char *mess) { static MEMBER member; register int read_chars; @@ -468,15 +497,15 @@ char *mess; int src_fd; if (stat(name, &status) < 0) { - error(FALSE, "cannot find %s\n", name); + error2(FALSE, "cannot find %s\n", name); return; } else if (S_ISDIR(status.st_mode)) { - error(FALSE, "%s is a directory (ignored)\n", name); + error2(FALSE, "%s is a directory (ignored)\n", name); return; } else if ((src_fd = open(name, 0)) < 0) { - error(FALSE, "cannot open %s\n", name); + error2(FALSE, "cannot open %s\n", name); return; } @@ -512,7 +541,7 @@ char *mess; } else status.st_size -= x; if (read(src_fd, io_buffer, read_chars) != read_chars) { - error(FALSE,"%s seems to shrink\n", name); + error2(FALSE,"%s seems to shrink\n", name); break; } mwrite(fd, io_buffer, x); @@ -523,8 +552,7 @@ char *mess; close(src_fd); } -extract(member) -register MEMBER *member; +static void extract(register MEMBER *member) { int fd = 1; char buf[sizeof(member->ar_name) + 1]; @@ -532,7 +560,7 @@ register MEMBER *member; strncpy(buf, member->ar_name, sizeof(member->ar_name)); buf[sizeof(member->ar_name)] = 0; if (pr_fl == FALSE && (fd = creat(buf, 0666)) < 0) { - error(FALSE, "cannot create %s\n", buf); + error2(FALSE, "cannot create %s\n", buf); fd = -1; } @@ -548,9 +576,7 @@ register MEMBER *member; if (pr_fl == FALSE) chmod(buf, member->ar_mode); } -copy_member(member, from, to, extracting) -register MEMBER *member; -int from, to; +static void copy_member(MEMBER *member, int from, int to, int extracting) { register int rest; long mem_size = member->ar_size; @@ -572,7 +598,7 @@ int from, to; strncpy(buf, member->ar_name, sizeof(member->ar_name)); buf[sizeof(member->ar_name)] = 0; - error(TRUE, "read error on %s\n", buf); + error2(TRUE, "read error on %s\n", buf); } if (to >= 0) mwrite(to, io_buffer, rest); mem_size -= (long) rest; @@ -607,27 +633,23 @@ register int mode; return mode_buf; } -wr_fatal() +void wr_fatal() { - error(TRUE, "write error\n"); + error1(TRUE, "write error\n"); } -rd_fatal() +void rd_fatal() { - error(TRUE, "read error\n"); + error1(TRUE, "read error\n"); } -mwrite(fd, address, bytes) -int fd; -register char *address; -register int bytes; +static void mwrite(int fd, char *address, int bytes) { if (write(fd, address, bytes) != bytes) - error(TRUE, "write error\n"); + error1(TRUE, "write error\n"); } -show(s, name) -char *s, *name; +static void show(char *s, char *name) { MEMBER x; char buf[sizeof(x.ar_name)+1]; @@ -645,7 +667,7 @@ char *s, *name; * then 4 bytes giving the size of the string table, followed by the string * table itself. */ -write_symdef() +static void write_symdef(void) { register struct ranlib *ran; register int i; @@ -690,15 +712,12 @@ write_symdef() * The header is put in `headp'. */ int -is_outhead(headp) - register struct outhead *headp; +is_outhead(register struct outhead *headp) { - return !BADMAGIC(*headp) && headp->oh_nname != 0; } -do_object(f, size) - long size; +static void do_object(int f, long size) { struct outhead headbuf; @@ -724,8 +743,7 @@ do_object(f, size) * name table and read and write the names one by one. Update the ranlib table * accordingly. */ -do_names(headp) - struct outhead *headp; +static void do_names(struct outhead *headp) { register char *strings; register int nnames = headp->oh_nname; @@ -736,7 +754,7 @@ do_names(headp) if ( headp->oh_nchar != (unsigned int)headp->oh_nchar || (strings = malloc((unsigned int)headp->oh_nchar)) == (char *)0 ) { - error(TRUE, "string table too big\n"); + error1(TRUE, "string table too big\n"); } rd_string(strings, headp->oh_nchar); while (nnames) { @@ -770,15 +788,14 @@ do_names(headp) free(strings); } -enter_name(namep) - struct outname *namep; +static void enter_name(struct outname *namep) { register char *cp; if (tnum >= tabsz) { tab = (struct ranlib *) realloc((char *) tab, (tabsz += 512) * sizeof(struct ranlib)); - if (! tab) error(TRUE, "Out of core\n"); + if (! tab) error1(TRUE, "Out of core\n"); } tab[tnum].ran_off = tssiz; tab[tnum].ran_pos = offset; @@ -786,7 +803,7 @@ enter_name(namep) for (cp = namep->on_mptr;; cp++) { if (tssiz >= strtabsz) { tstrtab = realloc(tstrtab, (strtabsz += 4096)); - if (! tstrtab) error(TRUE, "string table overflow\n"); + if (! tstrtab) error1(TRUE, "string table overflow\n"); } tstrtab[tssiz++] = *cp; if (!*cp) break; diff --git a/commands/aal/archiver.h b/commands/aal/archiver.h new file mode 100644 index 000000000..18e8bb586 --- /dev/null +++ b/commands/aal/archiver.h @@ -0,0 +1,3 @@ + +extern void rd_fatal(); +extern void wr_fatal(); diff --git a/commands/aal/format.c b/commands/aal/format.c index ffb3a65b7..0bf576d1c 100644 --- a/commands/aal/format.c +++ b/commands/aal/format.c @@ -9,11 +9,12 @@ #else #include #endif +#include extern char *long2str(); static int -integral(c) +integral(int c) { switch (c) { case 'b': @@ -39,16 +40,14 @@ integral(c) %d = int $ */ int -_format(buf, fmt, argp) - char *buf, *fmt; - register va_list argp; +_format(char *buf, char *fmt, va_list argp) { register char *pf = fmt; register char *pb = buf; while (*pf) { if (*pf == '%') { - register width, base, pad, npad; + register int width, base, pad, npad; char *arg; char cbuf[2]; char *badformat = ""; @@ -78,7 +77,8 @@ _format(buf, fmt, argp) else if (*pf == 'l') { /* alignment ??? */ - if (base = integral(*++pf)) { + base = integral(*++pf); + if (base) { arg = long2str(va_arg(argp,long), base); } else { @@ -87,7 +87,7 @@ _format(buf, fmt, argp) } } else - if (base = integral(*pf)) { + if ((base = integral(*pf))) { arg = long2str((long)va_arg(argp,int), base); } else diff --git a/commands/aal/format.h b/commands/aal/format.h new file mode 100644 index 000000000..aee33eba0 --- /dev/null +++ b/commands/aal/format.h @@ -0,0 +1,2 @@ + +extern int _format(char *buf, char *fmt, va_list argp); diff --git a/commands/aal/long2str.c b/commands/aal/long2str.c index 7052ecaec..3d622f97d 100644 --- a/commands/aal/long2str.c +++ b/commands/aal/long2str.c @@ -15,7 +15,7 @@ char * long2str(val, base) register long val; - register base; + register int base; { static char numbuf[MAXWIDTH]; static char vec[] = "0123456789ABCDEF"; @@ -38,7 +38,7 @@ long2str(val, base) if (base < 0) { /* unsigned */ base = -base; if (val < 0L) { /* taken from Amoeba src */ - register mod, i; + register int mod, i; overflow: mod = 0; for (i = 0; i < 8 * sizeof val; i++) { diff --git a/commands/aal/print.c b/commands/aal/print.c index bb7353d7c..3757b54e4 100644 --- a/commands/aal/print.c +++ b/commands/aal/print.c @@ -11,6 +11,8 @@ #endif #include #include "param.h" +#include "format.h" +#include "write.h" /*VARARGS*/ /*FORMAT0v $ @@ -20,7 +22,7 @@ %[uxbo] = unsigned int %d = int $ */ -int +void #if __STDC__ print(char *fmt, ...) #else diff --git a/commands/aal/print.h b/commands/aal/print.h new file mode 100644 index 000000000..28ac8abe2 --- /dev/null +++ b/commands/aal/print.h @@ -0,0 +1,2 @@ + +extern void print(char *fmt, ...); diff --git a/commands/aal/ranlib.h b/commands/aal/ranlib.h index 84f4d6c96..e8c6e842c 100644 --- a/commands/aal/ranlib.h +++ b/commands/aal/ranlib.h @@ -31,4 +31,6 @@ struct ranlib { #define SZ_RAN 8 #define SF_RAN "44" +extern void wr_ranlib(int fd, struct ranlib ran[], long cnt); #endif /* __RANLIB_H_INCLUDED */ + diff --git a/commands/aal/rd.c b/commands/aal/rd.c index 2618750de..43febc886 100644 --- a/commands/aal/rd.c +++ b/commands/aal/rd.c @@ -3,8 +3,13 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#include +#include +#include +#include +#include "out.h" #include "object.h" +#include "rd.h" +#include "rd_bytes.h" extern long lseek(); @@ -43,9 +48,7 @@ static long rd_base; static int sectionnr; static -OUTREAD(p, b, n) - char *b; - long n; +void OUTREAD(int p, char *b, long n) { register long l = outseek[p]; @@ -62,18 +65,17 @@ OUTREAD(p, b, n) * Open the output file according to the chosen strategy. */ int -rd_open(f) - char *f; +rd_open(char *f) { - - if ((outfile = open(f, 0)) < 0) + int outfile = open(f, 0); + if (outfile < 0) return 0; return rd_fdopen(outfile); } static int offcnt; -rd_fdopen(fd) +int rd_fdopen(int fd) { register int i; @@ -90,20 +92,19 @@ rd_fdopen(fd) return 1; } -rd_close() +void rd_close() { close(outfile); outfile = -1; } -rd_fd() +int rd_fd() { return outfile; } -rd_ohead(head) - register struct outhead *head; +void rd_ohead(register struct outhead *head) { register long off; @@ -135,7 +136,7 @@ rd_ohead(head) #endif } -rd_rew_relos(head) +void rd_rew_relos(head) register struct outhead *head; { register long off = OFF_RELO(*head) + rd_base; @@ -143,7 +144,7 @@ rd_rew_relos(head) BEGINSEEK(PARTRELO, off); } -rd_sect(sect, cnt) +void rd_sect(sect, cnt) register struct outsect *sect; register unsigned int cnt; { @@ -173,7 +174,7 @@ rd_sect(sect, cnt) } } -rd_outsect(s) +void rd_outsect(int s) { OUTSECT(s); sectionnr = s; @@ -182,7 +183,7 @@ rd_outsect(s) /* * We don't have to worry about byte order here. */ -rd_emit(emit, cnt) +void rd_emit(emit, cnt) char *emit; long cnt; { @@ -190,11 +191,10 @@ rd_emit(emit, cnt) offset[sectionnr] += cnt; } -rd_relo(relo, cnt) +void rd_relo(relo, cnt) register struct outrelo *relo; register unsigned int cnt; { - OUTREAD(PARTRELO, (char *) relo, (long) cnt * SZ_RELO); #if ! (BYTES_REVERSED || WORDS_REVERSED) if (sizeof(struct outrelo) != SZ_RELO) @@ -213,9 +213,7 @@ rd_relo(relo, cnt) } } -rd_name(name, cnt) - register struct outname *name; - register unsigned int cnt; +void rd_name(struct outname *name, unsigned int cnt) { OUTREAD(PARTNAME, (char *) name, (long) cnt * SZ_NAME); @@ -236,18 +234,13 @@ rd_name(name, cnt) } } -rd_string(addr, len) - char *addr; - long len; +void rd_string(char *addr, long len) { - OUTREAD(PARTCHAR, addr, len); } #ifdef SYMDBUG -rd_dbug(buf, size) - char *buf; - long size; +void rd_dbug(char *buf, long size) { OUTREAD(PARTDBUG, buf, size); } diff --git a/commands/aal/rd.h b/commands/aal/rd.h new file mode 100644 index 000000000..39f68f765 --- /dev/null +++ b/commands/aal/rd.h @@ -0,0 +1,10 @@ +/* + * Headers for rd.c + */ + +#include "out.h" + +extern void rd_string(char *addr, long len); +extern void rd_name(struct outname name[], unsigned int cnt); +extern int rd_fdopen(int fd); +extern void rd_ohead(register struct outhead head[]); diff --git a/commands/aal/rd_arhdr.c b/commands/aal/rd_arhdr.c index 8ea9f773e..dd676a254 100644 --- a/commands/aal/rd_arhdr.c +++ b/commands/aal/rd_arhdr.c @@ -3,12 +3,16 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ +#include +#include #include #include "object.h" +#include "arch.h" +#include "archiver.h" + int -rd_arhdr(fd, arhdr) - register struct ar_hdr *arhdr; +rd_arhdr(int fd, register struct ar_hdr *arhdr) { char buf[AR_TOTAL]; register char *c = buf; diff --git a/commands/aal/rd_bytes.c b/commands/aal/rd_bytes.c index 9964e0ac1..fd9f89683 100644 --- a/commands/aal/rd_bytes.c +++ b/commands/aal/rd_bytes.c @@ -9,16 +9,19 @@ an int! */ +#include +#include + +#include "archiver.h" +#include "rd_bytes.h" + static int maxchunk = MAXCHUNK; /* * We don't have to worry about byte order here. * Just read "cnt" bytes from file-descriptor "fd". */ -int -rd_bytes(fd, string, cnt) - register char *string; - register long cnt; +void rd_bytes(int fd, char *string, long cnt) { while (cnt) { diff --git a/commands/aal/rd_bytes.h b/commands/aal/rd_bytes.h new file mode 100644 index 000000000..fe2c8c5cd --- /dev/null +++ b/commands/aal/rd_bytes.h @@ -0,0 +1,2 @@ + +extern void rd_bytes(int fd, char *string, long cnt); diff --git a/commands/aal/rd_unsig2.c b/commands/aal/rd_unsig2.c index 13a816f06..5885f78c4 100644 --- a/commands/aal/rd_unsig2.c +++ b/commands/aal/rd_unsig2.c @@ -4,9 +4,10 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include "object.h" +#include "rd_bytes.h" unsigned int -rd_unsigned2(fd) +rd_unsigned2(int fd) { char buf[2]; diff --git a/commands/aal/sprint.c b/commands/aal/sprint.c index bdef67a45..adcb5cdb1 100644 --- a/commands/aal/sprint.c +++ b/commands/aal/sprint.c @@ -11,6 +11,7 @@ #endif #include #include "param.h" +#include "format.h" /*VARARGS*/ /*FORMAT1v $ diff --git a/commands/aal/system.h b/commands/aal/system.h index af36299dd..489241e85 100644 --- a/commands/aal/system.h +++ b/commands/aal/system.h @@ -43,5 +43,7 @@ extern File _sys_ftab[]; #define ILL_BREAK ((char *)0) /* system's idea of block */ +#ifndef BUFSIZ #define BUFSIZ 1024 +#endif #endif /* __SYSTEM_INCLUDED__ */ diff --git a/commands/aal/wr_arhdr.c b/commands/aal/wr_arhdr.c index a074f2dfe..267aab6bd 100644 --- a/commands/aal/wr_arhdr.c +++ b/commands/aal/wr_arhdr.c @@ -5,9 +5,11 @@ */ #include #include "object.h" +#include "arch.h" +#include "write.h" +#include "wr_bytes.h" -wr_arhdr(fd, arhdr) - register struct ar_hdr *arhdr; +void wr_arhdr(int fd, struct ar_hdr *arhdr) { char buf[AR_TOTAL]; register char *c = buf; diff --git a/commands/aal/wr_bytes.c b/commands/aal/wr_bytes.c index 36629da8a..6787c943c 100644 --- a/commands/aal/wr_bytes.c +++ b/commands/aal/wr_bytes.c @@ -9,14 +9,17 @@ You have to put it in an int! */ +#include +#include +#include "wr_bytes.h" +#include "archiver.h" + static int maxchunk = MAXCHUNK; /* * Just write "cnt" bytes to file-descriptor "fd". */ -wr_bytes(fd, string, cnt) - register char *string; - register long cnt; +void wr_bytes(int fd, register char *string, long cnt) { while (cnt) { diff --git a/commands/aal/wr_bytes.h b/commands/aal/wr_bytes.h new file mode 100644 index 000000000..77a860904 --- /dev/null +++ b/commands/aal/wr_bytes.h @@ -0,0 +1,4 @@ +/* + * Exported symbols of wr_bytes.c + */ +extern void wr_bytes(int fd, register char *string, long cnt); diff --git a/commands/aal/wr_int2.c b/commands/aal/wr_int2.c index 39966b183..4db0d9bf4 100644 --- a/commands/aal/wr_int2.c +++ b/commands/aal/wr_int2.c @@ -4,8 +4,10 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include "object.h" +#include "wr_int2.h" +#include "wr_bytes.h" -wr_int2(fd, i) +void wr_int2(int fd, int i) { char buf[2]; diff --git a/commands/aal/wr_int2.h b/commands/aal/wr_int2.h new file mode 100644 index 000000000..8e9891dc4 --- /dev/null +++ b/commands/aal/wr_int2.h @@ -0,0 +1,2 @@ + +extern void wr_int2(int fd, int i); diff --git a/commands/aal/wr_long.c b/commands/aal/wr_long.c index c5df7d8f6..288707c8c 100644 --- a/commands/aal/wr_long.c +++ b/commands/aal/wr_long.c @@ -4,9 +4,10 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include "object.h" +#include "wr_bytes.h" +#include "wr_long.h" -wr_long(fd, l) - long l; +void wr_long(int fd, long l) { char buf[4]; diff --git a/commands/aal/wr_long.h b/commands/aal/wr_long.h new file mode 100644 index 000000000..8d849b27b --- /dev/null +++ b/commands/aal/wr_long.h @@ -0,0 +1,2 @@ + +extern void wr_long(int fd, long l); diff --git a/commands/aal/wr_ranlib.c b/commands/aal/wr_ranlib.c index a0b4be366..35cbc075f 100644 --- a/commands/aal/wr_ranlib.c +++ b/commands/aal/wr_ranlib.c @@ -5,10 +5,10 @@ */ #include #include "object.h" +#include "wr_bytes.h" +#include "ranlib.h" -wr_ranlib(fd, ran, cnt) - register struct ranlib *ran; - register long cnt; +void wr_ranlib(int fd, struct ranlib *ran, long cnt) { #if ! (BYTES_REVERSED || WORDS_REVERSED) if (sizeof (struct ranlib) != SZ_RAN) diff --git a/commands/aal/write.c b/commands/aal/write.c index dd98446e0..bec67fbaf 100644 --- a/commands/aal/write.c +++ b/commands/aal/write.c @@ -4,13 +4,13 @@ */ /* $Header$ */ +#include +#include #include +#include "write.h" int -sys_write(fp, bufptr, nbytes) - File *fp; - char *bufptr; - int nbytes; +sys_write(File *fp, char *bufptr, int nbytes) { if (! fp) return 0; return write(fp->o_fd, bufptr, nbytes) == nbytes; diff --git a/commands/aal/write.h b/commands/aal/write.h new file mode 100644 index 000000000..fa04c1ffc --- /dev/null +++ b/commands/aal/write.h @@ -0,0 +1,3 @@ + +#include "system.h" +extern int sys_write(File *fp, char *bufptr, int nbytes);