Module Name: src Committed By: elric Date: Thu Apr 14 18:12:08 UTC 2011
Modified Files: src/crypto/external/bsd/heimdal/dist/lib/roken: get_window_size.c getarg.c roken.h.in src/crypto/external/bsd/heimdal/include: roken.h Log Message: Replicate changes to get_window_size() made in previous location: revision 1.7 date: 2010/01/24 16:45:57; author: christos; state: Exp; make the window size function return the lines and columns variables separately instead of depending on the existance of struct winsize. Technically I should bump the library version or version the symbol, but nothing seems to use this outside the library! To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c \ src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c \ src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in cvs rdiff -u -r1.1 -r1.2 src/crypto/external/bsd/heimdal/include/roken.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c diff -u src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c:1.2 --- src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c:1.1.1.1 Wed Apr 13 18:15:41 2011 +++ src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c Thu Apr 14 18:12:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: get_window_size.c,v 1.1.1.1 2011/04/13 18:15:41 elric Exp $ */ +/* $NetBSD: get_window_size.c,v 1.2 2011/04/14 18:12:08 elric Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan @@ -60,32 +60,46 @@ #include <krb5/roken.h> ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL -get_window_size(int fd, struct winsize *wp) +get_window_size(int fd, int *lines, int *columns) { - int ret = -1; - - memset(wp, 0, sizeof(*wp)); + int ret; + char *s; #if defined(TIOCGWINSZ) - ret = ioctl(fd, TIOCGWINSZ, wp); + { + struct winsize ws; + ret = ioctl(fd, TIOCGWINSZ, &ws); + if (ret != -1) { + if (lines) + *lines = ws.ws_row; + if (columns) + *columns = ws.ws_col; + return 0; + } + } #elif defined(TIOCGSIZE) { struct ttysize ts; ret = ioctl(fd, TIOCGSIZE, &ts); - if(ret == 0) { - wp->ws_row = ts.ts_lines; - wp->ws_col = ts.ts_cols; - } + if (ret != -1) { + if (lines) + *lines = ts.ws_lines; + if (columns) + *columns = ts.ts_cols; + return 0; + } } #elif defined(HAVE__SCRSIZE) { int dst[2]; - - _scrsize(dst); - wp->ws_row = dst[1]; - wp->ws_col = dst[0]; - ret = 0; + + _scrsize(dst); + if (lines) + *lines = dst[1]; + if (columns) + *columns = dst[0]; + return 0; } #elif defined(_WIN32) { @@ -102,14 +116,17 @@ } } #endif - if (ret != 0) { - char *s; - if((s = getenv("COLUMNS"))) - wp->ws_col = atoi(s); - if((s = getenv("LINES"))) - wp->ws_row = atoi(s); - if(wp->ws_col > 0 && wp->ws_row > 0) - ret = 0; + if (columns) { + if ((s = getenv("COLUMNS"))) + *columns = atoi(s); + else + return -1; + } + if (lines) { + if ((s = getenv("LINES"))) + *lines = atoi(s); + else + return -1; } - return ret; + return 0; } Index: src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c diff -u src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c:1.2 --- src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c:1.1.1.1 Wed Apr 13 18:15:41 2011 +++ src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c Thu Apr 14 18:12:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: getarg.c,v 1.1.1.1 2011/04/13 18:15:41 elric Exp $ */ +/* $NetBSD: getarg.c,v 1.2 2011/04/14 18:12:08 elric Exp $ */ /* * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan @@ -230,7 +230,6 @@ size_t i, max_len = 0; char buf[128]; int col = 0, columns; - struct winsize ws; if (progname == NULL) progname = getprogname(); @@ -242,9 +241,7 @@ mandoc_template(args, num_args, progname, extra_string, i18n); return; } - if(get_window_size(2, &ws) == 0) - columns = ws.ws_col; - else + if(get_window_size(2, NULL, &columns) == -1) columns = 80; col = 0; col += fprintf (stderr, "%s: %s", usage, progname); Index: src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in diff -u src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in:1.2 --- src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in:1.1.1.1 Wed Apr 13 18:15:42 2011 +++ src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in Thu Apr 14 18:12:08 2011 @@ -759,7 +759,7 @@ }; #endif -ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, struct winsize *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, int *, int *); #ifndef HAVE_VSYSLOG #define vsyslog rk_vsyslog Index: src/crypto/external/bsd/heimdal/include/roken.h diff -u src/crypto/external/bsd/heimdal/include/roken.h:1.1 src/crypto/external/bsd/heimdal/include/roken.h:1.2 --- src/crypto/external/bsd/heimdal/include/roken.h:1.1 Wed Apr 13 19:03:58 2011 +++ src/crypto/external/bsd/heimdal/include/roken.h Thu Apr 14 18:12:08 2011 @@ -201,7 +201,7 @@ issuid(void); -ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, struct winsize *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, int *, int *);