+static int
+get_byte_resource (char *name, char *class)
+{
+ char *s = get_string_resource (name, class);
+ char *s2 = s;
+ int n = 0;
+ if (!s) return 0;
+
+ while (isspace(*s2)) s2++;
+ while (*s2 >= '0' && *s2 <= '9')
+ {
+ n = (n * 10) + (*s2 - '0');
+ s2++;
+ }
+ while (isspace(*s2)) s2++;
+ if (*s2 == 'k' || *s2 == 'K') n <<= 10;
+ else if (*s2 == 'm' || *s2 == 'M') n <<= 20;
+ else if (*s2 == 'g' || *s2 == 'G') n <<= 30;
+ else if (*s2)
+ {
+ LOSE:
+ fprintf (stderr, "%s: %s must be a number of bytes, not \"%s\".\n",
+ progname, name, s);
+ return 0;
+ }
+ s2++;
+ if (*s2 == 'b' || *s2 == 'B') s2++;
+ while (isspace(*s2)) s2++;
+ if (*s2) goto LOSE;
+
+ return n;
+}
+