Commit 387e52d6 authored by rswindell's avatar rswindell
Browse files

Introduce @-code modifier: -Z# for zero-padding expanded @-codes

(Nelgin's idea), so for exmample, @node-z3@ would display "001" for node #1
and "011" for node #11.
parent 7f363ffa
......@@ -54,6 +54,7 @@ int sbbs_t::show_atcode(const char *instr)
bool padded_left=false;
bool padded_right=false;
bool centered=false;
bool zero_padded=false;
const char *cp;
SAFECOPY(str,instr);
......@@ -74,6 +75,8 @@ int sbbs_t::show_atcode(const char *instr)
padded_right=true;
else if((p=strstr(sp,"-C"))!=NULL)
centered=true;
else if((p=strstr(sp,"-Z"))!=NULL)
zero_padded=true;
if(p!=NULL) {
if(*(p+2) && isdigit(*(p+2)))
disp_len=atoi(p+2);
......@@ -95,6 +98,8 @@ int sbbs_t::show_atcode(const char *instr)
bprintf("%*s%-*s", left, "", disp_len - left, cp);
} else
bputs(cp);
} else if(zero_padded) {
bprintf("%-.*s%s", disp_len - strlen(cp), "0000000000", cp);
} else
bputs(cp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment