X-Git-Url: https://git.saurik.com/apple/system_cmds.git/blobdiff_plain/d904471cf60febf9484bc16c29e58e92baf2b9cc..50f84f3edf8c5d2478e7ac178963d1664fa44630:/vipw.tproj/vipw.c diff --git a/vipw.tproj/vipw.c b/vipw.tproj/vipw.c index d15932b..4bbad91 100644 --- a/vipw.tproj/vipw.c +++ b/vipw.tproj/vipw.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * Copyright (c) 1999-2016 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * + * * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights * Reserved. This file contains Original Code and/or Modifications of * Original Code as defined in and that are subject to the Apple Public @@ -10,7 +10,7 @@ * except in compliance with the License. Please obtain a copy of the * License at http://www.apple.com/publicsource and read it before using * this file. - * + * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, @@ -18,7 +18,7 @@ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License." - * + * * @APPLE_LICENSE_HEADER_END@ */ /* @@ -54,14 +54,15 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = +__unused static char copyright[] = "@(#) Copyright (c) 1987, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)vipw.c 8.3 (Berkeley) 4/2/94"; +__unused static char sccsid[] = "@(#)vipw.c 8.3 (Berkeley) 4/2/94"; #endif /* not lint */ #include @@ -82,9 +83,7 @@ void copyfile __P((int, int)); void usage __P((void)); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int pfd, tfd; struct stat begin, end; @@ -96,7 +95,7 @@ main(argc, argv) default: usage(); } - + argc -= optind; argv += optind; @@ -127,12 +126,11 @@ main(argc, argv) } void -copyfile(from, to) - int from, to; +copyfile(int from, int to) { - int nr, nw, off; + long nr, nw, off; char buf[8*1024]; - + while ((nr = read(from, buf, sizeof(buf))) > 0) for (off = 0; off < nr; nr -= nw, off += nw) if ((nw = write(to, buf + off, nr)) < 0) @@ -142,9 +140,8 @@ copyfile(from, to) } void -usage() +usage(void) { - (void)fprintf(stderr, "usage: vipw\n"); exit(1); }