Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157007506
D16204.id62334.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D16204.id62334.diff
View Options
Index: usr.bin/top/display.h
===================================================================
--- usr.bin/top/display.h
+++ usr.bin/top/display.h
@@ -11,7 +11,6 @@
void clear_message(void);
int display_resize(void);
void i_header(const char *text);
-char *printable(char *string);
void display_header(int t);
int display_init(struct statics *statics);
void i_arc(int *stats);
Index: usr.bin/top/display.c
===================================================================
--- usr.bin/top/display.c
+++ usr.bin/top/display.c
@@ -1291,31 +1291,6 @@
}
}
-/*
- * printable(str) - make the string pointed to by "str" into one that is
- * printable (i.e.: all ascii), by converting all non-printable
- * characters into '?'. Replacements are done in place and a pointer
- * to the original buffer is returned.
- */
-
-char *
-printable(char str[])
-{
- char *ptr;
- char ch;
-
- ptr = str;
- while ((ch = *ptr) != '\0')
- {
- if (!isprint(ch))
- {
- *ptr = '?';
- }
- ptr++;
- }
- return(str);
-}
-
void
i_uptime(struct timeval *bt, time_t *tod)
{
Index: usr.bin/top/machine.c
===================================================================
--- usr.bin/top/machine.c
+++ usr.bin/top/machine.c
@@ -1003,7 +1003,7 @@
len = (argbuflen - (dst - argbuf) - 1) / 4;
strvisx(dst, src,
MIN(strlen(src), len),
- VIS_NL | VIS_CSTYLE);
+ VIS_NL | VIS_CSTYLE | VIS_OCTAL);
while (*dst != '\0')
dst++;
if ((argbuflen - (dst - argbuf) - 1) / 4 > 0)
@@ -1102,7 +1102,7 @@
sbuf_printf(procbuf, "%6s ", format_time(cputime));
sbuf_printf(procbuf, "%6.2f%% ", ps.wcpu ? 100.0 * weighted_cpu(PCTCPU(pp), pp) : 100.0 * PCTCPU(pp));
}
- sbuf_printf(procbuf, "%s", printable(cmdbuf));
+ sbuf_printf(procbuf, "%s", cmdbuf);
free(cmdbuf);
return (sbuf_data(procbuf));
}
Index: usr.bin/top/top.c
===================================================================
--- usr.bin/top/top.c
+++ usr.bin/top/top.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <getopt.h>
#include <jail.h>
+#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -265,6 +266,11 @@
setbuffer(stdout, stdoutbuf, Buffersize);
#endif
+ if (setlocale(LC_ALL, "") == NULL) {
+ fprintf(stderr, "invalid locale.\n");
+ exit(1);
+ }
+
mypid = getpid();
/* get our name */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 10:29 PM (14 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33230191
Default Alt Text
D16204.id62334.diff (2 KB)
Attached To
Mode
D16204: top(1): support multibyte characters in command names (ARGV array) depending on locale
Attached
Detach File
Event Timeline
Log In to Comment