home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / A / CATLBR.ARC / CATLBR.C < prev    next >
Text File  |  1989-10-07  |  2KB  |  53 lines

  1. /*  Program to generate SUB files */
  2. /*  Joe S. Vogler 08/22/83
  3.     3622 Highland Lakes Drive
  4.     Kingwood, Texas  77339
  5.     (713) 358-7586 (evenings)
  6. */
  7.  
  8.  
  9. #define CR          0x0d       /* Carriage return */
  10. #include "bdscio.h"
  11. /* begin externals */
  12. int isopen;
  13. int outbuf;
  14.  
  15. main(argc,argv)
  16. char **argv;
  17. {
  18.    int c;
  19.    int i;
  20.    wildexp(&argc,&argv);    /* first statement in program  */
  21.    printf("\nCATLBR.COM - Version 1.0 - August 22, 1983.");
  22.    printf("\nSubmit file generator for cataloging of LBR files.");
  23.    printf("\nJoe Vogler (713) 358-7586 (evenings)\n");
  24.    if( argc < 2 ) {
  25.       printf("\nUsage:\n\n  A> CATLBR  [{!}<afn>]... [{!}<afn>] <CR>");
  26.       printf("\n\nThe ! is optional and directs program to exclude files");
  27.       printf("\nSee CATLBR.DOC for additional info.\n");
  28.       exit();
  29.     }
  30.  
  31.    if(( outbuf=sbrk(BUFSIZ)) == ERROR ) {
  32.       printf("\nCannot create output buffer for COMMANDS.SUB");
  33.       exit();
  34.     }
  35.  
  36.    if( fcreat("commands.sub",outbuf) == ERROR ) {
  37.       printf("\nCannot open file COMMANDS.SUB.");
  38.       exit();
  39.     }
  40.  
  41.    for ( i = 1; i < argc; i++ )  {
  42.        printf("Writing line number %d%c",i,CR);
  43.        fprintf( outbuf,"$1 $3 %s      \n$2      \n",argv[i]);
  44.     }
  45.  
  46.    fprintf(outbuf,"%c",CPMEOF);
  47.    fflush(outbuf);
  48.    fclose(outbuf);
  49.    printf("Output file COMMANDS.SUB created on default disk");
  50.    printf("\n ...for %d matches.",i-1);
  51.    exit();
  52. }
  53.