Skip to content
Snippets Groups Projects
Select Git revision
  • d4847b52087253446ccf9a15d3e6e40e77c5950f
  • master default
  • wip-slh-dsa-sha2-128s
  • master-updates
  • release-3.10-fixes
  • getopt-prototype
  • fix-bcrypt-warning
  • refactor-hmac
  • wip-use-alignas
  • trim-sha3-context
  • fix-gitlab-ci
  • check-fat-emulate
  • delete-digest_func-size
  • slh-dsa-shake-128f-nettle
  • slh-dsa-shake-128s-nettle
  • slh-dsa-shake-128s
  • delete-openpgp
  • ppc64-sha512
  • delete-md5-compat
  • cleanup-hmac-tests
  • ppc64-sha256
  • nettle_3.10.2_release_20250626
  • nettle_3.10.1_release_20241230
  • nettle_3.10_release_20240616
  • nettle_3.10rc2
  • nettle_3.10rc1
  • nettle_3.9.1_release_20230601
  • nettle_3.9_release_20230514
  • nettle_3.8.1_release_20220727
  • nettle_3.8_release_20220602
  • nettle_3.7.3_release_20210606
  • nettle_3.7.2_release_20210321
  • nettle_3.7.1_release_20210217
  • nettle_3.7_release_20210104
  • nettle_3.7rc1
  • nettle_3.6_release_20200429
  • nettle_3.6rc3
  • nettle_3.6rc2
  • nettle_3.6rc1
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
41 results

realloc.h

Blame
  • Html.pmod 1.42 KiB
    string *quote_from;
    string *quote_to;
    string *unquote_from;
    string *unquote_to;
    
    void create()
    {
      quote_from=quote_to=unquote_from=unquote_to=({});
      for(int e=0;e<256;e++)
      {
        switch(e)
        {
        case 'a'..'z':
        case 'A'..'Z':
        case '0'..'9':
        case 'å': case 'ä': case 'ö':
        case 'Å': case 'Ä': case 'Ö':
        case 'ü': case 'Ü':
        case '!':
        case '#':
        case '$':
        case '&':
        case '/':
        case '(':
        case ')':
        case '=':
        case '-':
        case '_':
        case '+':
        case '?':
        case '~':
        case '*':
        case ',':
        case '.':
        case ';':
        case ':':
          break;
    
        default:
          quote_from+=({sprintf("%c",e)});
          quote_to+=({sprintf("%%%02x",e)});
        }
        unquote_from+=({sprintf("%%%02x",e)});
        unquote_to+=({sprintf("%c",e)});
      }
    }
    
    string quote_param(string s) { return replace(s,quote_from,quote_to); }
    string unquote_param(string s) { return replace(s,unquote_from,unquote_to); }
    
    string mktag(string tag, mapping params)
    {
      string ret="<"+tag;
      foreach(indices(params),string i)
      {
        ret+=" "+i;
    
        if(stringp(params[i]))
        {
          switch(i)
          {
    	case "href":
    	case "name":
    	  ret+="='"+quote_param(params[i])+"'";
    	  break;
    
    	default:
    	  if(search(params[i],"\"")==-1)
    	    ret+="=\""+params[i]+"\"";
    	  else if(search(params[i],"'")==-1)
    	    ret+="='"+params[i]+"'";
    	  else
    	    ret+="=\""+replace(params[i],"\"","'")+"\"";
          }
        }
      }
      return ret+">";
    }