atoul
int atoul(char *, u_long *);
if (atoul($1, &ulval) == -1) {
if (atoul(n, &ulval) == 0) {
if (atoul(w, &ulval) == -1) {