FreeBSD Bugzilla – Attachment 21851 Details for
Bug 38152
ls improvments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 893 bytes, created by
thinker
on 2002-05-16 17:00:07 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
thinker
Created:
2002-05-16 17:00:07 UTC
Size:
893 bytes
patch
obsolete
>--- util.c.orig Thu May 16 23:37:22 2002 >+++ util.c Thu May 16 23:43:19 2002 >@@ -52,6 +52,8 @@ > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >+#include <rune.h> >+#include <wctype.h> > > #include "ls.h" > #include "extern.h" >@@ -60,15 +62,33 @@ > prn_printable(s) > const char *s; > { >- unsigned char c; >- int n; >+ const char *p1, *p2; >+ char *r, *ri; >+ int len, dc; >+ rune_t c; > >- for (n = 0; (c = *s) != '\0'; ++s, ++n) >- if (isprint(c)) >- putchar(c); >- else >- putchar('?'); >- return n; >+ p1 = s; >+ dc = len = strlen(s); >+ ri = r = (char *)malloc(len + 1); >+ while(*p1 != 0) { >+ c = sgetrune(p1, dc, &p2); >+ if(c == _INVALID_RUNE) { >+ p1++; >+ dc--; >+ *ri++ = '?'; >+ } else { >+ dc -= p2 - p1; >+ if(isprint(c)) >+ while(p1 != p2) >+ *ri++ = *p1++; >+ else >+ while(p1 != p2) >+ *ri++ = '?'; >+ } >+ } >+ *ri = 0; >+ printf("%s", r); >+ return len; > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 38152
: 21851