File src/manual.cxx changed (mode: 100644) (index 7de1868..509f826) |
... |
... |
using std::string; |
26 |
26 |
#include <vector> |
#include <vector> |
27 |
27 |
using std::vector; |
using std::vector; |
28 |
28 |
#include <algorithm> // for std::sort and std::find |
#include <algorithm> // for std::sort and std::find |
29 |
|
#include <cctype> |
|
|
29 |
|
#include <cctype> // for tolower, isspace, isalpha, isdigit |
30 |
30 |
|
|
31 |
31 |
#include <sys/stat.h> |
#include <sys/stat.h> |
32 |
32 |
|
|
|
... |
... |
set_initial_history(string name) |
193 |
193 |
{ |
{ |
194 |
194 |
/* filter trailing spaces */ |
/* filter trailing spaces */ |
195 |
195 |
string::size_type len; |
string::size_type len; |
196 |
|
for (len = name.length(); (len > 0) && isspace(name[len - 1]); len--); |
|
|
196 |
|
for (len = name.length(); (len > 0) && std::isspace(name[len - 1]); len--); |
197 |
197 |
name.resize(len); |
name.resize(len); |
198 |
198 |
|
|
199 |
199 |
/* find the beginning of the last token */ |
/* find the beginning of the last token */ |
200 |
200 |
string::size_type i; |
string::size_type i; |
201 |
|
for (i = len - 1; (i > 0) && !isspace(name[i]); i--); |
|
|
201 |
|
for (i = len - 1; (i > 0) && !std::isspace(name[i]); i--); |
202 |
202 |
|
|
203 |
203 |
/* if we've found space, then we move to the first nonspace character */ |
/* if we've found space, then we move to the first nonspace character */ |
204 |
|
if ( (i > 0) || (i == 0 && isspace(name[i])) ) { |
|
|
204 |
|
if ( (i > 0) || (i == 0 && std::isspace(name[i])) ) { |
205 |
205 |
i++; |
i++; |
206 |
206 |
} |
} |
207 |
207 |
|
|
|
... |
... |
construct_manualname(string& buf, int which) |
236 |
236 |
buf.resize(buf.length() - 2); |
buf.resize(buf.length() - 2); |
237 |
237 |
/* Find tail with decent characters */ |
/* Find tail with decent characters */ |
238 |
238 |
idx = buf.length() - 1; |
idx = buf.length() - 1; |
239 |
|
while ( ( (isalpha(buf[idx])) |
|
|
239 |
|
while ( ( (std::isalpha(buf[idx])) |
240 |
240 |
|| (buf[idx] == '.') |
|| (buf[idx] == '.') |
241 |
241 |
|| (buf[idx] == '_') |
|| (buf[idx] == '_') |
242 |
242 |
) |
) |
|
... |
... |
construct_manualname(string& buf, int which) |
265 |
265 |
|
|
266 |
266 |
/* skip whitespace */ |
/* skip whitespace */ |
267 |
267 |
string::size_type idx = 0; |
string::size_type idx = 0; |
268 |
|
while (isspace(tmpstr[idx])) |
|
|
268 |
|
while (std::isspace(tmpstr[idx])) |
269 |
269 |
idx++; |
idx++; |
270 |
270 |
tmpstr.erase(0, idx); |
tmpstr.erase(0, idx); |
271 |
271 |
|
|
|
... |
... |
man_initializelinks(const string& line, int line_num, int carry) |
385 |
385 |
if (i < 0) |
if (i < 0) |
386 |
386 |
i++; |
i++; |
387 |
387 |
for (; i > 0; i--) { |
for (; i > 0; i--) { |
388 |
|
if (!isspace(line[i])) |
|
|
388 |
|
if (!std::isspace(line[i])) |
389 |
389 |
/* ignore spaces between linkname and '(x)' */ |
/* ignore spaces between linkname and '(x)' */ |
390 |
390 |
break; |
break; |
391 |
391 |
} |
} |
|
... |
... |
man_initializelinks(const string& line, int line_num, int carry) |
398 |
398 |
* the beginning of the scanned token |
* the beginning of the scanned token |
399 |
399 |
*/ |
*/ |
400 |
400 |
for (i = prebreak.size() - 1; i > 0; i--) { |
for (i = prebreak.size() - 1; i > 0; i--) { |
401 |
|
if (isspace(prebreak[i])) { |
|
|
401 |
|
if (std::isspace(prebreak[i])) { |
402 |
402 |
i++; |
i++; |
403 |
403 |
break; |
break; |
404 |
404 |
} |
} |
405 |
405 |
} |
} |
406 |
|
if ((i == 0) && isspace(prebreak[i])) { |
|
|
406 |
|
if ((i == 0) && std::isspace(prebreak[i])) { |
407 |
407 |
i++; |
i++; |
408 |
408 |
} |
} |
409 |
409 |
|
|
|
... |
... |
man_initializelinks(const string& line, int line_num, int carry) |
440 |
440 |
my_link.section = ""; |
my_link.section = ""; |
441 |
441 |
for (string::size_type b = left_bracket_index + 1; |
for (string::size_type b = left_bracket_index + 1; |
442 |
442 |
line[b] != ')'; b++) { |
line[b] != ')'; b++) { |
443 |
|
my_link.section += tolower(line[b]); |
|
|
443 |
|
my_link.section += std::tolower(line[b]); |
444 |
444 |
} |
} |
445 |
445 |
} else { |
} else { |
446 |
446 |
/* Short manual links */ |
/* Short manual links */ |
|
... |
... |
man_initializelinks(const string& line, int line_num, int carry) |
454 |
454 |
int b; |
int b; |
455 |
455 |
for (b = i - 1; b >= 0; b--) { |
for (b = i - 1; b >= 0; b--) { |
456 |
456 |
if (b > 0) |
if (b > 0) |
457 |
|
if (!isspace(line[b])) |
|
|
457 |
|
if (!std::isspace(line[b])) |
458 |
458 |
break; |
break; |
459 |
459 |
} |
} |
460 |
460 |
if (b >= 0) |
if (b >= 0) |
|
... |
... |
add_highlights() |
600 |
600 |
* positon link_begin to the beginning of the link to be |
* positon link_begin to the beginning of the link to be |
601 |
601 |
* highlighted |
* highlighted |
602 |
602 |
*/ |
*/ |
603 |
|
while ( isalpha(tmp_string[link_begin]) |
|
|
603 |
|
while ( std::isalpha(tmp_string[link_begin]) |
604 |
604 |
|| (tmp_string[link_begin] == '.') |
|| (tmp_string[link_begin] == '.') |
605 |
605 |
|| (tmp_string[link_begin] == '_') |
|| (tmp_string[link_begin] == '_') |
606 |
606 |
) { |
) { |
|
... |
... |
add_highlights() |
645 |
645 |
strip_manual(tmp_string); |
strip_manual(tmp_string); |
646 |
646 |
/* skip spaces */ |
/* skip spaces */ |
647 |
647 |
string::size_type wsk_idx = 0; |
string::size_type wsk_idx = 0; |
648 |
|
while (isspace(tmp_string[wsk_idx])) |
|
|
648 |
|
while (std::isspace(tmp_string[wsk_idx])) |
649 |
649 |
wsk_idx++; |
wsk_idx++; |
650 |
650 |
|
|
651 |
651 |
/* find the end of url */ |
/* find the end of url */ |
|
... |
... |
manualwork() |
971 |
971 |
bool digit_val = true; |
bool digit_val = true; |
972 |
972 |
for (int i = 0; i < token_string.length(); i++) |
for (int i = 0; i < token_string.length(); i++) |
973 |
973 |
{ |
{ |
974 |
|
if (!isdigit(token_string[i])) |
|
|
974 |
|
if (!std::isdigit(token_string[i])) |
975 |
975 |
digit_val = false; |
digit_val = false; |
976 |
976 |
} |
} |
977 |
977 |
/* move cursor position */ |
/* move cursor position */ |
File src/parse_config.cxx changed (mode: 100644) (index 8fdcccb..94804a5) |
25 |
25 |
using std::string; |
using std::string; |
26 |
26 |
#include <vector> |
#include <vector> |
27 |
27 |
using std::vector; |
using std::vector; |
28 |
|
#include <cctype> |
|
|
28 |
|
#include <cctype> // for tolower, isupper, isdigit |
29 |
29 |
|
|
30 |
30 |
#include "colors.h" |
#include "colors.h" |
31 |
31 |
#include "datatypes.h" |
#include "datatypes.h" |
|
... |
... |
static char * |
105 |
105 |
str_toupper(char *str) |
str_toupper(char *str) |
106 |
106 |
{ |
{ |
107 |
107 |
for (unsigned int i = 0; i < strlen(str); ++i) |
for (unsigned int i = 0; i < strlen(str); ++i) |
108 |
|
if (islower(str[i])) |
|
109 |
|
str[i] = toupper(str[i]); |
|
|
108 |
|
if (std::islower(str[i])) |
|
109 |
|
str[i] = std::toupper(str[i]); |
110 |
110 |
|
|
111 |
111 |
return str; |
return str; |
112 |
112 |
} |
} |
|
... |
... |
parse_line(char *line) |
827 |
827 |
{ |
{ |
828 |
828 |
if (temp[1] == '\'') |
if (temp[1] == '\'') |
829 |
829 |
*key = KEY_CTRL(temp[2]); |
*key = KEY_CTRL(temp[2]); |
830 |
|
else if (isdigit(temp[1])) |
|
|
830 |
|
else if (std::isdigit(temp[1])) |
831 |
831 |
{ |
{ |
832 |
832 |
char *tail = temp +(strlen(temp)); |
char *tail = temp +(strlen(temp)); |
833 |
833 |
*key = KEY_CTRL((int) strtol(temp + 1, &tail, 10)); |
*key = KEY_CTRL((int) strtol(temp + 1, &tail, 10)); |
|
... |
... |
parse_line(char *line) |
845 |
845 |
if (temp[0] == '(') |
if (temp[0] == '(') |
846 |
846 |
{ |
{ |
847 |
847 |
if (temp[1] == '\'') |
if (temp[1] == '\'') |
848 |
|
*key = KEY_ALT(tolower(temp[2])); |
|
849 |
|
else if (isdigit(temp[1])) |
|
|
848 |
|
*key = KEY_ALT(std::tolower(temp[2])); |
|
849 |
|
else if (std::isdigit(temp[1])) |
850 |
850 |
{ |
{ |
851 |
851 |
char *tail = temp +(strlen(temp)); |
char *tail = temp +(strlen(temp)); |
852 |
852 |
*key = KEY_ALT((int) strtol(temp + 1, &tail, 10)); |
*key = KEY_ALT((int) strtol(temp + 1, &tail, 10)); |
|
... |
... |
parse_line(char *line) |
880 |
880 |
*key = temp[1]; |
*key = temp[1]; |
881 |
881 |
} |
} |
882 |
882 |
} |
} |
883 |
|
else if (isdigit(temp[0])) |
|
|
883 |
|
else if (std::isdigit(temp[0])) |
884 |
884 |
{ |
{ |
885 |
885 |
char *tail = temp +(strlen(temp)); |
char *tail = temp +(strlen(temp)); |
886 |
886 |
*key =(int) strtol(temp, &tail, 10); |
*key =(int) strtol(temp, &tail, 10); |
File src/utils.cxx changed (mode: 100644) (index 94eaa1c..b136d5d) |
... |
... |
using std::string; |
28 |
28 |
using std::vector; |
using std::vector; |
29 |
29 |
#include <utility> // for std::pair |
#include <utility> // for std::pair |
30 |
30 |
#include <algorithm> // for std::equal_range |
#include <algorithm> // for std::equal_range |
|
31 |
|
#include <cctype> // for islower, toupper, isspace |
31 |
32 |
|
|
32 |
33 |
#include "datatypes.h" // for TagTable |
#include "datatypes.h" // for TagTable |
33 |
34 |
|
|
|
... |
... |
checkfilename(const string filename) |
51 |
52 |
(filename.find('&') != string::npos) || |
(filename.find('&') != string::npos) || |
52 |
53 |
(filename.find(';') != string::npos) |
(filename.find(';') != string::npos) |
53 |
54 |
) { |
) { |
54 |
|
printf(_("Illegal characters in filename!\n*** %s\n"), filename.c_str()); |
|
|
55 |
|
printf(_("Illegal characters in filename!\n*** $s\n"), filename.c_str()); |
55 |
56 |
exit(1); |
exit(1); |
56 |
57 |
} |
} |
57 |
58 |
} |
} |
|
... |
... |
compare_tag_table_string(const char *base, const char *compared) |
66 |
67 |
int j = 0; |
int j = 0; |
67 |
68 |
while (base[i] != '\0') { |
while (base[i] != '\0') { |
68 |
69 |
if (base[i] != compared[j]) { |
if (base[i] != compared[j]) { |
69 |
|
if (isspace(compared[j]) && isspace(base[i])) { |
|
|
70 |
|
if (std::isspace(compared[j]) && std::isspace(base[i])) { |
70 |
71 |
/* OK--two blanks */ |
/* OK--two blanks */ |
71 |
72 |
j++; |
j++; |
72 |
73 |
i++; |
i++; |
73 |
|
} else if (isspace(compared[j])) { |
|
|
74 |
|
} else if (std::isspace(compared[j])) { |
74 |
75 |
/* index of `base' stands in place |
/* index of `base' stands in place |
75 |
76 |
* and waits for compared to skip blanks */ |
* and waits for compared to skip blanks */ |
76 |
77 |
j++; |
j++; |
77 |
|
} else if (isspace(base[i])) { |
|
|
78 |
|
} else if (std::isspace(base[i])) { |
78 |
79 |
/* index of `compared' stands in place |
/* index of `compared' stands in place |
79 |
80 |
* and waits for base to skip blanks */ |
* and waits for base to skip blanks */ |
80 |
81 |
i++; |
i++; |
|
... |
... |
compare_tag_table_string(const char *base, const char *compared) |
89 |
90 |
} |
} |
90 |
91 |
/* handle trailing whitespaces of variable `compared' */ |
/* handle trailing whitespaces of variable `compared' */ |
91 |
92 |
while (compared[j] != '\0') { |
while (compared[j] != '\0') { |
92 |
|
if (!isspace(compared[j])) |
|
|
93 |
|
if (!std::isspace(compared[j])) |
93 |
94 |
return (int) '\0' - (int) compared[j]; /* Negative, as base is shorter */ |
return (int) '\0' - (int) compared[j]; /* Negative, as base is shorter */ |
94 |
95 |
j++; |
j++; |
95 |
96 |
} |
} |
|
... |
... |
string |
151 |
152 |
string_toupper(string str) |
string_toupper(string str) |
152 |
153 |
{ |
{ |
153 |
154 |
for (string::size_type i = 0; i < str.length(); i++) |
for (string::size_type i = 0; i < str.length(); i++) |
154 |
|
if (islower(str[i])) |
|
155 |
|
str[i] = toupper(str[i]); |
|
|
155 |
|
if (std::islower(str[i])) |
|
156 |
|
str[i] = std::toupper(str[i]); |
156 |
157 |
return str; |
return str; |
157 |
158 |
} |
} |
158 |
159 |
|
|