File:  [MW Coherent from dump] / coherent / b / bin / dirname.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:36 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/* (-lgl
 * 	COHERENT Version 4.0
 * 	Copyright (c) 1982, 1992 by Mark Williams Company.
 * 	All rights reserved. May not be copied without permission.
 -lgl) */
/*
 * Print directry name.
 */
#include <stdio.h>

main(argc, argv)
int	argc;
char	*argv[];
{
	extern char	*rindex();
	char		*pch;

	if (argc > 2) {
		fprintf(stderr, "Usage: dirname [path]\n");
		exit(1);
	}
	
	if ((pch = rindex(argv[1], '/')) == NULL)
		puts(".");
	else 
		if (pch == argv[1])
			puts("/");
		else {
			*pch ='\0';
			puts(argv[1]);
		}
}

unix.superglobalmegacorp.com

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