rm.c (82725ba9bf1fd59746a4006a06f24d4d61d142f2) rm.c (19b4f0dca0cf914fa9a60c824f5dfe6be962c703)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

96 * "unlink", for which the functionality provided is greatly
97 * simplified.
98 */
99 if ((p = strrchr(argv[0], '/')) == NULL)
100 p = argv[0];
101 else
102 ++p;
103 if (strcmp(p, "unlink") == 0) {
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

96 * "unlink", for which the functionality provided is greatly
97 * simplified.
98 */
99 if ((p = strrchr(argv[0], '/')) == NULL)
100 p = argv[0];
101 else
102 ++p;
103 if (strcmp(p, "unlink") == 0) {
104 while (getopt(argc, argv, "") != -1)
104 if (argc == 2)
105 rm_file(&argv[1]);
106 else if (argc == 3 && strcmp(argv[1], "--") == 0)
107 rm_file(&argv[2]);
108 else
105 usage();
109 usage();
106 argc -= optind;
107 argv += optind;
108 if (argc != 1)
109 usage();
110 rm_file(&argv[0]);
111 exit(eval);
112 }
113
114 Pflag = rflag = xflag = 0;
115 while ((ch = getopt(argc, argv, "dfiIPRrvWx")) != -1)
116 switch(ch) {
117 case 'd':
118 dflag = 1;

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

629}
630
631static void
632usage(void)
633{
634
635 (void)fprintf(stderr, "%s\n%s\n",
636 "usage: rm [-f | -i] [-dIPRrvWx] file ...",
110 exit(eval);
111 }
112
113 Pflag = rflag = xflag = 0;
114 while ((ch = getopt(argc, argv, "dfiIPRrvWx")) != -1)
115 switch(ch) {
116 case 'd':
117 dflag = 1;

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

628}
629
630static void
631usage(void)
632{
633
634 (void)fprintf(stderr, "%s\n%s\n",
635 "usage: rm [-f | -i] [-dIPRrvWx] file ...",
637 " unlink file");
636 " unlink [--] file");
638 exit(EX_USAGE);
639}
640
641static void
642siginfo(int sig __unused)
643{
644
645 info = 1;
646}
637 exit(EX_USAGE);
638}
639
640static void
641siginfo(int sig __unused)
642{
643
644 info = 1;
645}