On Mon, 2004-08-23 at 04:35, Robert Story wrote:
> On Sat, 21 Aug 2004 01:03:21 +0100 Richard wrote:
> RM> I did a bit of investigation on the issue and came up with the following
> RM> patch. It uses the C99 macro SCNuMAX to get the appropriate scan
> RM> specifier for uintmax_t. How does that look?
>
> I hadn't see that macro before. It is just what we need. The only problem is
> that the minimum entry level for compilers has always been ANSI C. I am not
> sure that bumping it up to C99 will go over very well.
>
> Checking a few of the sourceforge compile farms hosts reveal that neither
> FreeBSD or OpenBSD have SCNuMAX defined in <inttypes.h>. So instead of an
> out-and-out replacement, we need to break down and use an ifdef on
> __STDC_FORMAT_MACROS to add the new 64-bit compatabile definitions. That should
> not break ANSI systems, but work for newer systems too.
>
How does this revised patch look?
Richard
--- net-snmp-5.1.1.orig/agent/mibgroup/mibII/interfaces.c 2004-08-24
22:02:58.000000000 +0100
+++ net-snmp-5.1.1/agent/mibgroup/mibII/interfaces.c 2004-08-24
21:56:41.000000000 +0100
@@ -1512,14 +1512,28 @@
struct ifreq ifrq;
struct ifnet **ifnetaddr_ptr;
FILE *devin;
- unsigned long rec_pkt, rec_oct, rec_err, rec_drop;
- unsigned long snd_pkt, snd_oct, snd_err, snd_drop, coll;
int i, fd;
conf_if_list *if_ptr;
+#ifdef __STDC_FORMAT_MACROS
+ uintmax_t rec_pkt, rec_oct, rec_err, rec_drop;
+ uintmax_t snd_pkt, snd_oct, snd_err, snd_drop, coll;
+ const char *scan_line_2_2 =
+ "%" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX
+ " %*" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX
+ " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX;
+ const char *scan_line_2_0 =
+ "%" SCNuMAX " %" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %*" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX;
+#else
+ unsigned long rec_pkt, rec_oct, rec_err, rec_drop;
+ unsigned long snd_pkt, snd_oct, snd_err, snd_drop, coll;
const char *scan_line_2_2 =
"%lu %lu %lu %lu %*lu %*lu %*lu %*lu %lu %lu %lu %lu %*lu %lu";
const char *scan_line_2_0 =
"%lu %lu %*lu %*lu %*lu %lu %lu %*lu %*lu %lu";
+#endif
const char *scan_line_to_use;
struct timeval et; /* elapsed time */
--
[EMAIL PROTECTED]
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders