Use warn(3).

This commit is contained in:
Philippe Charnier 1997-06-19 14:40:41 +00:00
parent 64c12016e7
commit 6da7f3783b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26740

View File

@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*
* $Id$
*/ */
#ifndef lint #ifndef lint
@ -46,8 +48,10 @@ static char sccsid[] = "@(#)swapon.c 8.1 (Berkeley) 6/5/93";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include <err.h>
void usage __P((void)); static void usage __P((void));
int add __P((char *name, int ignoreebusy)); int add __P((char *name, int ignoreebusy));
int int
@ -100,13 +104,10 @@ add(char *name, int ignoreebusy)
switch (errno) { switch (errno) {
case EBUSY: case EBUSY:
if (!ignoreebusy) if (!ignoreebusy)
fprintf(stderr, warnx("%s: device already in use", name);
"swapon: %s: device already in use\n",
name);
break; break;
default: default:
fprintf(stderr, "swapon: %s: ", name); warn("%s", name);
perror((char *)NULL);
break; break;
} }
return(1); return(1);
@ -114,7 +115,7 @@ add(char *name, int ignoreebusy)
return(0); return(0);
} }
void static void
usage() usage()
{ {
fprintf(stderr, "usage: swapon [-a] [special_file ...]\n"); fprintf(stderr, "usage: swapon [-a] [special_file ...]\n");