-/*
- Read exactly one line and strip the trailing newline if any. If the
- file was on EOF, return NULL. Otherwise, return all the data in a
- dynamically allocated buffer.
-
- If line is non-NULL, it will be used as an initial buffer, to avoid
- unnecessary mallocing each time this function is called. If buf is
- given, and buf needs to be expanded, the var pointed to by buflen
- will be increased.
-*/
-static char *readline(FILE * fp, char **buf, size_t *buflen) {
- char *newline = NULL;
- char *p;
- char *line; /* The array that contains everything that has been read so far */
- char *idx; /* Read into this pointer, which points to an offset within line */
- size_t size, newsize; /* The size of the current array pointed to by line */
- size_t maxlen; /* Maximum number of characters that may be read with fgets. This is newsize - oldsize. */
-
- if(feof(fp))
- return NULL;
-
- if(buf && buflen) {
- size = *buflen;
- line = *buf;
- } else {
- size = 100;
- line = xmalloc(size);
- }
-
- maxlen = size;
- idx = line;
- *idx = 0;
-
- for(;;) {
- errno = 0;
- p = fgets(idx, maxlen, fp);
-
- if(!p) { /* EOF or error */
- if(feof(fp))
- break;
-
- /* otherwise: error; let the calling function print an error message if applicable */
- free(line);
- return NULL;
- }
+/// Read an invitation file, and immediately delete it.
+bool invitation_read(meshlink_handle_t *mesh, const char *name, config_t *config) {
+ if(!mesh->confbase) {
+ return false;
+ }