SNMP Subagent Programmer's Guide
Programming Tutorials
SNMP Subagent Programmer’s Guide—119728 2-41
Static Directory Program
Example 2-8. Static Directory Include File dirC (page 1 of 3)
#include "tdmporth"
#include "machtypH"
#include "syspubH"
#include "dirH"
#include <tal.h> <--
12
#include <cextdecs(FILENAME_FINDSTART_, FILENAME_FINDNEXT_, \
FILENAME_FINDFINISH_)>
/*Local prototypes */
static int cmp(char *x,
char *y,
int l);
static struct file_entry *insert_new_file(struct file_entry *file_list,
struct file_entry *file);
...
/*****************************************************************************
* comp_files Lexically compare two DisplayString <--
13
* variables.
****************************************************************************/
static int
cmp(char *x,
char *y,
int l)
{
while (l--)
{
if (*x == *y)
{
x++;
y++;
}
else if (*x > * y)
{p
return(1);
}
else
{
return(-1);
}
}
return(0);
}
int
comp_files(DisplayString *f1,
DisplayString *f2)
{
if (f1->len != f2->len)
{
return((f1->len > f2->len)? 1 : -1);
}
return(cmp((char *)f1->val, (char *)f2->val, f1->len));
}