|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 4.0
3: * Copyright (c) 1982, 1992 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * Print directry name.
8: */
9: #include <stdio.h>
10:
11: main(argc, argv)
12: int argc;
13: char *argv[];
14: {
15: extern char *rindex();
16: char *pch;
17:
18: if (argc > 2) {
19: fprintf(stderr, "Usage: dirname [path]\n");
20: exit(1);
21: }
22:
23: if ((pch = rindex(argv[1], '/')) == NULL)
24: puts(".");
25: else
26: if (pch == argv[1])
27: puts("/");
28: else {
29: *pch ='\0';
30: puts(argv[1]);
31: }
32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.