summaryrefslogtreecommitdiff
path: root/ws2a
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-11 18:50:44 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-11 18:50:44 -0400
commit6aa2466b525a45a7a7eacc44e1cbcde663879f21 (patch)
tree7737d662a936efecd25a9af7ca3dde903e3e476e /ws2a
parentc843996cae5a4bf558c7d4dda4f7bcc0601daf07 (diff)
downloadwebpage-6aa2466b525a45a7a7eacc44e1cbcde663879f21.tar.gz
webpage-6aa2466b525a45a7a7eacc44e1cbcde663879f21.tar.bz2
webpage-6aa2466b525a45a7a7eacc44e1cbcde663879f21.zip
More fixes to handel new lines
Diffstat (limited to 'ws2a')
-rw-r--r--ws2a/bugcomment.c11
-rw-r--r--ws2a/testhtmlreplace.c9
2 files changed, 13 insertions, 7 deletions
diff --git a/ws2a/bugcomment.c b/ws2a/bugcomment.c
index ce11a85..130087b 100644
--- a/ws2a/bugcomment.c
+++ b/ws2a/bugcomment.c
@@ -24,7 +24,10 @@ char* replaceHTML(char* str){
int hex;
sscanf(str+strp,"%%%x",&hex);
//printf("Was:%c\n",(char)hex);
- if(hex == 0x0D) continue;
+ if(hex == 0x0D){
+ strp+=3;
+ continue;
+ }
if(hex == 0x0A){
nstr[nstrp] = '\\';
nstr[nstrp+1] = 'n';
@@ -158,9 +161,9 @@ int main(){
char* duid = useridhash(userid);
char* dcomment = replaceHTML(comment);
printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10);
- //printf("Location: ../ws2a/bugview.html?id=%s\n\n",bugid);
- printf("<p>data:%s",data);
- printf("<p>comment:%s<p>dcomment:%s",comment,dcomment);
+ printf("Location: ../ws2a/bugview.html?id=%s\n\n",bugid);
+ //printf("<p>data:%s",data);
+ //printf("<p>comment:%s<p>dcomment:%s",comment,dcomment);
//printf("Everything ok, inserting comment!");
fprintf(bugfile,"\n%s\n%s\n%s\n",dname,duid,dcomment);
free(dname);
diff --git a/ws2a/testhtmlreplace.c b/ws2a/testhtmlreplace.c
index 6ac6f90..925bb6d 100644
--- a/ws2a/testhtmlreplace.c
+++ b/ws2a/testhtmlreplace.c
@@ -24,12 +24,15 @@ char* replaceHTML(char* str){
int hex;
sscanf(str+strp,"%%%x",&hex);
//printf("Was:%c\n",(char)hex);
- if(hex == 0x0D) continue;
+ if(hex == 0x0D){
+ strp+=3;
+ continue;
+ }
if(hex == 0x0A){
nstr[nstrp] = '\\';
nstr[nstrp+1] = 'n';
nstrp+=2;
- strp++;
+ strp+=3;
continue;
}
nstr[nstrp] = (char)hex;
@@ -85,7 +88,7 @@ int main(){
char teststring[] = "This+is+a+test\nWith\nSome\nNewlines";
char* parsed = replaceHTML(teststring);
printf("%s\n",parsed);
- char teststring2[] = "This+is+another+test";
+ char teststring2[] = "This%0D%0Ais+another%0D%0Atest";
char* parsed2 = replaceHTML(teststring2);
printf("%s\n",parsed2);
return 0;