diff toys/swapon.c @ 483:26db0cd433f3

Minor tweaks.
author Rob Landley <rob@landley.net>
date Sun, 19 Feb 2012 17:37:49 -0600
parents b4a9fd8773d6
children
line wrap: on
line diff
--- a/toys/swapon.c	Sat Feb 18 15:33:27 2012 +0100
+++ b/toys/swapon.c	Sun Feb 19 17:37:49 2012 -0600
@@ -12,9 +12,9 @@
 	bool "swapon"
 	default y
 	help
-	  usage: swapon swapregion
+	  usage: swapon [-p priority] filename
 
-	  Enable swapping on a given swapregion.
+	  Enable swapping on a given device/file.
 */
 
 #include "toys.h"
@@ -30,9 +30,8 @@
 	int flags = 0;
 
 	if (toys.optflags & 1)
-		flags = SWAP_FLAG_PREFER |
-			((TT.priority & SWAP_FLAG_PRIO_MASK) << SWAP_FLAG_PRIO_SHIFT);
+		flags = SWAP_FLAG_PREFER | (TT.priority << SWAP_FLAG_PRIO_SHIFT);
 
-	if (swapon(toys.optargs[0], flags))
-		perror_exit("failed to enable swaparea");
+	if (swapon(*toys.optargs, flags))
+		perror_exit("Couldn't swapon '%s'", *toys.optargs);
 }