Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161526335
D41756.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41756.diff
View Options
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -41,7 +41,6 @@
#endif
#include <sys/param.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
@@ -85,9 +84,9 @@
int
main(int argc, char **argv)
{
- int ch;
- int error;
- char *ep, *p;
+ const char *p;
+ char *ep;
+ int ch, error;
setlocale(LC_ALL, "");
@@ -157,17 +156,22 @@
argv += optind;
argc -= optind;
- if (*argv != NULL) { /* Input file. */
+ if (argc > 0) { /* Input file. */
if (strcmp(*argv, "-") == 0)
ifd = STDIN_FILENO;
else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
err(EX_NOINPUT, "%s", *argv);
++argv;
+ --argc;
}
- if (*argv != NULL) /* File name prefix. */
- if (strlcpy(fname, *argv++, sizeof(fname)) >= sizeof(fname))
- errx(EX_USAGE, "file name prefix is too long");
- if (*argv != NULL)
+ if (argc > 0) { /* File name prefix. */
+ if (strlcpy(fname, *argv, sizeof(fname)) >= sizeof(fname))
+ errx(EX_USAGE, "file name prefix is too long: %s",
+ *argv);
+ ++argv;
+ --argc;
+ }
+ if (argc > 0)
usage();
if (strlen(fname) + (unsigned long)sufflen >= sizeof(fname))
@@ -400,7 +404,6 @@
sufflen++;
/* Reset so we start back at all 'a's in our extended suffix. */
- tfnum = 0;
fnum = 0;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 5, 1:37 PM (4 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34711752
Default Alt Text
D41756.diff (1 KB)
Attached To
Mode
D41756: split: Code cleanup.
Attached
Detach File
Event Timeline
Log In to Comment