All pastes #20384 Raw Edit

Something

public c v1 · immutable
#20384 ·published 2005-08-19 01:58 UTC
rendered paste body
char pr_hex(char *hex) {  char digit;  digit = (hex[0] >= 'A' ? ((hex[0] & 0xdf) - 'A')+10 : (hex[0] - '0'));  digit *= 16;  digit += (hex[1] >= 'A' ? ((hex[1] & 0xdf) - 'A')+10 : (hex[1] - '0'));  return (digit);}char *pr_unescape(char *string) {  int x, y, len;    if(!string) return string;  len = pr_strlen(string);  if(len < 2) return string;  for(x = 0, y = 0; string[y]; x++, y++) {    if ((string[x] = string[y]) == '%' && y < len - 2) {      string[x] = pr_hex(&string[y + 1]);      y += 2;    } else if(string[x] == '+') {       string[x] = ' ';    }  }  string[x] = '\0';  return string;}