Path: utzoo!attcan!uunet!island!daniel From: daniel@island.uu.net (Dan Smith) Newsgroups: comp.unix.questions Subject: Re: changing dir inside shell Summary: Work around it with "typein" Message-ID: <294@island.uu.net> Date: 27 Jul 88 21:40:42 GMT References: <47800013@uxe.cso.uiuc.edu> Reply-To: daniel@island.uu.net (Dan Smith, Island Volleybrawl Team) Organization: Island Graphics, Marin County, California Lines: 55 In article ron@topaz.rutgers.edu (Ron Natalie) writes: >You can't. Directory changing is a per process thing. Well...you can, at least on BSD systems. I use a program that will "type" its arguments to standard input (like a "cd foo" command). I guess it would be analogous to "keyfake" or something of that type for MsLoss. Ron's right technically - you just have to work around the per-process limit! :-) Below is the source to "typein", written by my friend David Vezie many moons ago. Posted with permission. Try "typein date", and "typein date^M" (type control V control M) dan -----------------------snip crumble chomp----------------------------- /* * typein.c -- push it's arguments onto the standard input. * uses the TIOCSTI ioctl, and LPENDIN (turning off echo), so * it appears after the prompt. * * Copyright 1984, David Vezie. * Permission to copy unlimited granted, providing this message * stays with the source * All other rights reserved (unless all lawyers are shot :-). */ #include #include main(argc, argv) int argc; char **argv; { register char *cp; struct sgttyb stb, stb2; int pendin = LPENDIN; ioctl(2, TIOCGETP, &stb); stb2 = stb; stb.sg_flags &= ~ECHO; ioctl(2, TIOCSETN, &stb); for (argc--, argv++; argc > 0; argc--, argv++) { for (cp = *argv; cp && *cp; cp++) ioctl(2, TIOCSTI, cp); if (argc > 1) ioctl(2, TIOCSTI, " "); } ioctl(2, TIOCSETN, &stb2); ioctl(2, TIOCLBIS, &pendin); exit(0); } ---------------------------------------------------------------------- -- dan smith, island graphics, marin co, ca| +1 (415) 491 1000(W), 332 FAST(H) 4000 civic center dr, san rafael 94903 | dis: they're solely my opinions daniel@island.uu.net {ucbvax!ucbcad,sun}!island!daniel pacbell!unicom!daniel I'd rather have Roosevelt in a wheelchair, than Reagan & Bush on a horse -Jesse