X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Futils.c;h=64df443b22455688012af8890d7190d104783515;hp=8aba5b6ad63036e45e6cfbc0bd69e47fe2c937eb;hb=b439ec143c4d2e2daf4b0a9c332123f24500cd9a;hpb=0364511845929f2b946b7a216289e9954f4a13d6 diff --git a/sbr/utils.c b/sbr/utils.c index 8aba5b6..64df443 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -12,6 +12,7 @@ #include #include #include +#include #include /* @@ -184,3 +185,19 @@ app_msgarg(struct msgs_array *msgs, char *cp) msgs->msgs = mh_xrealloc(msgs->msgs, (msgs->max+=MAXMSGS)*sizeof(*msgs->msgs)); msgs->msgs[msgs->size++] = cp; } + +/* Open a form or components file */ +int +open_form(char **form, char *def) +{ + int in; + if (*form) { + if ((in = open (etcpath (*form), O_RDONLY)) == NOTOK) + adios (*form, "unable to open form file"); + } else { + if ((in = open (etcpath (def), O_RDONLY)) == NOTOK) + adios (def, "unable to open default components file"); + *form = def; + } + return in; +}