commit 7e9abfc893a8e6fbb4e1a9bd83669a41c484fd8d
parent fec480511e3311648d8d56575bbc37bfcc6e1c44
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 2 Apr 2020 10:08:23 +0200
Use fprintf instead of dprintf to suppress warnings on linux
Diffstat:
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/1d_fd_simple_shear.c b/1d_fd_simple_shear.c
@@ -32,7 +32,7 @@ struct simulation sim;
static void
usage(void)
{
- dprintf(2, "usage: %s "
+ fprintf(stderr, "usage: %s "
"[-A grain-nonlocal-ampl] "
"[-a fluid-pressure-ampl] "
"[-b grain-rate-dependence] "
@@ -86,7 +86,7 @@ main(int argc, char* argv[])
#ifdef __OpenBSD__
if (pledge("stdio wpath cpath", NULL) == -1) {
- dprintf(2, "error: pledge failed");
+ fprintf(stderr, "error: pledge failed");
exit(1);
}
#endif
@@ -188,7 +188,7 @@ main(int argc, char* argv[])
else if (!strncmp(argv[1], "square", 6))
sim.p_f_mod_pulse_shape = 1;
else {
- dprintf(2, "error: invalid pulse shape '%s'\n",
+ fprintf(stderr, "error: invalid pulse shape '%s'\n",
argv[1]);
return 1;
}
@@ -292,8 +292,8 @@ main(int argc, char* argv[])
}
if (++stressiter > MAX_ITER_STRESS) {
- dprintf(2, "error: stress solution did not converge:\n");
- dprintf(2, "v_x=%g, v_x_fix=%g, v_x_limit=%g, "
+ fprintf(stderr, "error: stress solution did not converge:\n");
+ fprintf(stderr, "v_x=%g, v_x_fix=%g, v_x_limit=%g, "
"res_norm=%g, mu_wall=%g\n",
sim.v_x[sim.nz-1], sim.v_x_fix, sim.v_x_limit,
res_norm, sim.mu_wall);
diff --git a/max_depth_simple_shear.c b/max_depth_simple_shear.c
@@ -28,7 +28,7 @@ struct simulation sim;
static void
usage(void)
{
- dprintf(2, "usage: %s "
+ fprintf(stderr, "usage: %s "
"[-a fluid-pressure-ampl] "
"[-C fluid-compressibility] "
"[-g gravity-accel] "
diff --git a/shear_flux.c b/shear_flux.c
@@ -10,7 +10,7 @@ char *argv0;
static void
usage(void)
{
- dprintf(2, "usage: %s "
+ fprintf(stderr, "usage: %s "
"[-v] "
"[-h] "
"[file ...] "
diff --git a/simulation.c b/simulation.c
@@ -500,7 +500,7 @@ write_output_file(const int normalize)
print_output(fp, normalize);
fclose(fp);
} else {
- dprintf(2, "could not open output file: %s", outfile);
+ fprintf(stderr, "could not open output file: %s", outfile);
exit(1);
}
}