Deleted Added
sdiff udiff text old ( 146466 ) new ( 188006 )
full compact
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 27 unchanged lines hidden (view full) ---

36"@(#) Copyright (c) 1991, 1993, 1994\n\
37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41static const char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
42#endif /* not lint */
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/usr.bin/dirname/dirname.c 146466 2005-05-21 09:55:10Z ru $");
45
46#include <err.h>
47#include <libgen.h>
48#include <stdio.h>
49#include <stdlib.h>
50#include <unistd.h>
51
52void usage(void);

--- 8 unchanged lines hidden (view full) ---

61 switch(ch) {
62 case '?':
63 default:
64 usage();
65 }
66 argc -= optind;
67 argv += optind;
68
69 if (argc != 1)
70 usage();
71
72 if ((p = dirname(*argv)) == NULL)
73 err(1, "%s", *argv);
74 (void)printf("%s\n", p);
75 exit(0);
76}
77
78void
79usage(void)
80{
81
82 (void)fprintf(stderr, "usage: dirname string\n");
83 exit(1);
84}