{ NULL, 0 }
};
+char *version=VERSION;
+
/*
** static prototypes
*/
if (folder)
adios(EX_USAGE, NULL, "only one folder at a time!");
else
- folder = getcpy(expandfol(cp));
+ folder = mh_xstrdup(expandfol(cp));
} else if (*cp == '/' || *cp == '.') {
if (file)
adios(EX_USAGE, NULL, "only one file at a time!");
}
/* We'll grow this buffer as needed. */
- field = (char *)mh_xcalloc(field_size = 256, sizeof(char));
+ field = mh_xcalloc(field_size = 256, sizeof(char));
make_comp(&comp);
length = strlen(comp); /* Convenience copy. */
break;
}
if (++n >= field_size - 1) {
- field = (char *)mh_xrealloc(field,
- field_size += 256);
+ field = mh_xrealloc(field, field_size += 256);
cp = field + n - 1;
}
}
} while (*field && *field != '-');
- free(field);
+ mh_free0(&field);
fclose(fp);
return;
if ((fp = fdopen(fd, "r")) == NULL) {
adios(EX_IOERR, NULL, "unable to fdopen file.");
}
- field = (char *)mh_xcalloc(field_size, sizeof(char));
+ field = mh_xcalloc(field_size, sizeof(char));
/*
** Copy lines from the input file to the temporary file
** a long path name.
*/
for (n=0, cp=field; (c=getc(fp)) != EOF; *cp++ = c) {
- if (c == '\n' && (c = getc(fp)) != ' ' &&
- c != '\t') {
- ungetc(c, fp);
+ if (c == '\n') {
+ ungetc((c = getc(fp)), fp);
+ if (c != ' ' && c != '\t') {
+ c = '\n';
+ break;
+ }
c = '\n';
- break;
}
if (++n >= field_size - 1) {
- field = (char *) mh_xrealloc(field,
- field_size *= 2);
+ field = mh_xrealloc(field, field_size *= 2);
cp = field + n - 1;
}
}
} while (*field && *field != '-');
- free(field);
+ mh_free0(&field);
fflush(tmp);
fflush(fp); /* The underlying fd will be closed by lkclose() */