]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/testsnmp.c
Changelog.
[thirdparty/cups.git] / cups / testsnmp.c
index fbbc309293c2bff76d35ceeed65ceef27ba58e25..8071847a780353131dee099d2e5575c48293ffc2 100644 (file)
@@ -1,34 +1,16 @@
 /*
- * "$Id$"
+ * SNMP test program for CUPS.
  *
- *   SNMP test program for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Apple Inc.
  *
- *   Copyright 2008 by Apple Inc.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- *   which should have been included with this file.  If this file is
- *   file is missing or damaged, see the license at "http://www.cups.org/".
- *
- *   This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- *   main()     - Main entry.
- *   scan_oid() - Scan an OID value.
- *   show_oid() - Show the specified OID.
- *   usage()    - Show program usage and exit.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
  * Include necessary headers...
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "string.h"
+#include "cups-private.h"
 #include "snmp-private.h"
 
 
@@ -39,7 +21,7 @@
 static void    print_packet(cups_snmp_t *packet, void *data);
 static int     show_oid(int fd, const char *community,
                         http_addr_t *addr, const char *s, int walk);
-static void    usage(void);
+static void    usage(void) _CUPS_NORETURN;
 
 
 /*
@@ -122,7 +104,7 @@ main(int  argc,                             /* I - Number of command-line args */
                         ".1.3.6.1.2.1.43.10.2.1.4.1.1", walk))
       return (1);
   }
-  
+
   return (0);
 }
 
@@ -135,8 +117,8 @@ static void
 print_packet(cups_snmp_t *packet,      /* I - SNMP response packet */
              void        *data)                /* I - User data pointer (not used) */
 {
-  int  i;                              /* Looping var */
-  char temp[1024];                     /* Temporary OID string */
+  unsigned     i;                      /* Looping var */
+  char         temp[1024];             /* Temporary OID string */
 
 
   (void)data;
@@ -155,11 +137,13 @@ print_packet(cups_snmp_t *packet, /* I - SNMP response packet */
        break;
 
     case CUPS_ASN1_BIT_STRING :
-       printf("BIT-STRING \"%s\"\n", packet->object_value.string);
+       printf("BIT-STRING \"%s\"\n",
+              (char *)packet->object_value.string.bytes);
        break;
 
     case CUPS_ASN1_OCTET_STRING :
-       printf("OCTET-STRING \"%s\"\n", packet->object_value.string);
+       printf("OCTET-STRING \"%s\"\n",
+              (char *)packet->object_value.string.bytes);
        break;
 
     case CUPS_ASN1_NULL_VALUE :
@@ -173,8 +157,8 @@ print_packet(cups_snmp_t *packet,   /* I - SNMP response packet */
 
     case CUPS_ASN1_HEX_STRING :
        fputs("Hex-STRING", stdout);
-       for (i = 0; i < packet->object_value.hex_string.num_bytes; i ++)
-         printf(" %02X", packet->object_value.hex_string.bytes[i]);
+       for (i = 0; i < packet->object_value.string.num_bytes; i ++)
+         printf(" %02X", packet->object_value.string.bytes[i]);
        putchar('\n');
        break;
 
@@ -298,8 +282,3 @@ usage(void)
 
   exit (1);
 }
-
-
-/*
- * End of "$Id$".
- */