delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/19/03:46:35

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: stdout flushing after printf, SIGALRM signal and GNU Make
Date: Wed, 19 Nov 1997 09:00:02 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 85
Message-ID: <34729C82.45251CE5@LSTM.Ruhr-UNI-Bochum.De>
References: <347259eb DOT 883582 AT news DOT total DOT net>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

J. Hughes wrote:
> 
> Hello,
> 
> I've been reading the newsgroup for a while now and I haven't found
> anything on the following things I have problems with; sorry if it's
> already been asked:
> 
> 1. When using printf without a "\n", you need to use fflush (stdout);
> to make it appear on screen. I was simply wandering if there was a
> compiler switch, a conditional define or anything (besides making a
> new function for 'printf') which could automate the process? That
> would basically output to the screen on every printf with or without a
> trailing \n..
That should be explained in the FAQ, or check the libc info
files for the magic word setvbuf.
Anyway, because this is the most frequently asked frequently
asked question, DJ is planning to change stdout to unbuffered.

Seems to be too much UNIXism in a DOS world. 


> 
> 2. Also, I've written a small inet client/daemon in Linux, which works
> very well, but when I try to run it on DJGPP with the libsocket-0.5,
> the signal (signal(SIGALRM, handler);) doesn't seem to work.. I have
> the handler all setup (runs fine in Linux as I said)
> 
> void handler ()
> {
>   signal (SIGALRM, handler);
> }
> 
> But without signal I just don't know how to make the winsock 'connect'
> function quit after an X second delay..

Well, like this it'll never work. 
What I think you want is probably something like

volatile int alarm_triggered;

void handler(int sig){
  if(SIGALARM == sig){
    alarm_triggered = 1;
  }
}

int main(void){
   alarm_triggered = 0;
   signal(SIGALRM, handler);
   alarm(5);
   do{
    Try_what_ever_you_want();
   } while(it_didnt_succeed && !alarm_triggered);
   alarm(0);
}


> 
> 3. And finally (sorry), I'm having problems with the GNU make
> (3.76.1): though it's supposed to support long file names, when I try
> to run a makefile with LFN or a dep file starting with a dot, it
> crashes out:
> 
> make.exe[1]: Entering directory `d:/gcc/libsoc~1.5/src'
> make.exe[1]: *** No rule to make target `protoresolve', needed by
> `library2'.  Stop.
> Any ideas?
Not for that one. Eli?


-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019