summaryrefslogtreecommitdiffstats
path: root/hdrline.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-01-05 11:26:35 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-01-05 11:26:35 +0000
commitf8b9a3ac7dc51643780fcf402e1bd117377aa11b (patch)
treefea69c0e819e0368f63d394306760fef7f294860 /hdrline.c
parent4d6b5611ef0211369f3011e357d65573cf5ea73b (diff)
[unstable] merging changes from stable.
Diffstat (limited to 'hdrline.c')
-rw-r--r--hdrline.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/hdrline.c b/hdrline.c
index 97c833bc..c41c30f4 100644
--- a/hdrline.c
+++ b/hdrline.c
@@ -414,8 +414,16 @@ hdr_format_str (char *dest,
break;
case 'l':
- snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
- snprintf (dest, destlen, fmt, (int) hdr->lines);
+ if (!optional)
+ {
+ snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
+ snprintf (dest, destlen, fmt, (int) hdr->lines);
+ }
+ else
+ {
+ if (hdr->lines > 0)
+ optional = 0;
+ }
break;
case 'L':
@@ -448,8 +456,16 @@ hdr_format_str (char *dest,
break;
case 'N':
- snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
- snprintf (dest, destlen, fmt, hdr->score);
+ if (!optional)
+ {
+ snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
+ snprintf (dest, destlen, fmt, hdr->score);
+ }
+ else
+ {
+ if (hdr->score > 0)
+ optional = 0;
+ }
break;
case 'O':