Deleted Added
full compact
var.c (22988) var.c (25222)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * $Id$
36 * $Id: var.c,v 1.9 1997/02/22 13:58:47 peter Exp $
37 */
38
39#ifndef lint
40static char const sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
41#endif /* not lint */
42
43#include <unistd.h>
44#include <stdlib.h>

--- 711 unchanged lines hidden (view full) ---

756
757
758/*
759 * Find the appropriate entry in the hash table from the name.
760 */
761
762STATIC struct var **
763hashvar(p)
37 */
38
39#ifndef lint
40static char const sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
41#endif /* not lint */
42
43#include <unistd.h>
44#include <stdlib.h>

--- 711 unchanged lines hidden (view full) ---

756
757
758/*
759 * Find the appropriate entry in the hash table from the name.
760 */
761
762STATIC struct var **
763hashvar(p)
764 register char *p;
764 char *p;
765 {
766 unsigned int hashval;
767
768 hashval = ((unsigned char) *p) << 4;
769 while (*p && *p != '=')
770 hashval += (unsigned char) *p++;
771 return &vartab[hashval % VTABSIZE];
772}
773
774
775
776/*
777 * Returns true if the two strings specify the same varable. The first
778 * variable name is terminated by '='; the second may be terminated by
779 * either '=' or '\0'.
780 */
781
782STATIC int
783varequal(p, q)
765 {
766 unsigned int hashval;
767
768 hashval = ((unsigned char) *p) << 4;
769 while (*p && *p != '=')
770 hashval += (unsigned char) *p++;
771 return &vartab[hashval % VTABSIZE];
772}
773
774
775
776/*
777 * Returns true if the two strings specify the same varable. The first
778 * variable name is terminated by '='; the second may be terminated by
779 * either '=' or '\0'.
780 */
781
782STATIC int
783varequal(p, q)
784 register char *p, *q;
784 char *p, *q;
785 {
786 while (*p == *q++) {
787 if (*p++ == '=')
788 return 1;
789 }
790 if (*p == '=' && *(q - 1) == '\0')
791 return 1;
792 return 0;
793}
785 {
786 while (*p == *q++) {
787 if (*p++ == '=')
788 return 1;
789 }
790 if (*p == '=' && *(q - 1) == '\0')
791 return 1;
792 return 0;
793}