Deleted Added
sdiff udiff text old ( 241014 ) new ( 249948 )
full compact
1/*-
2 * Copyright (c) 1990, 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

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

34 The Regents of the University of California. All rights reserved.\n";
35#endif /* not lint */
36
37#ifndef lint
38static char sccsid[] = "@(#)rm.c 8.5 (Berkeley) 4/18/94";
39#endif /* not lint */
40#endif
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/bin/rm/rm.c 241014 2012-09-27 23:31:12Z mdf $");
43
44#include <sys/stat.h>
45#include <sys/param.h>
46#include <sys/mount.h>
47
48#include <err.h>
49#include <errno.h>
50#include <fcntl.h>
51#include <fts.h>
52#include <grp.h>
53#include <pwd.h>
54#include <stdint.h>
55#include <stdio.h>
56#include <stdlib.h>
57#include <string.h>
58#include <sysexits.h>
59#include <unistd.h>
60
61static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
62static int rflag, Iflag;
63static uid_t uid;
64static volatile sig_atomic_t info;
65
66int check(char *, char *, struct stat *);
67int check2(char **);
68void checkdot(char **);
69void checkslash(char **);
70void rm_file(char **);

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

101 argc -= optind;
102 argv += optind;
103 if (argc != 1)
104 usage();
105 rm_file(&argv[0]);
106 exit(eval);
107 }
108
109 Pflag = rflag = 0;
110 while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1)
111 switch(ch) {
112 case 'd':
113 dflag = 1;
114 break;
115 case 'f':
116 fflag = 1;
117 iflag = 0;
118 break;

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

131 rflag = 1;
132 break;
133 case 'v':
134 vflag = 1;
135 break;
136 case 'W':
137 Wflag = 1;
138 break;
139 default:
140 usage();
141 }
142 argc -= optind;
143 argv += optind;
144
145 if (argc < 1) {
146 if (fflag)

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

191 */
192#define SKIPPED 1
193
194 flags = FTS_PHYSICAL;
195 if (!needstat)
196 flags |= FTS_NOSTAT;
197 if (Wflag)
198 flags |= FTS_WHITEOUT;
199 if (!(fts = fts_open(argv, flags, NULL))) {
200 if (fflag && errno == ENOENT)
201 return;
202 err(1, "fts_open");
203 }
204 while ((p = fts_read(fts)) != NULL) {
205 switch (p->fts_info) {
206 case FTS_DNR:

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

619 }
620}
621
622void
623usage(void)
624{
625
626 (void)fprintf(stderr, "%s\n%s\n",
627 "usage: rm [-f | -i] [-dIPRrvW] file ...",
628 " unlink file");
629 exit(EX_USAGE);
630}
631
632static void
633siginfo(int sig __unused)
634{
635
636 info = 1;
637}