File:  [CSRG BSD Unix] / 43BSDTahoe / new / cpm / src / delete.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

/*	delete.c	1.7	85/03/24	*/

#include <stdio.h>
#include "cpmio.h"
#include "cpmfio.h"

/*
 * Delete cp/m file
 */

delete(cmdline)
	char *cmdline;
{

	char name[9], ext[4], *fixname();
	register C_FILE *cio;

	if (!(namesep(cmdline, name, ext))) 
		return;
	if (searchdir(name, ext) == -1) {
		fprintf(stderr, "File not found: %s\n", fixname(name, ext));
		return;
	}
	cio = c_open(name, ext, READ);
	cio->c_dirp->status = (char) 0xe5;
	while(cio->c_dirp->blkcnt == (char) 0x80 && getnext(cio) != 0)
		cio->c_dirp->status = (char) 0xe5;
	savedir();
	c_close(cio);
	/* 
	 * rebuild the bitmap completely instead of recovering
         * each block as they are deleted
	 */
	build_bmap(); 
	fprintf(stderr, "%s deleted\n", fixname(name, ext));
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.