diff --git a/allover13.c b/allover13.c index c65888f..851fdcb 100644 --- a/allover13.c +++ b/allover13.c @@ -52,7 +52,10 @@ int main(int argc, char * const argv[]) Scale = 40.0; pitch = 45.0 * Scale; - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/arches.c b/arches.c index fab86ee..39a06d1 100644 --- a/arches.c +++ b/arches.c @@ -38,7 +38,10 @@ int main(int argc, char * const argv[]) } /* Select first pen and draw border */ - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/celticstep.c b/celticstep.c index fc8f77b..25ec2c3 100644 --- a/celticstep.c +++ b/celticstep.c @@ -57,7 +57,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/circle_lines.c b/circle_lines.c index 759a71b..ff00ff3 100644 --- a/circle_lines.c +++ b/circle_lines.c @@ -52,7 +52,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/coords.c b/coords.c index 37c1d47..b8b48da 100644 --- a/coords.c +++ b/coords.c @@ -35,7 +35,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/cs_rosette.c b/cs_rosette.c index f3a7299..125a182 100644 --- a/cs_rosette.c +++ b/cs_rosette.c @@ -57,7 +57,10 @@ int main(int argc, char * const argv[]) nrings = 4; nlines = 16; - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/curve_stitching.c b/curve_stitching.c index d2708c7..9ac3998 100644 --- a/curve_stitching.c +++ b/curve_stitching.c @@ -49,7 +49,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/dala1.c b/dala1.c index 5d622d4..5948937 100644 --- a/dala1.c +++ b/dala1.c @@ -42,7 +42,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/dala2.c b/dala2.c index 50a89d2..80bfd3d 100644 --- a/dala2.c +++ b/dala2.c @@ -84,7 +84,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/dala2c.c b/dala2c.c index 096375c..1853066 100644 --- a/dala2c.c +++ b/dala2c.c @@ -52,7 +52,10 @@ int main (int argc, char * const argv[]) } } - plotbegin (0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize (&maxx, &maxy); diff --git a/dala3.c b/dala3.c index d67d9af..db8d881 100644 --- a/dala3.c +++ b/dala3.c @@ -42,7 +42,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/ellipse.c b/ellipse.c index f52179a..384e4e7 100644 --- a/ellipse.c +++ b/ellipse.c @@ -38,7 +38,10 @@ int main(int argc, char * const argv[]) } /* Select first pen and draw border */ - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/fraserspiral.c b/fraserspiral.c index 50794db..e183ddb 100644 --- a/fraserspiral.c +++ b/fraserspiral.c @@ -39,7 +39,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/hyp.c b/hyp.c index 7b79112..da0719e 100644 --- a/hyp.c +++ b/hyp.c @@ -42,7 +42,10 @@ int main(int argc, char *const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&X0, &Y0); diff --git a/isogrid.c b/isogrid.c index 4c16c02..d2d363c 100644 --- a/isogrid.c +++ b/isogrid.c @@ -40,7 +40,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/libtest.c b/libtest.c index 9a1afaf..ac4daaf 100644 --- a/libtest.c +++ b/libtest.c @@ -42,7 +42,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/lissajous.c b/lissajous.c index 767106f..3be0bd4 100644 --- a/lissajous.c +++ b/lissajous.c @@ -35,7 +35,10 @@ int main(int argc, char * const argv[]) } /* Select first pen and draw border */ - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/lotus.c b/lotus.c index c3e077d..2d0aef8 100644 --- a/lotus.c +++ b/lotus.c @@ -50,7 +50,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/morphpoly.c b/morphpoly.c index 0c9b33e..05670e8 100644 --- a/morphpoly.c +++ b/morphpoly.c @@ -59,7 +59,10 @@ int main(int argc, char * const argv[]) srand((unsigned int)time(NULL)); - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/op_moire.c b/op_moire.c index 5537c61..2fbaf36 100644 --- a/op_moire.c +++ b/op_moire.c @@ -43,7 +43,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/pappus.c b/pappus.c index 334d1ac..5b0d6b0 100644 --- a/pappus.c +++ b/pappus.c @@ -41,7 +41,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/pin_and_cotton.c b/pin_and_cotton.c index 1698989..efcc5a7 100644 --- a/pin_and_cotton.c +++ b/pin_and_cotton.c @@ -62,7 +62,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/pin_circle.c b/pin_circle.c index ac132e4..00230af 100644 --- a/pin_circle.c +++ b/pin_circle.c @@ -39,7 +39,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/piscis.c b/piscis.c index cd6854b..fdd8576 100644 --- a/piscis.c +++ b/piscis.c @@ -34,7 +34,10 @@ int main(int argc, char * const argv[]) } /* Select first pen and draw border */ - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/poly_oval.c b/poly_oval.c index 961627b..5895814 100644 --- a/poly_oval.c +++ b/poly_oval.c @@ -46,7 +46,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/qrplot.c b/qrplot.c index d2479df..bea43e8 100644 --- a/qrplot.c +++ b/qrplot.c @@ -32,7 +32,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } plotPBM("qr_sample.pbm", 50.0, 0.0, 2.0); diff --git a/spiralsq.c b/spiralsq.c index 9436403..4c29e91 100644 --- a/spiralsq.c +++ b/spiralsq.c @@ -42,7 +42,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/sqinsq.c b/sqinsq.c index 4d8d9ee..79ceb61 100644 --- a/sqinsq.c +++ b/sqinsq.c @@ -44,7 +44,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/star_grid.c b/star_grid.c index f811b80..53764eb 100644 --- a/star_grid.c +++ b/star_grid.c @@ -52,7 +52,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/superellipse.c b/superellipse.c index 969f908..aefa4a2 100644 --- a/superellipse.c +++ b/superellipse.c @@ -51,7 +51,10 @@ int main(int argc, char * const argv[]) } /* Select first pen and draw border */ - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/sutpent.c b/sutpent.c index 55c85e8..abea858 100644 --- a/sutpent.c +++ b/sutpent.c @@ -45,7 +45,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(1); + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/ternary_arcs.c b/ternary_arcs.c index 09484b9..b31a97c 100644 --- a/ternary_arcs.c +++ b/ternary_arcs.c @@ -43,7 +43,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/twist.c b/twist.c index 3da767c..4935ef0 100644 --- a/twist.c +++ b/twist.c @@ -37,7 +37,10 @@ int main(int argc, char * const argv[]) } } - plotbegin(0); + if (plotbegin(0) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } getplotsize(&maxx, &maxy); diff --git a/zigzag.c b/zigzag.c index df6c3fe..7c3d3ca 100644 --- a/zigzag.c +++ b/zigzag.c @@ -38,6 +38,11 @@ int main(int argc, char * const argv[]) } } + if (plotbegin(1) < 0) { + fputs("Failed to initialise HPGL library\n", stderr); + exit(EXIT_FAILURE); + } + if ((fp = fopen("zigzag.pgm", "r")) == NULL) { perror("zigzag.pgm"); exit(EXIT_FAILURE); @@ -47,8 +52,6 @@ int main(int argc, char * const argv[]) fgets(lin, 128, fp); fgets(lin, 128, fp); - plotbegin(1); - getplotsize(&maxx, &maxy); for (i = 0; i < 40; i++) {