/[pcre]/code/trunk/maint/utf8.c
ViewVC logotype

Diff of /code/trunk/maint/utf8.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 522 by ph10, Sat May 22 19:19:40 2010 UTC revision 592 by ph10, Sat Apr 30 17:37:37 2011 UTC
# Line 135  return i+1; Line 135  return i+1;
135  int  int
136  main(int argc, char **argv)  main(int argc, char **argv)
137  {  {
138  int i;  int i = 1;
139    int show = 0;
140  unsigned char buffer[8];  unsigned char buffer[8];
141  for (i = 1; i < argc; i++)  
142    if (strcmp(argv[1], "-s") == 0)
143      {
144      show = 1;
145      i = 2;
146      }
147    
148    for (; i < argc; i++)
149    {    {
150    unsigned char *x = argv[i];    unsigned char *x = argv[i];
151    if (strncmp(x, "0x", 2) == 0)    if (strncmp(x, "0x", 2) == 0)
# Line 146  for (i = 1; i < argc; i++) Line 154  for (i = 1; i < argc; i++)
154      int d = strtol(x+2, NULL, 16);      int d = strtol(x+2, NULL, 16);
155      int rc = ord2utf8(d, buffer);      int rc = ord2utf8(d, buffer);
156      printf("0x%08x => ", d);      printf("0x%08x => ", d);
157      if (rc <= 0) printf("*** Error %d ***", rc);      if (rc <= 0) printf("*** Error %d ***", rc); else
158        else for (j = 0; j < rc; j++) printf("%02x ", buffer[j]);        {
159          for (j = 0; j < rc; j++) printf("%02x ", buffer[j]);
160          if (show)
161            {
162            printf(">");
163            for (j = 0; j < rc; j++) printf("%c", buffer[j]);
164            printf("<");
165            }
166          }
167      printf("\n");      printf("\n");
168      }      }
169    else    else

Legend:
Removed from v.522  
changed lines
  Added in v.592

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12