From: "Dave Yeo" Received: from [192.168.100.201] (HELO mail.2rosenthals.com) by 2rosenthals.com (CommuniGate Pro SMTP 5.4.10) with ESMTPS id 3690768 for gnuports@2rosenthals.com; Sat, 14 May 2022 21:52:31 -0400 Received: from secmgr-va.2rosenthals.com ([50.73.8.217]:44420 helo=mail2.2rosenthals.com) by mail.2rosenthals.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nq3Qi-0004Mh-2l for gnuports@2rosenthals.com; Sat, 14 May 2022 21:52:21 -0400 Received: from mail-pj1-f42.google.com ([209.85.216.42]:41800) by mail2.2rosenthals.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nq3Qb-0002rW-24 for gnuports@2rosenthals.com; Sat, 14 May 2022 21:52:14 -0400 Received: by mail-pj1-f42.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso11181607pjg.0 for ; Sat, 14 May 2022 18:52:13 -0700 (PDT) X-SASI-Hits: BODYTEXTP_SIZE_3000_LESS 0.000000, BODY_SIZE_1400_1499 0.000000, BODY_SIZE_2000_LESS 0.000000, BODY_SIZE_5000_LESS 0.000000, BODY_SIZE_7000_LESS 0.000000, DATE_TZ_NA 0.000000, DKIM_ALIGNS 0.000000, DKIM_SIGNATURE 0.000000, FORGED_FROM_GMAIL 0.100000, HTML_00_01 0.050000, HTML_00_10 0.050000, IN_REP_TO 0.000000, LEGITIMATE_SIGNS 0.000000, MSG_THREAD 0.000000, NO_CTA_URI_FOUND 0.000000, NO_URI_HTTPS 0.000000, REFERENCES 0.000000, SENDER_NO_AUTH 0.000000, __ANY_URI 0.000000, __BODY_NO_MAILTO 0.000000, __BOUNCE_CHALLENGE_SUBJ 0.000000, __BOUNCE_NDR_SUBJ_EXEMPT 0.000000, __CT 0.000000, __CTE 0.000000, __CT_TEXT_PLAIN 0.000000, __DKIM_ALIGNS_1 0.000000, __DKIM_ALIGNS_2 0.000000, __DQ_NEG_DOMAIN 0.000000, __DQ_NEG_HEUR 0.000000, __DQ_NEG_IP 0.000000, __FORWARDED_MSG 0.000000, __FRAUD_WEBMAIL 0.000000, __FRAUD_WEBMAIL_FROM 0.000000, __FROM_DOMAIN_NOT_IN_BODY 0.000000, __FROM_GMAIL 0.000000, __FUR_HEADER 0.000000, __HAS_FROM 0.000000, __HAS_MSGID 0.000000, __HAS_REFERENCES 0.000000, __HEADER_ORDER_FROM 0.000000, __IN_REP_TO 0.000000, __MAIL_CHAIN 0.000000, __MIME_TEXT_ONLY 0.000000, __MIME_TEXT_P 0.000000, __MIME_TEXT_P1 0.000000, __MIME_VERSION 0.000000, __MOZILLA_USER_AGENT 0.000000, __NO_HTML_TAG_RAW 0.000000, __PHISH_SPEAR_STRUCTURE_1 0.000000, __REFERENCES 0.000000, __SANE_MSGID 0.000000, __SUBJ_ALPHA_NEGATE 0.000000, __SUBJ_REPLY 0.000000, __TO_MALFORMED_2 0.000000, __TO_NAME 0.000000, __TO_NAME_DIFF_FROM_ACC 0.000000, __TO_REAL_NAMES 0.000000, __URI_MAILTO 0.000000, __URI_NO_WWW 0.000000, __URI_NS 0.000000, __USER_AGENT 0.000000, __X_GM_MESSAGE_STATE 0.000000, __X_GOOGLE_DKIM_SIGNATURE 0.000000, __X_GOOGLE_SMTP_SOURCE 0.000000, __YOUTUBE_RCVD 0.000000 X-SASI-Probability: 8% X-SASI-RCODE: 200 X-SASI-Version: Antispam-Engine: 4.1.4, AntispamData: 2022.5.15.4219 X-SASI-Hits: BODYTEXTP_SIZE_3000_LESS 0.000000, BODY_SIZE_1400_1499 0.000000, BODY_SIZE_2000_LESS 0.000000, BODY_SIZE_5000_LESS 0.000000, BODY_SIZE_7000_LESS 0.000000, DATE_TZ_NA 0.000000, DKIM_ALIGNS 0.000000, DKIM_SIGNATURE 0.000000, HTML_00_01 0.050000, HTML_00_10 0.050000, IN_REP_TO 0.000000, KNOWN_MTA_TFX 0.000000, LEGITIMATE_SIGNS 0.000000, MSG_THREAD 0.000000, NO_CTA_URI_FOUND 0.000000, NO_URI_HTTPS 0.000000, REFERENCES 0.000000, SENDER_NO_AUTH 0.000000, SXL_IP_TFX_WM 0.000000, WEBMAIL_SOURCE 0.000000, __ANY_URI 0.000000, __BODY_NO_MAILTO 0.000000, __BOUNCE_CHALLENGE_SUBJ 0.000000, __BOUNCE_NDR_SUBJ_EXEMPT 0.000000, __CT 0.000000, __CTE 0.000000, __CT_TEXT_PLAIN 0.000000, __DKIM_ALIGNS_1 0.000000, __DKIM_ALIGNS_2 0.000000, __DQ_NEG_DOMAIN 0.000000, __DQ_NEG_HEUR 0.000000, __DQ_NEG_IP 0.000000, __FORWARDED_MSG 0.000000, __FRAUD_WEBMAIL 0.000000, __FRAUD_WEBMAIL_FROM 0.000000, __FROM_DOMAIN_NOT_IN_BODY 0.000000, __FROM_GMAIL 0.000000, __FUR_HEADER 0.000000, __FUR_RDNS_GMAIL 0.000000, __HAS_FROM 0.000000, __HAS_MSGID 0.000000, __HAS_REFERENCES 0.000000, __HEADER_ORDER_FROM 0.000000, __IN_REP_TO 0.000000, __MAIL_CHAIN 0.000000, __MIME_TEXT_ONLY 0.000000, __MIME_TEXT_P 0.000000, __MIME_TEXT_P1 0.000000, __MIME_VERSION 0.000000, __MOZILLA_USER_AGENT 0.000000, __NO_HTML_TAG_RAW 0.000000, __PHISH_SPEAR_STRUCTURE_1 0.000000, __RDNS_WEBMAIL 0.000000, __REFERENCES 0.000000, __SANE_MSGID 0.000000, __SUBJ_ALPHA_NEGATE 0.000000, __SUBJ_REPLY 0.000000, __TO_MALFORMED_2 0.000000, __TO_NAME 0.000000, __TO_NAME_DIFF_FROM_ACC 0.000000, __TO_REAL_NAMES 0.000000, __URI_MAILTO 0.000000, __URI_NO_WWW 0.000000, __URI_NS 0.000000, __USER_AGENT 0.000000, __X_GM_MESSAGE_STATE 0.000000, __X_GOOGLE_DKIM_SIGNATURE 0.000000, __X_GOOGLE_SMTP_SOURCE 0.000000, __YOUTUBE_RCVD 0.000000 X-SASI-Probability: 7% X-SASI-RCODE: 200 X-SASI-Version: Antispam-Engine: 4.1.4, AntispamData: 2022.5.15.4219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=pRoAfgFTaJbQbY/5+Bjj7rsBy7THvgx3F3m128KmpOY=; b=TXZ5MAaJbuwYsyi0hAaegUS5JrTsvnNlFXnWz2dyOeO8cAxumKF4B97f00QEEYqRJV OYpJbCPeDq5wiEVKQgUBz1cyEjCcEiHNnt6CrMO5pD1m0mH3hv9Uj6NoT6Wv+EUDt8cZ yBAtejFxYbzTrgWpHWLvTXrycnhOIo2JuZanSbRnshQQAhgLTNKslu9G3EsdsqUnt1bH lCHJvlk+/C1rA3SdvL9H5FZNshOTXJOxh9RdPRUMYGhERBeNF7aNQ5MJikEPzoIJtbA4 YiomJjN8A2iKCKzLqhNXsUvht+20GR4MzKsHcuL4v4xRTsKzxXyqC9YSODk5N8+LDiB+ 4Vhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=pRoAfgFTaJbQbY/5+Bjj7rsBy7THvgx3F3m128KmpOY=; b=v1MBKynimyb7LafTV+aMleba1TqbUeImMFcDAs7D4mCqK+JZr3Kj/EQi95RZTV2d0V 2fZFAOdgKXcWNwpkm04zs0AGgCudPJO+2q0bz6XTJzauQzPiHu7PVrxcdQXgawmPM7FB 1F4KA/7wIxAY8G/V8+9KVuC5nPsr+Fk5cL1NbraQd/Uc+JDutZ5fC5dv8go6SCepR1qm MX5sTCXcQoIhfOFQ/N+FQCGS0NQpAjDJHtSPZtTy6G2aEuck+u5FGaZMZn8xTFuLka3I vEuV9CNwQZ+xaPWXj8RgdAEZVLn1Eqr0PM/8MFLi3G9KBZ4RFL5aO7ovcPo71v2+32NR 5Rjw== X-Gm-Message-State: AOAM532ZsSMx4fvP0QfRR6ZkWVZuc0erMXxPrEDGbm4PZ3eIXpFC1tiB ZCH+dzzi3xrdMmBWcR3QTsuFdh+tmlk= X-Google-Smtp-Source: ABdhPJyYk0ZBLIDjWwnDgkbqTjH7dSLo9sE6K6QJ6yO7u2Vq4feM6hQwS7UGsNQ2Tcsj4wIGaRbo9Q== X-Received: by 2002:a17:902:ef43:b0:156:9c5d:b0fe with SMTP id e3-20020a170902ef4300b001569c5db0femr11236578plx.158.1652579532046; Sat, 14 May 2022 18:52:12 -0700 (PDT) Return-Path: Received: from [192.168.0.104] ([207.194.98.61]) by smtp.gmail.com with ESMTPSA id g12-20020a170902868c00b0015e8d4eb251sm4284651plo.155.2022.05.14.18.52.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 May 2022 18:52:11 -0700 (PDT) Subject: Re: [GNU Ports] Terminal width? To: GNU Ports for eCS Mailing List References: Message-ID: Date: Sat, 14 May 2022 18:52:07 -0700 User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 05/14/22 11:35 AM, Steven Levine wrote: > In , on 05/14/22 > at 10:29 AM, "Dave Yeo" said: > > Hi Dave, > >> Need something like this, but we are missing TIOCGWINSZ() >> int term_width(int fd) >> { >> struct winsize geometry; >> geometry.ws_col = 0; >> if(ioctl(fd, TIOCGWINSZ, &geometry) >= 0) >> return (int)geometry.ws_col; >> return -1; >> } > >> Ideas? Even OS/2 API? > > Assuming this is a VIO app, the Vio functions are your friends. > VioGetMode should give you what you need. > Hunting for example code, I found in libc (and EMX where it is documented), Headers: #include Prototype: void _scrsize (int *dst); Compatibility: emx Description: Retrieve the screen (window) size. The number of text columns (width) is stored to dst[0], the number of text rows (height) is stored to dst[1]. See also: v_dimen() Does this code make sense? /* Also serves as a way to detect if we have an interactive terminal. */ #ifndef __OS2__ int term_width(int fd) { struct winsize geometry; geometry.ws_col = 0; if(ioctl(fd, TIOCGWINSZ, &geometry) >= 0) return (int)geometry.ws_col; return -1; } #else int term_width(int fd) { int dst[1]; void _scrsize (int *dst); return dst[0]; } #endif Thanks, Dave