summaryrefslogtreecommitdiffstats
path: root/hangman
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1995-03-23 08:28:00 +0000
committercgd <cgd@NetBSD.org>1995-03-23 08:28:00 +0000
commit94b5353c71e7246077d468afe68d51ce85fc213d (patch)
tree0b6f70b8110f5d6650a6083460424df854c415f8 /hangman
parent1c0b80f0fe7a28cd947ace3e69f5fd2ac8ed47cb (diff)
downloadbsdgames-darwin-94b5353c71e7246077d468afe68d51ce85fc213d.tar.gz
bsdgames-darwin-94b5353c71e7246077d468afe68d51ce85fc213d.tar.zst
bsdgames-darwin-94b5353c71e7246077d468afe68d51ce85fc213d.zip
merge with Lite, new RCS id conventions, etc.
Diffstat (limited to 'hangman')
-rw-r--r--hangman/Makefile4
-rw-r--r--hangman/endgame.c27
-rw-r--r--hangman/extern.c13
-rw-r--r--hangman/getguess.c20
-rw-r--r--hangman/getword.c26
-rw-r--r--hangman/hangman.611
-rw-r--r--hangman/hangman.h9
-rw-r--r--hangman/main.c19
-rw-r--r--hangman/pathnames.h9
-rw-r--r--hangman/playgame.c13
-rw-r--r--hangman/prdata.c13
-rw-r--r--hangman/prman.c13
-rw-r--r--hangman/prword.c13
-rw-r--r--hangman/setup.c13
14 files changed, 133 insertions, 70 deletions
diff --git a/hangman/Makefile b/hangman/Makefile
index 7785f294..1c965e92 100644
--- a/hangman/Makefile
+++ b/hangman/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.7 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.4 1994/12/22 09:34:37 cgd Exp $
+# $NetBSD: Makefile,v 1.5 1995/03/23 08:32:38 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= hangman
SRCS= endgame.c extern.c getguess.c getword.c main.c playgame.c \
diff --git a/hangman/endgame.c b/hangman/endgame.c
index 8fb634ae..300c0efb 100644
--- a/hangman/endgame.c
+++ b/hangman/endgame.c
@@ -1,6 +1,8 @@
+/* $NetBSD: endgame.c,v 1.3 1995/03/23 08:32:40 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)endgame.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: endgame.c,v 1.2 1993/08/01 18:54:28 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)endgame.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: endgame.c,v 1.3 1995/03/23 08:32:40 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
@@ -70,5 +75,17 @@ endgame()
leaveok(stdscr, TRUE);
move(MESGY, MESGX);
- addstr("\n\n\n");
+ deleteln();
+ deleteln();
+ deleteln();
}
+
+
+
+
+
+
+
+
+
+
diff --git a/hangman/extern.c b/hangman/extern.c
index 91b70d45..2d5f0082 100644
--- a/hangman/extern.c
+++ b/hangman/extern.c
@@ -1,6 +1,8 @@
+/* $NetBSD: extern.c,v 1.3 1995/03/23 08:32:41 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)extern.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: extern.c,v 1.2 1993/08/01 18:54:27 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: extern.c,v 1.3 1995/03/23 08:32:41 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/getguess.c b/hangman/getguess.c
index d8c5cc02..e7a31acd 100644
--- a/hangman/getguess.c
+++ b/hangman/getguess.c
@@ -1,6 +1,8 @@
+/* $NetBSD: getguess.c,v 1.5 1995/03/23 08:32:43 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,12 +34,15 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)getguess.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: getguess.c,v 1.4 1993/11/10 15:28:25 cgd Exp $";
+#if 0
+static char sccsid[] = "@(#)getguess.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: getguess.c,v 1.5 1995/03/23 08:32:43 cgd Exp $";
+#endif
#endif /* not lint */
-# include <termios.h>
-# include "hangman.h"
+#include <sys/ttydefaults.h>
+#include "hangman.h"
/*
* getguess:
@@ -102,7 +107,8 @@ readch()
else if (ch == CTRL('L')) {
wrefresh(curscr);
mvcur(0, 0, curscr->cury, curscr->curx);
- } else
+ }
+ else
return ch;
}
}
diff --git a/hangman/getword.c b/hangman/getword.c
index c54d293d..e858fabe 100644
--- a/hangman/getword.c
+++ b/hangman/getword.c
@@ -1,6 +1,8 @@
+/* $NetBSD: getword.c,v 1.4 1995/03/23 08:32:45 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,17 +34,15 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)getword.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: getword.c,v 1.3 1994/06/29 21:22:50 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)getword.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: getword.c,v 1.4 1995/03/23 08:32:45 cgd Exp $";
+#endif
#endif /* not lint */
-# include "hangman.h"
-
-# if pdp11
-# define RN (((off_t) rand() << 16) | (off_t) rand())
-# else
-# define RN rand()
-# endif
+#include "hangman.h"
+#include <stdlib.h>
/*
* getword:
@@ -52,10 +52,12 @@ getword()
{
register FILE *inf;
register char *wp, *gp;
+ register long pos;
inf = Dict;
for (;;) {
- fseek(inf, abs(RN % Dict_size), 0);
+ pos = (double)rand() / (RAND_MAX + 1.0) * (double)Dict_size;
+ fseek(inf, pos, 0);
if (fgets(Word, BUFSIZ, inf) == NULL)
continue;
if (fgets(Word, BUFSIZ, inf) == NULL)
diff --git a/hangman/hangman.6 b/hangman/hangman.6
index be0573dd..42040574 100644
--- a/hangman/hangman.6
+++ b/hangman/hangman.6
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1983 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: hangman.6,v 1.5 1995/03/23 08:32:46 cgd Exp $
+.\"
+.\" Copyright (c) 1983, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)hangman.6 6.3 (Berkeley) 6/23/90
-.\" $Id: hangman.6,v 1.4 1993/09/16 17:02:51 jtc Exp $
+.\" @(#)hangman.6 8.1 (Berkeley) 5/31/93
.\"
-.Dd June 23, 1990
+.Dd May 31, 1993
.Dt HANGMAN 6
.Os
.Sh NAME
diff --git a/hangman/hangman.h b/hangman/hangman.h
index e8dbffd6..7d7bf484 100644
--- a/hangman/hangman.h
+++ b/hangman/hangman.h
@@ -1,6 +1,8 @@
+/* $NetBSD: hangman.h,v 1.4 1995/03/23 08:32:48 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)hangman.h 5.5 (Berkeley) 2/28/91
- * $Id: hangman.h,v 1.3 1994/06/29 21:22:52 deraadt Exp $
+ * @(#)hangman.h 8.1 (Berkeley) 5/31/93
*/
# include <curses.h>
diff --git a/hangman/main.c b/hangman/main.c
index a4a44d5a..3da3bac1 100644
--- a/hangman/main.c
+++ b/hangman/main.c
@@ -1,6 +1,8 @@
+/* $NetBSD: main.c,v 1.3 1995/03/23 08:32:50 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +34,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1983 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)main.c 5.4 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: main.c,v 1.2 1993/08/01 18:54:24 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: main.c,v 1.3 1995/03/23 08:32:50 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/pathnames.h b/hangman/pathnames.h
index e46fc9b6..5b539e37 100644
--- a/hangman/pathnames.h
+++ b/hangman/pathnames.h
@@ -1,6 +1,8 @@
+/* $NetBSD: pathnames.h,v 1.3 1995/03/23 08:32:51 cgd Exp $ */
+
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)pathnames.h 5.1 (Berkeley) 6/1/90
- * $Id: pathnames.h,v 1.2 1993/08/01 18:54:29 mycroft Exp $
+ * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
*/
#define _PATH_DICT "/usr/share/dict/words"
diff --git a/hangman/playgame.c b/hangman/playgame.c
index 2663923a..5a591520 100644
--- a/hangman/playgame.c
+++ b/hangman/playgame.c
@@ -1,6 +1,8 @@
+/* $NetBSD: playgame.c,v 1.3 1995/03/23 08:32:53 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)playgame.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: playgame.c,v 1.2 1993/08/01 18:54:23 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)playgame.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: playgame.c,v 1.3 1995/03/23 08:32:53 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/prdata.c b/hangman/prdata.c
index 02321d0a..adfff8f3 100644
--- a/hangman/prdata.c
+++ b/hangman/prdata.c
@@ -1,6 +1,8 @@
+/* $NetBSD: prdata.c,v 1.3 1995/03/23 08:32:54 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)prdata.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: prdata.c,v 1.2 1993/08/01 18:54:23 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)prdata.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: prdata.c,v 1.3 1995/03/23 08:32:54 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/prman.c b/hangman/prman.c
index a740f053..2337b639 100644
--- a/hangman/prman.c
+++ b/hangman/prman.c
@@ -1,6 +1,8 @@
+/* $NetBSD: prman.c,v 1.3 1995/03/23 08:32:56 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)prman.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: prman.c,v 1.2 1993/08/01 18:54:22 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)prman.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: prman.c,v 1.3 1995/03/23 08:32:56 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/prword.c b/hangman/prword.c
index 0efbb3bb..ba2ab634 100644
--- a/hangman/prword.c
+++ b/hangman/prword.c
@@ -1,6 +1,8 @@
+/* $NetBSD: prword.c,v 1.3 1995/03/23 08:32:58 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)prword.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: prword.c,v 1.2 1993/08/01 18:54:21 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)prword.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: prword.c,v 1.3 1995/03/23 08:32:58 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/setup.c b/hangman/setup.c
index d119e755..73c835f9 100644
--- a/hangman/setup.c
+++ b/hangman/setup.c
@@ -1,6 +1,8 @@
+/* $NetBSD: setup.c,v 1.3 1995/03/23 08:32:59 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)setup.c 5.4 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: setup.c,v 1.2 1993/08/01 18:54:20 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: setup.c,v 1.3 1995/03/23 08:32:59 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"