- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: help in C
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 09:44 AM
тАО03-24-2009 09:44 AM
Re: help in C
(the part marked with ^^^)
char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 \"D\" \"msg\"";
^^^
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 10:03 AM
тАО03-24-2009 10:03 AM
Re: help in C
#include
#include
main()
{
char *cmd ="write sys$output msg";
printf( " cmd: >%s<.\n", cmd);
}
SUNNY2$ xx :== $sys$login:x.exe
SUNNY2$ xx
cmd: >write sys$output msg<.
I want to be able to do this
main( argument)
{
char *cmd ="write sys$output
}
SUNNY2$ xx :== $sys$login:x.exe
SUNNY2$ xx "test msg"
cmd: >write sys$output test msg<.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 10:31 AM
тАО03-24-2009 10:31 AM
Re: help in C
#include
#include
int main(int argc, char *argv[])
{
int sts;
char msg;
char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 \"D\" \"*msg\"";
printf("program: %s\n",argv[1]);
/* printf( " cmd: >%s<.\n", cmd); */
sts = system( cmd);
printf( " sts = %%x%08x.\n", sts);
}
SUNNY2$ sndsnmp testing
program: testing
sts = %x00000001.
but I cant replace the 'msg' with the argument passed .. any ideas ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 10:42 AM
тАО03-24-2009 10:42 AM
Re: help in C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 10:45 AM
тАО03-24-2009 10:45 AM
Re: help in C
char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 \"D\" \"*msg\"";
^^^^
how can i do this by sprintf ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 11:05 AM
тАО03-24-2009 11:05 AM
Re: help in C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 11:10 AM
тАО03-24-2009 11:10 AM
Re: help in C
tsprintf.c:
#include stdio
int main(int argc, char *argv[]) {
char cmd[256];
sprintf(cmd,"mcr sys$system:tcpip$snmp_trapsnd.exe"\
" 0.0 local 0 0 0 -h %s v2c"\
"1.3.6.1.6.3.1.1.4.1.0 \"D\" \"*msg\"",argv[1]);
printf(" %s\n",cmd); /show result*/
}
Test the program:
$ mcr []tsprintf 10.1.222.1
mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.1.222.1 v2c1.3.6.1.
6.3.1.1.4.1.0 "D" "*msg"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 11:38 AM
тАО03-24-2009 11:38 AM
Re: help in C
> Sami, do You mean something like this ?
Probably more like this:
alp $ type snmp2.c
#include
#include
int main( int argc, char **argv)
{
int sts;
char cmd[ 1024];
sprintf( cmd, "mcr tcpip$snmp_trapsnd.exe\
1.3.6.1.6.3.1.1.4.1.0 local 0 0 0 -v2c -h 10.100.10.112 \"D\" \"%s\"",
argv[ 1]);
printf( " cmd: >%s<.\n", cmd);
sts = system( cmd);
printf( " sts = %%x%08x.\n", sts);
}
alp $ cc snmp2
alp $ link snmp2
alp $ mcr []snmp2 "my message text"
cmd: >mcr tcpip$snmp_trapsnd.exe 1.3.6.1.6.3.1.1.4.1.0 local 0 0 0 -v2c -h 10.1
00.10.112 "D" "my message text"<.
Invalid variable name OID syntax: D
Invalid variable list.
#snmp_trapsnd enterprise agent-address generic specific timeticks
[-v version] [-c community] [-h host] [-p port] [-tcp] {variable [type value]}
sts = %x00000001.
alp $
Looks as if the command itself may need a
little work.
The 'D' must be '"D"' to keep it upper-case
when snmp_trapsnd sees it.
Note that no one is checking to see if you
really have a command-line argument (argc >
1), so it'll behave badly if you don't
specify one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 12:21 PM
тАО03-24-2009 12:21 PM
Re: help in C
marked 10.100.18.245 by ^^^^, so I assumed this IP address should be the variable argument.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 09:06 PM
тАО03-24-2009 09:06 PM
Re: help in C
Cut and paste into (for example notepad), and you will see.
But what does this whole topic have to do with VMS?
Sami, if you need to learn C, this isn't the place to learn.
See Hoff's response to your question about snmp traps.
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1325393
- « Previous
-
- 1
- 2
- Next »