X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id D4D22DC01FF for ; Sun, 30 Jun 2013 08:02:20 +0000 (UTC) Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 347EB20FBB for ; Sun, 30 Jun 2013 04:02:20 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute2.internal (MEProxy); Sun, 30 Jun 2013 04:02:20 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :in-reply-to:references; s=smtpout; bh=W6iQTplGUS/excdUe14Ijj+yH l0=; b=CGohlZf3UyzTSZ7AVZFPJF1J42cPKDLXzMKVeVpNNxGZdzE1JQjk2miuc vPHvJCUtAPzfCqpKGFU5JmLHQlJgBJdqt7v6b3/YTrYcfGUfteAIxSjO41jDw7KW KRDTrXtKi3/vV0GTOK5oPc5/06BwlbQuuCBqlOgd8V1n66vNaE= X-Sasl-enc: 6VVcmsWZHAIZA3LIfczeYPEGq5EeseiBsPrDM3tnjPbM 1372579339 Received: from localhost (unknown [69.86.161.244]) by mail.messagingengine.com (Postfix) with ESMTPA id E6591680254 for ; Sun, 30 Jun 2013 04:02:19 -0400 (EDT) From: Dubiousjim To: alpine-devel@lists.alpinelinux.org Subject: [alpine-devel] [PATCH 2/2] apk: infrastructure for short-option-only synonyms Date: Sun, 30 Jun 2013 04:02:19 -0400 Message-Id: <6e2248ca48687bc77837f1ef6fb8784f8c0a70ff.1372579185.git.dubiousjim@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: --- src/apk.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/apk.c b/src/apk.c index 17e87d5..a236b37 100644 --- a/src/apk.c +++ b/src/apk.c @@ -111,13 +111,14 @@ static void print_usage(const char *cmd, const char *args, int num_opts, int i, j; indent.x = printf("\nusage: apk %s", cmd) - 1; - for (i = 0; i < num_opts; i++) { - j = 0; - word[j++] = '['; - j += format_option(&word[j], sizeof(word) - j, &opts[i], "|"); - word[j++] = ']'; - apk_print_indented(&indent, APK_BLOB_PTR_LEN(word, j)); - } + for (i = 0; i < num_opts; i++) + if (opts[i].name != NULL) { + j = 0; + word[j++] = '['; + j += format_option(&word[j], sizeof(word) - j, &opts[i], "|"); + word[j++] = ']'; + apk_print_indented(&indent, APK_BLOB_PTR_LEN(word, j)); + } if (args != NULL) apk_print_indented(&indent, APK_BLOB_STR(args)); printf("\n"); @@ -230,7 +231,7 @@ static void merge_options(struct option *opts, struct apk_option *ao, int num) int i; for (i = 0; i < num; i++, opts++, ao++) { - opts->name = ao->name; + opts->name = ao->name ?: ""; opts->has_arg = ao->has_arg; opts->flag = NULL; opts->val = ao->val; -- 1.8.3.1 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---