2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
21 char *filenam
= "/usr/share/lib/dict/words";
31 int compare(char *, char *);
32 void canon(char *, char *);
36 main(int argc
, char **argv
)
42 while (argc
>= 2 && *argv
[1] == '-') {
73 dfile
= fopen(filenam
, "r");
75 (void) fprintf(stderr
, "look: can't open %s\n", filenam
);
78 wstring
= strdup(argv
[1]);
80 if ((ptr
= strchr(wstring
, tab
)) != NULL
) {
86 (void) fseek(dfile
, 0L, 2);
90 (void) fseek(dfile
, mid
, 0);
94 } while (c
!= EOF
&& c
!= '\n');
98 switch (compare(key
, word
)) {
113 (void) fseek(dfile
, bot
, 0);
114 while (ftell(dfile
) < top
) {
118 switch (compare(key
, word
)) {
131 while (getword(entry
)) {
133 switch (compare(key
, word
)) {
145 compare(char *s
, char *t
)
147 for (; *s
== *t
; s
++, t
++)
159 int avail
= WORDSIZE
- 1;
176 canon(char *old
, char *new)
179 int avail
= WORDSIZE
- 1;