home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
TELECOM
/
GNU_ATP_1_40.lzh
/
EDITLINE
/
testit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-05-01
|
651b
|
38 lines
/* $Revision: 1.2 $
**
** A "micro-shell" to test editline library.
** If given any arguments, commands aren't executed.
*/
#include <stdio.h>
#include <stdlib.h>
extern char *readline();
extern void add_history();
char *luxptr = NULL ;
/* ARGSUSED1 */
int
main(ac, av)
int ac;
char *av[];
{
char *p;
int doit;
doit = ac == 1;
while ((p = readline("testit> ")) != NULL) {
(void)printf("\t\t\t|%s|\n", p);
if (doit)
if (strncmp(p, "cd ", 3) == 0) {
if (chdir(&p[3]) < 0)
perror(&p[3]);
}
else if (system(p) != 0)
perror(p);
add_history(p);
free(p);
}
exit(0);
/* NOTREACHED */
}