| Rev | Line | |
|---|
| [9] | 1 | /* $Header: /cvsup/minix/src/lib/ack/libp/wri.c,v 1.1 2005/10/10 15:27:47 beng Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|---|
| 4 | *
|
|---|
| 5 | * This product is part of the Amsterdam Compiler Kit.
|
|---|
| 6 | *
|
|---|
| 7 | * Permission to use, sell, duplicate or disclose this software must be
|
|---|
| 8 | * obtained in writing. Requests for such permissions may be sent to
|
|---|
| 9 | *
|
|---|
| 10 | * Dr. Andrew S. Tanenbaum
|
|---|
| 11 | * Wiskundig Seminarium
|
|---|
| 12 | * Vrije Universiteit
|
|---|
| 13 | * Postbox 7161
|
|---|
| 14 | * 1007 MC Amsterdam
|
|---|
| 15 | * The Netherlands
|
|---|
| 16 | *
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | #include <pc_err.h>
|
|---|
| 20 | #include <pc_file.h>
|
|---|
| 21 |
|
|---|
| 22 | extern _wstrin();
|
|---|
| 23 |
|
|---|
| 24 | #ifndef EM_WSIZE
|
|---|
| 25 | #ifdef _EM_WSIZE
|
|---|
| 26 | #define EM_WSIZE _EM_WSIZE
|
|---|
| 27 | #endif
|
|---|
| 28 | #endif
|
|---|
| 29 |
|
|---|
| 30 | #if EM_WSIZE==4
|
|---|
| 31 | #define SZ 11
|
|---|
| 32 | #define MININT -2147483648
|
|---|
| 33 | #define STRMININT "-2147483648"
|
|---|
| 34 | #endif
|
|---|
| 35 | #if EM_WSIZE==2
|
|---|
| 36 | #define SZ 6
|
|---|
| 37 | #define MININT -32768
|
|---|
| 38 | #define STRMININT "-32768"
|
|---|
| 39 | #endif
|
|---|
| 40 | #if EM_WSIZE==1
|
|---|
| 41 | #define SZ 4
|
|---|
| 42 | #define MININT -128
|
|---|
| 43 | #define STRMININT "-128"
|
|---|
| 44 | #endif
|
|---|
| 45 |
|
|---|
| 46 | #ifndef STRMININT
|
|---|
| 47 | Something wrong here!
|
|---|
| 48 | #endif
|
|---|
| 49 |
|
|---|
| 50 | _wsi(w,i,f) int w,i; struct file *f; {
|
|---|
| 51 | char *p; int j; char buf[SZ];
|
|---|
| 52 |
|
|---|
| 53 | if (w < 0) _trp(EWIDTH);
|
|---|
| 54 | p = &buf[SZ];
|
|---|
| 55 | if ((j=i) < 0) {
|
|---|
| 56 | if (i == MININT) {
|
|---|
| 57 | _wstrin(w,SZ,STRMININT,f);
|
|---|
| 58 | return;
|
|---|
| 59 | }
|
|---|
| 60 | j = -j;
|
|---|
| 61 | }
|
|---|
| 62 | do
|
|---|
| 63 | *--p = '0' + j%10;
|
|---|
| 64 | while (j /= 10);
|
|---|
| 65 | if (i<0)
|
|---|
| 66 | *--p = '-';
|
|---|
| 67 | _wstrin(w,(int)(&buf[SZ]-p),p,f);
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | _wri(i,f) int i; struct file *f; {
|
|---|
| 71 | _wsi(SZ,i,f);
|
|---|
| 72 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.