Re: A few requests (and, of course, ObHacks)
Article: 7421 of alt.hackers From: chowes@newsserver.sfu.ca (Charles Howes) Newsgroups: alt.hackers Subject: Re: A few requests (and, of course, ObHacks) Date: 19 Feb 1995 06:43:20 -0800 Organization: Simon Fraser University Lines: 102 Approved: alt.hackers Message-ID: 3i7le8$qjr@kits.sfu.ca NNTP-Posting-Host: chowes@kits.sfu.ca Status: RO
Paul Smith (wz40ft@elec.mid.gmeds.com) wrote: ] Question #2: ] Anyone know how to redirect output to stderr in csh? I know for sh you just ] tack "1>&2" on the end of a line, but i've not found an equivalent for csh. (somecommand > /dev/tty) |& cat will insure the output goes to your screen and stderr becomes stdout. ---convert.stdin.to.stderr.c---- #include <stdio.h> main(){ char c; while (read(0,&c,1)==1) write (2,&c,1); } -------------------------------- somecommand | convert.stdin.to.stderr will redirect stdout to stderr, if that's really how you want it. Obhack: Infinite loop makefile. It runs itself every five seconds, and if it finds anything to compile, it does so and then runs it. Great for X applications. Type 'make run' to start. Take out the 'echo' statements when you understand it. -----Makefile----- SHELL = /bin/sh # Written by chowes@sfu.ca - 1995-02-19 06:19:26 OBJS=assign1.o main.o CMD=assign1 # # I work from the /tmp directory; it's faster than NFS. # Crashing/rebooting erases the /tmp directory. # # So, I like the best of both worlds. # BACKUPDIR=/home/user/assign1 # # I could find no built-in replacement for OBJS; $? didn't work right. # Otherwise, CMD and OBJS would be unnecessary. # # $(CMD) : $(OBJS) @echo Linking $(OBJS) '->' $@ @$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) # # The guts of the infinite loop; the '-' means ignore errors. # # run : @echo Running infinite loop @-while true ; do make test ; sleep 5 ; done # # This prevents the message 'test.it is up to date' from occuring # # test : test.it # # Builds and runs CMD # test.it : $(CMD) @echo Running $(CMD) now. @$(CMD) @-cp * $(BACKUPDIR) @touch test.it # # Not actually used, but darned useful at other times. # This is copied from the default rules. # .c: @echo Compiling... $? '->' $@ @$(CC) $(CFLAGS) -o $@ $? $(LDFLAGS) # # Turns source files into OBJS. This is copied from the default rules. # .c.o: @echo Compiling... $? '->' $@ @$(CC) $(CFLAGS) -c $? $(LDFLAGS) ------------------- Charles Howes -- chowes@sfu.ca All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. --IBM maintenance manual, 1925