X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/a43fb158d0c5c90291b792d683aa0221403f1893..28db4ccb3e2ee071d561e6ab9f075e7deb65fdb6:/mille/varpush.c diff --git a/mille/varpush.c b/mille/varpush.c index 47c10555..31963745 100644 --- a/mille/varpush.c +++ b/mille/varpush.c @@ -1,4 +1,4 @@ -/* $NetBSD: varpush.c,v 1.8 2004/01/27 20:30:30 jsm Exp $ */ +/* $NetBSD: varpush.c,v 1.13 2016/06/05 18:39:02 christos Exp $ */ /* * Copyright (c) 1982, 1993 @@ -34,12 +34,12 @@ #if 0 static char sccsid[] = "@(#)varpush.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: varpush.c,v 1.8 2004/01/27 20:30:30 jsm Exp $"); +__RCSID("$NetBSD: varpush.c,v 1.13 2016/06/05 18:39:02 christos Exp $"); #endif #endif /* not lint */ -# include -# include "mille.h" +#include +#include "mille.h" /* * @(#)varpush.c 1.1 (Berkeley) 4/1/82 @@ -50,9 +50,7 @@ __RCSID("$NetBSD: varpush.c,v 1.8 2004/01/27 20:30:30 jsm Exp $"); * channel file. func() is either read or write. */ bool -varpush(file, func) - int file; - ssize_t (*func)(int, const struct iovec *, int); +varpush(int file, ssize_t (*func)(int, const struct iovec *, int)) { int temp; const struct iovec vec[] = { @@ -72,33 +70,35 @@ varpush(file, func) }; if (((func)(file, vec, sizeof(vec) / sizeof(vec[0]))) < 0) { - error(strerror(errno)); + error("%s", strerror(errno)); return FALSE; } if (func == readv) { if ((read(file, (void *) &temp, sizeof temp)) < 0) { - error(strerror(errno)); + error("%s", strerror(errno)); return FALSE; } Topcard = &Deck[temp]; #ifdef DEBUG if (Debug) { - char buf[80]; + char buf[80], *bp; over: printf("Debug file:"); - gets(buf); + fgets(buf, (int)sizeof(buf), stdin); + if ((bp = strchr(buf, '\n')) != NULL) + *bp = '\0'; if ((outf = fopen(buf, "w")) == NULL) { warn("%s", buf); goto over; } if (strcmp(buf, _PATH_DEVNULL) != 0) - setbuf(outf, (char *)NULL); + setbuf(outf, NULL); } #endif } else { temp = Topcard - Deck; if ((write(file, (void *) &temp, sizeof temp)) < 0) { - error(strerror(errno)); + error("%s", strerror(errno)); return FALSE; } }