Category : OS/2 Files
Archive   : EMXTST8F.ZIP
Filename : STACK.C

 
Output of file : STACK.C contained in archive : EMXTST8F.ZIP
/* stack.c (emx+gcc) */

#include
#include
#include
#include
#include

void print_esp (void)
{
unsigned long n;

n = (unsigned long)&n;
printf ("ESP = 0x%.8lx\n", n);
}

void mysig (int sig)
{
printf ("\n---Signal\n");
exit (1);
}

void test (int level)
{
int n, fill_flag;
char buf[10000], *p;

signal (SIGINT, mysig); /* DosSetSignalExceptionFocus */
fill_flag = 0;
for (;;)
{
print_esp ();
printf ("Input(%d): ", level); fflush (stdout);
if (fgets (buf, sizeof (buf), stdin) == NULL)
exit (0);
p = strchr (buf, '\n');
if (p != NULL) *p = 0;
errno = 0;
if (buf[0] == 0)
break;
if (buf[0] == 'r')
test (level+1);
else if (buf[0] == 'f')
fill_flag = !fill_flag;
else if ((n = strtol (buf, &p, 0)) > 0 && errno == 0 && *p == 0)
{
p = alloca (n);
if (fill_flag)
memset (p, '*', n);
}
else
printf ("Redo!\n");
}
}

int main (void)
{
test (1);
return (0);
}


  3 Responses to “Category : OS/2 Files
Archive   : EMXTST8F.ZIP
Filename : STACK.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/