int	status;

main(argc, argv)
int argc;
char **argv;
{
register i;
register char *c1, *c2;
char dirname[100];

if(argc < 3)
	{
	prs("arg count\n");
	exit(1);
	}
argc--;
c1 = dirname;
c2 = argv[argc];
while(*c1++ = *c2++);
c1[-1] = '/';
c1[0] = '.';
c1[1] = '\0';
if(filetype(dirname) !=  4)
	{
	prs(dirname);
	prs(" is not a directory.\n");
	exit(1);
	}

for(i=1; i<argc; i++) 
	{
	if(filetype(argv[i]) != 0)
		{
		prs(argv[i]);
		prs(" is not an ordinary file.\n");
		}
	else if(fork() == 0)
		{
		execl("/bin/mv", "mv", argv[i], dirname,0);
		exit(1);
		}
	else wait(&status);
	}
}

filetype(filename)
char *filename;
{
struct	{
	char minor;
	char major;
	int inumber;
	int flags;
	char nlinks;
	char uid;
	char gid;
	char size0;
	int size1;
	int addr[8];
	long int actime;
	long int modtim;
	} buf;

if(stat(filename,&buf) < 0) 
	return(-1);
else return( (buf.flags&060000)>>12 );
}


prs(s)
register char *s;
{
while(*s)
	write(2, s++, 1);
}
