extern void safeputchar(int);
extern void safeputs(const char *, int);
+#define PLURAL_SUFFIX(n) \
+ (((n) != 1) ? "s" : "")
+
#if 0
extern const char *isonsap_string(netdissect_options *, const u_char *);
extern const char *protoid_string(netdissect_options *, const u_char *);
tok2str(cdp_tlv_values,"unknown field type", type),
type,
len,
- len>1 ? "s" : ""); /* plural */
+ PLURAL_SUFFIX(len)); /* plural */
switch (type) {
lsap = op->ospf_lsu.lsu_lsa;
TCHECK(op->ospf_lsu.lsu_count);
lsa_count_max = EXTRACT_32BITS(&op->ospf_lsu.lsu_count);
- printf(", %d LSA%s",lsa_count_max, lsa_count_max > 1 ? "s" : "");
+ printf(", %d LSA%s",lsa_count_max, PLURAL_SUFFIX(lsa_count_max));
for (lsa_count=1;lsa_count <= lsa_count_max;lsa_count++) {
printf("\n\t LSA #%u",lsa_count);
lsap = (const struct lsa *)ospf_print_lsa(lsap);
if (!verbose)
fprintf(stderr, "%s: ", program_name);
- (void)fprintf(stderr, "%u packets captured", packets_captured);
+ (void)fprintf(stderr, "%u packet%s captured", packets_captured,
+ PLURAL_SUFFIX(packets_captured));
if (!verbose)
fputs(", ", stderr);
else
putc('\n', stderr);
- (void)fprintf(stderr, "%u packets received by filter", stat.ps_recv);
+ (void)fprintf(stderr, "%u packet%s received by filter", stat.ps_recv,
+ PLURAL_SUFFIX(stat.ps_recv));
if (!verbose)
fputs(", ", stderr);
else
putc('\n', stderr);
- (void)fprintf(stderr, "%u packets dropped by kernel", stat.ps_drop);
+ (void)fprintf(stderr, "%u packet%s dropped by kernel", stat.ps_drop,
+ PLURAL_SUFFIX(stat.ps_drop));
if (stat.ps_ifdrop != 0) {
if (!verbose)
fputs(", ", stderr);
else
putc('\n', stderr);
- (void)fprintf(stderr, "%u packets dropped by interface\n",
- stat.ps_ifdrop);
+ (void)fprintf(stderr, "%u packet%s dropped by interface\n",
+ stat.ps_ifdrop, PLURAL_SUFFIX(stat.ps_ifdrop));
} else
putc('\n', stderr);
infoprint = 0;