vsta

Check-in [879326aa9d]
Login

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

Overview
Comment:Add dirname(1)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:879326aa9d9e7cf27ddee5ca58989dc88c018c7464bd7df0c2a35657eb4780d6
User & Date: vandys 2001-12-19 13:26:12
Context
2001-12-19
21:41
Make namer name and disk block device name available via stat(). check-in: 270aa604dc user: vandys tags: master, trunk
13:26
Add dirname(1) check-in: 879326aa9d user: vandys tags: master, trunk
2001-12-18
10:06
Add support for preallocating contiguous files. Fix exposure to invalid arguments in stat(). Add info on file allocation so we can determine sector address of a given file from stat() results. check-in: e2e9f5f71e user: vandys tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added vsta/src/bin/cmds/dirname.c.































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * dirname.c
 *	Print directory name of path
 */
#include <stdio.h>
#include <string.h>

main(int argc, char **argv)
{
	int i;
	char *p;

	/*
	 * Usage
	 */
	if (argc != 2) {
		fprintf(stderr, "Usage is: %s <path>\n", argv[0]);
		return(1);
	}

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

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

Changes to vsta/src/bin/cmds/makefile.

1
2
3
4

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
144
145
146
147
148
149
150



151
152
153
154
OUT=test args cat id ls swapd rm cp sleep mkdir pwd kill mv stat \
	dumpsect fstab rmdir touch strings xargs echo du \
	tput basename uname fmt purge printf ps rcsdo changed \
	which true false whoami egrep fgrep awk cc [ view ascii


OBJS= args.o basename.o cat.o changed.o chmod.o cp.o du.o dumpsect.o \
	echo.o fmt.o fstab.o id.o kill.o ls.o mkdir.o \
	mv.o printf.o ps.o purge.o pwd.o rcsdo.o rm.o rmdir.o \
	sleep.o stat.o strings.o swapd.o test.o touch.o tput.o \
	uname.o wc.o which.o xargs.o dump.o operators.o true.o \
	false.o whoami.o egrep.o fgrep.o awk.o cc.o [.o view.o \
	ascii.o

include ../../makefile.all

rcsdo: rcsdo.o
	$(LD) $(LDFLAGS) -o rcsdo $(CRT0) rcsdo.o -lc

changed: changed.o
................................................................................

view: view.o
	$(LD) $(LDFLAGS) -o view $(CRT0) view.o -lc

ascii: ascii.o
	$(LD) $(LDFLAGS) -o ascii $(CRT0) ascii.o -lc




install: all
	strip $(OUT)
	cp $(OUT) $(ROOT)/bin
	cp man.sh $(ROOT)/bin/man



|
>







|







 







>
>
>




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
OUT=test args cat id ls swapd rm cp sleep mkdir pwd kill mv stat \
	dumpsect fstab rmdir touch strings xargs echo du \
	tput basename uname fmt purge printf ps rcsdo changed \
	which true false whoami egrep fgrep awk cc [ view ascii \
	dirname

OBJS= args.o basename.o cat.o changed.o chmod.o cp.o du.o dumpsect.o \
	echo.o fmt.o fstab.o id.o kill.o ls.o mkdir.o \
	mv.o printf.o ps.o purge.o pwd.o rcsdo.o rm.o rmdir.o \
	sleep.o stat.o strings.o swapd.o test.o touch.o tput.o \
	uname.o wc.o which.o xargs.o dump.o operators.o true.o \
	false.o whoami.o egrep.o fgrep.o awk.o cc.o [.o view.o \
	ascii.o dirname.o

include ../../makefile.all

rcsdo: rcsdo.o
	$(LD) $(LDFLAGS) -o rcsdo $(CRT0) rcsdo.o -lc

changed: changed.o
................................................................................

view: view.o
	$(LD) $(LDFLAGS) -o view $(CRT0) view.o -lc

ascii: ascii.o
	$(LD) $(LDFLAGS) -o ascii $(CRT0) ascii.o -lc

dirname: dirname.o
	$(LD) $(LDFLAGS) -o dirname $(CRT0) dirname.o -lc

install: all
	strip $(OUT)
	cp $(OUT) $(ROOT)/bin
	cp man.sh $(ROOT)/bin/man