⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nprint.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/snmptalk/nprint.c,v 1.3 2003/01/15 14:04:55 josh Exp $ *//* * Copyright (C) 1999-2005 Wind River Systems, Inc. * All rights reserved.  Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. *//**************************************************************************** *  Copyright 1991-1997 Epilogue Technology Corporation. *  Copyright 1998 Integrated Systems, Inc. *  All rights reserved. ****************************************************************************//* * $Log: nprint.c,v $ * Revision 1.3  2003/01/15 14:04:55  josh * directory structure shifting * * Revision 1.2  2001/11/08 16:47:27  tneale * Updated for newset file layout * * Revision 1.1.1.1  2001/11/05 17:49:12  tneale * Tornado shuffle * * Revision 7.10  2001/01/19 22:24:47  paul * Update copyright. * * Revision 7.9  2000/03/17 00:14:34  meister * Update copyright message * * Revision 7.8  1998/06/04 15:13:51  sar * Cleaned up some installation options to allow v3 to work if v2 isn't * installed * * Revision 7.7  1998/06/03 21:50:31  sar * Moved nvutils and nvviews to snark/lib so we can have one copy shared * amongst the demos * Moved the common string functions from stdf to common/lib and created * a series of macros for this code to use * Moved strdup to snark/lib and renamed it to etc_strdup to avoid * needing one from the system libraries * * Revision 7.6  1998/02/25 04:57:57  sra * Update copyrights. * * Revision 7.5  1997/10/21 02:49:17  sar * Allow print_vblist to be accessed for outside nprint so that * it can be used to print out allocated indexes in agentx * * Revision 7.4  1997/03/20 06:53:48  sra * DFARS-safe copyright text.  Zap! * * Revision 7.3  1997/02/25 10:58:16  sra * Update copyright notice, dust under the bed. * * Revision 7.2  1997/01/08 23:26:53  sar * Updated include files to use envoy/h as appropriate after * move from envoy/utils to snark/snmptalk * * Revision 7.1  1997/01/08  01:55:00  sar * Modified to use the snark sty driver for in/output * * Revision 7.0  1996/03/18  20:19:20  sar * Updated rev to 7.0 and copyright to 96 * * Revision 6.2  1995/11/01  00:56:58  sar * removed no_pp stuff * * Revision 6.1  1995/10/20  22:50:18  sar * twiddled no_pp stuff * * Revision 6.0  1995/05/31  21:50:14  sra * Release 6.0. * * Revision 5.1  1994/09/29  18:33:21  sar * Only include & use v2 types if necessary (v2 or use_v2_types installed). * * Revision 5.0  1994/05/16  15:57:40  sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.1  1993/10/05  17:10:56  sar *  Modified printing of an empty object id, we now print that the object * is empty previously we returned an uninited string. * Fixed the call to BitStringGet in print bit string. * * Revision 4.0  1993/06/24  17:14:56  sar * Updated rev to 4.0 and copyright to 93 * * Revision 3.9  1993/06/09  16:14:09  dab * missing ; in NO_PP section * * Revision 3.8  1993/06/02  23:10:22  dab * Changed #ifdef's to #if's for things from install.h * * Revision 3.7  1993/05/20  20:34:22  sar * tidied up some fprintf commands. * * Revision 3.6  1993/05/14  19:01:01  sar * Use ALENGTH_T in calls to printable to avoid some conversion * warnings. * * Revision 3.5  1993/04/26  20:30:09  sar * Added ifdefs (and corrected code) to allow clean makes of version 1 or 2 * * Revision 3.4  1993/03/03  20:03:53  dab * Don't need to undef __() * * Revision 3.3  1993/02/17  21:18:34  sar * Added VT_UINTEGER32 (new data type) and VT_NOSUCHOBJ, VT_NOSUCHINS and * VTENDOFMIB (new exception types in print_vb. * * Revision 3.1  92/06/16  16:05:38  dab * Added batch mode *  * Revision 3.0  92/04/03  17:51:43  dab * Release 3.0 *  * Revision 2.107  91/12/12  09:40:45  dab * checked in with -k by dab at 92.04.03.17.47.49. *  * Revision 2.107  91/12/12  09:40:45  dab * Changed to use "nprint.h" instead of <print.h>. *  * Revision 2.106  91/12/10  10:48:38  dab * Split print_vblist() into print_vblist() and print_vb() and made * print_vb() extern. *  * Revision 2.105  91/11/06  13:55:03  dab * Added function prototypes for internal functions and other fixups so * pickier compilers would be happy. *  * Revision 2.104  91/11/05  10:04:39  dab * Fixed printable() to allow \r, \n, and \t. *  * Revision 2.103  91/11/04  16:15:22  dab * Improved to compile with higher warning levels on the compiler. *  * Revision 2.102  91/09/30  12:59:02  dab * Added time scaling. *  * Revision 2.101  91/09/12  13:56:12  dab * Removed reference to <libfuncs.h>. *  * Revision 2.100  91/08/09  14:05:20  dab * Update version number.  This is just before the work to upgrade to * release 3.0. *  * Revision 1.1  91/07/11  18:13:27  romkey * Initial revision *  *  *    Rev 2.0   31 Mar 1990 15:06:52 * Release 2.00 *  *    Rev 1.4   23 Aug 1989 23:42:00 * Corrected printf format strings to match data types in VB list. *  *    Rev 1.3   27 Apr 1989 15:56:04 * Removed unused variables *  *    Rev 1.2   19 Sep 1988 17:26:40 * Made changes to make the Sun C compiler happy. *  *    Rev 1.1   14 Sep 1988 17:57:18 * Moved includes of system include files into libfuncs.h. *  *    Rev 1.0   12 Sep 1988 10:47:04 * Initial revision.*//* [clearcase]modification history-------------------01c,10may05,job  update output buffer to show complete instances01b,19apr05,job  update copyright notices01a,25mar05,job  alternate display code*/#include <wrn/wm/common/config.h>#include <snmptalk.h>#include <stdio.h>#include <wrn/wm/snmp/engine/asn1conf.h>#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/localio.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/decode.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/objectid.h>#include <wrn/wm/snmp/engine/ui64.h>#include <wrn/wm/demo/snarklib.h>#include "mibutils.h"#include "nprint.h"#include <wrn/wm/common/glue.h>extern int batch_mode;extern int alt_display;static void scale_time        (unsigned long, char *, int);static void print_obj_id_list (struct sty *, int obj_cnt, OIDC_T *objp);static void print_obj_id      (struct sty *, OBJ_ID_T * objp);static void print_obj_int     (struct sty *, OBJ_ID_T * objp, long val);static int printable          (char *s, ALENGTH_T len);static void print_ebuffer     (struct sty *, EBUFFER_T *ebp);static void print_ipaddress   (struct sty *, unsigned char * ipa);/****************************************************************************This module contains various utility routines that print things****************************************************************************/struct scale {    int multiplier;    char *singular;    char *plural;};static struct scale times[] = {    { 1, "%ld ms", "%ld ms" },    { 1000, "%ld sec", "%ld secs" },    { 60, "%ld min", "%ld mins" },    { 60, "%ld hr", "%ld hrs" },    { 24, "%ld day", "%ld days" },    { 7, "%ld week", "%ld weeks" },    { 0, 0, 0 }};static void  scale_time(unsigned long  time_val,                      char *buf,                      int   buflen){    struct scale *scale_point;    unsigned long stime;    unsigned long ptime;    ptime = 0;    for (scale_point = times; scale_point->multiplier != 0; scale_point++) {        stime = time_val / scale_point->multiplier;        if (stime == 0)          break;        ptime = time_val % scale_point->multiplier;        time_val = stime;    }    if (time_val != 0)      scale_point--;    sprintf(buf, time_val == 1 ? scale_point->singular : scale_point->plural,            time_val);    if (ptime != 0) {        scale_point--;        buf += STRLEN(buf);        *buf++ = ' ';        sprintf(buf, ptime == 1 ? scale_point->singular : scale_point->plural,                ptime);    }}static void  print_obj_id_list(struct sty    *sty, 		           int     obj_cnt,                           OIDC_T *objp){    char pbuf[160], *ptr;    char print_dot = 0;        if (obj_cnt == 0) {        sty_puts(sty, "<empty object id>");        return;        }    if (batch_mode)      while (obj_cnt--) {        sty_printf(sty, "%s%lu", print_dot ? "." : "", (unsigned long)*objp++);        print_dot = 1;      }    else {      oid2string(objp, obj_cnt, pbuf, sizeof(pbuf), 0);      if (alt_display)	  {	  	ptr = pbuf;		while (*ptr != '.' && *ptr != NULL) ptr++;		if (*ptr == NULL)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -