inpcom.c, introduce find_back_assignment()
This commit is contained in:
parent
5238f0b1cb
commit
511389ad10
|
|
@ -436,6 +436,27 @@ find_assignment(const char *str)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* backward search for an assignment
|
||||
* fixme, doesn't honour neither " nor ' quotes
|
||||
*/
|
||||
|
||||
char *
|
||||
find_back_assignment(const char *p, const char *start)
|
||||
{
|
||||
while (--p >= start) {
|
||||
if (*p != '=')
|
||||
continue;
|
||||
// check for '!=', '<=', '>=', '=='
|
||||
if (p <= start || !strchr("!<=>", p[-1]))
|
||||
return (char *) p;
|
||||
p--;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
Read the entire input file and return a pointer to the first line of
|
||||
the linked list of 'card' records in data. The pointer is stored in
|
||||
|
|
|
|||
|
|
@ -216,6 +216,8 @@ extern struct line *inp_readall(FILE *fp, char *dir_name, bool comfile, bool int
|
|||
extern FILE *inp_pathopen(char *name, char *mode);
|
||||
extern char *search_identifier(char *str, const char *identifier, char *str_begin);
|
||||
extern char *find_assignment(const char *s);
|
||||
extern char *find_back_assignment(const char *s, const char *start);
|
||||
|
||||
extern struct line *line_nconc(struct line *head, struct line *rest);
|
||||
extern struct line *line_reverse(struct line *head);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue