projects
/
unix-history
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e8050e5
)
BSD 4_1_snap development
author
CSRG
<csrg@ucbvax.Berkeley.EDU>
Fri, 28 Mar 1980 14:09:32 +0000
(06:09 -0800)
committer
CSRG
<csrg@ucbvax.Berkeley.EDU>
Fri, 28 Mar 1980 14:09:32 +0000
(06:09 -0800)
Work on file usr/src/games/boggle/comp.c
Synthesized-from: CSRG/cd1/4.1.snap
usr/src/games/boggle/comp.c
[new file with mode: 0644]
patch
|
blob
diff --git a/usr/src/games/boggle/comp.c
b/usr/src/games/boggle/comp.c
new file mode 100644
(file)
index 0000000..
efc5791
--- /dev/null
+++ b/
usr/src/games/boggle/comp.c
@@ -0,0
+1,21
@@
+#include <stdio.h>
+#define MAX ' '
+
+char new[MAX], old[MAX];
+
+main ()
+{
+ register int i, j;
+ old[0] = '\0';
+ while (fgets(&new[0], MAX, stdin) != NULL) {
+ for (i=0; i<MAX && old[i]==new[i]; i++);
+ if (i >= MAX) {
+ fprintf(stderr, "long word\n");
+ exit(1);
+ }
+ putc(i, stdout);
+ for (j=0; (old[j]=new[j]) != '\n'; j++);
+ old[j] = '\0';
+ fputs(&old[i], stdout);
+ }
+}