[Midnightbsd-cvs] src [6619] trunk/usr.sbin/mport/mport.c: return usage on mport exec without specifying package names for install, update or delete

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Mar 18 00:12:11 EDT 2014


Revision: 6619
          http://svnweb.midnightbsd.org/src/?rev=6619
Author:   laffer1
Date:     2014-03-18 00:12:10 -0400 (Tue, 18 Mar 2014)
Log Message:
-----------
return usage on mport exec without specifying package names for install, update or delete

Modified Paths:
--------------
    trunk/usr.sbin/mport/mport.c

Modified: trunk/usr.sbin/mport/mport.c
===================================================================
--- trunk/usr.sbin/mport/mport.c	2014-03-18 03:06:29 UTC (rev 6618)
+++ trunk/usr.sbin/mport/mport.c	2014-03-18 04:12:10 UTC (rev 6619)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010, 2011, 2013 Lucas Holt
+ * Copyright (c) 2010, 2011, 2013, 2014 Lucas Holt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD: src/usr.sbin/mport/mport.c,v 1.51 2013/09/07 19:50:08 laffer1 Exp $");
+__MBSDID("$MidnightBSD$");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -74,9 +74,17 @@
 	}
 
 	if (!strcmp(argv[1], "install")) {
+		if (argc == 2) {
+			mport_instance_free(mport);
+			usage();
+		}
 		loadIndex(mport);
 		resultCode = install(mport, argv[2]);
 	} else if (!strcmp(argv[1], "delete")) {
+		if (argc == 2) {
+			mport_instance_free(mport);
+			usage();
+		}
 		for (i = 2; i < argc; i++) {
 			tempResultCode = delete(argv[i]);
 			if (tempResultCode != 0)
@@ -83,6 +91,10 @@
 				resultCode = tempResultCode;
 		}
 	} else if (!strcmp(argv[1], "update")) {
+		if (argc == 2) { 
+			mport_instance_free(mport);
+			usage();
+		}
 		loadIndex(mport);
 		for (i = 2; i < argc; i++) {
 			tempResultCode = update(mport, argv[2]);



More information about the Midnightbsd-cvs mailing list