diff options
| author | Manuel Mausz <manuel@mausz.at> | 2026-06-25 14:19:33 +0200 |
|---|---|---|
| committer | Manuel Mausz <manuel@mausz.at> | 2026-06-25 14:19:33 +0200 |
| commit | 3e992e7fbf16c7f4249223bb807e13b56f078022 (patch) | |
| tree | eab38342bc6ec5e1b665eacbfd59468be98c5c31 /substdo.c | |
| parent | 1fe361bba7bc096850f5bef391dea620f2f53ab3 (diff) | |
| download | qmail-3e992e7fbf16c7f4249223bb807e13b56f078022.tar.gz qmail-3e992e7fbf16c7f4249223bb807e13b56f078022.tar.bz2 qmail-3e992e7fbf16c7f4249223bb807e13b56f078022.zip | |
add signatures for substdi/substdo
Diffstat (limited to 'substdo.c')
| -rw-r--r-- | substdo.c | 46 |
1 files changed, 13 insertions, 33 deletions
| @@ -3,13 +3,9 @@ | |||
| 3 | #include "byte.h" | 3 | #include "byte.h" |
| 4 | #include "error.h" | 4 | #include "error.h" |
| 5 | 5 | ||
| 6 | static int allwrite(op,fd,buf,len) | 6 | static int allwrite(ssize_t (*op)(int, const void*, size_t), int fd, char *buf, int len) |
| 7 | register int (*op)(); | ||
| 8 | register int fd; | ||
| 9 | register char *buf; | ||
| 10 | register int len; | ||
| 11 | { | 7 | { |
| 12 | register int w; | 8 | int w; |
| 13 | 9 | ||
| 14 | while (len) { | 10 | while (len) { |
| 15 | w = op(fd,buf,len); | 11 | w = op(fd,buf,len); |
| @@ -17,17 +13,16 @@ register int len; | |||
| 17 | if (errno == error_intr) continue; | 13 | if (errno == error_intr) continue; |
| 18 | return -1; /* note that some data may have been written */ | 14 | return -1; /* note that some data may have been written */ |
| 19 | } | 15 | } |
| 20 | if (w == 0) ; /* luser's fault */ | 16 | /* if (w == 0) ; luser's fault */ |
| 21 | buf += w; | 17 | buf += w; |
| 22 | len -= w; | 18 | len -= w; |
| 23 | } | 19 | } |
| 24 | return 0; | 20 | return 0; |
| 25 | } | 21 | } |
| 26 | 22 | ||
| 27 | int substdio_flush(s) | 23 | int substdio_flush(substdio *s) |
| 28 | register substdio *s; | ||
| 29 | { | 24 | { |
| 30 | register int p; | 25 | int p; |
| 31 | 26 | ||
| 32 | p = s->p; | 27 | p = s->p; |
| 33 | if (!p) return 0; | 28 | if (!p) return 0; |
| @@ -35,12 +30,9 @@ register substdio *s; | |||
| 35 | return allwrite(s->op,s->fd,s->x,p); | 30 | return allwrite(s->op,s->fd,s->x,p); |
| 36 | } | 31 | } |
| 37 | 32 | ||
| 38 | int substdio_bput(s,buf,len) | 33 | int substdio_bput(substdio *s, char *buf, int len) |
| 39 | register substdio *s; | ||
| 40 | register char *buf; | ||
| 41 | register int len; | ||
| 42 | { | 34 | { |
| 43 | register int n; | 35 | int n; |
| 44 | 36 | ||
| 45 | while (len > (n = s->n - s->p)) { | 37 | while (len > (n = s->n - s->p)) { |
| 46 | byte_copy(s->x + s->p,n,buf); s->p += n; buf += n; len -= n; | 38 | byte_copy(s->x + s->p,n,buf); s->p += n; buf += n; len -= n; |
| @@ -52,12 +44,9 @@ register int len; | |||
| 52 | return 0; | 44 | return 0; |
| 53 | } | 45 | } |
| 54 | 46 | ||
| 55 | int substdio_put(s,buf,len) | 47 | int substdio_put(substdio *s, char *buf, int len) |
| 56 | register substdio *s; | ||
| 57 | register char *buf; | ||
| 58 | register int len; | ||
| 59 | { | 48 | { |
| 60 | register int n; | 49 | int n; |
| 61 | 50 | ||
| 62 | n = s->n; | 51 | n = s->n; |
| 63 | if (len > n - s->p) { | 52 | if (len > n - s->p) { |
| @@ -77,32 +66,23 @@ register int len; | |||
| 77 | return 0; | 66 | return 0; |
| 78 | } | 67 | } |
| 79 | 68 | ||
| 80 | int substdio_putflush(s,buf,len) | 69 | int substdio_putflush(substdio* s, char *buf, int len) |
| 81 | register substdio *s; | ||
| 82 | register char *buf; | ||
| 83 | register int len; | ||
| 84 | { | 70 | { |
| 85 | if (substdio_flush(s) == -1) return -1; | 71 | if (substdio_flush(s) == -1) return -1; |
| 86 | return allwrite(s->op,s->fd,buf,len); | 72 | return allwrite(s->op,s->fd,buf,len); |
| 87 | } | 73 | } |
| 88 | 74 | ||
| 89 | int substdio_bputs(s,buf) | 75 | int substdio_bputs(substdio *s, char *buf) |
| 90 | register substdio *s; | ||
| 91 | register char *buf; | ||
| 92 | { | 76 | { |
| 93 | return substdio_bput(s,buf,str_len(buf)); | 77 | return substdio_bput(s,buf,str_len(buf)); |
| 94 | } | 78 | } |
| 95 | 79 | ||
| 96 | int substdio_puts(s,buf) | 80 | int substdio_puts(substdio *s, char *buf) |
| 97 | register substdio *s; | ||
| 98 | register char *buf; | ||
| 99 | { | 81 | { |
| 100 | return substdio_put(s,buf,str_len(buf)); | 82 | return substdio_put(s,buf,str_len(buf)); |
| 101 | } | 83 | } |
| 102 | 84 | ||
| 103 | int substdio_putsflush(s,buf) | 85 | int substdio_putsflush(substdio *s, char *buf) |
| 104 | register substdio *s; | ||
| 105 | register char *buf; | ||
| 106 | { | 86 | { |
| 107 | return substdio_putflush(s,buf,str_len(buf)); | 87 | return substdio_putflush(s,buf,str_len(buf)); |
| 108 | } | 88 | } |
