Browse Source

Prettified the task names that are shown to the user. Dashes are turned to

spaces, and first letters of words are capitalized.
keep-around/43e990ab3f4cc50982f8dbc32e3465ca7c827876
Joey Hess 24 years ago
parent
commit
253a94d6f4
  1. 16
      data.c
  2. 3
      data.h
  3. 4
      slangui.c

16
data.c

@ -1,4 +1,4 @@
/* $Id: data.c,v 1.4 1999/12/29 16:10:01 tausq Exp $ */
/* $Id: data.c,v 1.5 2000/01/07 22:27:48 joeyh Exp $ */
/* data.c - encapsulates functions for reading a package listing like dpkg's available file
* Internally, packages are stored in a binary tree format to faciliate search operations
*/
@ -110,12 +110,26 @@ static void addpackage(struct packages_t *pkgs,
/* Adds package to the package list binary tree */
struct package_t *node = NEW(struct package_t);
void *p;
char *c;
char space=1;
VERIFY(name != NULL);
/* DPRINTF("Adding package %s to list\n", name); */
memset(node, 0, sizeof(struct package_t));
node->name = STRDUP(name);
c = node->prettyname = STRDUP(name+5);
while(c[0]) {
if (c[0] == '-') {
c[0] = ' ';
space=1;
}
else if(space) {
c[0] = toupper(c[0]);
space=0;
}
c++;
}
node->shortdesc = STRDUP(shortdesc);
node->longdesc = STRDUP(longdesc);

3
data.h

@ -1,9 +1,10 @@
/* $Id: data.h,v 1.1 1999/11/21 22:01:04 tausq Exp $ */
/* $Id: data.h,v 1.2 2000/01/07 22:27:48 joeyh Exp $ */
#ifndef _DATA_H
#define _DATA_H
struct package_t {
char *name;
char *prettyname;
char *shortdesc;
char *longdesc;
int dependscount;

4
slangui.c

@ -1,4 +1,4 @@
/* $Id: slangui.c,v 1.9 2000/01/07 22:10:18 joeyh Exp $ */
/* $Id: slangui.c,v 1.10 2000/01/07 22:27:48 joeyh Exp $ */
/* slangui.c - SLang user interface routines */
/* TODO: the redraw code is a bit broken, also this module is using way too many
* global vars */
@ -349,7 +349,7 @@ void ui_drawchooseritem(int index)
snprintf(buf, 1024, "[%c] %s: %s",
(_taskpackagesary[index]->selected == 0 ? ' ' : '*'),
_taskpackagesary[index]->name+5, _taskpackagesary[index]->shortdesc);
_taskpackagesary[index]->prettyname, _taskpackagesary[index]->shortdesc);
/* I fear the 1 below is an off-by-one error somewhere -- Joeyh */
SLsmg_write_nstring(buf, _chooserinfo.width - 1);
}

Loading…
Cancel
Save