Deleted Added
full compact
dirname.c (146466) dirname.c (188006)
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>
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 $");
44__FBSDID("$FreeBSD: head/usr.bin/dirname/dirname.c 188006 2009-02-02 11:19:56Z rwatson $");
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
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)
69 if (argc < 1)
70 usage();
71
70 usage();
71
72 if ((p = dirname(*argv)) == NULL)
73 err(1, "%s", *argv);
74 (void)printf("%s\n", p);
72 while (argc--) {
73 if ((p = dirname(*argv)) == NULL)
74 err(1, "%s", *argv);
75 argv++;
76 (void)printf("%s\n", p);
77 }
75 exit(0);
76}
77
78void
79usage(void)
80{
81
78 exit(0);
79}
80
81void
82usage(void)
83{
84
82 (void)fprintf(stderr, "usage: dirname string\n");
85 (void)fprintf(stderr, "usage: dirname string [...]\n");
83 exit(1);
84}
86 exit(1);
87}