From patchwork Thu Nov 1 11:39:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 196170 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 6BC322C0312 for ; Thu, 1 Nov 2012 22:40:08 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 43AA14A573; Thu, 1 Nov 2012 12:39:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id htQZZ46hOD61; Thu, 1 Nov 2012 12:39:52 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8FB174A574; Thu, 1 Nov 2012 12:39:36 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B19454A562 for ; Thu, 1 Nov 2012 12:39:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pLA8fymJglFP for ; Thu, 1 Nov 2012 12:39:33 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ea0-f172.google.com (mail-ea0-f172.google.com [209.85.215.172]) by theia.denx.de (Postfix) with ESMTPS id 07A984A565 for ; Thu, 1 Nov 2012 12:39:30 +0100 (CET) Received: by mail-ea0-f172.google.com with SMTP id k13so1052978eaa.3 for ; Thu, 01 Nov 2012 04:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Foyn43M1MNJMGrSizuWmfWCBg676dHMWpUXR4TuAHIU=; b=KRNry8dvhlSwLMrF2WoIQoZYdbRZdxYWDBIOZR4rfeK+3+THXpVRnF8iG+Jrlj1sw2 RnhmQtBxhl/IWguofa5T3IHVDuuL2QdhGaxV5yP4mS61d+u9Ms5GcLLpsGzrxsBn97HD ijpqQb0NqxL/xr2znyt63aVCVXAIideCTyLEQ01eYceEcNPnFoFhYeIRP6dgQgFNvHt5 b8+xfgRFVk/PVrE+PQjgGw8h3DYDFkPOHS4rt6rc22nXC4R/CDdGnFw1ogAS99oBC3Fe 6GLI1BPZfK8c8tiXMG8TMIKUmZrUlEiNBaS7PkQEQ/WNkQqlB2Xl8YiT98T0GuietUwg a+rQ== Received: by 10.14.215.69 with SMTP id d45mr96234504eep.16.1351769969991; Thu, 01 Nov 2012 04:39:29 -0700 (PDT) Received: from Pali-EliteBook.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPS id d44sm13984543eeo.10.2012.11.01.04.39.28 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Nov 2012 04:39:29 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: u-boot@lists.denx.de Date: Thu, 1 Nov 2012 12:39:12 +0100 Message-Id: <1351769953-13560-4-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1351769953-13560-1-git-send-email-pali.rohar@gmail.com> References: <1338136729-3907-1-git-send-email-pali.rohar@gmail.com> <1351769953-13560-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Cc: Marcel Mol , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [U-Boot] [PATCH v2 3/4] New command clear: Clear the ANSI terminal X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch adding new simple command clear which clear ANSI terminal. Signed-off-by: Pali Rohár Cc: Marcel Mol --- This patch was in Nokia RX-51 patch series (v2). Changes since RX-51 patch v2: - Removed from include/config_cmd_all.h - Removed ANSI escape codes (now in BootMenu command patch) Changes since original version: - Renamed command clr to clear - Use puts instead printf - Move cursor to pos1,1 common/Makefile | 1 + common/cmd_clear.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 common/cmd_clear.c diff --git a/common/Makefile b/common/Makefile index 1435992..328ca49 100644 --- a/common/Makefile +++ b/common/Makefile @@ -70,6 +70,7 @@ COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o +COBJS-$(CONFIG_CMD_CLEAR) += cmd_clear.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o diff --git a/common/cmd_clear.c b/common/cmd_clear.c new file mode 100644 index 0000000..29b4718 --- /dev/null +++ b/common/cmd_clear.c @@ -0,0 +1,43 @@ +/* + * Copyright 2011 + * Marcel Mol, MESA Consulting, marcel@mesa.nl + * + * Copyright 2011 + * Pali Rohár, pali.rohar@gmail.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include + +static int do_clear(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + puts(ANSI_CLEAR_CONSOLE); + printf(ANSI_CURSOR_POSITION, 1, 1); + return 0; +} + +U_BOOT_CMD( + clear, CONFIG_SYS_MAXARGS, 1, do_clear, + "clear", + "\n" + " - clear screen and move cursor to top of screen" +);