mirror of
https://github.com/siemens-mobile-hacks/sieelf.git
synced 2026-11-25 22:27:29 +00:00
33 lines
598 B
C
33 lines
598 B
C
#include "..\inc\swilib.h"
|
|
#include "urlwork.h"
|
|
|
|
void urlescape(char *out, const char *source)
|
|
{
|
|
const char * h = "0123456789abcdef";
|
|
int c;
|
|
while((c =*source++)!=0)
|
|
{
|
|
if ('a' <= c && c <= 'z'
|
|
|| 'A' <= c && c <= 'Z'
|
|
|| '0' <= c && c <= '9'
|
|
/*|| c == '-' */|| c == '_' || c == '.'
|
|
)
|
|
*out++= c;
|
|
else
|
|
// if( c == ' ' )
|
|
// *out++= '+';
|
|
// else
|
|
{
|
|
*out++= '%';
|
|
*out++= h[c >> 4];
|
|
*out++= h[c & 0x0f];
|
|
}
|
|
}
|
|
*out=0;
|
|
}
|
|
|
|
void urlcat(char *out, const char *source)
|
|
{
|
|
urlescape(out+strlen(out),source);
|
|
}
|
|
|