1221807Sstas/*-
2221807Sstas * Copyright (c) 2009 Stanislav Sedov <stas@FreeBSD.org>.
3221807Sstas * All rights reserved.
4221807Sstas *
5221807Sstas * Redistribution and use in source and binary forms, with or without
6221807Sstas * modification, are permitted provided that the following conditions
7221807Sstas * are met:
8221807Sstas * 1. Redistributions of source code must retain the above copyright
9221807Sstas *    notice, this list of conditions and the following disclaimer.
10221807Sstas * 2. Redistributions in binary form must reproduce the above copyright
11221807Sstas *    notice, this list of conditions and the following disclaimer in the
12221807Sstas *    documentation and/or other materials provided with the distribution.
13221807Sstas *
14221807Sstas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15221807Sstas * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16221807Sstas * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17221807Sstas * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18221807Sstas * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19221807Sstas * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20221807Sstas * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21221807Sstas * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22221807Sstas * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23221807Sstas * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24221807Sstas *
25221807Sstas */
26221807Sstas
27221807Sstas#include <sys/cdefs.h>
28221807Sstas__FBSDID("$FreeBSD$");
29221807Sstas
30221807Sstas#include <err.h>
31221807Sstas#include <libgen.h>
32221807Sstas#include <stdlib.h>
33221807Sstas#include <string.h>
34221807Sstas
35221807Sstas#include "functions.h"
36221807Sstas
37221807Sstasint
38221807Sstasmain(int argc, char *argv[])
39221807Sstas{
40221807Sstas	char *p;
41221807Sstas
42221807Sstas	p = basename(argv[0]);
43221807Sstas	if (p == NULL)
44221807Sstas		err(1, "basename(%s)", argv[0]);
45221807Sstas	if (!strcmp(p, "fuser"))
46221807Sstas		return (do_fuser(argc, argv));
47221807Sstas	else
48221807Sstas		return (do_fstat(argc, argv));
49221807Sstas}
50