summaryrefslogtreecommitdiff
path: root/dyadic.c
blob: 8136bb5734ed5d3cbd44caab3fbd27b0766f2512 (plain)
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
#include "internal.h"
#include <stdio.h>

extern int
dyadic_main(
 struct FileInfo *	i
,int				argc
,char * *			argv)
{
	int		flags;

	i->dyadic = 1;
	i->destination = argv[argc - 1];

	for ( flags = 0; flags < (argc - 1) && argv[flags + 1][0] == '-' ; flags++ )
		;
	if ( argc - flags < 3 ) {
		usage(i->applet->usage);
		return 1;
	}
	else if ( argc - flags > 3 ) {
		if ( !is_a_directory(i->destination) ) {
			fprintf(stderr, "%s: not a directory.\n", i->destination);
			return 1;
		}
	}
	return monadic_main(i, argc - 1, argv);
}