__asm__(".section " ".ident" " ; .asciz \"" "$NetBSD: vis.c,v 1.23 2002/05/26 14:03:20 wiz Exp $" "\" ; .text"); typedef unsigned int __uint32_t; typedef __uint32_t u_int32_t; typedef unsigned long int size_t; typedef unsigned char u_char; extern const unsigned char *_ctype_; void *alloca (size_t); char *strchr (const char *, int); char * _svis(dst, c, flag, nextc, extra) char *dst; int c, flag, nextc; const char *extra; { char *nextra; ((void)0); ((void)0); do { const char *o = extra; char *e; while (*o++) continue; nextra = alloca((size_t)((o - extra) + 5)); for (o = extra, e = nextra; (*e++ = *o++) != '\0';) continue; e--; if (flag & 0x04) *e++ = ' '; if (flag & 0x08) *e++ = '\t'; if (flag & 0x10) *e++ = '\n'; if ((flag & 0x40) == 0) *e++ = '\\'; *e = '\0'; } while ( 0); if (flag & 0x80) do if (!((unsigned)(c) <= 0177) || !((int)((_ctype_ + 1)[(int)(c)] & (0x01|0x02|0x04))) || strchr("$-_.+!*'(),", c) != 0) { *dst++ = '%'; *dst++ = "0123456789abcdef"[((unsigned int)c >> 4) & 0xf]; *dst++ = "0123456789abcdef"[(unsigned int)c & 0xf]; } else { do { int isextra, isc; isextra = strchr(nextra, c) != 0; if (!isextra && ((unsigned)(c) <= 0177) && (((int)((_ctype_ + 1)[(int)(c)] & (0x10|0x01|0x02|0x04))) || (c == ' ' || c == '\t' || c == '\n') || ((flag & 0x20) && (c == '\b' || c == '\a' || c == '\r')))) { *dst++ = c; break; } isc = 0; if (flag & 0x02) { switch (c) { case '\n': isc = 1; *dst++ = '\\'; *dst++ = 'n'; break; case '\r': isc = 1; *dst++ = '\\'; *dst++ = 'r'; break; case '\b': isc = 1; *dst++ = '\\'; *dst++ = 'b'; break; case '\a': isc = 1; *dst++ = '\\'; *dst++ = 'a'; break; case '\v': isc = 1; *dst++ = '\\'; *dst++ = 'v'; break; case '\t': isc = 1; *dst++ = '\\'; *dst++ = 't'; break; case '\f': isc = 1; *dst++ = '\\'; *dst++ = 'f'; break; case ' ': isc = 1; *dst++ = '\\'; *dst++ = 's'; break; case '\0': isc = 1; *dst++ = '\\'; *dst++ = '0'; if ((((u_char)(nextc)) >= '0' && ((u_char)(nextc)) <= '7')) { *dst++ = '0'; *dst++ = '0'; } } } if (isc) break; if (isextra || ((c & 0177) == ' ') || (flag & 0x01)) { *dst++ = '\\'; *dst++ = (u_char)(((u_int32_t)(u_char)c >> 6) & 03) + '0'; *dst++ = (u_char)(((u_int32_t)(u_char)c >> 3) & 07) + '0'; *dst++ = (c & 07) + '0'; } else { if ((flag & 0x40) == 0) *dst++ = '\\'; if (c & 0200) { c &= 0177; *dst++ = 'M'; } if (((int)((_ctype_ + 1)[(int)(c)] & 0x20))) { *dst++ = '^'; if (c == 0177) *dst++ = '?'; else *dst++ = c + '@'; } else { *dst++ = '-'; *dst++ = c; } } } while ( 0); } while ( 0); else do { int isextra, isc; isextra = strchr(nextra, c) != 0; if (!isextra && ((unsigned)(c) <= 0177) && (((int)((_ctype_ + 1)[(int)(c)] & (0x10|0x01|0x02|0x04))) || (c == ' ' || c == '\t' || c == '\n') || ((flag & 0x20) && (c == '\b' || c == '\a' || c == '\r')))) { *dst++ = c; break; } isc = 0; if (flag & 0x02) { switch (c) { case '\n': isc = 1; *dst++ = '\\'; *dst++ = 'n'; break; case '\r': isc = 1; *dst++ = '\\'; *dst++ = 'r'; break; case '\b': isc = 1; *dst++ = '\\'; *dst++ = 'b'; break; case '\a': isc = 1; *dst++ = '\\'; *dst++ = 'a'; break; case '\v': isc = 1; *dst++ = '\\'; *dst++ = 'v'; break; case '\t': isc = 1; *dst++ = '\\'; *dst++ = 't'; break; case '\f': isc = 1; *dst++ = '\\'; *dst++ = 'f'; break; case ' ': isc = 1; *dst++ = '\\'; *dst++ = 's'; break; case '\0': isc = 1; *dst++ = '\\'; *dst++ = '0'; if ((((u_char)(nextc)) >= '0' && ((u_char)(nextc)) <= '7')) { *dst++ = '0'; *dst++ = '0'; } } } if (isc) break; if (isextra || ((c & 0177) == ' ') || (flag & 0x01)) { *dst++ = '\\'; *dst++ = (u_char)(((u_int32_t)(u_char)c >> 6) & 03) + '0'; *dst++ = (u_char)(((u_int32_t)(u_char)c >> 3) & 07) + '0'; *dst++ = (c & 07) + '0'; } else { if ((flag & 0x40) == 0) *dst++ = '\\'; if (c & 0200) { c &= 0177; *dst++ = 'M'; } if (((int)((_ctype_ + 1)[(int)(c)] & 0x20))) { *dst++ = '^'; if (c == 0177) *dst++ = '?'; else *dst++ = c + '@'; } else { *dst++ = '-'; *dst++ = c; } } } while ( 0); *dst = '\0'; return(dst); }