Two style related changes:

(1) use strlcpy instead of strncpy since the use here of the latter
    was incorrect.
(2) Move 'N' case into proper sorted order (sorted the same way that
    ls sorts its args).
This commit is contained in:
Warner Losh 2004-07-21 17:02:36 +00:00
parent 46e38ce826
commit 24412bd1af

View File

@ -122,13 +122,16 @@ main(int argc, char *argv[])
strcpy(prefix, _PATH_PWD);
makeold = 0;
username = NULL;
while ((ch = getopt(argc, argv, "Cd:ps:u:vN")) != -1)
while ((ch = getopt(argc, argv, "CNd:ps:u:v")) != -1)
switch(ch) {
case 'C': /* verify only */
Cflag = 1;
break;
case 'N': /* do not wait for lock */
nblock = LOCK_NB; /* will fail if locked */
break;
case 'd':
strncpy(prefix, optarg, sizeof prefix - 1);
strlcpy(prefix, optarg, sizeof(prefix));
break;
case 'p': /* create V7 "file.orig" */
makeold = 1;
@ -141,9 +144,6 @@ main(int argc, char *argv[])
break;
case 'v': /* backward compatible */
break;
case 'N': /* do not wait for lock */
nblock = LOCK_NB;
break;
default:
usage();
}