summaryrefslogtreecommitdiffabout
path: root/getc.c
authorSergey Poznyakoff <gray@gnu.org.ua>2017-07-19 08:29:27 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2017-07-19 08:29:27 (GMT)
commit651babfefa21536112cbcd799932b3595aeb2da4 (patch) (side-by-side diff)
tree6922b7ea70642f4ce7a8cb97f01e62115e97d940 /getc.c
parent3e59cfb01443a14962547ed75bbbaaefa25a7633 (diff)
downloadruncap-651babfefa21536112cbcd799932b3595aeb2da4.tar.gz
runcap-651babfefa21536112cbcd799932b3595aeb2da4.tar.bz2
Rename struct filecapture to stream_capture; portability fixes
Diffstat (limited to 'getc.c') (more/less context) (ignore whitespace changes)
-rw-r--r--getc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/getc.c b/getc.c
index fce14ea..ed6713d 100644
--- a/getc.c
+++ b/getc.c
@@ -21,34 +21,34 @@
#include "runcap.h"
int
-runcap_getc(struct runcap *rc, int stream, char *cp)
+runcap_getc(struct runcap *rc, int sd, char *cp)
{
- struct filecapture *fp;
+ struct stream_capture *cap;
if (!cp) {
errno = EINVAL;
return -1;
}
- fp = runcap_filecapture(rc, stream);
- if (!fp)
+ cap = runcap_stream_capture(rc, sd);
+ if (!cap)
return -1;
- if (fp->fc_level == fp->fc_cur) {
- if (fp->fc_tmpfd != -1) {
- ssize_t r = read(fp->fc_tmpfd, fp->fc_base,
- fp->fc_size);
+ if (cap->sc_level == cap->sc_cur) {
+ if (cap->sc_storfd != -1) {
+ ssize_t r = read(cap->sc_storfd, cap->sc_base,
+ cap->sc_size);
if (r < 0)
return -1;
else if (r == 0)
return 0;
- fp->fc_level = r;
- fp->fc_cur = 0;
+ cap->sc_level = r;
+ cap->sc_cur = 0;
} else {
return 0;
}
}
- *cp = fp->fc_base[fp->fc_cur++];
+ *cp = cap->sc_base[cap->sc_cur++];
return 1;
}

Return to:

Send suggestions and report system problems to the System administrator.