From fa82bf4e17d3b6422eb922374e04631e08af93ef Mon Sep 17 00:00:00 2001 From: charnier Date: Tue, 2 Dec 1997 12:33:42 +0000 Subject: Use err(3). Add protos for -Wall. --- libexec/talkd/talkd.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'libexec/talkd/talkd.c') diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c index acaa888..dcb2624 100644 --- a/libexec/talkd/talkd.c +++ b/libexec/talkd/talkd.c @@ -29,18 +29,20 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $Id$ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -53,22 +55,22 @@ static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93"; #include #include #include -#include -#include -#include +#include #include -#include +#include +#include #include #include #include -#include +#include +#include +#include CTL_MSG request; CTL_RESPONSE response; int sockt; int debug = 0; -void timeout(); long lastmsgtime; char hostname[MAXHOSTNAMELEN + 1]; @@ -76,6 +78,10 @@ char hostname[MAXHOSTNAMELEN + 1]; #define TIMEOUT 30 #define MAXIDLE 120 +void process_request __P((CTL_MSG *, CTL_RESPONSE *)); +void timeout(); + +int main(argc, argv) int argc; char *argv[]; @@ -83,10 +89,8 @@ main(argc, argv) register CTL_MSG *mp = &request; int cc; - if (getuid()) { - fprintf(stderr, "%s: getuid: not super-user\n", argv[0]); - exit(1); - } + if (getuid()) + errx(1, "getuid: not super-user"); openlog("talkd", LOG_PID, LOG_DAEMON); if (gethostname(hostname, sizeof (hostname) - 1) < 0) { syslog(LOG_ERR, "gethostname: %m"); @@ -101,8 +105,6 @@ main(argc, argv) signal(SIGALRM, timeout); alarm(TIMEOUT); for (;;) { - extern int errno; - cc = recv(0, (char *)mp, sizeof (*mp), 0); if (cc != sizeof (*mp)) { if (cc < 0 && errno != EINTR) -- cgit v1.1