📄 xtraps.cpp
字号:
/* Copyright (c) 1996 Hewlett-Packard Company ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS. Permission to use, copy, modify, distribute and/or sell this software and/or its documentation is hereby granted without fee. User agrees to display the above copyright notice and this license notice in all copies of the software and any documentation of the software. User agrees to assume all liability for the use of the software; Hewlett-Packard makes no representations about the suitability of this software for any purpose. It is provided "AS-IS without warranty of any kind,either express or implied. User hereby grants a royalty-free license to any and all derivatives based upon this software code base.*/#include <stdio.h>#include <stdlib.h>#ifdef XOPEN_CATALOG#include <locale.h>#endif#include <X11/Intrinsic.h>#include <X11/StringDefs.h>#include <X11/Xlib.h>#include <Xm/Xm.h>#include <snmp_pp.h>#include <eventlist.h>XtAppContext UxAppContext;Widget UxTopLevel;Widget FormHandle;Display *UxDisplay;int UxScreen;Snmp *the_Session; /*----------------------------------------------------------------*/ /* Function prototype for initializer. This is required, because */ /* there is no way for a general interface to determine what app */ /* context to use without explicit statement by the user. */ /*----------------------------------------------------------------*/void snmp_initialize(XtAppContext app_context){ int status; status = SNMPX11Initialize(app_context); the_Session = new Snmp(status); if (status){ fprintf(stderr, "Failed to create Snmp Session:\n %s\n", the_Session->error_msg(status)); delete the_Session; exit(1); }}int main( int argc, char *argv[]){ Widget mainIface; /*--------------------------------- * Interface function declaration *--------------------------------*/ Widget create_form1(Widget); Widget UxParent = NULL; /*--------------------- * Initialize program *--------------------*/#ifdef XOPEN_CATALOG setlocale(LC_ALL,""); if (XSupportsLocale()) { XtSetLanguageProc(NULL,(XtLanguageProc)NULL,NULL); }#endif UxTopLevel = XtAppInitialize(&UxAppContext, "xquery", NULL, 0, &argc, argv, NULL, NULL, 0); snmp_initialize(UxAppContext); UxDisplay = XtDisplay(UxTopLevel); UxScreen = XDefaultScreen(UxDisplay); mainIface = create_form1(UxTopLevel); FormHandle = mainIface; XtPopup(mainIface, XtGrabNone); /*----------------------- * Enter the event loop *----------------------*/ XtAppMainLoop (UxAppContext); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -