modernize
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7845 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -3,40 +3,19 @@
|
|||||||
** A "micro-shell" to test editline library.
|
** A "micro-shell" to test editline library.
|
||||||
** If given any arguments, commands aren't executed.
|
** If given any arguments, commands aren't executed.
|
||||||
*/
|
*/
|
||||||
|
#if defined(HAVE_CONFIG_H)
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(HAVE_STDLIB)
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif /* defined(HAVE_STDLIB) */
|
#ifdef HAVE_ERRNO_H
|
||||||
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char *readline();
|
#include "editline.h"
|
||||||
extern void add_history();
|
|
||||||
|
|
||||||
#if !defined(HAVE_STDLIB)
|
|
||||||
extern int chdir();
|
|
||||||
extern int free();
|
|
||||||
extern int strncmp();
|
|
||||||
extern int system();
|
|
||||||
extern void exit();
|
|
||||||
#endif /* !defined(HAVE_STDLIB) */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(NEED_PERROR)
|
|
||||||
void
|
|
||||||
perror(s)
|
|
||||||
char *s;
|
|
||||||
{
|
|
||||||
extern int errno;
|
|
||||||
|
|
||||||
(voidf)printf(stderr, "%s: error %d\n", s, errno);
|
|
||||||
}
|
|
||||||
#endif /* defined(NEED_PERROR) */
|
|
||||||
|
|
||||||
|
|
||||||
/* ARGSUSED1 */
|
|
||||||
int
|
int
|
||||||
main(ac, av)
|
main(int ac, char **av)
|
||||||
int ac;
|
|
||||||
char *av[];
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int doit;
|
int doit;
|
||||||
@@ -48,9 +27,9 @@ main(ac, av)
|
|||||||
if (strncmp(p, "cd ", 3) == 0) {
|
if (strncmp(p, "cd ", 3) == 0) {
|
||||||
if (chdir(&p[3]) < 0)
|
if (chdir(&p[3]) < 0)
|
||||||
perror(&p[3]);
|
perror(&p[3]);
|
||||||
}
|
} else if (system(p) != 0) {
|
||||||
else if (system(p) != 0)
|
|
||||||
perror(p);
|
perror(p);
|
||||||
|
}
|
||||||
add_history(p);
|
add_history(p);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user