Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_posix/sys/src/cmd/bind.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
 
4
void	usage(void);
5
 
6
void
7
main(int argc, char *argv[])
8
{
9
	ulong flag = 0;
10
	int qflag = 0;
11
 
12
	ARGBEGIN{
13
	case 'a':
14
		flag |= MAFTER;
15
		break;
16
	case 'b':
17
		flag |= MBEFORE;
18
		break;
19
	case 'c':
20
		flag |= MCREATE;
21
		break;
22
	case 'q':
23
		qflag = 1;
24
		break;
25
	default:
26
		usage();
27
	}ARGEND
28
 
29
	if(argc != 2 || (flag&MAFTER)&&(flag&MBEFORE))
30
		usage();
31
 
32
	if(bind(argv[0], argv[1], flag) < 0){
33
		if(qflag)
34
			exits(0);
35
		/* try to give a less confusing error than the default */
36
		if(access(argv[0], 0) < 0)
37
			fprint(2, "bind: %s: %r\n", argv[0]);
38
		else if(access(argv[1], 0) < 0)
39
			fprint(2, "bind: %s: %r\n", argv[1]);
40
		else
41
			fprint(2, "bind %s %s: %r\n", argv[0], argv[1]);
42
		exits("bind");
43
	}
44
	exits(0);
45
}
46
 
47
void
48
usage(void)
49
{
50
	fprint(2, "usage: bind [-q] [-b|-a|-c|-bc|-ac] new old\n");
51
	exits("usage");
52
}