Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
523 B

#include <string.h>
#include "buffer.h"
#include "textcode.h"
18 years ago
#include "havealloca.h"
#include <unistd.h>
void urlencode(const char* c) {
char* buf=alloca(strlen(c)*3+1);
buffer_put(buffer_1,buf,fmt_urlencoded(buf,c,strlen(c)));
buffer_putnlflush(buffer_1);
}
int main(int argc,char* argv[]) {
int i;
for (i=1; i<argc; ++i) {
urlencode(argv[i]);
}
20 years ago
if (argc<2) {
char src[1024];
int len=read(0,src,sizeof(src)-1);
if (len==-1) return(1);
src[len]=0;
urlencode(src);
}
return 0;
}