]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - snmplib/parse.c
SourceFormat Enforcement
[thirdparty/squid.git] / snmplib / parse.c
index 69335fa1b23ee4c28b6b92935cde2630ca485d95..02fe588e7641a0a253deb0847ce83ce82decf260 100644 (file)
@@ -23,7 +23,14 @@ SOFTWARE.
 /*
  * parse.c
  */
-#include "config.h"
+#include "squid.h"
+#include "asn1.h"
+#include "cache_snmp.h"
+#include "parse.h"
+#include "snmp_debug.h"
+#include "snmp_pdu.h"
+#include "snmp_vars.h"
+#include "util.h"
 
 #include <stdio.h>
 
@@ -47,10 +54,10 @@ SOFTWARE.
 #if HAVE_MEMORY_H
 #include <memory.h>
 #endif
-#ifdef HAVE_STRING_H
+#if HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_STRINGS_H
+#if HAVE_STRINGS_H
 #include <strings.h>
 #endif
 #if HAVE_BSTRING_H
@@ -74,16 +81,10 @@ SOFTWARE.
 #if HAVE_ASSERT_H
 #include <assert.h>
 #endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
-
-#include "asn1.h"
-#include "snmp_vars.h"
-#include "parse.h"
-#include "snmp_debug.h"
-
-#include "util.h"
-
-#include "cache_snmp.h"
 /*
  * This is one element of an object identifier with either an integer subidentifier,
  * or a textual string label, or both.
@@ -161,7 +162,6 @@ struct tok {
     struct tok *next;          /* pointer to next in hash table */
 };
 
-
 struct tok tokens[] = {
     {"obsolete", sizeof("obsolete") - 1, OBSOLETE},
     {"Opaque", sizeof("Opaque") - 1, SNMP_OPAQUE},
@@ -258,7 +258,6 @@ init_node_hash(struct node *nodes)
     }
 }
 
-
 static void
 print_error(const char *string, const char *token, int type)
 {
@@ -271,7 +270,7 @@ print_error(const char *string, const char *token, int type)
         snmplib_debug(0, "%s: On or around line %d\n", string, Line);
 }
 
-#ifdef TEST
+#if TEST
 print_subtree(tree, count)
 struct snmp_mib_tree *tree;
 int count;
@@ -424,11 +423,11 @@ do_subtree(struct snmp_mib_tree *root, struct node **nodes)
         xfree(oldnp);
 }
 
-#ifndef TEST
+#if !TEST
 static
 #endif
 struct snmp_mib_tree *
-            build_tree(struct node *nodes) {
+build_tree(struct node *nodes) {
     struct node *np;
     struct snmp_mib_tree *tp;
     int bucket, nodes_left = 0;
@@ -447,7 +446,7 @@ struct snmp_mib_tree *
     init_node_hash(nodes);
     /* XXX nodes isn't needed in do_subtree() ??? */
     do_subtree(tp, &nodes);
-#ifdef TEST
+#if TEST
     print_subtree(tp, 0);
 #endif /* TEST */
     /* If any nodes are left, the tree is probably inconsistent */
@@ -470,7 +469,6 @@ struct snmp_mib_tree *
     return tp;
 }
 
-
 /*
  * Parses a token from the file.  The type of the token parsed is returned,
  * and the text is placed in the string pointed to by token.
@@ -611,7 +609,6 @@ getoid(register FILE *fp, register struct subid *SubOid, int length)
     }
     return count;
 
-
 }
 
 static void
@@ -635,7 +632,7 @@ free_node(struct node *np)
  * Returns 0 on error.
  */
 static struct node *
-            parse_objectid(FILE *fp, char *name) {
+parse_objectid(FILE *fp, char *name) {
     int type;
     char token[64];
     register int count;
@@ -744,7 +741,7 @@ parse_asntype(FILE *fp)
  * Returns 0 on error.
  */
 static struct node *
-            parse_objecttype(register FILE *fp, char *name) {
+parse_objecttype(register FILE *fp, char *name) {
     register int type;
     char token[64];
     int count, length;
@@ -969,16 +966,15 @@ static struct node *
     return np;
 }
 
-
 /*
  * Parses a mib file and returns a linked list of nodes found in the file.
  * Returns NULL on error.
  */
-#ifndef TEST
+#if !TEST
 static
 #endif
 struct node *
-            parse(FILE *fp) {
+parse(FILE *fp) {
     char token[64];
     char name[64];
     int type = 1;
@@ -1042,7 +1038,7 @@ struct node *
             return NULL;
         }
     }
-#ifdef TEST
+#if TEST
     {
         struct enum_list *ep;
 
@@ -1062,7 +1058,7 @@ struct node *
 }
 
 struct snmp_mib_tree *
-            read_mib(char *filename) {
+read_mib(char *filename) {
     FILE *fp;
     struct node *nodes;
     struct snmp_mib_tree *tree;