Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
31b3a2d2
Commit
31b3a2d2
authored
Mar 11, 2009
by
Hisham Muhammad
Browse files
catch nonprintable characters
parent
385a7dbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
RichString.c
View file @
31b3a2d2
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <curses.h>
#include <curses.h>
#include <ctype.h>
#include "debug.h"
#include "debug.h"
#include <assert.h>
#include <assert.h>
...
@@ -89,7 +90,8 @@ int RichString_findChar(RichString *this, char c, int start) {
...
@@ -89,7 +90,8 @@ int RichString_findChar(RichString *this, char c, int start) {
inline
void
RichString_appendn
(
RichString
*
this
,
int
attrs
,
char
*
data_c
,
int
len
)
{
inline
void
RichString_appendn
(
RichString
*
this
,
int
attrs
,
char
*
data_c
,
int
len
)
{
int
last
=
MIN
(
RICHSTRING_MAXLEN
-
1
,
len
+
this
->
len
);
int
last
=
MIN
(
RICHSTRING_MAXLEN
-
1
,
len
+
this
->
len
);
for
(
int
i
=
this
->
len
,
j
=
0
;
i
<
last
;
i
++
,
j
++
)
for
(
int
i
=
this
->
len
,
j
=
0
;
i
<
last
;
i
++
,
j
++
)
this
->
chstr
[
i
]
=
data_c
[
j
]
|
attrs
;
this
->
chstr
[
i
]
=
(
isprint
(
data_c
[
j
])
?
data_c
[
j
]
:
'?'
)
|
attrs
;
this
->
chstr
[
last
]
=
0
;
this
->
chstr
[
last
]
=
0
;
this
->
len
=
last
;
this
->
len
=
last
;
}
}
...
...
RichString.h
View file @
31b3a2d2
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <curses.h>
#include <curses.h>
#include <ctype.h>
#include "debug.h"
#include "debug.h"
#include <assert.h>
#include <assert.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment