Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbaF2HTO (ORCPT ); Sun, 29 Jun 2014 03:19:14 -0400 Received: from mail-qc0-f179.google.com ([209.85.216.179]:41907 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752487AbaF2HTL (ORCPT ); Sun, 29 Jun 2014 03:19:11 -0400 MIME-Version: 1.0 In-Reply-To: References: <1402996306-6811-1-git-send-email-andriy.shevchenko@linux.intel.com> <1402996306-6811-3-git-send-email-andriy.shevchenko@linux.intel.com> Date: Sun, 29 Jun 2014 00:19:10 -0700 X-Google-Sender-Auth: k26a6I7DSVLQ8C5YLUFiH1iWxxQ Message-ID: Subject: Re: [PATCH v2 2/2] lib.c: skip --param parameters From: Christopher Li To: Andy Shevchenko Cc: Josh Triplett , linux-kernel , Linux-Sparse Content-Type: multipart/mixed; boundary=001a1132f770dd479904fcf45b40 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --001a1132f770dd479904fcf45b40 Content-Type: text/plain; charset=ISO-8859-1 Hi Andy, On Sat, Jun 28, 2014 at 9:59 AM, Christopher Li wrote: > I think this is problematic.There are three possible input > from args: > 1) "--parm", you need to ++next skip to next arg, which is the value for parm. > 2) "--parm=x", you don't need to skip to next arg. > 3) "--parm-with-crap", invalid argument. You don't need to skip next arg. How about this patch, I modify from your patch. It fix the problem I mention earlier. If no objections, I will push the change. Chris --001a1132f770dd479904fcf45b40 Content-Type: text/x-patch; charset=US-ASCII; name="0001-lib.c-skip-param-parameters.patch" Content-Disposition: attachment; filename="0001-lib.c-skip-param-parameters.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hx00yvwn0 RnJvbSBkOTE3NjYyZDU0YmE2OGQwYzNiMDNlOTk0Y2IxZmE2NmQ3YjE5YzMwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBbmR5IFNoZXZjaGVua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g== --001a1132f770dd479904fcf45b40-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/