version 1.19, 2016/01/12 23:01:23 |
version 1.20, 2016/01/13 22:47:45 |
|
|
{ |
{ |
char buf[INT_STRLEN_BOUND(pos) + 2]; |
char buf[INT_STRLEN_BOUND(pos) + 2]; |
|
|
postoa(pos, buf, sizeof buf); |
postoa(pos, buf, sizeof(buf)); |
ap_str(buf); |
ap_str(buf); |
} |
} |
|
|
/* |
/* |
* Append a line number to the end of the message. |
|
*/ |
|
static void |
|
ap_linenum(off_t linenum) |
|
{ |
|
char buf[INT_STRLEN_BOUND(linenum) + 2]; |
|
|
|
linenumtoa(linenum, buf, sizeof buf); |
|
ap_str(buf); |
|
} |
|
|
|
/* |
|
* Append an integer to the end of the message. |
* Append an integer to the end of the message. |
*/ |
*/ |
static void |
static void |
|
|
case 'd': /* Current page number */ |
case 'd': /* Current page number */ |
linenum = currline(where); |
linenum = currline(where); |
if (linenum > 0 && sc_height > 1) |
if (linenum > 0 && sc_height > 1) |
ap_linenum(PAGE_NUM(linenum)); |
ap_pos(PAGE_NUM(linenum)); |
else |
else |
ap_quest(); |
ap_quest(); |
break; |
break; |
|
|
ap_quest(); |
ap_quest(); |
} else if (len == 0) { |
} else if (len == 0) { |
/* An empty file has no pages. */ |
/* An empty file has no pages. */ |
ap_linenum(0); |
ap_pos(0); |
} else { |
} else { |
linenum = find_linenum(len - 1); |
linenum = find_linenum(len - 1); |
if (linenum <= 0) |
if (linenum <= 0) |
ap_quest(); |
ap_quest(); |
else |
else |
ap_linenum(PAGE_NUM(linenum)); |
ap_pos(PAGE_NUM(linenum)); |
} |
} |
break; |
break; |
case 'E': /* Editor name */ |
case 'E': /* Editor name */ |
|
|
case 'l': /* Current line number */ |
case 'l': /* Current line number */ |
linenum = currline(where); |
linenum = currline(where); |
if (linenum != 0) |
if (linenum != 0) |
ap_linenum(linenum); |
ap_pos(linenum); |
else |
else |
ap_quest(); |
ap_quest(); |
break; |
break; |
|
|
(linenum = find_linenum(len)) <= 0) |
(linenum = find_linenum(len)) <= 0) |
ap_quest(); |
ap_quest(); |
else |
else |
ap_linenum(linenum-1); |
ap_pos(linenum-1); |
break; |
break; |
case 'm': /* Number of files */ |
case 'm': /* Number of files */ |
n = ntags(); |
n = ntags(); |