1999-12-06 06:32:12 +00:00
|
|
|
/* HelloWorld.c: Simple demo program for "pagelets" */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
1999-12-26 15:19:45 +00:00
|
|
|
#include <stdlib.h>
|
1999-12-06 06:32:12 +00:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
char ch;
|
1999-12-26 15:19:45 +00:00
|
|
|
char* cookie;
|
|
|
|
|
|
|
|
cookie = getenv("LTERM_COOKIE"); /* Get security cookie */
|
|
|
|
if (cookie == NULL)
|
|
|
|
cookie = "";
|
|
|
|
|
2000-04-21 13:10:44 +00:00
|
|
|
printf("\033{S%s\n", cookie); /* Escape sequence for start of HTML frag */
|
1999-12-06 06:32:12 +00:00
|
|
|
|
|
|
|
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' \
|
2000-03-06 15:16:48 +00:00
|
|
|
onClick=\"return HandleEvent(event, 'click', 'sendln','#','b')\"> \
|
1999-12-06 06:32:12 +00:00
|
|
|
<INPUT ID='button-e#' TYPE=button VALUE='Emphasis' \
|
2000-03-06 15:16:48 +00:00
|
|
|
onClick=\"return HandleEvent(event, 'click', 'sendln','#','e')\"> \
|
1999-12-06 06:32:12 +00:00
|
|
|
<INPUT ID='button-q#' TYPE=button VALUE='Quit' \
|
2000-03-06 15:16:48 +00:00
|
|
|
onClick=\"return HandleEvent(event, 'click', 'sendln','#','q')\"> \
|
1999-12-06 06:32:12 +00:00
|
|
|
<BR></FORM>");
|
|
|
|
|
1999-12-26 15:19:45 +00:00
|
|
|
printf("%c", '\0'); /* Escape sequence signalling end of HTML */
|
1999-12-06 06:32:12 +00:00
|
|
|
|
|
|
|
while((ch = getchar())){ /* Poll for data generated by button click events */
|
|
|
|
switch (ch) {
|
|
|
|
case 'b':
|
2000-04-21 13:10:44 +00:00
|
|
|
printf("\033{S%s\n<B>Hello World!</B><BR> %c", cookie, '\0');
|
1999-12-06 06:32:12 +00:00
|
|
|
break;
|
|
|
|
case 'e':
|
2000-04-21 13:10:44 +00:00
|
|
|
printf("\033{S%s\n<EM>Hello World!</EM><BR> %c", cookie, '\0');
|
1999-12-06 06:32:12 +00:00
|
|
|
break;
|
|
|
|
case 'q':
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-21 13:10:44 +00:00
|
|
|
printf("\033{1E\n"); /* Enable input echo */
|
1999-12-26 15:19:45 +00:00
|
|
|
|
1999-12-06 06:32:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|