📄 agent.c
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/unxagent/agent.c,v 1.3 2003/01/15 14:04:58 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 1988-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//**********************************************************************//* *//* Simple SNMP agent *//* *//**********************************************************************//* * $Log: agent.c,v $ * Revision 1.3 2003/01/15 14:04:58 josh * directory structure shifting * * Revision 1.2 2001/11/09 21:48:58 josh * unxagent demo path adjustment, first pass * * Revision 1.1.1.1 2001/11/05 17:49:15 tneale * Tornado shuffle * * Revision 7.9 2001/06/25 19:38:28 markadam * Added an include of install.h to pick up INSTALL_on_solaris. * * Revision 7.8 2001/06/25 17:06:45 josh * Let's make snark/unxagent build on Solaris * * Revision 7.7 2001/01/19 22:24:57 paul * Update copyright. * * Revision 7.6 2000/03/17 00:14:54 meister * Update copyright message * * Revision 7.5 1998/02/25 15:22:00 sra * Finish moving types.h, bug.h, and bugdef.h to common/h/. * * Revision 7.4 1998/02/25 04:58:10 sra * Update copyrights. * * Revision 7.3 1997/03/20 06:54:18 sra * DFARS-safe copyright text. Zap! * * Revision 7.2 1997/02/25 10:58:16 sra * Update copyright notice, dust under the bed. * * Revision 7.1 1997/01/08 22:46:52 sar * Updated copyright and changed include files to use envoy/h where * appropriate * * Revision 7.0 1996/03/15 21:57:35 sar * Updated revision to 7.0 and copyright to 96 * * Revision 6.1 1995/11/01 01:01:02 sar * Added pp style argument lists and removed no_pp style stuff * * Revision 6.0 1995/05/31 21:49:32 sra * Release 6.0. * * Revision 5.0 1994/05/16 16:38:15 sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.0 1993/06/24 17:20:50 sar * Updated rev to 4.0 and copyright to 93 * * Revision 3.2 1993/06/13 02:51:33 sar * removed a then definition, and made the extern defs use the * __() macro. * * Revision 3.1 1993/05/13 22:01:10 sar * added some defines and some includes <sysent.h> to get rid of warnings. * * Revision 3.0 1992/04/03 19:53:41 dab * Release 3.0 * * Revision 2.100 92/02/03 16:42:23 dab * version with 2.0 release. * * * Rev 2.0 31 Mar 1990 15:19:50 * Initial revision.*//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*/#include <stdio.h>#include <strings.h>#include <wrn/wm/common/types.h>#include <wrn/wm/common/install.h>/* These are extracted from libc, can't include libc as it conflicts with getopt */extern void exit __((int));extern int atoi __((char *));#include "agent.h"extern int errno;char usage[] = "Usage: agent [-p port] [-c config-file] [-T trace-level]\n";/* Stuff for getopt() */extern char * optarg;extern int optint, opterr;#if !INSTALL_on_solarisextern char getopt(int, char **, char *);#endifint main(int argc, char **argv){int portnum;char c;portnum = AGENT_UDP_PORT;trace_level = 0;opterr = 0; /* Keep getopt quiet */while ((c = getopt(argc, argv, "p:c:T:")) != (char)-1) { switch(c) { case 'c': /* configuration file name */ strncpy(config_file, optarg, MAX_CONFIG_FILE - 1); break; case 'p': /* port number */ portnum = atoi(optarg); break; case 'T': /* Tracing level */ trace_level = atoi(optarg); break; case '?': /* Unknown */ default: printf(usage); exit(1); } }/* Give the agent-specific code a chance to initialize */if (agent_init(portnum, argv[0]) == -1) { printf("Can not initialize -- ABORTING\n"); exit(1); }/* call into the agent-specific body */(void) agent_body(portnum, argv[0]);return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -