modernize

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7845 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-02-02 02:19:40 +00:00
parent 507ef41251
commit c7ffabb148

View File

@@ -3,40 +3,19 @@
** A "micro-shell" to test editline library.
** If given any arguments, commands aren't executed.
*/
#if defined(HAVE_CONFIG_H)
#include <config.h>
#endif
#include <stdio.h>
#if defined(HAVE_STDLIB)
#include <stdlib.h>
#endif /* defined(HAVE_STDLIB) */
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
extern char *readline();
extern void add_history();
#include "editline.h"
#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
main(ac, av)
int ac;
char *av[];
main(int ac, char **av)
{
char *p;
int doit;
@@ -48,9 +27,9 @@ main(ac, av)
if (strncmp(p, "cd ", 3) == 0) {
if (chdir(&p[3]) < 0)
perror(&p[3]);
}
else if (system(p) != 0)
} else if (system(p) != 0) {
perror(p);
}
add_history(p);
free(p);
}