home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
sigm
/
vol179
/
cutils.lbr
/
MAKSUB11.C
< prev
next >
Wrap
Text File
|
1985-02-09
|
3KB
|
107 lines
/* BDS 'C' Programers Aid makesub.c ver 1.1 by Cliff Mueller
This program accepts as a command line argument the filename
you are going to work with, as well as any link files you might
want to use. The program then generates; W.SUB, C.SUB and S.SUB.
W.SUB merely invokes the Wordstar editor with your filename
and quits after exiting Wordstar.
C.SUB runs the 'C' compiler then the linker and quits.
S.SUB invokes Wordstar, then the 'C' compiler and linker,
then runs your program.
To implement:
First get SUBMIT.COM or SUPSUB.COM on to the disk and rename
it to S.COM. Then enter makesub [filename] <LINKFILE>
<LINKFILE> <LINKFILE> and makesub wil generate the proper
files for you. You may omit the link files if they are not
needed. When entering filenames DO NOT enter the extent .C,
or .CRL. The program will do that for you. After compiling
and linking run the com file through NOBOOT to eliminate
the warm booting. Finally, to save typing rename the
maksub11.com file to ms.com.
To use:
Enter s<space>w for the WS "filename.c".
Enter s<space>c for the CC1 "filename.c" & L2 "filename".
Enter s<space>s for both of above and to run the program.
Author's note:
I have been using this version for about six months now and
the only bug I've found is that if a compiler error appears
its difficult to abort the sub file. The procedure I use is to
use W first, then C to clear errors, then use S to fine tune
the code. If you find any bugs or have any suggestions call
me at 408-736-9401.
Happy Hacking
*/
#include <bdscio.h>
main(argc,argv)
int argc;
char *argv[];
{
int fd;
char obuf[BUFSIZ];
printf("makesub.c version 1.1 1/17/83 by Cliff Mueller\n\n");
while(1)
{
if (argc < 2)
{
printf("Usage: filename <linkfile> <linkfile> <linkfile>");
exit();
}
if((fd = fcreat("w.sub",obuf))==ERROR) /* ws .sub file */
{
printf("\nCan't open w.sub");
exit();
}
fprintf(obuf,"WS %s.C\n",argv[1]);
putc(CPMEOF,obuf);
fflush(obuf);
fclose(obuf);
if((fd = fcreat("c.sub",obuf))==ERROR) /* CC1 & L2 .sub file */
{
printf("\nCan't open c.sub");
exit();
}
fprintf(obuf,"CC1 %s.C\n",argv[1]);
if(argc==2) fprintf(obuf,"L2 %s\n",argv[1]);
if(argc==3) fprintf(obuf,"L2 %s %s\n",argv[1],argv[2]);
if(argc==4) fprintf(obuf,"L2 %s %s %s\n",argv[1],argv[2],argv[3]);
if(argc==5) fprintf(obuf,"L2 %s %s %s %s\n",argv[1],argv[2],argv[3],argv[4]);
putc(CPMEOF,obuf);
fflush(obuf);
fclose(obuf);
if((fd = fcreat("s.sub",obuf))==ERROR) /* CC1 & L2 $ program .sub file */
{
printf("\nCan't open s.sub");
exit();
}
fprintf(obuf,"WS %s.C\n",argv[1]);
fprintf(obuf,"CC1 %s.C\n",argv[1]);
if(argc==2) fprintf(obuf,"L2 %s\n",argv[1]);
if(argc==3) fprintf(obuf,"L2 %s %s\n",argv[1],argv[2]);
if(argc==4) fprintf(obuf,"L2 %s %s %s\n",argv[1],argv[2],argv[3]);
if(argc==5) fprintf(obuf,"L2 %s %s %s %s\n",argv[1],argv[2],argv[3],argv[4]);
fprintf(obuf,"%s\n",argv[1]);
putc(CPMEOF,obuf);
fflush(obuf);
fclose(obuf);
printf("\n.SUB files now contain filename -> %s.C\n",argv[1]);
if(argc==3)printf("link file = %s\n",argv[2]);
if(argc==4)printf("link files = %s, %s\n",argv[2],argv[3]);
if(argc==5)printf("link files = %s, %s, %s\n",argv[2],argv[3],argv[4]);
printf("The disc with the .SUB files must be on the 'A' drive.\n");
exit();
}
}