Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!uw-beaver!uw-june!schneidr From: schneidr@cs.washington.edu (Scott Schneider) Newsgroups: comp.sys.apollo Subject: Re: invoking the dm editor from inside a Bourne shell Summary: Modify dmwin to create an EDIT pad instead of a transcript pad. Message-ID: <12856@june.cs.washington.edu> Date: 22 Aug 90 15:21:49 GMT References: <1990Aug16.231437.28459@Neon.Stanford.EDU> Distribution: comp Organization: U of Washington, Computer Science, Seattle Lines: 92 In article , glenn@huxley.huxley.bitstream.com (Glenn P. Parker) writes: > In article <4c41b6e2.20b6d@apollo.HP.COM>, > valante_g@apollo.HP.COM (Glen E Valante) writes: > > In article <1990Aug16.231437.28459@Neon.Stanford.EDU>, > > ammon@Neon.Stanford.EDU (Daniel Ammon) writes: > >> > >> Is there anyway to get a (Bourne) shell script to bring up a file > >> in the dm editor? Right now I am calling vi, but I would also like > >> to be able to bring up the editor you get when pressing the EDIT key. > > > > from the shell, you can execute: > > > > /com/xdmc ce > > Unfortunately, /com/xdmc only works if it is executed from an Apollo pad, > i.e. _not_ inside an xterm. So, your script won't be as portable if you > use this technique. You _can_ do the following: > > /usr/bin/X11/dmwin /usr/apollo/bin/xdmc ce > > But this leaves a "scrap" DM window lying around. Ah well, if you like the > DM editor, you probably don't care about xterms anyway... :-/ You can also modify the 'dmwin' source (/usr/X11/examples/dmwin) to create an EDIT pad instead of a TRANSCRIPT pad so that it doesn't leave a "scrap" DM window laying around. It also creates the EDIT pad a lot faster. Here are my modifications to DMWIN. Note: the code is not very clean cuz I was in a hurry. --------------- dmedit.c ----------------- pad_$window_desc_t w_desc = {200,300,875,650}; main( int argc, char **argv, char **envp ) { extern char *optarg, *getenv(char *a); extern int optind; status_$t st; ios_$id_t fd; char **ep; char sw; char *infile; int errflag = 0, rawflag = 0, i; infile = "/usr/tmp/tempfile"; /* default file if none passed */ while ( (getopt( argc, argv, "?fh" )) != EOF ) switch(sw) { case 'f': infile = argv[optind]; break; case 'h': case '?': errflag++; } if (errflag) { fprintf( stderr, "usage: %s [-f filename]\n", argv[0] ); exit(2); } /* create an edit pad */ pad_$create_window (infile, (short)strlen(infile), pad_$edit, 1, w_desc, &fd, &st); if (st.all != status_$ok) { fprintf (stderr, "%s: could not create window\n", argv[0]); exit (1); } close (fd); exit (1); } > -- > -------------------------------------------------------------------------- > Glenn P. Parker Bitstream, Inc. > uunet!huxley!glenn 215 First Street > glenn@bitstream.com Cambridge, MA 02142-1270 Enjoy! -- Scott Schneider Boeing Commercial Airplane schneidr@june.cs.washington.edu