void uniq(struct cmdnames *cmds)
{ unsignedint i, j;
if (!cmds->cnt) return;
for (i = 1; i < cmds->cnt; i++) { if (!strcmp(cmds->names[i]->name, cmds->names[i-1]->name))
zfree(&cmds->names[i - 1]);
} for (i = 0, j = 0; i < cmds->cnt; i++) { if (cmds->names[i]) { if (i == j)
j++; else
cmds->names[j++] = cmds->names[i];
}
}
cmds->cnt = j; while (j < i)
cmds->names[j++] = NULL;
}
if (s != NULL) {
ws->ws_row = atoi(s);
s = getenv("COLUMNS"); if (s != NULL) {
ws->ws_col = atoi(s); if (ws->ws_row && ws->ws_col) return;
}
} #ifdef TIOCGWINSZ if (ioctl(1, TIOCGWINSZ, ws) == 0 &&
ws->ws_row && ws->ws_col) return; #endif
ws->ws_row = 25;
ws->ws_col = 80;
}
staticvoid pretty_print_string_list(struct cmdnames *cmds, int longest)
{ int cols = 1, rows; int space = longest + 1; /* min 1 SP between words */ struct winsize win; int max_cols; int i, j;
for (i = 0; i < main_cmds->cnt; i++) if (longest < main_cmds->names[i]->len)
longest = main_cmds->names[i]->len; for (i = 0; i < other_cmds->cnt; i++) if (longest < other_cmds->names[i]->len)
longest = other_cmds->names[i]->len;
if (other_cmds->cnt) {
printf("%s available from elsewhere on your $PATH\n", title);
printf("---------------------------------------");
mput_char('-', strlen(title));
putchar('\n');
pretty_print_string_list(other_cmds, longest);
putchar('\n');
}
}
int is_in_cmdlist(struct cmdnames *c, constchar *s)
{ unsignedint i;
for (i = 0; i < c->cnt; i++) if (!strcmp(s, c->names[i]->name)) return 1; return 0;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.