mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 09:05:45 +00:00
b0e7263a58
Changed XMLterm escape sequence string terminator from ^G to CRLF to allow use with buffered STDOUT.
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
/* HelloWorld.c: Simple demo program for "pagelets" */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void)
|
|
{
|
|
char ch;
|
|
char* cookie;
|
|
|
|
cookie = getenv("LTERM_COOKIE"); /* Get security cookie */
|
|
if (cookie == NULL)
|
|
cookie = "";
|
|
|
|
printf("\033{S%s\n", cookie); /* Escape sequence for start of HTML frag */
|
|
|
|
printf("<FORM> \
|
|
<IMG align=center src='chrome://navigator/skin/animthrob_single.gif'> \
|
|
<B>Please click a button</B> <BR> \
|
|
<INPUT ID='button-b#' TYPE=button VALUE='Bold' \
|
|
onClick=\"return HandleEvent(event, 'click', 'sendln','#','b')\"> \
|
|
<INPUT ID='button-e#' TYPE=button VALUE='Emphasis' \
|
|
onClick=\"return HandleEvent(event, 'click', 'sendln','#','e')\"> \
|
|
<INPUT ID='button-q#' TYPE=button VALUE='Quit' \
|
|
onClick=\"return HandleEvent(event, 'click', 'sendln','#','q')\"> \
|
|
<BR></FORM>");
|
|
|
|
printf("%c", '\0'); /* Escape sequence signalling end of HTML */
|
|
|
|
while((ch = getchar())){ /* Poll for data generated by button click events */
|
|
switch (ch) {
|
|
case 'b':
|
|
printf("\033{S%s\n<B>Hello World!</B><BR> %c", cookie, '\0');
|
|
break;
|
|
case 'e':
|
|
printf("\033{S%s\n<EM>Hello World!</EM><BR> %c", cookie, '\0');
|
|
break;
|
|
case 'q':
|
|
return 0;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
printf("\033{1E\n"); /* Enable input echo */
|
|
|
|
return 0;
|
|
}
|