From 2fe6ccee025915304ce8ce384337ed9c7094cea8 Mon Sep 17 00:00:00 2001 From: kyak Date: Wed, 28 Jul 2010 19:37:46 +0400 Subject: [PATCH] fbsize, a small utility to show current terminal size --- fbsize/Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ fbsize/fbsize | Bin 0 -> 6521 bytes fbsize/files/fbsize.c | 19 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 fbsize/Makefile create mode 100755 fbsize/fbsize create mode 100644 fbsize/files/fbsize.c diff --git a/fbsize/Makefile b/fbsize/Makefile new file mode 100644 index 0000000..84a7706 --- /dev/null +++ b/fbsize/Makefile @@ -0,0 +1,40 @@ +# +# kyak@freenode/#qi-hardware +# +# This is free software, licensed under the GNU General Public License v2. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=fbsize +PKG_VERSION:=0.0.1 +PKG_RELEASE:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/fbsize + SECTION:=utils + CATEGORY:=Utilities + TITLE:=fbsize shows current terminal size + SUBMENU:=Terminal +endef + +define Package/fbsize/description + fbsize, a dummy utility to show current terminal size (might be handy) +endef + +define Build/Compile + $(TARGET_CC) -o fbsize ./files/fbsize.c +endef + +define Package/fbsize/install + $(INSTALL_DIR) \ + $(1)/usr/bin + + $(INSTALL_BIN) \ + fbsize \ + $(1)/usr/bin/fbsize + +endef + +$(eval $(call BuildPackage,fbsize)) diff --git a/fbsize/fbsize b/fbsize/fbsize new file mode 100755 index 0000000000000000000000000000000000000000..b33345bb1509173341cb318fa22a300a3d7c8bf2 GIT binary patch literal 6521 zcmb7IZ){sv6+iaNAJ_X+rwh!3ZnHOc38Hven@!U&=s8ZBX3Nshc7lx$FOKabo}AdS zUq*^17DfkSlqG^nXi`A|b*N&6WL1Ri9qGP%e)pVv?z#Woz4tsdFuW%a2uMIQ1tp|-yWN&v6xFX6X^qHeuf!nfmbly| zZ78R#SEyr)ssID6C~HBoCdK#tT2%tV>jPGv8cy^t|QQO-oUPY1|WD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S6(LPEQ|_^7!M0oQv|^ zy~d4!k$%;PZqy()Y54UP)s$yato`TG^S(&g4r4aYpy=%MA2C zvVTB@-O_^tCJd&dXU%Yz4scCYoP4oX@deec4%%HKC}-R2F)$s5Q^V=`uHF%wg!BA0 zo3XcMh)u`f*29D!jPCiOaVp%$E;Ot1z2e36O!V%W(Lfc!yDA#!#R&ZtuN9(HF~I)= D7X{cK literal 0 HcmV?d00001 diff --git a/fbsize/files/fbsize.c b/fbsize/files/fbsize.c new file mode 100644 index 0000000..556dfa0 --- /dev/null +++ b/fbsize/files/fbsize.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +int +main(int argc,char **argv) +{ +struct winsize ws; + +if (ioctl(0,TIOCGWINSZ,&ws)!=0) { +fprintf(stderr,"TIOCGWINSZ:%s\n",strerror(errno)); +exit(1); +} +printf("row=%d, col=%d, xpixel=%d, ypixel=%d\n", +ws.ws_row,ws.ws_col,ws.ws_xpixel,ws.ws_ypixel); +return 0; +}