vsta

Check-in [90a5182f46]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Handle edge case of entries in rootdir
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:90a5182f46167c003a2af9afbd038e93093d2f009e47e0777360e2cb7f8cdda3
User & Date: vandys 2001-12-19 22:11:14
Context
2001-12-19
22:16
Fix cleanup of other objects check-in: fc075e5967 user: vandys tags: master, trunk
22:11
Handle edge case of entries in rootdir check-in: 90a5182f46 user: vandys tags: master, trunk
22:10
Fix error message (duh) check-in: 2998b01bb1 user: vandys tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to vsta/src/bin/cmds/dirname.c.

19
20
21
22
23
24
25






26

27
28
29
30
31
	}

	/*
	 * Trim path
	 */
	p = strrchr(argv[1], '/');
	if (p) {






		*p = '\0';

	}

	puts(argv[1]);
	return(0);
}







>
>
>
>
>
>
|
>





19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
	}

	/*
	 * Trim path
	 */
	p = strrchr(argv[1], '/');
	if (p) {
		/*
		 * Map /foo -> /, but / -> (blank)
		 */
		if ((p == argv[1]) && p[1]) {
			p[1] = '\0';
		} else {
			*p = '\0';
		}
	}

	puts(argv[1]);
	return(0);
}