SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-75
SNMPSET
case 'x':
/* Get the value passed to SNMP_WriteRead_ */
debug_level = strtol(*argv, (char **)NULL, 0);
argv++,argc--;
break;
default:
fprintf(stdout, usage, whoami);
exit(0);
} /* switch */
} /* while */
if (argc < 3)
{
fprintf(stdout, usage, whoami);
exit(0);
}
hostname = *argv++; argc--;
for (i = 0; argc > 0; i++)
{
if (i == MAXOIDS)
{
fprintf(stdout, "Exceeded %d object identifiers\n", MAXOIDS);
exit(0);
}
if ((longform && argc < 3) || argc < 2)
{
fprintf(stderr, usage, whoami);
exit(0);
}
oidstr[i] = *argv++; argc--;
if (longform) <--4
{
typestr[i] = *argv++; argc--;
}
valstr[i] = *argv++; argc--;
}
oidcnt = i;
opt2 = SNMP_Init_(&host_int, sizeof(host_int), hostname); <--5
switch (opt2)
Example 2-9. Contents of snmpsetc (page 4 of 9)