Added wrappers around libc's memory management functions, to easily debug memory usage
This commit is contained in:
67
src/help.c
67
src/help.c
@@ -1,4 +1,4 @@
|
||||
/* $calcurse: help.c,v 1.35 2008/12/20 19:27:31 culot Exp $ */
|
||||
/* $calcurse: help.c,v 1.36 2008/12/28 13:13:59 culot Exp $ */
|
||||
|
||||
/*
|
||||
* Calcurse - text-based organizer
|
||||
@@ -29,6 +29,10 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "i18n.h"
|
||||
#include "custom.h"
|
||||
#include "utils.h"
|
||||
@@ -67,15 +71,15 @@ help_pages_e;
|
||||
static int
|
||||
get_help_lines (char *text)
|
||||
{
|
||||
int i;
|
||||
int nl = 0;
|
||||
int i, newline;
|
||||
|
||||
newline = 0;
|
||||
for (i = 0; text[i]; i++)
|
||||
{
|
||||
if (text[i] == '\n')
|
||||
nl++;
|
||||
newline++;
|
||||
}
|
||||
return (nl + 1);
|
||||
return newline + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -146,7 +150,7 @@ help_wins_init (scrollwin_t *hwin, int x, int y, int h, int w)
|
||||
hwin->pad.h = BUFSIZ;
|
||||
hwin->pad.w = hwin->win.w - 2 * PADOFFSET + 1;
|
||||
|
||||
snprintf (hwin->label, BUFSIZ, _("Calcurse %s | help"), VERSION);
|
||||
(void)snprintf (hwin->label, BUFSIZ, _("Calcurse %s | help"), VERSION);
|
||||
wins_scrollwin_init (hwin);
|
||||
wins_show (hwin->win.p, hwin->label);
|
||||
}
|
||||
@@ -311,7 +315,7 @@ help_screen (void)
|
||||
|
||||
hscr[HELP_MAIN].title =
|
||||
_(" Welcome to Calcurse. This is the main help screen.\n");
|
||||
snprintf (hscr[HELP_MAIN].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_MAIN].text, HELPTEXTSIZ,
|
||||
_("Moving around: Press '%s' or '%s' to scroll text upward or downward\n"
|
||||
" inside help screens, if necessary.\n\n"
|
||||
" Exit help: When finished, press '%s' to exit help and go back to\n"
|
||||
@@ -332,7 +336,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_GENERIC_CREDITS));
|
||||
|
||||
hscr[HELP_SAVE].title = _("Save\n");
|
||||
snprintf (hscr[HELP_SAVE].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_SAVE].text, HELPTEXTSIZ,
|
||||
_("Save calcurse data.\n"
|
||||
"Data are splitted into four different files which contain :"
|
||||
"\n\n"
|
||||
@@ -345,7 +349,7 @@ help_screen (void)
|
||||
"automatically before quitting."));
|
||||
|
||||
hscr[HELP_IMPORT].title = _("Import\n");
|
||||
snprintf (hscr[HELP_IMPORT].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_IMPORT].text, HELPTEXTSIZ,
|
||||
_("Import data from an icalendar file.\n"
|
||||
"You will be asked to enter the file name from which to load ical\n"
|
||||
"items. At the end of the import process, and if the general option\n"
|
||||
@@ -363,7 +367,7 @@ help_screen (void)
|
||||
"the item could not be imported.\n"));
|
||||
|
||||
hscr[HELP_EXPORT].title = _("Export\n");
|
||||
snprintf (hscr[HELP_EXPORT].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_EXPORT].text, HELPTEXTSIZ,
|
||||
_("Export calcurse data (appointments, events and todos).\n"
|
||||
"This leads to the export submenu, from which you can choose between\n"
|
||||
"two different export formats: 'ical' and 'pcal'. Choosing one of\n"
|
||||
@@ -378,12 +382,15 @@ help_screen (void)
|
||||
"Calcurse data are exported in the following order:\n"
|
||||
" events, appointments, todos.\n"));
|
||||
|
||||
strncpy (keystr[MOVE_UP], keys_action_allkeys (KEY_MOVE_UP), BUFSIZ);
|
||||
strncpy (keystr[MOVE_DOWN], keys_action_allkeys (KEY_MOVE_DOWN), BUFSIZ);
|
||||
strncpy (keystr[MOVE_LEFT], keys_action_allkeys (KEY_MOVE_LEFT), BUFSIZ);
|
||||
strncpy (keystr[MOVE_RIGHT], keys_action_allkeys (KEY_MOVE_RIGHT), BUFSIZ);
|
||||
(void)strncpy (keystr[MOVE_UP], keys_action_allkeys (KEY_MOVE_UP), BUFSIZ);
|
||||
(void)strncpy (keystr[MOVE_DOWN], keys_action_allkeys (KEY_MOVE_DOWN),
|
||||
BUFSIZ);
|
||||
(void)strncpy (keystr[MOVE_LEFT], keys_action_allkeys (KEY_MOVE_LEFT),
|
||||
BUFSIZ);
|
||||
(void)strncpy (keystr[MOVE_RIGHT], keys_action_allkeys (KEY_MOVE_RIGHT),
|
||||
BUFSIZ);
|
||||
hscr[HELP_DISPLACEMENT].title = _("Displacement keys\n");
|
||||
snprintf (hscr[HELP_DISPLACEMENT].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_DISPLACEMENT].text, HELPTEXTSIZ,
|
||||
_("Move around inside calcurse screens.\n"
|
||||
"The following scheme summarizes how to get around:\n\n"
|
||||
" move up\n"
|
||||
@@ -410,7 +417,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_END_OF_WEEK));
|
||||
|
||||
hscr[HELP_VIEW].title = _("View\n");
|
||||
snprintf (hscr[HELP_VIEW].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_VIEW].text, HELPTEXTSIZ,
|
||||
_("View the item you select in either the Todo or Appointment panel.\n"
|
||||
"\nThis is usefull when an event description is longer than the "
|
||||
"available\nspace to display it. "
|
||||
@@ -423,7 +430,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_VIEW_ITEM));
|
||||
|
||||
hscr[HELP_TAB].title = _("Tab\n");
|
||||
snprintf (hscr[HELP_TAB].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_TAB].text, HELPTEXTSIZ,
|
||||
_("Switch between panels.\n"
|
||||
"The panel currently in use has its border colorized.\n"
|
||||
"\nSome actions are possible only if the right panel is selected.\n"
|
||||
@@ -438,7 +445,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW));
|
||||
|
||||
hscr[HELP_GOTO].title = _("Goto\n");
|
||||
snprintf (hscr[HELP_GOTO].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_GOTO].text, HELPTEXTSIZ,
|
||||
_("Jump to a specific day in the calendar.\n"
|
||||
"\nUsing this command, you do not need to travel to that day using\n"
|
||||
"the displacement keys inside the calendar panel.\n"
|
||||
@@ -449,7 +456,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_GENERIC_GOTO_TODAY));
|
||||
|
||||
hscr[HELP_DELETE].title = _("Delete\n");
|
||||
snprintf (hscr[HELP_DELETE].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_DELETE].text, HELPTEXTSIZ,
|
||||
_("Delete an element in the ToDo or Appointment list.\n"
|
||||
"\nDepending on which panel is selected when you press the delete key,\n"
|
||||
"the hilighted item of either the ToDo or Appointment list will be \n"
|
||||
@@ -463,7 +470,7 @@ help_screen (void)
|
||||
"next time you launch Calcurse."));
|
||||
|
||||
hscr[HELP_ADD].title = _("Add\n");
|
||||
snprintf (hscr[HELP_ADD].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_ADD].text, HELPTEXTSIZ,
|
||||
_("Add an item in either the ToDo or Appointment list, depending on which\n"
|
||||
"panel is selected when you press '%s'.\n"
|
||||
"\nTo enter a new item in the TODO list, you will need first to enter the"
|
||||
@@ -500,7 +507,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_ADD_ITEM));
|
||||
|
||||
hscr[HELP_EDIT].title = _("Edit Item\n");
|
||||
snprintf (hscr[HELP_EDIT].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_EDIT].text, HELPTEXTSIZ,
|
||||
_("Edit the item which is currently selected.\n"
|
||||
"Depending on the item type (appointment, event, or todo), and if it is\n"
|
||||
"repeated or not, you will be asked to choose one of the item properties"
|
||||
@@ -517,7 +524,7 @@ help_screen (void)
|
||||
" modified properties next time you launch Calcurse."));
|
||||
|
||||
hscr[HELP_ENOTE].title = _("EditNote\n");
|
||||
snprintf (hscr[HELP_ENOTE].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_ENOTE].text, HELPTEXTSIZ,
|
||||
_("Attach a note to any type of item, or edit an already existing note.\n"
|
||||
"This feature is useful if you do not have enough space to store all\n"
|
||||
"of your item description, or if you would like to add sub-tasks to an\n"
|
||||
@@ -538,7 +545,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_EDIT_NOTE));
|
||||
|
||||
hscr[HELP_VNOTE].title = _("ViewNote\n");
|
||||
snprintf (hscr[HELP_VNOTE].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_VNOTE].text, HELPTEXTSIZ,
|
||||
_("View a note which was previously attached to an item (an item which\n"
|
||||
"owns a note has a '>' sign in front of it).\n"
|
||||
"This command only permits to view the note, not to edit it (to do so,\n"
|
||||
@@ -557,7 +564,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_VIEW_NOTE));
|
||||
|
||||
hscr[HELP_PRIORITY].title = _("Priority\n");
|
||||
snprintf (hscr[HELP_PRIORITY].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_PRIORITY].text, HELPTEXTSIZ,
|
||||
_("Change the priority of the currently selected item in the ToDo list.\n"
|
||||
"Priorities are represented by the number appearing in front of the\n"
|
||||
"todo description. This number goes from 9 for the lowest priority to\n"
|
||||
@@ -575,7 +582,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_LOWER_PRIORITY));
|
||||
|
||||
hscr[HELP_REPEAT].title = _("Repeat\n");
|
||||
snprintf (hscr[HELP_REPEAT].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_REPEAT].text, HELPTEXTSIZ,
|
||||
_("Repeat an event or an appointment.\n"
|
||||
"You must first select the item to be repeated by moving inside the\n"
|
||||
"appointment panel. Then pressing '%s' will lead you to a set of three\n"
|
||||
@@ -602,7 +609,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_REPEAT_ITEM));
|
||||
|
||||
hscr[HELP_FLAG].title = _("Flag Item\n");
|
||||
snprintf (hscr[HELP_FLAG].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_FLAG].text, HELPTEXTSIZ,
|
||||
_("Toggle an appointment's 'important' flag.\n"
|
||||
"If an item is flagged as important, an exclamation mark appears in front"
|
||||
"\nof it, and you will be warned if time gets closed to the appointment\n"
|
||||
@@ -612,7 +619,7 @@ help_screen (void)
|
||||
"\nand how long before it he gets notified."));
|
||||
|
||||
hscr[HELP_CONFIG].title = _("Config\n");
|
||||
snprintf (hscr[HELP_CONFIG].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_CONFIG].text, HELPTEXTSIZ,
|
||||
_("Open the configuration submenu.\n"
|
||||
"From this submenu, you can select between color, layout, notification\n"
|
||||
"and general options, and you can also configure your keybindings.\n"
|
||||
@@ -627,7 +634,7 @@ help_screen (void)
|
||||
"\nnext time you launch Calcurse."));
|
||||
|
||||
hscr[HELP_GENERAL].title = _("Generic keybindings\n");
|
||||
snprintf (hscr[HELP_GENERAL].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_GENERAL].text, HELPTEXTSIZ,
|
||||
_("Some of the keybindings apply whatever panel is selected. They are\n"
|
||||
"called generic keybinding.\n"
|
||||
"Here is the list of all the generic key bindings, together with their\n"
|
||||
@@ -652,7 +659,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_GENERIC_GOTO_TODAY));
|
||||
|
||||
hscr[HELP_OTHER].title = _("OtherCmd\n");
|
||||
snprintf (hscr[HELP_OTHER].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_OTHER].text, HELPTEXTSIZ,
|
||||
_("Switch between status bar help pages.\n"
|
||||
"Because the terminal screen is too narrow to display all of the\n"
|
||||
"available commands, you need to press '%s' to see the next set of\n"
|
||||
@@ -663,7 +670,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_GENERIC_OTHER_CMD));
|
||||
|
||||
hscr[HELP_CREDITS].title = _("Calcurse - text-based organizer");
|
||||
snprintf (hscr[HELP_CREDITS].text, HELPTEXTSIZ,
|
||||
(void)snprintf (hscr[HELP_CREDITS].text, HELPTEXTSIZ,
|
||||
_("\nCopyright (c) 2004-2008 Frederic Culot\n"
|
||||
"\n"
|
||||
"This program is free software; you can redistribute it and/or modify\n"
|
||||
|
||||
Reference in New Issue
Block a user