git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52817 15284696-431f-4ddb-bdfa-cd5b030d7da7
@@ -72,10 +72,10 @@ int header(int unit1, int unit2)
divider("|");
label = nlayers > 1 ? "MAPS:" : "MAP:";
- len1 = strlen(label) + 1;
mask = maskinfo();
label = "MASK:";
+ len1 = strlen(label) + 1;
while (mask) {
fprintf(stdout, "|%-*s", len1, label);
label = "";
@@ -1,5 +1,7 @@
#include <string.h>
#include <stdio.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
char *print_label(char *s, int len, int pflag, int spacing, int dot)
{
@@ -7,6 +9,11 @@ char *print_label(char *s, int len, int pflag, int spacing, int dot)
int n;
int i;
+ if (len <= 0) {
+ G_warning(_("Page width is too small"));
+ return NULL;
+ }
+
/* strip away leading spaces */
while (*s == ' ')
s++;