From 0b67be12abb6a4d6fe44eadc8a1fb0467b8e96d9 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 3 Jan 2024 01:50:36 +0100 Subject: Reformatted com_unalias() --- FICS/comproc.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'FICS') diff --git a/FICS/comproc.c b/FICS/comproc.c index d3fc981..dbc82a4 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -1416,27 +1416,36 @@ PUBLIC int com_alias(int p, param_list param) return COM_OK; } -PUBLIC int com_unalias(int p, param_list param) +PUBLIC int +com_unalias(int p, param_list param) { - int al; - int i; + int al; - ASSERT(param[0].type == TYPE_WORD); - al = alias_lookup(param[0].val.word, parray[p].alias_list, parray[p].numAlias); - if (al < 0) { - pprintf(p, "You have no alias named '%s'.\n", param[0].val.word); - } else { - rfree(parray[p].alias_list[al].comm_name); - rfree(parray[p].alias_list[al].alias); - for (i = al; i < parray[p].numAlias; i++) { - parray[p].alias_list[i].comm_name = parray[p].alias_list[i + 1].comm_name; - parray[p].alias_list[i].alias = parray[p].alias_list[i + 1].alias; - } - parray[p].numAlias--; - parray[p].alias_list[parray[p].numAlias].comm_name = NULL; - pprintf(p, "Alias removed.\n"); - } - return COM_OK; + ASSERT(param[0].type == TYPE_WORD); + + al = alias_lookup(param[0].val.word, parray[p].alias_list, + parray[p].numAlias); + + if (al < 0) { + pprintf(p, "You have no alias named '%s'.\n", + param[0].val.word); + } else { + rfree(parray[p].alias_list[al].comm_name); + rfree(parray[p].alias_list[al].alias); + + for (int i = al; i < parray[p].numAlias; i++) { + parray[p].alias_list[i].comm_name = + parray[p].alias_list[i + 1].comm_name; + parray[p].alias_list[i].alias = + parray[p].alias_list[i + 1].alias; + } + + parray[p].numAlias--; + parray[p].alias_list[parray[p].numAlias].comm_name = NULL; + pprintf(p, "Alias removed.\n"); + } + + return COM_OK; } PUBLIC int -- cgit v1.2.3