Category : C++ Source Code
Archive   : BR.ZIP
Filename : COMMANDS.CPP
// 4321 Harborough Rd.
// Columbus, OH 43220
// LVS Windows Library
// Commands.cpp
#include
#include
#include
#include
#include
#include "pxengine.h"
#pragma hdrstop // stop header file compile
#include "br.hpp"
static void Usage ()
{
printf ("BR [/B] [/M] [/S
printf (" /B = force bios video writes.\n");
printf (" /M = force mono colors.\n");
printf (" /S = print paradox file structure. In file is required. If\n");
printf (" no out file is given the structure is printed to the screen.\n");
printf (" The screen output can be redirected.\n");
printf (" /? = display this screen.\n");
}
static int PX_Error (int rc)
{
if (rc)
printf ("%s\n", PXErrMsg (rc));
return rc;
}
static void Output_Structure (char *file, FILE *fp)
{
if (PX_Error (PXInit ()))
return;
if (PX_Error (PXTblOpen (file, &tblHandle, 0, 1)))
return;
char name[100];
if (PX_Error (PXTblName (tblHandle, 100, name)))
{
PXTblClose (tblHandle);
return;
}
char *new_line = "\r\n";
if (fp == stdout)
new_line = "\n";
fprintf (fp, "Structure for: %s\n%s", name, new_line);
fprintf (fp, " Field Name Type%s", new_line);
fprintf (fp, " ------------------------- -----%s", new_line);
if (PX_Error (PXRecNFlds (tblHandle, &flds)))
{
PXTblClose (tblHandle);
return;
}
for (unsigned i=1; i <= flds; i++)
{
char str [26], str2[10];
PXFldName (tblHandle, i, 26, str);
str_setsz (str, 25);
PXFldType (tblHandle, i, 10, str2);
fprintf (fp, " %3d. %s %s%s", i, str, str2, new_line);
}
PXTblClose (tblHandle);
}
void Parse_Commands (int argv, char **argc)
{
for (int i = 1; i < argv; i++)
{
if (argc[i][0] == '-' || argc[i][0] == '/')
{
switch (toupper (argc[i][1]))
{
case 'S': /* print structure */
if (i == argv - 1)
{
printf ("Must supply an input file name.\n\n");
Usage ();
exit (1);
}
i++;
if (i == argv - 1)
{
Output_Structure (argc[i], stdout);
}
else
{
FILE *fp = fopen (argc[i+1], "rb");
if (fp)
{
fclose (fp);
printf ("Output file exists.\n");
exit (1);
}
fp = fopen (argc[i+1], "wb");
if (fp)
{
Output_Structure (argc[i], fp);
fclose (fp);
}
else
{
printf ("Error opening output file.\n");
exit (1);
}
}
exit (0);
break;
case 'M': /* Mono */
Win_mono (W_ON);
break;
case 'B': /* Bios */
Win_bios (W_ON);
break;
case '?':
case 'H':
Usage ();
exit (0);
break;
}
}
else
{
Usage ();
exit (1);
}
}
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/