From: Robert Pengelly Date: Mon, 15 Sep 2025 00:55:51 +0000 (+0100) Subject: Changed to execvp and output cleanup X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=165e53b4b875d09a7bf30886fa2376f3b53796ae;p=xmake.git Changed to execvp and output cleanup --- diff --git a/Makefile.pdw b/Makefile.pdw index a6256df..b269b7f 100644 --- a/Makefile.pdw +++ b/Makefile.pdw @@ -5,7 +5,7 @@ AS=aswin CC=gccwin LD=ldwin -COPTS=-S -O2 -fno-common -ansi -I. -I./include -I../pdos/pdpclib -I../pdos/src -D__WIN32__ -D__NOBIVA__ -D__PDOS__ +COPTS=-S -O2 -fno-common -ansi -I. -I../pdos/pdpclib -I../pdos/src -D__WIN32__ -D__NOBIVA__ -D__PDOS__ COBJ=cstr.o hashtab.o lib.o report.o read.o rule.o variable.o xmake.o all: clean xmake.exe diff --git a/Makefile.unix b/Makefile.unix index 9c4310b..18faf04 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -5,7 +5,7 @@ SRCDIR ?= $(CURDIR) VPATH := $(SRCDIR) CC := gcc -CFLAGS := -D_FILE_OFFSET_BITS=64 -I$(SRCDIR)/include -O2 -Wall -Werror -Wextra -ansi -pedantic -std=c90 +CFLAGS := -D_FILE_OFFSET_BITS=64 -O2 -Wall -Werror -Wextra -ansi -pedantic -std=c90 CSRC := cstr.c hashtab.c lib.c read.c report.c rule.c variable.c xmake.c diff --git a/Makefile.w32 b/Makefile.w32 index 7d64d9e..29e873e 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -5,7 +5,7 @@ SRCDIR ?= $(CURDIR) VPATH := $(SRCDIR) CC := gcc -CFLAGS := -D_FILE_OFFSET_BITS=64 -I$(SRCDIR)/include -O2 -Wall -Werror -Wextra -ansi -pedantic -std=c90 +CFLAGS := -D_FILE_OFFSET_BITS=64 -O2 -Wall -Werror -Wextra -ansi -pedantic -std=c90 CSRC := cstr.c hashtab.c lib.c read.c report.c rule.c variable.c xmake.c diff --git a/Makefile.wat b/Makefile.wat index 29f7ade..42bddbd 100644 --- a/Makefile.wat +++ b/Makefile.wat @@ -10,7 +10,7 @@ all: xmake.exe xmake.exe: $(SRC) - wcl -I.\\include -fe=$@ $^ + wcl -fe=$@ $^ clean: diff --git a/command.h b/command.h new file mode 100644 index 0000000..c3ce4e1 --- /dev/null +++ b/command.h @@ -0,0 +1,14 @@ +/****************************************************************************** + * @file command.h + *****************************************************************************/ +#ifndef _COMMAND_H +#define _COMMAND_H + +struct commands { + + char *text; + unsigned long len; + +}; + +#endif /* _COMMAND_H */ diff --git a/cstr.c b/cstr.c index 803ee72..a4a219d 100644 --- a/cstr.c +++ b/cstr.c @@ -4,8 +4,7 @@ #include #include -#include - +#include "cstr.h" extern void *xrealloc (void *__ptr, unsigned long __size); static void cstr_realloc (CString *cstr, long new_size) { diff --git a/cstr.h b/cstr.h new file mode 100644 index 0000000..6202270 --- /dev/null +++ b/cstr.h @@ -0,0 +1,22 @@ +/****************************************************************************** + * @file cstr.h + *****************************************************************************/ +#ifndef _CSTR_H +#define _CSTR_H + +typedef struct CString { + + long size; + void *data; + + long size_allocated; + +} CString; + +void cstr_ccat (CString *cstr, int ch); +void cstr_cat (CString *cstr, const char *str, long len); + +void cstr_new (CString *cstr); +void cstr_free (CString *cstr); + +#endif /* _CSTR_H */ diff --git a/dep.h b/dep.h new file mode 100644 index 0000000..b683f81 --- /dev/null +++ b/dep.h @@ -0,0 +1,14 @@ +/****************************************************************************** + * @file dep.h + *****************************************************************************/ +#ifndef _DEP_H +#define _DEP_H + +struct dep { + + char *name; + struct dep *next; + +}; + +#endif /* _DEP_H */ diff --git a/hashtab.c b/hashtab.c index 32f3c40..abd6ad6 100644 --- a/hashtab.c +++ b/hashtab.c @@ -5,7 +5,7 @@ #include #include -#include +#include "hashtab.h" static struct hashtab_entry *find_entry (struct hashtab_entry *entries, unsigned long capacity, struct hashtab_name *key); static int adjust_capacity (struct hashtab *table, unsigned long new_capacity) { diff --git a/hashtab.h b/hashtab.h new file mode 100644 index 0000000..24e6b0d --- /dev/null +++ b/hashtab.h @@ -0,0 +1,43 @@ +/****************************************************************************** + * @file hashtab.h + *****************************************************************************/ +#ifndef _HASHTAB_H +#define _HASHTAB_H + +#include + +#define hashtab_get haget +#define hashtab_put haput +#define hashtab_remove haremove + + +struct hashtab_name { + + const char *chars; + unsigned int bytes, hash; + +}; + +struct hashtab_entry { + + struct hashtab_name *key; + void *value; + +}; + +struct hashtab { + + struct hashtab_entry *entries; + unsigned long capacity, count, used; + +}; + +struct hashtab_name *hashtab_alloc_name (const char *str); +struct hashtab_name *hashtab_get_key (struct hashtab *table, const char *name); + +int hashtab_put (struct hashtab *table, struct hashtab_name *key, void *value); + +void *hashtab_get (struct hashtab *table, struct hashtab_name *key); +void hashtab_remove (struct hashtab *table, struct hashtab_name *key); + +#endif /* _HASHTAB_H */ diff --git a/include/xmake/command.h b/include/xmake/command.h deleted file mode 100644 index c3ce4e1..0000000 --- a/include/xmake/command.h +++ /dev/null @@ -1,14 +0,0 @@ -/****************************************************************************** - * @file command.h - *****************************************************************************/ -#ifndef _COMMAND_H -#define _COMMAND_H - -struct commands { - - char *text; - unsigned long len; - -}; - -#endif /* _COMMAND_H */ diff --git a/include/xmake/cstr.h b/include/xmake/cstr.h deleted file mode 100644 index 6202270..0000000 --- a/include/xmake/cstr.h +++ /dev/null @@ -1,22 +0,0 @@ -/****************************************************************************** - * @file cstr.h - *****************************************************************************/ -#ifndef _CSTR_H -#define _CSTR_H - -typedef struct CString { - - long size; - void *data; - - long size_allocated; - -} CString; - -void cstr_ccat (CString *cstr, int ch); -void cstr_cat (CString *cstr, const char *str, long len); - -void cstr_new (CString *cstr); -void cstr_free (CString *cstr); - -#endif /* _CSTR_H */ diff --git a/include/xmake/dep.h b/include/xmake/dep.h deleted file mode 100644 index b683f81..0000000 --- a/include/xmake/dep.h +++ /dev/null @@ -1,14 +0,0 @@ -/****************************************************************************** - * @file dep.h - *****************************************************************************/ -#ifndef _DEP_H -#define _DEP_H - -struct dep { - - char *name; - struct dep *next; - -}; - -#endif /* _DEP_H */ diff --git a/include/xmake/hashtab.h b/include/xmake/hashtab.h deleted file mode 100644 index 24e6b0d..0000000 --- a/include/xmake/hashtab.h +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * @file hashtab.h - *****************************************************************************/ -#ifndef _HASHTAB_H -#define _HASHTAB_H - -#include - -#define hashtab_get haget -#define hashtab_put haput -#define hashtab_remove haremove - - -struct hashtab_name { - - const char *chars; - unsigned int bytes, hash; - -}; - -struct hashtab_entry { - - struct hashtab_name *key; - void *value; - -}; - -struct hashtab { - - struct hashtab_entry *entries; - unsigned long capacity, count, used; - -}; - -struct hashtab_name *hashtab_alloc_name (const char *str); -struct hashtab_name *hashtab_get_key (struct hashtab *table, const char *name); - -int hashtab_put (struct hashtab *table, struct hashtab_name *key, void *value); - -void *hashtab_get (struct hashtab *table, struct hashtab_name *key); -void hashtab_remove (struct hashtab *table, struct hashtab_name *key); - -#endif /* _HASHTAB_H */ diff --git a/include/xmake/lib.h b/include/xmake/lib.h deleted file mode 100644 index d0afe68..0000000 --- a/include/xmake/lib.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** - * @file lib.h - *****************************************************************************/ -#ifndef _LIB_H -#define _LIB_H - -#if defined (_WIN32) -# define PATHSEP ";" -#else -# define PATHSEP ":" -#endif - -struct option { - - const char *rule; - int (*callback) (const char *); - -}; - -char *skip_whitespace (char *p); - -char *xstrdup (const char *__s); -char *xstrndup (const char *__s, unsigned long __len); - -int parse_args (char **__args, int __cnt); -void dynarray_add (void *__ptab, unsigned long *__nb_ptr, void *__data); - -void *xmalloc (unsigned long __sz); -void *xrealloc (void *__ptr, unsigned long __sz); - - -char *get_current_directory (void); - -int change_directory (const char *__path); -int directory_exists (const char *__path); - -#endif /* _LIB_H */ diff --git a/include/xmake/read.h b/include/xmake/read.h deleted file mode 100644 index a880c0e..0000000 --- a/include/xmake/read.h +++ /dev/null @@ -1,20 +0,0 @@ -/****************************************************************************** - * @file read.h - *****************************************************************************/ -#ifndef _READ_H -#define _READ_H - -void read_memory_makefile (const char *filename, unsigned long line_no, char *memory); -int read_makefile (const char *filename); - -struct nameseq { - - char *name; - struct nameseq *next; - -}; - -void record_files (const char *filename, unsigned long line_no, struct nameseq *filenames, char *cmds, size_t cmds_idx, char *depstr); -void *parse_nameseq (char *line, size_t size); - -#endif /* _READ_H */ diff --git a/include/xmake/report.h b/include/xmake/report.h deleted file mode 100644 index 4e507f4..0000000 --- a/include/xmake/report.h +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************** - * @file report.h - *****************************************************************************/ -#ifndef _REPORT_H -#define _REPORT_H - -enum report_type { - - REPORT_WARNING, - REPORT_ERROR, - REPORT_FATAL_ERROR, - REPORT_INTERNAL_ERROR - -}; - -#if defined (_WIN32) -# define COLOR_ERROR 12 -# define COLOR_WARNING 13 -# define COLOR_INTERNAL_ERROR 19 -#else -# define COLOR_ERROR 91 -# define COLOR_INTERNAL_ERROR 94 -# define COLOR_WARNING 95 -#endif - -unsigned long get_error_count (void); -void report_at (const char *filename, unsigned long lineno, enum report_type type, const char *fmt, ...); - -#endif /* _REPORT_H */ diff --git a/include/xmake/rule.h b/include/xmake/rule.h deleted file mode 100644 index 9e01c7b..0000000 --- a/include/xmake/rule.h +++ /dev/null @@ -1,41 +0,0 @@ -/****************************************************************************** - * @file rule.h - *****************************************************************************/ -#ifndef _RULE_H -#define _RULE_H - -#include -#include - -struct rule { - - char *name; - - struct dep *deps; - struct commands *cmds; - - const char *filename; - unsigned long line_no; - -}; - -struct suffix_rule { - - char *first, *second; - struct commands *cmds; - - const char *filename; - unsigned long line_no; - - struct suffix_rule *next; - -}; - -extern struct suffix_rule *suffix_rules; -struct rule *rule_find (const char *name); - -void rule_add (const char *filename, unsigned long line_no, char *name, struct dep *deps, struct commands *cmds); -void rule_add_suffix (const char *filename, unsigned long line_no, char *name, struct commands *cmds); -void rules_init (void); - -#endif /* _RULE_H */ diff --git a/include/xmake/variable.h b/include/xmake/variable.h deleted file mode 100644 index 95573cb..0000000 --- a/include/xmake/variable.h +++ /dev/null @@ -1,41 +0,0 @@ -/****************************************************************************** - * @file variable.h - *****************************************************************************/ -#ifndef _VARIABLE_H -#define _VARIABLE_H - -enum variable_flavor { - - VAR_FLAVOR_RECURSIVELY_EXPANDED, - VAR_FLAVOR_SIMPLY_EXPANDED, - VAR_FLAVOR_IMMEDIATELY_EXPANDED - -}; - -enum variable_origin { - - VAR_ORIGIN_AUTOMATIC, - VAR_ORIGIN_COMMAND_LINE, - VAR_ORIGIN_FILE - -}; - -struct variable { - - char *name, *value; - - enum variable_flavor flavor; - enum variable_origin origin; - -}; - -struct variable *variable_add (char *name, char *value, enum variable_origin origin); -struct variable *variable_change (char *name, char *value, enum variable_origin origin); -struct variable *variable_find (char *name); - -void parse_var_line (const char *filename, unsigned long line_no, char *line, enum variable_origin origin); -char *variable_expand_line (const char *filename, unsigned long line_no, char *line); - -void variables_init (void); - -#endif /* _VARIABLE_H */ diff --git a/include/xmake/xmake.h b/include/xmake/xmake.h deleted file mode 100644 index c277782..0000000 --- a/include/xmake/xmake.h +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************** - * @file xmake.h - *****************************************************************************/ -#ifndef _XMAKE_H -#define _XMAKE_H - -struct xmake_state { - - char **makefiles; - unsigned long nb_makefiles; - - char **goals; - unsigned long nb_goals; - - char **include_paths; - unsigned long nb_include_paths; - - char **directories; - unsigned long nb_directories; - - char *path; - int quiet, no_print; - - int dry_run, env_override, keep_going; - int ignore_errors; - -}; - -#if defined (__PDOS386__) -# ifndef __PDOS__ -# define __PDOS__ -# endif -#endif - -extern struct xmake_state *state; -extern const char *program_name; - -int rule_search_and_build (char *name); - -#endif /* _XMAKE_H */ diff --git a/lib.c b/lib.c index 01bf0b3..94c69a5 100644 --- a/lib.c +++ b/lib.c @@ -7,11 +7,11 @@ #include #include -#include -#include -#include -#include -#include +#include "cstr.h" +#include "lib.h" +#include "report.h" +#include "variable.h" +#include "xmake.h" size_t len = 0; diff --git a/lib.h b/lib.h new file mode 100644 index 0000000..d0afe68 --- /dev/null +++ b/lib.h @@ -0,0 +1,37 @@ +/****************************************************************************** + * @file lib.h + *****************************************************************************/ +#ifndef _LIB_H +#define _LIB_H + +#if defined (_WIN32) +# define PATHSEP ";" +#else +# define PATHSEP ":" +#endif + +struct option { + + const char *rule; + int (*callback) (const char *); + +}; + +char *skip_whitespace (char *p); + +char *xstrdup (const char *__s); +char *xstrndup (const char *__s, unsigned long __len); + +int parse_args (char **__args, int __cnt); +void dynarray_add (void *__ptab, unsigned long *__nb_ptr, void *__data); + +void *xmalloc (unsigned long __sz); +void *xrealloc (void *__ptr, unsigned long __sz); + + +char *get_current_directory (void); + +int change_directory (const char *__path); +int directory_exists (const char *__path); + +#endif /* _LIB_H */ diff --git a/read.c b/read.c index 5e0eab8..b19c453 100644 --- a/read.c +++ b/read.c @@ -6,13 +6,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include "command.h" +#include "dep.h" +#include "lib.h" +#include "read.h" +#include "rule.h" +#include "variable.h" +#include "xmake.h" extern struct variable *default_goal_var; diff --git a/read.h b/read.h new file mode 100644 index 0000000..a880c0e --- /dev/null +++ b/read.h @@ -0,0 +1,20 @@ +/****************************************************************************** + * @file read.h + *****************************************************************************/ +#ifndef _READ_H +#define _READ_H + +void read_memory_makefile (const char *filename, unsigned long line_no, char *memory); +int read_makefile (const char *filename); + +struct nameseq { + + char *name; + struct nameseq *next; + +}; + +void record_files (const char *filename, unsigned long line_no, struct nameseq *filenames, char *cmds, size_t cmds_idx, char *depstr); +void *parse_nameseq (char *line, size_t size); + +#endif /* _READ_H */ diff --git a/report.c b/report.c index d36483b..db2c9b1 100644 --- a/report.c +++ b/report.c @@ -5,8 +5,7 @@ #include #include -#include - +#include "report.h" unsigned long errors = 0; #ifndef __PDOS__ diff --git a/report.h b/report.h new file mode 100644 index 0000000..4e507f4 --- /dev/null +++ b/report.h @@ -0,0 +1,29 @@ +/****************************************************************************** + * @file report.h + *****************************************************************************/ +#ifndef _REPORT_H +#define _REPORT_H + +enum report_type { + + REPORT_WARNING, + REPORT_ERROR, + REPORT_FATAL_ERROR, + REPORT_INTERNAL_ERROR + +}; + +#if defined (_WIN32) +# define COLOR_ERROR 12 +# define COLOR_WARNING 13 +# define COLOR_INTERNAL_ERROR 19 +#else +# define COLOR_ERROR 91 +# define COLOR_INTERNAL_ERROR 94 +# define COLOR_WARNING 95 +#endif + +unsigned long get_error_count (void); +void report_at (const char *filename, unsigned long lineno, enum report_type type, const char *fmt, ...); + +#endif /* _REPORT_H */ diff --git a/rule.c b/rule.c index 19c7484..58470f3 100644 --- a/rule.c +++ b/rule.c @@ -3,11 +3,11 @@ *****************************************************************************/ #include -#include -#include -#include -#include -#include +#include "command.h" +#include "dep.h" +#include "hashtab.h" +#include "lib.h" +#include "rule.h" static struct hashtab hashtab_rules = { 0 }; struct suffix_rule *suffix_rules = 0; diff --git a/rule.h b/rule.h new file mode 100644 index 0000000..862bd4d --- /dev/null +++ b/rule.h @@ -0,0 +1,41 @@ +/****************************************************************************** + * @file rule.h + *****************************************************************************/ +#ifndef _RULE_H +#define _RULE_H + +#include "command.h" +#include "dep.h" + +struct rule { + + char *name; + + struct dep *deps; + struct commands *cmds; + + const char *filename; + unsigned long line_no; + +}; + +struct suffix_rule { + + char *first, *second; + struct commands *cmds; + + const char *filename; + unsigned long line_no; + + struct suffix_rule *next; + +}; + +extern struct suffix_rule *suffix_rules; +struct rule *rule_find (const char *name); + +void rule_add (const char *filename, unsigned long line_no, char *name, struct dep *deps, struct commands *cmds); +void rule_add_suffix (const char *filename, unsigned long line_no, char *name, struct commands *cmds); +void rules_init (void); + +#endif /* _RULE_H */ diff --git a/variable.c b/variable.c index e6cd868..ef98a44 100644 --- a/variable.c +++ b/variable.c @@ -11,12 +11,12 @@ #include -#include -#include -#include -#include -#include -#include +#include "hashtab.h" +#include "lib.h" +#include "read.h" +#include "report.h" +#include "variable.h" +#include "xmake.h" struct linebuf { diff --git a/variable.h b/variable.h new file mode 100644 index 0000000..95573cb --- /dev/null +++ b/variable.h @@ -0,0 +1,41 @@ +/****************************************************************************** + * @file variable.h + *****************************************************************************/ +#ifndef _VARIABLE_H +#define _VARIABLE_H + +enum variable_flavor { + + VAR_FLAVOR_RECURSIVELY_EXPANDED, + VAR_FLAVOR_SIMPLY_EXPANDED, + VAR_FLAVOR_IMMEDIATELY_EXPANDED + +}; + +enum variable_origin { + + VAR_ORIGIN_AUTOMATIC, + VAR_ORIGIN_COMMAND_LINE, + VAR_ORIGIN_FILE + +}; + +struct variable { + + char *name, *value; + + enum variable_flavor flavor; + enum variable_origin origin; + +}; + +struct variable *variable_add (char *name, char *value, enum variable_origin origin); +struct variable *variable_change (char *name, char *value, enum variable_origin origin); +struct variable *variable_find (char *name); + +void parse_var_line (const char *filename, unsigned long line_no, char *line, enum variable_origin origin); +char *variable_expand_line (const char *filename, unsigned long line_no, char *line); + +void variables_init (void); + +#endif /* _VARIABLE_H */ diff --git a/xmake.c b/xmake.c index 4878820..4b1d5af 100644 --- a/xmake.c +++ b/xmake.c @@ -11,12 +11,12 @@ #include -#include -#include -#include -#include -#include -#include +#include "cstr.h" +#include "lib.h" +#include "read.h" +#include "rule.h" +#include "variable.h" +#include "xmake.h" struct variable *default_goal_var = 0; @@ -302,8 +302,7 @@ static int pipe_command (const char *filename, unsigned long line_no, char *inpu p = xstrndup (p, space - p); } - fprintf (stderr, "%s", lbuf.start); - fprintf (stderr, "%s: *** [%s:%lu: %s] Error %ld\n", program_name, filename, line_no, name, dwExitCode); + fprintf (stderr, "%s%s: *** [%s:%lu: %s] Error %ld\n", lbuf.start, program_name, filename, line_no, name, dwExitCode); if (state->keep_going) { return dwExitCode; @@ -349,18 +348,112 @@ static int pipe_command (const char *filename, unsigned long line_no, char *inpu if (pid == 0) { - char *prog = input, *space = 0, *slash; + char **argv; + int argc = 1; + + char *prog = input, *space = 0, *ptr; + int offset = 0, quote, i; if ((space = strchr (prog, ' '))) { + + ptr = space + 1; + + for (i = 0; ptr[i]; i++) { + + if (isspace ((int) ptr[i])) { + argc++; + } + + } + prog = xstrndup (prog, space - prog); + argv = xmalloc (sizeof (*argv) * (argc + 1)); + + for (i = 0; ; i++) { + + if (!isspace ((int) ptr[i])) { + break; + } + + } + + argv[1] = ptr + i; + argc = 1; + quote = 0; + + while (ptr[i]) { + + ptr[i - offset] = ptr[i]; + + if (quote) { + + if (ptr[i] == '\\' && (ptr[i + 1] == quote || ptr[i + 1] == '\\')) { + + offset++; + i++; + + ptr[i - offset] = ptr[i]; + + } else if (ptr[i] == quote) { + + quote = 0; + offset++; + + } + + i++; + + } else if (ptr[i] == '\'' || ptr[i] == '"') { + + if (argv[argc] == ptr + i - offset) { + argv[argc]++; + } + + quote = ptr[i]; + i++; + + } else if (isspace ((int) ptr[i])) { + + ptr[i - offset] = '\0'; + argc++; + + for (i = i + 1; ; i++) { + + if (!isspace ((int) ptr[i])) { + break; + } + + } + + argv[argc] = ptr + i - offset; + + } else { + i++; + } + + } + + if (argv[argc] != ptr + i - offset) { + + ptr[i - offset] = '\0'; + argc++; + + } + + } else { + argv = xmalloc (sizeof (*argv) * (argc + 1)); } + argv[0] = prog; + argv[argc] = 0; + dup2 (pipefd[1], STDOUT_FILENO); close (pipefd[0]); close (pipefd[1]); - execlp (prog, (slash = strrchr (prog, '/')) ? (slash + 1) : prog, space ? skip_whitespace (space) : NULL, NULL); + execvp (prog, argv); + free (argv); printf ("%s: %s: %s\n", program_name, prog, strerror (errno)); exit (EXIT_FAILURE); @@ -411,7 +504,7 @@ static int pipe_command (const char *filename, unsigned long line_no, char *inpu } - { + /*{ char *p = lbuf.start, ch; @@ -438,14 +531,13 @@ static int pipe_command (const char *filename, unsigned long line_no, char *inpu *(p - 1) = '\0'; } - } + }*/ if (status) { if (!is_ignoring_errors) { - fprintf (stderr, "%s\n", lbuf.start); - fprintf (stderr, "%s: *** [%s:%lu: %s] Error %d\n", program_name, filename, line_no, name, status); + fprintf (stderr, "%s%s: *** [%s:%lu: %s] Error %d\n", lbuf.start, program_name, filename, line_no, name, status); if (state->keep_going) { return status; @@ -456,7 +548,7 @@ static int pipe_command (const char *filename, unsigned long line_no, char *inpu } } else { - printf ("%s\n", lbuf.start); + printf ("%s", lbuf.start); } return 0; diff --git a/xmake.h b/xmake.h new file mode 100644 index 0000000..c277782 --- /dev/null +++ b/xmake.h @@ -0,0 +1,40 @@ +/****************************************************************************** + * @file xmake.h + *****************************************************************************/ +#ifndef _XMAKE_H +#define _XMAKE_H + +struct xmake_state { + + char **makefiles; + unsigned long nb_makefiles; + + char **goals; + unsigned long nb_goals; + + char **include_paths; + unsigned long nb_include_paths; + + char **directories; + unsigned long nb_directories; + + char *path; + int quiet, no_print; + + int dry_run, env_override, keep_going; + int ignore_errors; + +}; + +#if defined (__PDOS386__) +# ifndef __PDOS__ +# define __PDOS__ +# endif +#endif + +extern struct xmake_state *state; +extern const char *program_name; + +int rule_search_and_build (char *name); + +#endif /* _XMAKE_H */