TIP: Click on subject to list as thread! ANSI
echo: apple
to: comp.os.cpm,comp.sys.apple2,comp.sy
from: Bill Buckels
date: 2008-11-08 05:52:50
subject: Re: Building an Apple CP/M Disk

"Bill Buckels"  wrote in message 
news:72fRk.1144$sl.547{at}newsfe23.iad...
>I have updated the Disk Images at the following link to include a utility 
>called BHEAD.COM and have also included a version of MORE.COM and my Aztec 
>C  Source for both .

x--- snip ---x

/* bhead.c (C) Copyright 2008 Bill Buckels */

/* Written in Aztec C */

/* CP/M 80 program to remove the first 4 bytes
   of a DOS 3.3 Binary File transferred to
   Apple CP/M using the APDOS utility */

/* You have a royalty free right to use
   this program for any purpose whatsoever
   provided you agree that Bill Buckels
   has no liability whatsoever from its use. */

#include 

#define BUFLEN 256

char infile[80], outfile[80], buf[BUFLEN];
int fi, fo, len, olen, cmdline;

main(argc, argv)
int argc;
char **argv;
{

 printf("BHEAD (C) Bill Buckels 2008\n");
 printf("Usage is: \"BHEAD infile outfile\"\n");
 printf("---------------------------\n");

    if (argc > 2) {
    cmdline = 1;
    strcpy(infile,argv[1]);
    strcpy(outfile,argv[2]);
 }
 else {
      cmdline = 0;
      printf("Infile  ? ");

     /* let them bail if they enter a blank line */
  gets(infile);
  if (infile[0] == 0)exit(0);
  printf("Outfile ? ");
  gets(outfile);
  if (outfile[0] == 0)exit(0);
 }

    /* force them to bail if any problems
       opening the input or the output file */
 fi = open(infile,  O_RDONLY, 0);
 if (fi == -1) {
    printf("Can't open %s...",infile);
    onexit(1);
 }
 fo = open(outfile, O_WRONLY|O_TRUNC|O_CREAT, 0);
 if (fo == -1) {
    printf("Can't open %s...",outfile);
    close(fi);
    onexit(2);
 }

 /* not bothering to see if the input file
    is shorter than 4 bytes... what does it
    matter anyway? */
 read(fi,buf,4);

 /* read the file in chunks to speed-up
    disk access */
 for (;;) {
  len = read(fi,buf,BUFLEN);
  if (len < 1)break;
  /* put a dot on the screen
     every write */
  putchar('.');
  olen = write(fo,buf,len);
  if (olen != len) {
     /* not bothering to clean-up */
     printf("\nDisk Full!");
     break;
  }
  if (len < BUFLEN) break;
 }
 close(fi);
 close(fo);
 printf("\nDone!");
 onexit(0);
}

onexit(xcode)
int xcode;
{
 if (cmdline == 0)getchar();
 putchar('\n');
 exit(xcode);
}
--- SBBSecho 2.12-Win32
* Origin: Derby City Gateway (1:2320/0)
SEEN-BY: 10/1 3 34/999 120/228 123/500 140/1 222/2 226/0 236/150 249/303
SEEN-BY: 250/306 261/20 38 100 1404 1406 1410 1418 266/1413 280/1027 320/119
SEEN-BY: 393/11 396/45 633/260 267 712/848 800/432 801/161 189 2222/700
SEEN-BY: 2320/100 105 200 2905/0
@PATH: 2320/0 100 261/38 633/260 267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.