Category : Files from Magazines
Archive   : 8809CLM.ZIP
Filename : PARSE.C

 
Output of file : PARSE.C contained in archive : 8809CLM.ZIP
Listing 1

#if !defined(ENVP)
/* saves space if _setenvp() from the library is not needed */
_setenvp() {}
#endif

#if defined(NOARGS)
/* saves space if _setargv() from the library is not needed */
_setargv() {}
#endif

main(
#if defined (ENVP)
argc,argv,enp) int argc; char *argv[]; char *envpi;
#elif !defined(NOARGS)
argc,argv) int argc; char *argv[];
#else
)
#endif


Listing 2

/* Display arguments one at a time, showing the result of _setargv().
For a simple file listing utility that displays a sorted list of files
matching a; path name with wildcards, include the alternate _setargv()
provided. Under release 4.0 use:
MSC FILES
LINK FILES+SSETARGB"V.OBJ.
Under 5.0 use:
CL FILES.C SETARGV.OBJ /link /NOE */

#include
#include "main.h"
{
int i;
for (i=1; i puts(argv[i]);
}


Listing 3

/* Get command line arguments from PSP. To test, add a main()
function. Compile with MSC CMDARGS /DTEST under release 4.0 or
CL /DTEST CMDARGS.C /link /NOE under release 5.0. */

#include
#include
#include
#define FP_PTR(seg,off) ((((long)seg)<<16)+off)

char *cmdargs(result)
char result[];
{
unsigned char far *dta=FP_PTR(_psp,0x80);
#if defined(M_I86SM) || defined(M_I86MM) /* small or medium model */
char far *far_result=result;
movedata(_psp,0x81,FP_SET(far_result),FP_OFF(far_result),*dta);
#else
memcpy(result,dta+1,*dta);
#endif
result[*dta]=0;
return(result);
}
#ifdef TEST
#include
#define NOARGS
#include "main.h"
{
char args[128];
cmdargs(args);
purchar('"');
fputs(args,stdout);
putchar('"');
}
#endif


  3 Responses to “Category : Files from Magazines
Archive   : 8809CLM.ZIP
Filename : PARSE.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/