add function get_plot(name) to return address of named plot

This commit is contained in:
Holger Vogt 2019-01-27 12:39:32 +01:00
parent 29f364d475
commit 872ec89692
2 changed files with 13 additions and 0 deletions

View File

@ -945,6 +945,18 @@ vec_basename(struct dvec *v)
return (copy(s));
}
/* get address of plot named 'name' */
struct plot *
get_plot(char* name)
{
struct plot *pl;
for (pl = plot_list; pl; pl = pl->pl_next)
if (plot_prefix(name, pl->pl_typename))
return pl;
fprintf(cp_err, "Error: no such plot named %s\n", name);
return NULL;
}
/* Make a plot the current one. This gets called by cp_usrset() when one
* does a 'set curplot = name'.

View File

@ -359,6 +359,7 @@ extern void vec_new(struct dvec *d);
extern void plot_docoms(wordlist *wl);
extern void vec_remove(char *name);
extern void plot_setcur(char *name);
extern struct plot *get_plot(char* name);
extern void plot_new(struct plot *pl);
extern char *vec_basename(struct dvec *v);
extern bool plot_prefix(char *pre, char *str);