#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README mib.c.diff parse.c.diff parse.h.diff
# Wrapped by phil@Shiva.COM on Wed Jan 15 22:36:07 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(91 characters\)
sed "s/^X//" >README <<'END_OF_README'
XPatches for CMU SNMP tools 1.1b to accept new concise MIB clauses
Xand "deprecated" status!
END_OF_README
if test 91 -ne `wc -c <README`; then
    echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mib.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"mib.c.diff\"
else
echo shar: Extracting \"mib.c.diff\" \(2009 characters\)
sed "s/^X//" >mib.c.diff <<'END_OF_mib.c.diff'
X===================================================================
XRCS file: /s/usr2/K/repo/tools/cmu-snmp/snmplib/mib.c,v
Xretrieving revision 1.1
Xdiff -c -r1.1 mib.c
X*** /tmp/,RCSt1a22330	Tue Sep 24 20:22:57 1991
X--- mib.c	Tue Aug 20 22:54:27 1991
X***************
X*** 93,100 ****
X--- 93,102 ----
X  	    *buf++ = '.';
X  	    cp++;
X  	}
X+ #if 0
X  	if ((x % 48) == 47)
X  	    *buf++ = '\n';
X+ #endif
X      }
X      *buf = '\0';
X  }
X***************
X*** 396,402 ****
X  struct tree *get_symbol();
X  
X  oid RFC1066_MIB[] = { 1, 3, 6, 1, 2, 1 };
X! unsigned char RFC1066_MIB_text[] = ".iso.org.dod.internet.mgmt.mib";
X  struct tree *Mib;
X  
X  init_mib()
X--- 398,412 ----
X  struct tree *get_symbol();
X  
X  oid RFC1066_MIB[] = { 1, 3, 6, 1, 2, 1 };
X! char RFC1066_MIB_text[] = ".iso.org.dod.internet.mgmt.mib";
X! 
X! /* phil@Shiva.COM; */
X! #define RFC1066_MIB_text_len (sizeof(RFC1066_MIB_text)-1)
X! 
X! /* phil@Shiva.COM; */
X! char RFC1158_MIB_text[] = ".iso.org.dod.internet.mgmt.mib-2";
X! #define RFC1158_MIB_text_len (sizeof(RFC1158_MIB_text)-1)
X! 
X  struct tree *Mib;
X  
X  init_mib()
X***************
X*** 671,679 ****
X      *buf = '.';	/* this is a fully qualified name */
X      subtree = get_symbol(objid, objidlen, subtree, buf + 1);
X      cp = buf;
X!     if ((strlen(buf) >= strlen((char *)RFC1066_MIB_text)) && !bcmp(buf, (char *)RFC1066_MIB_text,
X! 	strlen((char *)RFC1066_MIB_text))){
X! 	    cp += sizeof(RFC1066_MIB_text);
X      }
X      printf("Name: %s\n", cp);
X      *buf = '\0';
X--- 681,693 ----
X      *buf = '.';	/* this is a fully qualified name */
X      subtree = get_symbol(objid, objidlen, subtree, buf + 1);
X      cp = buf;
X!     if ((strlen(buf) >= RFC1158_MIB_text_len)
X! 	&& !bcmp(buf, (char *)RFC1158_MIB_text, RFC1158_MIB_text_len)){
X! 	    cp += RFC1158_MIB_text_len+1;
X!     }
X!     else if ((strlen(buf) >= RFC1066_MIB_text_len)
X! 	&& !bcmp(buf, (char *)RFC1066_MIB_text, RFC1066_MIB_text_len)){
X! 	    cp += RFC1066_MIB_text_len+1;
X      }
X      printf("Name: %s\n", cp);
X      *buf = '\0';
END_OF_mib.c.diff
if test 2009 -ne `wc -c <mib.c.diff`; then
    echo shar: \"mib.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f parse.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"parse.c.diff\"
else
echo shar: Extracting \"parse.c.diff\" \(8109 characters\)
sed "s/^X//" >parse.c.diff <<'END_OF_parse.c.diff'
X===================================================================
XRCS file: /s/usr2/K/repo/tools/cmu-snmp/snmplib/parse.c,v
Xretrieving revision 1.1
Xdiff -c -r1.1 parse.c
X*** /tmp/,RCSt1a22340	Tue Sep 24 20:22:59 1991
X--- parse.c	Thu Sep 19 06:18:15 1991
X***************
X*** 1,3 ****
X--- 1,4 ----
X+ /* $Id: parse.c,v 1.3 91/09/19 06:18:33 phil Exp $	*/
X  /***********************************************************
X  	Copyright 1989 by Carnegie Mellon University
X  
X***************
X*** 69,74 ****
X--- 70,80 ----
X  #define RECOMMENDED 26
X  #define PUNCT	    27
X  #define EQUALS	    28
X+ #define DESCRIPTION 29
X+ #define QUOTESTRING 30
X+ #define INDEX	    31
X+ #define DEFVAL	    32
X+ #define DEPRECATED  33
X  
X  struct tok {
X  	char *name;			/* token name */
X***************
X*** 113,121 ****
X--- 119,132 ----
X  	{ "{", sizeof ("{")-1, PUNCT },
X  	{ "}", sizeof ("}")-1, PUNCT },
X  	{ "::=", sizeof ("::=")-1, EQUALS },
X+         { "DESCRIPTION", sizeof ("DESCRIPTION")-1, DESCRIPTION },
X+         { "INDEX", sizeof ("INDEX")-1, INDEX },
X+         { "DEFVAL", sizeof ("DEFVAL")-1, DEFVAL },
X+ 	{ "deprecated", sizeof ("deprecated")-1, DEPRECATED },
X  	{ NULL }
X  };
X  
X+ 
X  #define	HASHSIZE	32
X  #define	BUCKET(x)	(x & 0x01F)
X  
X***************
X*** 341,347 ****
X  {
X      register int count;
X      int type;
X!     char token[64], label[32];
X      register char *cp, *tp;
X  
X      if ((type = get_token(fp, token)) != PUNCT){
X--- 352,358 ----
X  {
X      register int count;
X      int type;
X!     char token[MAXTOKEN], label[MAXLABEL];
X      register char *cp, *tp;
X  
X      if ((type = get_token(fp, token)) != PUNCT){
X***************
X*** 430,436 ****
X      char *name;
X  {
X      int type;
X!     char token[64];
X      register int count;
X      register struct subid *op, *nop;
X      int length;
X--- 441,447 ----
X      char *name;
X  {
X      int type;
X!     char token[MAXTOKEN];
X      register int count;
X      register struct subid *op, *nop;
X      int length;
X***************
X*** 516,526 ****
X      FILE *fp;
X  {
X      int type;
X!     char token[64];
X  
X      type = get_token(fp, token);
X      if (type != SEQUENCE){
X! 	print_error("Not a sequence", (char *)NULL); /* should we handle this */
X  	return NULL;
X      }
X      while((type = get_token(fp, token)) != NULL){
X--- 527,537 ----
X      FILE *fp;
X  {
X      int type;
X!     char token[MAXTOKEN];
X  
X      type = get_token(fp, token);
X      if (type != SEQUENCE){
X! 	type = get_token(fp, token);
X  	return NULL;
X      }
X      while((type = get_token(fp, token)) != NULL){
X***************
X*** 543,554 ****
X      char *name;
X  {
X      register int type;
X!     char token[64];
X      int count, length;
X      struct subid oid[16];
X!     char syntax[32];
X      int nexttype;
X!     char nexttoken[64];
X      register struct node *np;
X      register struct enum_list *ep;
X      register char *cp;
X--- 554,565 ----
X      char *name;
X  {
X      register int type;
X!     char token[MAXTOKEN];
X      int count, length;
X      struct subid oid[16];
X!     char syntax[MAXTOKEN];
X      int nexttype;
X!     char nexttoken[MAXTOKEN];
X      register struct node *np;
X      register struct enum_list *ep;
X      register char *cp;
X***************
X*** 706,717 ****
X  	return 0;
X      }
X      type = get_token(fp, token);
X!     if (type != MANDATORY && type != OPTIONAL && type != OBSOLETE && type != RECOMMENDED){
X  	print_error("Bad status", token);
X  	free_node(np);
X  	return 0;
X      }
X      type = get_token(fp, token);
X      if (type != EQUALS){
X  	print_error("Bad format", token);
X  	free_node(np);
X--- 717,760 ----
X  	return 0;
X      }
X      type = get_token(fp, token);
X!     if (type != MANDATORY && type != OPTIONAL && type != OBSOLETE && type != RECOMMENDED && type != DEPRECATED){
X  	print_error("Bad status", token);
X  	free_node(np);
X  	return 0;
X      }
X      type = get_token(fp, token);
X+     /*
X+      * Optional parts of the OBJECT-TYPE macro
X+      */
X+     while (type != EQUALS) {
X+ 	int breakFlag = 0;
X+ 	switch (type) {
X+ 	  case DESCRIPTION:
X+ 	    type = get_token(fp, token);
X+ 	    if (type != QUOTESTRING) {
X+ 		print_error("Bad DESCRIPTION", token);
X+ 		free_node(np);
X+ 		return 0;
X+ 	    }
X+ 	    break;
X+ 
X+ 	  case INDEX:
X+ 	  case DEFVAL:
X+ 	    if (tossObjectIdentifier(fp, token) != OBJID) {
X+ 		print_error("Bad Object Identifier", token);
X+ 		free_node(np);
X+ 		return 0;
X+ 	    }
X+ 	    break;
X+ 
X+ 	  default:
X+ 	    print_error("Bad format of optional clauses", token);
X+ 	    free_node(np);
X+ 	    return 0;
X+ 	    break;
X+ 	}
X+ 	type = get_token(fp, token);
X+     }
X      if (type != EQUALS){
X  	print_error("Bad format", token);
X  	free_node(np);
X***************
X*** 721,727 ****
X      if (length > 1 && length <= 16){
X  	/* just take the last pair in the oid list */
X  	if (oid[length - 2].label)
X! 	    strncpy(np->parent, oid[length - 2].label, 32);
X  	strcpy(np->label, name);
X  	if (oid[length - 1].subid != -1)
X  	    np->subid = oid[length - 1].subid;
X--- 764,770 ----
X      if (length > 1 && length <= 16){
X  	/* just take the last pair in the oid list */
X  	if (oid[length - 2].label)
X! 	    strncpy(np->parent, oid[length - 2].label, MAXLABEL);
X  	strcpy(np->label, name);
X  	if (oid[length - 1].subid != -1)
X  	    np->subid = oid[length - 1].subid;
X***************
X*** 750,757 ****
X  parse(fp)
X      FILE *fp;
X  {
X!     char token[64];
X!     char name[32];
X      int	type = 1;
X      struct node *np, *root = NULL;
X  
X--- 793,800 ----
X  parse(fp)
X      FILE *fp;
X  {
X!     char token[MAXTOKEN];
X!     char name[MAXLABEL];
X      int	type = 1;
X      struct node *np, *root = NULL;
X  
X***************
X*** 766,772 ****
X  	    print_error(token, "is a reserved word");
X  	    return NULL;
X  	}
X! 	strncpy(name, token, 32);
X  	type = get_token(fp, token);
X  	if (type == OBJTYPE){
X  	    if (root == NULL){
X--- 809,815 ----
X  	    print_error(token, "is a reserved word");
X  	    return NULL;
X  	}
X! 	strncpy(name, token, MAXTOKEN);
X  	type = get_token(fp, token);
X  	if (type == OBJTYPE){
X  	    if (root == NULL){
X***************
X*** 806,811 ****
X--- 849,859 ----
X  		np = np->next;
X  	} else if (type == EQUALS){
X  	    type = parse_asntype(fp);
X+ 	    if (type != NULL) {
X+ 		/* equivalenced type: DdpAddress :== OCTET STRING */
X+ 		/* What to do?  */
X+ 	    }
X+ 	    
X  	} else if (type == NULL){
X  	    break;
X  	} else {
X***************
X*** 813,818 ****
X--- 861,867 ----
X  	    return NULL;
X  	}
X      }
X+     
X  #ifdef TEST
X  {
X      struct enum_list *ep;
X***************
X*** 854,859 ****
X--- 903,910 ----
X  	ch = getc(fp);
X  	if (ch == '\n')
X  	    Line++;
X+ 	else if (ch == '"')
X+ 	    return parseQuoteString(fp, token);
X      }
X      if (ch == -1)
X  	return NULL;
X***************
X*** 900,905 ****
X--- 951,1028 ----
X      
X      } while ((ch = getc(fp)) != -1);
X      return NULL;
X+ }
X+ 
X+ static int
X+ parseQuoteString(fp, token)
X+     register FILE *fp;
X+     register char *token;
X+ {
X+     static char last = ' ';
X+     register int ch;
X+     register char *cp = token;
X+     register int hash = 0;
X+     register struct tok *tp;
X+ 
X+     ch = ' ';
X+     
X+     while(ch != -1) {
X+ 	ch = getc(fp);
X+ 	cp++;
X+ 	
X+ 	if (ch == '\n')
X+ 	    Line++;
X+ 	else if (ch == '"') {
X+ 	    return QUOTESTRING;
X+ 	}
X+     }
X+     if (ch == -1) {
X+ 	last = ch;
X+ 	*cp = '\0';
X+ 	return NULL;
X+     }
X+ }
X+ 
X+ /*
X+  * This routine parses a string like  { blah blah blah } and returns OBJID if
X+  * it is well formed, and NULL if not.
X+  */ 
X+ static int
X+ tossObjectIdentifier(fp, token)
X+     register FILE *fp;
X+     register char *token;
X+ {
X+     static char last = ' ';
X+     register int ch;
X+     register char *cp = token;
X+     register int hash = 0;
X+     register struct tok *tp;
X+ 
X+ 
X+     ch = last;
X+     /* skip all white space */
X+     while(isspace(ch) && ch != -1){
X+ 	ch = getc(fp);
X+ 	if (ch == '\n')
X+ 	    Line++;
X+     }
X+     if (ch != '{')
X+ 	return NULL;
X+     
X+     while(ch != -1) {
X+ 	ch = getc(fp);
X+ 	cp++;
X+ 	
X+ 	if (ch == '\n')
X+ 	    Line++;
X+ 	else if (ch == '}')
X+ 	    return OBJID;
X+     }
X+     if (ch == -1){
X+ 	last = ch;
X+ 	*cp = '\0';
X+ 	return NULL;
X+     }
X  }
X  
X  struct tree *
END_OF_parse.c.diff
if test 8109 -ne `wc -c <parse.c.diff`; then
    echo shar: \"parse.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f parse.h.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"parse.h.diff\"
else
echo shar: Extracting \"parse.h.diff\" \(2432 characters\)
sed "s/^X//" >parse.h.diff <<'END_OF_parse.h.diff'
X===================================================================
XRCS file: /s/usr2/K/repo/tools/cmu-snmp/snmplib/parse.h,v
Xretrieving revision 1.1
Xdiff -c -r1.1 parse.h
X*** /tmp/,RCSt1a22345	Tue Sep 24 20:23:01 1991
X--- parse.h	Tue Aug 20 22:05:02 1991
X***************
X*** 1,3 ****
X--- 1,4 ----
X+ /* $Id: parse.h,v 1.2 91/07/27 23:38:30 nik Exp $	*/
X  /***********************************************************
X  	Copyright 1989 by Carnegie Mellon University
X  
X***************
X*** 23,28 ****
X--- 24,32 ----
X   * parse.h
X   */
X  
X+ #define MAXLABEL	64	/* maximum characters in a label */
X+ #define MAXTOKEN	64	/* maximum characters in a token */
X+ 
X  /*
X   * A linked list of tag-value pairs for enumerated integers.
X   */
X***************
X*** 37,45 ****
X   */
X  struct node {
X      struct node *next;
X!     char label[32]; /* This node's (unique) textual name */
X      u_long  subid;  /* This node's integer subidentifier */
X!     char parent[32];/* The parent's textual name */
X      int type;	    /* The type of object this represents */
X      struct enum_list *enums;	/* (optional) list of enumerated integers (otherwise NULL) */
X  };
X--- 41,49 ----
X   */
X  struct node {
X      struct node *next;
X!     char label[MAXLABEL]; /* This node's (unique) textual name */
X      u_long  subid;  /* This node's integer subidentifier */
X!     char parent[MAXLABEL];/* The parent's textual name */
X      int type;	    /* The type of object this represents */
X      struct enum_list *enums;	/* (optional) list of enumerated integers (otherwise NULL) */
X  };
X***************
X*** 51,57 ****
X      struct tree *child_list;	/* list of children of this node */
X      struct tree *next_peer;	/* Next node in list of peers */
X      struct tree *parent;
X!     char label[32];		/* This node's textual name */
X      u_long subid;		/* This node's integer subidentifier */
X      int type;			/* This node's object type */
X      struct enum_list *enums;	/* (optional) list of enumerated integers (otherwise NULL) */
X--- 55,61 ----
X      struct tree *child_list;	/* list of children of this node */
X      struct tree *next_peer;	/* Next node in list of peers */
X      struct tree *parent;
X!     char label[MAXLABEL];		/* This node's textual name */
X      u_long subid;		/* This node's integer subidentifier */
X      int type;			/* This node's object type */
X      struct enum_list *enums;	/* (optional) list of enumerated integers (otherwise NULL) */
END_OF_parse.h.diff
if test 2432 -ne `wc -c <parse.h.diff`; then
    echo shar: \"parse.h.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0
