Back to index

lightning-sunbird  0.9+nobinonly
teststream.c
Go to the documentation of this file.
00001 /* teststream.c: Test driver to generate escaped stream data */
00002 
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 
00006 int main(int argc, char *argv[]) {
00007   char* cookie;
00008 
00009   cookie = getenv("LTERM_COOKIE");  /* Get security cookie */
00010   if (cookie == NULL)
00011     cookie = "";
00012 
00013   if (argc < 2) {
00014     fprintf(stderr, "Usage: %s <data-string> [<terminator-string>]\n",argv[0]);
00015     return 1;
00016   }
00017 
00018   if (argc > 2) {
00019     /* NOT IMPLEMENTED YET */
00020     fprintf(stdout, "\033{T%s\n%s%s", argv[2], argv[1], argv[2]);
00021 
00022   } else {
00023     fprintf(stdout, "\033{S%s\n%s%c", cookie, argv[1], '\0');
00024   }
00025 
00026   return 0;
00027 }