From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4869 invoked by alias); 12 Sep 2014 18:53:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19074 Received: (qmail 28445 invoked from network); 12 Sep 2014 18:53:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Date: Fri, 12 Sep 2014 19:50:02 +0100 From: Dominik Vogt To: zsh-users@zsh.org Subject: Re: Determining the length of "long"? Message-ID: <20140912185002.GA4132@gmx.de> Reply-To: dominik.vogt@gmx.de Mail-Followup-To: zsh-users@zsh.org References: <20140911213608.GA1029@gmx.de> <20140912161724.GY4075@isis.sigpipe.cz> <20140912181019.GZ4075@isis.sigpipe.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140912181019.GZ4075@isis.sigpipe.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-Provags-ID: V03:K0:hc6B+ppgiFzjU2Tj7UZGTchATBw0VwJl0i5oHG468CTlU68NugY 2SPU41Oithy84o1L7E9RgakqK5iv5Z3dDMA9NmzVCMu0/Xxw2zDk9FRc0HSZjeUDzsyFDnD i+iMIw0MOZb/jAWoNrZQ75NzYozqgdyEmH2Z1wIX9BA/TS33hULB9BjBHX79fL+IKprexWA KJnyYSu7hLjJyH99GtqEQ== X-UI-Out-Filterresults: notjunk:1; On Fri, Sep 12, 2014 at 08:10:19PM +0200, Roman Neuhauser wrote: > # dominik.vogt@gmx.de / 2014-09-12 19:04:44 +0200: > > > see getconf(1)[0] and unistd.h(0P)[1], specifically > > > _POSIX_V6_ILP32_OFF32 and its brethren. > > > > Ah great, that pointed exactly to what I need. > > glad to be of help! i would have brought these up earlier but you said > > > inside a zsh script (without using external programs, of course). > > which seemed to disqualify getconf(1)... the clarification was also > very subtle: :) I know. :-) But I'm not immune to learning when a certain approach causes more trouble than it saves you. Actually I didn't know a simple configuration program was around and wanted to avoid using a monster like perl or gcc, because latency does matter. > > the shell is absolutely the right tool here (combine several unix > > command line programs in a pipe, filter their output and generate > > a wm command from that) > > overall a good reminder of the need for precise problem statements. :) Yes, but easy to say afterwards when one already know the solution. :) What the script actually does is: * When started by fvwm it is passed an input and an output file descriptor to receive and send data from and to the wm core as numbers on the command line. (The direction from fvwm to the script is disabled in that case). * Then, and that is the new feature, it determines automatically if binary longs are 32 bit or 64 bit and chooses a function to send strings to fvwm. (The length of the string is sent as a binary long value which is hard coded to 160.) * Then it goes into an endless loop and sleeps for a while with zselect. When it wakes up it * calls ps to determine the process that uses the most cpu * extracts the used memory percentage prom /proc/meminfo * uses strftime to get the current time and date in a certain format All this information is wrapped in wm commands and sent to the window manager core which forwards it to another module (FvwmButtons) which in turn updates the labels of some buttons to these strings. As I always have a plethora of zshs running anyway, this approach turned out to be very easy to implement, and does not use much resources. In earlier attempts to get this right there was a noticeable lag, say, when playing kobodeluxe. Eventually we'll make the fvwm module interface easier to use and then it won't be necessary to determine details of the machine architecture anymore. Ciao Dominik ^_^ ^_^ -- Dominik Vogt