[Debian-hebrew-package] r804 - in /pkg/bidiv/trunk: bidiv.c debian/changelog debian/patches/series debian/patches/term_size_get term.c term.h
tzafrir at users.alioth.debian.org
tzafrir at users.alioth.debian.org
Sat Apr 10 22:58:48 UTC 2010
Author: tzafrir
Date: Sat Apr 10 22:58:47 2010
New Revision: 804
URL: http://svn.debian.org/wsvn/debian-hebrew/?sc=1&rev=804
Log:
Patch term_size_get: properly check terminal width (originally in diff)
Added:
pkg/bidiv/trunk/debian/patches/term_size_get
Modified:
pkg/bidiv/trunk/bidiv.c
pkg/bidiv/trunk/debian/changelog
pkg/bidiv/trunk/debian/patches/series
pkg/bidiv/trunk/term.c
pkg/bidiv/trunk/term.h
Modified: pkg/bidiv/trunk/bidiv.c
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/bidiv/trunk/bidiv.c?rev=804&op=diff
==============================================================================
--- pkg/bidiv/trunk/bidiv.c (original)
+++ pkg/bidiv/trunk/bidiv.c Sat Apr 10 22:58:47 2010
@@ -30,8 +30,6 @@
#include <langinfo.h>
#include <string.h>
#endif
-
-#include "term.h"
char *progname;
@@ -233,15 +231,23 @@
main(int argc, char *argv[])
{
FILE *fp;
- int c;
+ char *s;
+ int i,c;
int status=0;
/* TODO: get width from tty setup, COLUMNS variable, and/or
command line option */
progname=argv[0];
- /* Read the size from the tty or the COLUMNS var, default to 80 otherwise */
- width = term_size_get();
+ /* The COLUMNS variable (set by zsh and bash, for example)
+ overrides the default 'width'.
+ TODO: also try to read the column number directly from the tty.
+ */
+ if((s=getenv("COLUMNS"))){
+ i=atoi(s);
+ if(i>0)
+ width=i;
+ }
#ifdef HAVE_LOCALE
setlocale(LC_CTYPE, "");
Modified: pkg/bidiv/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/bidiv/trunk/debian/changelog?rev=804&op=diff
==============================================================================
--- pkg/bidiv/trunk/debian/changelog (original)
+++ pkg/bidiv/trunk/debian/changelog Sat Apr 10 22:58:47 2010
@@ -9,13 +9,14 @@
[ Tzafrir Cohen ]
* Patch fribidi_019: Fix bidiv for fribidi 0.19 (Closes: #568130, #571351).
- * Add myself as uploader.
+ * Add myself as uploader.
* Standards version 3.8.4 (no change needed).
* Correct path to license file in debian/copyright.
- * Missing ${misc:Depends} debhelper deps.
- * Patch hyphen_minus: hyphen/minus in man page (originally part of the diff).
+ * Missing ${misc:Depends} debhelper deps.
+ * Patch hyphen_minus: hyphen/minus in man page (originally in diff).
+ * Patch term_size_get: properly check terminal width (originally in diff).
- -- Tzafrir Cohen <tzafrir at debian.org> Sun, 11 Apr 2010 01:47:21 +0300
+ -- Tzafrir Cohen <tzafrir at debian.org> Sun, 11 Apr 2010 01:57:03 +0300
bidiv (1.5-3) unstable; urgency=low
Modified: pkg/bidiv/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/bidiv/trunk/debian/patches/series?rev=804&op=diff
==============================================================================
--- pkg/bidiv/trunk/debian/patches/series (original)
+++ pkg/bidiv/trunk/debian/patches/series Sat Apr 10 22:58:47 2010
@@ -1,2 +1,3 @@
fribidi_019
hyphen_minus
+term_size_get
Added: pkg/bidiv/trunk/debian/patches/term_size_get
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/bidiv/trunk/debian/patches/term_size_get?rev=804&op=file
==============================================================================
--- pkg/bidiv/trunk/debian/patches/term_size_get (added)
+++ pkg/bidiv/trunk/debian/patches/term_size_get Sat Apr 10 22:58:47 2010
@@ -1,0 +1,78 @@
+Description: properly check terminal width
+Author: Baruch Even <baruch at debian.org>
+
+--- bidiv-1.5.orig/bidiv.c
++++ bidiv-1.5/bidiv.c
+@@ -31,6 +31,8 @@
+ #include <string.h>
+ #endif
+
++#include "term.h"
++
+ char *progname;
+
+ int width=80;
+@@ -226,23 +233,15 @@
+ main(int argc, char *argv[])
+ {
+ FILE *fp;
+- char *s;
+- int i,c;
++ int c;
+ int status=0;
+
+ /* TODO: get width from tty setup, COLUMNS variable, and/or
+ command line option */
+ progname=argv[0];
+
+- /* The COLUMNS variable (set by zsh and bash, for example)
+- overrides the default 'width'.
+- TODO: also try to read the column number directly from the tty.
+- */
+- if((s=getenv("COLUMNS"))){
+- i=atoi(s);
+- if(i>0)
+- width=i;
+- }
++ /* Read the size from the tty or the COLUMNS var, default to 80 otherwise */
++ width = term_size_get();
+
+ #ifdef HAVE_LOCALE
+ setlocale(LC_CTYPE, "");
+--- bidiv-1.5.orig/term.h
++++ bidiv-1.5/term.h
+@@ -0,0 +1,9 @@
++#ifndef _TERM_H_
++#define _TERM_H_
++
++/* Returns terminal size, attempt to get it from tty, COLUMNS or default to 80
++ * otherwise
++ */
++int term_size_get(void);
++
++#endif
+--- bidiv-1.5.orig/term.c
++++ bidiv-1.5/term.c
+@@ -0,0 +1,22 @@
++#include <sys/ioctl.h>
++#include <stdlib.h>
++#include <limits.h>
++#include "term.h"
++
++int term_size_get(void)
++{
++ struct winsize win;
++ int cols;
++ char *col_str;
++ int err;
++
++ err = ioctl(1, TIOCGWINSZ, (char *)&win);
++ if (err != -1 && win.ws_col > 0)
++ return win.ws_col;
++
++ col_str = getenv("COLUMNS");
++ if (!col_str || (cols = atoi(col_str)) <= 0 || cols == INT_MAX)
++ cols = 80;
++
++ return cols;
++}
Modified: pkg/bidiv/trunk/term.c
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/bidiv/trunk/term.c?rev=804&op=diff
==============================================================================
--- pkg/bidiv/trunk/term.c (original)
+++ pkg/bidiv/trunk/term.c Sat Apr 10 22:58:47 2010
@@ -1,22 +1,0 @@
-#include <sys/ioctl.h>
-#include <stdlib.h>
-#include <limits.h>
-#include "term.h"
-
-int term_size_get(void)
-{
- struct winsize win;
- int cols;
- char *col_str;
- int err;
-
- err = ioctl(1, TIOCGWINSZ, (char *)&win);
- if (err != -1 && win.ws_col > 0)
- return win.ws_col;
-
- col_str = getenv("COLUMNS");
- if (!col_str || (cols = atoi(col_str)) <= 0 || cols == INT_MAX)
- cols = 80;
-
- return cols;
-}
Modified: pkg/bidiv/trunk/term.h
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/bidiv/trunk/term.h?rev=804&op=diff
==============================================================================
--- pkg/bidiv/trunk/term.h (original)
+++ pkg/bidiv/trunk/term.h Sat Apr 10 22:58:47 2010
@@ -1,9 +1,0 @@
-#ifndef _TERM_H_
-#define _TERM_H_
-
-/* Returns terminal size, attempt to get it from tty, COLUMNS or default to 80
- * otherwise
- */
-int term_size_get(void);
-
-#endif
More information about the Debian-hebrew-package
mailing list