From 5527325a67f423ac093a580fb367778529e6158f Mon Sep 17 00:00:00 2001 From: h_vogt Date: Fri, 8 Jan 2016 23:42:31 +0100 Subject: [PATCH] runcoms.c, change command `setcirc' `setcirc' print a list of circuits loaded `setcirc ' switch to circuit number --- src/frontend/runcoms.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/frontend/runcoms.c b/src/frontend/runcoms.c index 475c25ead..2fd724083 100644 --- a/src/frontend/runcoms.c +++ b/src/frontend/runcoms.c @@ -49,13 +49,19 @@ char rawfileBuf[RAWBUF_SIZE]; char *last_used_rawfile = NULL; /*end saj */ -/* command "setcirc" */ + +/* + * command "setcirc" + * print a list of circuits loaded + * command "setcirc " + * switch to circuit number + */ + void com_scirc(wordlist *wl) { struct circ *p; int i, j = 0; - char buf[BSIZE_SP]; if (ft_circuits == NULL) { fprintf(cp_err, "Error: there aren't any circuits loaded.\n"); @@ -64,20 +70,13 @@ com_scirc(wordlist *wl) if (wl == NULL) { fprintf(cp_out, - "\tType the number of the desired circuit:\n\n"); + "List of circuits loaded:\n\n"); for (p = ft_circuits; p; p = p->ci_next) { if (ft_curckt == p) fprintf(cp_out, "Current"); fprintf(cp_out, "\t%d\t%s\n", ++j, p->ci_name); } - fprintf(cp_out, "? "); - (void) fflush(cp_out); - (void) fgets(buf, BSIZE_SP, cp_in); - clearerr(cp_in); - if ((sscanf(buf, " %d ", &i) != 1) || (i < 0) || (i > j)) - return; - for (p = ft_circuits; --i > 0; p = p->ci_next) - ; + return; } else { for (p = ft_circuits; p; p = p->ci_next) j++;