eb15+@andrew.cmu.edu (Edward D. Berger) (06/22/91)
I'm working on a tutorial to give my local usergroup members about writing an 'Amiga-ized' application program. I will be using C as the language, and have come across the following question. How do I 'runback' my program if the user starts from CLI with any arguments other than "?", but echo the command template to the CLI if that is what they obviously want. I have an example using SAS/C that if I link with cback.o doesn't allow the command template to be given, but then leaves the cli window 'stuck open' if I link with c.o instead. I don't really like having to hog a cli window by starting my program, but I think the user should be able to get a command template. I also don't think users should be expected to have third party software like runback for uses like this. (Though I use it all the time.) I would like generic code that would work with SAS/C, DICE, MANX, PDC, etc. (This is for a generic tutorial, after all, and compatibility between both workbench 1.3, and Release 2 AmigaOS is desired) ...Sorry to those folks who would rather this post be about Source Code availability..... Ed Berger eb15@andrew.cmu.edu
dillon@overload.Berkeley.CA.US (Matthew Dillon) (06/23/91)
In article <kcMf_0S00WB5A90kQc@andrew.cmu.edu> eb15+@andrew.cmu.edu (Edward D. Berger) writes: >they obviously want. I have an example using SAS/C that if I link with cback.o >doesn't allow the command template to be given, but then leaves the cli window >'stuck open' if I link with c.o instead. I don't really like having to hog >a cli window by starting my program, but I think the user should be able to get >a command template. I also don't think users should be expected to have third >party software like runback for uses like this. (Though I use it all the time.) > >I would like generic code that would work with SAS/C, DICE, MANX, PDC, etc. >(This is for a generic tutorial, after all, and compatibility between both > workbench 1.3, and Release 2 AmigaOS is desired) DICE does not have runback support. As far as I can tell it only confuses people, they aren't sure whether they should RUN it or just run it, and under 2.0 if you use RUN <nil: >nil: ... the program will be effectively detached from the CLI (i.e. equivalent to RunBack) >Ed Berger >eb15@andrew.cmu.edu -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA
elg@elgamy.raidernet.com (Eric Lee Green) (06/26/91)
From article <kcMf_0S00WB5A90kQc@andrew.cmu.edu>, by eb15+@andrew.cmu.edu (Edward D. Berger): > I'm working on a tutorial to give my local usergroup members about writing > an 'Amiga-ized' application program. I will be using C as the language, and > have come across the following question. > > How do I 'runback' my program if the user starts from CLI with any arguments > other than "?", but echo the command template to the CLI if that is what > they obviously want. I have an example using SAS/C that if I link with cback.o > doesn't allow the command template to be given, but then leaves the cli window > 'stuck open' if I link with c.o instead. Look in the file "umain.c" in your SAS/C sources directory. It's opening the file "*" for stderr, i.e., opening the current console for output. So print your stuff to stderr, then, if you want to close the console, close stderr. At least, I think this may be what's whomping you. Most "C" startups seem to do things like this. -- Eric Lee Green (318) 984-1820 P.O. Box 92191 Lafayette, LA 70509 elg@elgamy.RAIDERNET.COM uunet!mjbtn!raider!elgamy!elg
ecarroll@maths.tcd.ie (Eddy Carroll) (06/27/91)
In article <00677915228@elgamy.raidernet.com> elg@elgamy.raidernet.com (Eric Lee Green) writes: >From article <kcMf_0S00WB5A90kQc@andrew.cmu.edu>, by eb15+@andrew.cmu.edu >(Edward D. Berger): >> How do I 'runback' my program if the user starts from CLI with any arguments >> other than "?", but echo the command template to the CLI if that is what >> they obviously want. [ Goes on to say cback.o and c.o don't cut it ] > >Look in the file "umain.c" in your SAS/C sources directory. It's opening >the file "*" for stderr, i.e., opening the current console for output. >So print your stuff to stderr, then, if you want to close the console, >close stderr. I think Edward is trying to get his program to automatically detach from the CLI, yet still handle the case where the user tries to display a command template. The problem with cback.o is that by the time your code gets going, it's already running as a background task and control has been returned to the CLI. So, when you print out the usage message, it can be displayed _after_ the CLI prompt, which looks very tacky. It also prevents you from prompting the user for input. There are two solutions that I know of: - Tell the user to use RunBack if he wants the program to run in the background (or RUN <NIL: >NIL: for Workbench 1.3 upwards). This has the advantage of being clean and easy; you don't need any special code. - Write your own code to spawn the program off as a background task. This allows you to control exactly when the background task starts running, and you can print out templates/messages beforehand. This has the disadvantage that it involves playing with system structures and so may break on future revisions of the OS. It's friendlier to the user though (imho). I tend to use the second way myself (with no problems under 2.0). Grab the source code to SnoopDos or CpuBlit from your nearest comp.sources.amiga archive for an example of how I do it. There are similar examples on the fish disks as well (most noticeably Leo Schwab's on one of the earlier disks). Eddy -- Eddy Carroll ----* Genuine MUD Wizard | "You haven't lived until ADSPnet: cbmuk!cbmuka!quartz!ecarroll | you've died in MUD!" Internet: ecarroll@maths.tcd.ie | -- Richard Bartle