Subversion Repositories Keine

Rev

Rev 7 | Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 9
Line 1... Line 1...
1
/* $Id: man.c 7 2024-09-11 15:46:04Z nishi $ */
1
/* $Id: man.c 9 2024-09-11 15:58:08Z nishi $ */
2
 
2
 
3
#include "../config.h"
3
#include "../config.h"
4
 
4
 
5
#include "kn_man.h"
5
#include "kn_man.h"
6
 
6
 
Line 61... Line 61...
61
	free(pth);
61
	free(pth);
62
#endif
62
#endif
63
	return true;
63
	return true;
64
}
64
}
65
 
65
 
-
 
66
#define HTML(buf) (buf[0] == '<' ? "&lt;" : (buf[0] == '>' ? "&gt;" : (buf[0] == '&' ? "&amp;" : buf)))
-
 
67
 
66
char* kn_manpage_process(const char* path) {
68
char* kn_manpage_process(const char* path) {
67
	char* b = malloc(1);
69
	char* b = malloc(1);
68
	b[0] = 0;
70
	b[0] = 0;
69
	int pipes[2];
71
	int pipes[2];
70
	char cbuf[2];
72
	char cbuf[2];
Line 105... Line 107...
105
								free(tmp);
107
								free(tmp);
106
							}
108
							}
107
							m = 0;
109
							m = 0;
108
							cbuf[0] = s;
110
							cbuf[0] = s;
109
							tmp = b;
111
							tmp = b;
110
							b = kn_strcat(b, cbuf);
112
							b = kn_strcat(b, HTML(cbuf));
111
							free(tmp);
113
							free(tmp);
112
						} else {
114
						} else {
113
							if(old == s) {
115
							if(old == s) {
114
								cbuf[0] = s;
116
								cbuf[0] = s;
115
								char* tmp;
117
								char* tmp;
Line 123... Line 125...
123
									b = kn_strcat(b, "<b>");
125
									b = kn_strcat(b, "<b>");
124
									free(tmp);
126
									free(tmp);
125
								}
127
								}
126
								m = 'B';
128
								m = 'B';
127
								tmp = b;
129
								tmp = b;
128
								b = kn_strcat(b, cbuf);
130
								b = kn_strcat(b, HTML(cbuf));
129
								free(tmp);
131
								free(tmp);
130
							} else if(old == '_') {
132
							} else if(old == '_') {
131
								cbuf[0] = s;
133
								cbuf[0] = s;
132
								char* tmp;
134
								char* tmp;
133
								if(m == 'B') {
135
								if(m == 'B') {
Line 139... Line 141...
139
									tmp = b;
141
									tmp = b;
140
									b = kn_strcat(b, "<u>");
142
									b = kn_strcat(b, "<u>");
141
									free(tmp);
143
									free(tmp);
142
								}
144
								}
143
								tmp = b;
145
								tmp = b;
144
								b = kn_strcat(b, cbuf);
146
								b = kn_strcat(b, HTML(cbuf));
145
								free(tmp);
147
								free(tmp);
146
								tmp = b;
148
								tmp = b;
147
								b = kn_strcat(b, "</u>");
149
								b = kn_strcat(b, "</u>");
148
								free(tmp);
150
								free(tmp);
149
							}
151
							}