From cf1158bcfaf143ad7a8ce44a614ccdf70a3aeb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Sat, 28 Oct 2006 11:15:53 +0000 Subject: [PATCH] autotools compile maintenant dans le repertoire ou le configure est fait --- Makefile.am | 57 ++++++++++++++++++++++++++++++++++++++------- TODO | 5 +++- configure.ac | 13 +++++++++-- man/42sh.man | 25 ++++++++++++++++++++ src/Makefile.am | 1 - src/ast/ast_print.c | 4 ++-- src/parser/lexer.c | 8 ++++--- 7 files changed, 95 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index ac37e92..5bc0092 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,11 +1,54 @@ -SUBDIRS = src +bin_PROGRAMS=42sh + +42sh_SOURCES= src/ast/ast.h \ + src/ast/ast_and.c \ + src/ast/ast_bang.c \ + src/ast/ast_case.c \ + src/ast/ast_cmd.c \ + src/ast/ast_destruct.c \ + src/ast/ast_for.c \ + src/ast/ast_funcdec.c \ + src/ast/ast_if.c \ + src/ast/ast_or.c \ + src/ast/ast_pipe.c \ + src/ast/ast_print.c \ + src/ast/ast_red.c \ + src/ast/ast_sep.c \ + src/ast/ast_sepand.c \ + src/ast/ast_subshell.c \ + src/ast/ast_while.c \ + src/common/basename.c \ + src/common/common.h \ + src/common/constant.h \ + src/common/isdigitstr.c \ + src/common/macro.h \ + src/common/strmerge.c \ + src/common/strvectoradd.c \ + src/common/strvmerge.c \ + src/common/strndup.c \ + src/exec/exec.h \ + src/exec/exec_node.c \ + src/parser/alias.h \ + src/parser/alias.c \ + src/parser/getline.h \ + src/parser/getline.c \ + src/parser/parser.h \ + src/parser/parser.c \ + src/parser/lexer.c \ + src/shell/getoptions.c \ + src/shell/option.h \ + src/shell/option.c \ + src/shell/shell.h \ + src/shell/shell_entry.c \ + src/shell/shell_init.c \ + src/shell/shell_destroy.c \ + src/shell/prompt.c -noinst_DATA=42sh$(EXEEXT) -DISTCLEANFILES=42sh$(EXEEXT) +CLEANFILES= *~ '\#*' -.PHONY: tar doc re +EXTRA_DIST = AUTHORS README TODO -42sh$(EXEEXT): src/42sh$(EXEEXT) +.PHONY: tar doc re tar: distcheck @@ -13,7 +56,3 @@ re: clean all doc: cd $(srcdir)/doc && $(MAKE) doc - -CLEANFILES= *~ '\#*' - -EXTRA_DIST = AUTHORS README TODO diff --git a/TODO b/TODO index b7a43da..0f2839c 100644 --- a/TODO +++ b/TODO @@ -5,4 +5,7 @@ Maintenant il renvoie EOF a la place du token. - Parser -- aliases --- history \ No newline at end of file +-- history + +- Option +-- voir probleme de non initialisation envoye par valgrind a chaque tour de boucle \ No newline at end of file diff --git a/configure.ac b/configure.ac index 4c56f73..9a42d88 100644 --- a/configure.ac +++ b/configure.ac @@ -100,6 +100,16 @@ AC_ARG_WITH([noerror], ] ) +AC_ARG_WITH([dynamic], + [AS_HELP_STRING([--with-dynamic], [Compiling with dynamic libraries])], + [dnl action-if-given + dynamic=true + ], + [dnl action-if-not-given + dynamic=false + ] +) + AC_ARG_WITH([debug], [AS_HELP_STRING([--with-debug], [use -g and don't use -DNDEBUG -O3])], [dnl action-if-given @@ -117,7 +127,7 @@ AC_ARG_WITH([efence], CFLAGS="$CFLAGS -include stdlib.h -include efence.h" ], [dnl action-if-not-given - LDFLAGS="$LDFLAGS -static" + test "$dynamic" = "true" || LDFLAGS="$LDFLAGS -static" ] ) @@ -131,7 +141,6 @@ AC_CONFIG_HEADERS([config.h]) # define Autoconf config files AC_CONFIG_FILES([ Makefile - src/Makefile ]) AC_OUTPUT \ No newline at end of file diff --git a/man/42sh.man b/man/42sh.man index e69de29..be34b3d 100644 --- a/man/42sh.man +++ b/man/42sh.man @@ -0,0 +1,25 @@ +.TH 42sh 1 "2006 jan 21" +.SH NAME +42sh \- The 42 Shell +.SH SYNOPSIS +\fB42sh\fP [options] [file] +.SH DESCRIPTION +42sh is a complete implementation of a standard shell. +.SS Options +option petace +.TP +\fB-c\fP +Cafe chaud +.SH FILES +.TP +\fI~/.42shrc\fP +The personal initialization file +.TP +\fI/etc/42shrc\fP +The systemwide initialization file +.SH AUTHORS +Sebastien LUTTRINGER +.br +seblu@seblu.net +.SH "SEE ALSO" +bash (1) \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index e756508..5abfe8e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,3 @@ -#SUBDIRS= bin_PROGRAMS=42sh #42sh_LDADD = parser/libparse.a ../check/leaktrack/libmem.a evalexpr/libevalexpr.a diff --git a/src/ast/ast_print.c b/src/ast/ast_print.c index 68480e7..179bcd1 100644 --- a/src/ast/ast_print.c +++ b/src/ast/ast_print.c @@ -5,7 +5,7 @@ ** Login ** ** Started on Sat Mar 25 23:11:01 2006 Seblu -** Last update Thu Oct 12 13:12:31 2006 seblu +** Last update Thu Oct 19 13:02:30 2006 seblu */ #include @@ -49,7 +49,7 @@ static char *newastfilename(void); void ast_print(s_ast_node *ast, const char *filename) { FILE *fs; - unsigned int index; + unsigned int index = 0; if (ast == NULL) return; diff --git a/src/parser/lexer.c b/src/parser/lexer.c index 7c6a365..06ea1a5 100644 --- a/src/parser/lexer.c +++ b/src/parser/lexer.c @@ -5,7 +5,7 @@ ** Login ** ** Started on Sun Jul 30 04:36:53 2006 Seblu -** Last update Wed Oct 18 18:27:39 2006 seblu +** Last update Thu Oct 19 13:18:20 2006 seblu */ #include @@ -181,8 +181,10 @@ s_lexer *lexer_init(int fd) new->stream = getline_open(fd); new->buf = NULL; new->buf_size = new->buf_pos = 0; - token_set(&new->previous, TOK_NONE, NULL); - token_set(&new->current, TOK_NONE, NULL); + //dont use token_set, because it make comparaison on uninitialized values + new->previous.id = new->current.id = TOK_NONE; + new->previous.str = new->current.str = NULL; + new->previous.len = new->current.len = 0; new->eof = 0; return new; } -- GitLab