🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: net.micro.atari
1 messages
1 total messages Started by Mark D. Falleroni Mon, 04 Nov 1985 15:49
ST Source: onedsk.c
#1400
Author: Mark D. Falleroni
Date: Mon, 04 Nov 1985 15:49
71 lines
2105 bytes
The is an ST program that executes from the Hippo OS shell. It allows
files (up to 28000 bytes) to be copied with only one disk swap.

- - - - - - - - cut here - - - - - - - - cut here - - - - - - - -
#include <stdio.h>
#define MEMBUF 28000
#define READ 0
#define WRITE 1
#define BUFSIZE 1024


main(argc,argv)
int argc;
char *argv[];

{
 int handle,n,bytes_read,cnt,i,c;
 char bigbuf[MEMBUF];

	if (argc != 3)
	 error("ONEDSK usage: onedsk source file destination file",NULL);

	printf("\nOpening %s\n",argv[1]);

	if ((handle = open(argv[1],READ)) < 0)
	 error("ONEDSK: error opening %s",argv[1]);

	n=0;
	bytes_read=0;

	while ((n = read(handle,BUFSIZE,bigbuf+bytes_read)) > 0)
	{
	 bytes_read += n;
	 printf("Bytes read = %d\n",bytes_read);
	}

	close (handle);

	printf("\n\n");
	printf("Insert destination disk in Drive A:\n");
	printf("Type any key when ready\n");
	necin();	  /* get char with no screen echo */

	printf("\nCreating %s on the destination disk\n",argv[2]);

	if ((handle = create(argv[2],0777)) < 0)		/* if can't create it */
	 handle = open(argv[2],WRITE);  		/* try opening it */
	if (handle < 0)
	 error("ONEDSK: cannot create or open %s",argv[2]);

	if ((n = write(handle,bytes_read,bigbuf)) < 0)
	 error("ONEDSK: error writing to %s",argv[2]);
	printf("\nBytes written = %d\n",n);

	close(handle);

	if (n == bytes_read)
	 printf("\nCOPY COMPLETED\n\n");
	else
	 printf("\nBYTE COUNT MISMATCH: BAD COPY!\n\n");

}

error(s1,s2)
char *s1, *s2;

{
 printf(s1,s2);
 printf("\n");
 exit(1);
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads