winegcc: Modify error() to behave like all the other Wine tracing methods, that is to not append a '\n' to the message.

This commit is contained in:
Francois Gouget 2007-10-18 17:11:47 +02:00 committed by Alexandre Julliard
parent 4152085af1
commit dc3feef055
2 changed files with 12 additions and 13 deletions

View File

@ -43,7 +43,6 @@ void error(const char* s, ...)
va_start(ap, s);
fprintf(stderr, "winegcc: ");
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
exit(2);
}
@ -53,7 +52,7 @@ void* xmalloc(size_t size)
void* p;
if ((p = malloc (size)) == NULL)
error("Could not malloc %d bytes.", size);
error("Could not malloc %d bytes\n", size);
return p;
}
@ -62,7 +61,7 @@ void *xrealloc(void* p, size_t size)
{
void* p2 = realloc (p, size);
if (size && !p2)
error("Could not realloc %d bytes.", size);
error("Could not realloc %d bytes\n", size);
return p2;
}
@ -120,7 +119,7 @@ void strarray_add(strarray* arr, const char* str)
void strarray_del(strarray* arr, unsigned int i)
{
if (i >= arr->size) error("Invalid index i=%d", i);
if (i >= arr->size) error("Invalid index i=%d\n", i);
memmove(&arr->base[i], &arr->base[i + 1], (arr->size - i - 1) * sizeof(arr->base[0]));
arr->size--;
}
@ -195,7 +194,7 @@ void create_file(const char* name, int mode, const char* fmt, ...)
if (verbose) printf("Creating file %s\n", name);
va_start(ap, fmt);
if ( !(file = fopen(name, "w")) )
error("Unable to open %s for writing.", name);
error("Unable to open %s for writing\n", name);
vfprintf(file, fmt, ap);
va_end(ap);
fclose(file);
@ -327,7 +326,7 @@ void spawn(const strarray* prefix, const strarray* args, int ignore_errors)
if ((status = spawnvp( _P_WAIT, argv[0], argv)) && !ignore_errors)
{
if (status > 0) error("%s failed.", argv[0]);
if (status > 0) error("%s failed\n", argv[0]);
else perror("winegcc");
exit(3);
}

View File

@ -201,7 +201,7 @@ static char* get_temp_file(const char* prefix, const char* suffix)
free(tmp);
tmp = strmake("/tmp/%s-XXXXXX%s", prefix, suffix);
fd = mkstemps( tmp, strlen(suffix) );
if (fd == -1) error( "could not create temp file" );
if (fd == -1) error( "could not create temp file\n" );
}
close( fd );
strarray_add(tmp_files, tmp);
@ -233,7 +233,7 @@ static const strarray* get_translator(enum processor processor)
if (!as) as = strarray_fromstring(AS, " ");
return as;
}
error("Unknown processor");
error("Unknown processor\n");
}
static void compile(struct options* opts, const char* lang)
@ -507,12 +507,12 @@ static void build(struct options* opts)
case file_def:
case file_spec:
if (spec_file)
error("Only one spec file can be specified.");
error("Only one spec file can be specified\n");
spec_file = file;
break;
case file_rc:
/* FIXME: invoke wrc to build it */
error("Can't compile .rc file at the moment: %s", file);
error("Can't compile .rc file at the moment: %s\n", file);
break;
case file_res:
strarray_add(files, strmake("-r%s", file));
@ -527,7 +527,7 @@ static void build(struct options* opts)
strarray_add(files, strmake("-s%s", file));
break;
case file_na:
error("File does not exist: %s", file);
error("File does not exist: %s\n", file);
break;
default:
file = compile_to_object(opts, file, lang);
@ -541,7 +541,7 @@ static void build(struct options* opts)
lang = file;
}
if (opts->shared && !spec_file)
error("A spec file is currently needed in shared mode");
error("A spec file is currently needed in shared mode\n");
/* add the default libraries, if needed */
if (!opts->nostdlib && opts->use_msvcrt) add_library(lib_dirs, files, "msvcrt");
@ -1020,7 +1020,7 @@ int main(int argc, char **argv)
}
if (opts.processor == proc_cpp) linking = 0;
if (linking == -1) error("Static linking is not supported.");
if (linking == -1) error("Static linking is not supported\n");
if (opts.files->size == 0) forward(argc, argv, &opts);
else if (linking) build(&opts);