Re: [mpg123-devel] Please test new network code in/out of mpg123 (now with HTTPS support)!
Brought to you by:
sobukus
From: Dave Y. <dav...@gm...> - 2022-05-15 04:23:36
|
On 05/14/22 09:57 AM, Thomas Orgis wrote: > PS: A bit of cleanup happened … mainly to make TERM_NONE work. > PPS: And no … src/term_win32 will look quite different from OS/2, I > presume. But what do I know? You can have a look at how it's developing > and tell if you see resemblance to known API. OK, the OS/2 API is VioGetMode() which is actually still 16 bit. Googling for examples gave Windows examples, IIRC GetMode(). Windows often uses the same API with the prefix dropped. Hunting through my various sources I found an example in libc, where the 16 bit limitations were taken care of and we get, from the EMX documentation, Headers: #include <stdlib.h> 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() This seems to work, probably needs work as I'm not a programmer, #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 |