Compare commits

...

13 Commits

Author SHA1 Message Date
Paul Beckingham
a42b8a89c3 - Completed 0.9.9 2008-05-27 20:47:56 -04:00
Paul Beckingham
011ad8fafd - Documentation snapshot, version bump. 2008-05-27 16:05:54 -04:00
Paul Beckingham
586883a98d - Updated status in ChangeLog. 2008-05-26 21:40:56 -04:00
Paul Beckingham
40dc0490e1 - Removed unused variable only detectable on Ubuntu 8.
- Removed misplaced files.
2008-05-26 21:39:10 -04:00
Paul Beckingham
abef040ebc Merge branch 'fedora9'
Conflicts:

	src/Date.cpp
	src/Table.cpp
2008-05-26 21:14:34 -04:00
Paul Beckingham
cb4f86e9f1 - Changes necessary for a clean build on Fedora9. 2008-05-26 20:58:41 -04:00
Paul Beckingham
b8fc8a0172 - Changes to enable a clean build on Ubuntu 8. 2008-05-26 14:58:45 -04:00
Paul Beckingham
35dd5df583 Merge branch 'fedora8' 2008-05-26 14:45:59 -04:00
Paul Beckingham
e666772477 - Added bugs to ChangeLog 2008-05-26 14:17:59 -04:00
Paul Beckingham
6b07f04338 Merge branch 'master' into fedora8 2008-05-26 14:17:13 -04:00
Paul Beckingham
334eb45534 - Corrected improperly specified color in sample .taskrc 2008-05-26 14:04:15 -04:00
Paul Beckingham
5e6b256df5 - Changes to enable a clean build under Fedora 8. 2008-05-26 13:34:33 -04:00
Paul Beckingham
e392b8a95e - Added portability documentation. 2008-05-26 13:31:19 -04:00
16 changed files with 180 additions and 84 deletions

1
.gitignore vendored
View File

@@ -1,7 +1,6 @@
Makefile.in Makefile.in
aclocal.m4 aclocal.m4
autom4te.cache autom4te.cache
conf.defs
auto.h* auto.h*
config.h.in config.h.in
config.status config.status

View File

@@ -1,15 +1,27 @@
1.1.0 (?)
- Command line specification of .taskrc file
1.0.0 (?) 1.0.0 (?)
- New movie made, uploaded
- Bug: assertion fails on mobile for t v - Bug: assertion fails on mobile for t v
- Bug: configure.ac does not properly determine ncurses availability
0.9.9 (?) - Bug: when run without arguments, task dumps core on Solaris 10
- Autoconf/autmake behaving properly. - Bug: Cannot seem to use the percent character in a task description
- All bugs fixed. - Bug: New installation "task stats" reports newest task 12/31/1969
- Bug: New installation task projects displays header but no data - should short-circuit
+ Bug: incorrect color specification in sample .taskrc file
------ reality ----------------------------------- ------ reality -----------------------------------
0.9.9 (5/27/2008)
+ Autoconf/autmake behaving properly.
+ Clean build on OS X 10.5.
+ Clean build on Ubuntu 8.0.
+ Clean build on Fedora Core 8.
+ Clean build on Fedora Core 9.
0.9.8 (5/25/2008) 0.9.8 (5/25/2008)
+ Color command. + Added "task color" command.
+ Removed unnecessary files. + Removed unnecessary files.
+ Completed documentation. + Completed documentation.
@@ -57,10 +69,18 @@
+ Initial commit. + Initial commit.
0.9.3 (4/6/2008) 0.9.3 (4/6/2008)
+ Added "task completed" command.
+ Properly recognizes ncurses.
0.9.2 (4/3/2008) 0.9.2 (4/3/2008)
+ Recognizes whether ncurses, flock is available.
+ "task" duplicated to "task_rel" for preparation of a fork.
0.9.1 (4/1/2008) 0.9.1 (4/1/2008)
+ Blank attributes read are longer be written out.
+ Completed "task export" command.
+ Added configuration values to "task version" command.
+ Consolidated header files, removed unnecessary ones.
0.9.0 (3/23/2008) 0.9.0 (3/23/2008)
+ flat source directory + flat source directory

18
NEWS
View File

@@ -1,9 +1,19 @@
Welcome to Task 1.0.0. Welcome to Task 1.0.0.
While Task has undergone much testing, bugs are sure to remain. If you Task has been built and tested on the following configurations:
encounter a bug, please contact me at bugs@beckingham.net. Here is what you
could do, in order of increasing effort (to you) and usefulness (to me): - OS X 10.5 Leopard
- Fedora Core 8
- Fedora Core 9
- Ubuntu 8
Known Issues:
- problems running on Solaris 10
While Task has undergone testing, bugs are sure to remain. If you encounter a
bug, please contact me at bugs@beckingham.net. Here is what you could do, in
order of increasing effort (to you) and usefulness (to me):
- Do nothing. Bug probably won't get fixed. - Do nothing. Bug probably won't get fixed.

8
README
View File

@@ -14,12 +14,14 @@ frequently, with best practices and useful reports evolving from usage patterns.
Task is scope-limited to GTD functionality only. Task is scope-limited to GTD functionality only.
You may want to jump straight to the TUTORIAL file, or perhaps watch the old
task movie on YouTube:
http://www.youtube.com/watch?v=l68LCl6BYvs
You may want to jump straight to the TUTORIAL file, or perhaps watch the task or the new improved one:
movie on YouTube:
http://????????????????? http:/www.youtube.com/watch?v=????????????
Either will give you a fairly good idea of what task is capable of, and whether Either will give you a fairly good idea of what task is capable of, and whether
it fits in to your way of working. As a command line application, task is not it fits in to your way of working. As a command line application, task is not

View File

@@ -2,11 +2,10 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61) AC_PREREQ(2.61)
AC_INIT(task, 0.9.8, bugs@beckingham.net) AC_INIT(task, 0.9.9, bugs@beckingham.net)
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/task.cpp]) AC_CONFIG_SRCDIR([src/task.cpp])
AC_CONFIG_HEADER([auto.h]) AC_CONFIG_HEADER([auto.h])
#AC_CONFIG_SUBDIRS([src])
# Checks for programs. # Checks for programs.
AC_PROG_CXX AC_PROG_CXX
@@ -14,7 +13,6 @@ AC_PROG_CC
AC_LANG(C++) AC_LANG(C++)
# Checks for libraries. # Checks for libraries.
#AC_CHECK_LIB(ncurses, initscr, [LIBS="$LIBS -lncurses" AC_DEFINE([HAVE_NCURSES], [1], [Found ncurses])])
AC_CHECK_LIB(ncurses,initscr) AC_CHECK_LIB(ncurses,initscr)
AC_CHECK_LIB(ncurses,endwin) AC_CHECK_LIB(ncurses,endwin)

68
script.txt Normal file
View File

@@ -0,0 +1,68 @@
task add do laundry
task add project:garage order dumpster
task add +phone tell mom i loveher
task add +phone pro:garage schedule goodwill pickup
task add +email pro:garage ask Tom if he wants that old bike
task ls
task 1 pro:home
task 3 pro:home tell mom I love her
task ls pro:garage
task long pro:garage
task list pro:garage
task lis +phone
task li pro:garage +phone
task l mom
task 1 priority:H
task pri:H 3
task 1 pri:M
task li
task 2 pri:L
task li
task do 3
task li
# There may be an arbitrary number of tags.
task 2 +phone +mistake
# Oops!
task 2 -mistake
task tags
task info 2
task projects
task 3 fg:bold
task li
task 3 fg:white
task li
task 3 fg:bold_underline_white
task li
task 4 bg:on_bright_red fg:bold_yellow
task li
task 4 bg:
task li
task 4 fg:
task colors
task 1 due:6/8/2008
task li
task calendar
task 1 due:6/1/2008
task li
task overdue
task cal
task export file.csv
cat file.csv
task start 1
task active
task do 1
task li
task do 3
task do 1
task active
task summary
task history

View File

@@ -7,6 +7,7 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h>
#include "task.h" #include "task.h"
#include "Config.h" #include "Config.h"
@@ -35,7 +36,7 @@ bool Config::load (const std::string& file)
while (getline (in, line)) while (getline (in, line))
{ {
// Remove comments. // Remove comments.
unsigned int pound = line.find ("#"); size_type pound = line.find ("#");
if (pound != std::string::npos) if (pound != std::string::npos)
line = line.substr (0, pound); line = line.substr (0, pound);
@@ -44,7 +45,7 @@ bool Config::load (const std::string& file)
// Skip empty lines. // Skip empty lines.
if (line.length () > 0) if (line.length () > 0)
{ {
unsigned int equal = line.find ("="); size_type equal = line.find ("=");
if (equal != std::string::npos) if (equal != std::string::npos)
{ {
std::string key = trim (line.substr (0, equal), " \t"); std::string key = trim (line.substr (0, equal), " \t");
@@ -96,12 +97,12 @@ void Config::createDefault (const std::string& file)
fprintf (out, "curses=on\n"); fprintf (out, "curses=on\n");
fprintf (out, "color=on\n"); fprintf (out, "color=on\n");
fprintf (out, "color.overdue=red\n"); fprintf (out, "color.overdue=bold_red\n");
fprintf (out, "#color.due=on yellow\n"); fprintf (out, "#color.due=on_bright_yellow\n");
fprintf (out, "#color.pri.H=on_red\n"); fprintf (out, "#color.pri.H=on_red\n");
fprintf (out, "#color.pri.M=on_yellow\n"); fprintf (out, "#color.pri.M=on_yellow\n");
fprintf (out, "#color.pri.L=on_green\n"); fprintf (out, "#color.pri.L=on_green\n");
fprintf (out, "color.active=cyan\n"); fprintf (out, "color.active=bold_cyan\n");
fprintf (out, "color.tagged=yellow\n"); fprintf (out, "color.tagged=yellow\n");
fclose (out); fclose (out);

View File

@@ -5,6 +5,8 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream> #include <iostream>
#include <time.h> #include <time.h>
#include <assert.h>
#include <stdlib.h>
#include "task.h" #include "task.h"
#include "Date.h" #include "Date.h"
@@ -36,8 +38,8 @@ Date::Date (const int m, const int d, const int y)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Date::Date (const std::string& mdy) Date::Date (const std::string& mdy)
{ {
unsigned int firstSlash = mdy.find ("/"); size_t firstSlash = mdy.find ("/");
unsigned int secondSlash = mdy.find ("/", firstSlash + 1); size_t secondSlash = mdy.find ("/", firstSlash + 1);
if (firstSlash != std::string::npos && if (firstSlash != std::string::npos &&
secondSlash != std::string::npos) secondSlash != std::string::npos)
{ {
@@ -155,7 +157,7 @@ int Date::daysInMonth (int month, int year)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string Date::monthName (int month) std::string Date::monthName (int month)
{ {
static char* months[12] = static const char* months[12] =
{ {
"January", "January",
"February", "February",
@@ -179,7 +181,7 @@ std::string Date::monthName (int month)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Date::dayName (int dow, std::string& name) void Date::dayName (int dow, std::string& name)
{ {
static char* days[7] = static const char* days[7] =
{ {
"Sunday", "Sunday",
"Monday", "Monday",
@@ -196,7 +198,7 @@ void Date::dayName (int dow, std::string& name)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string Date::dayName (int dow) std::string Date::dayName (int dow)
{ {
static char* days[7] = static const char* days[7] =
{ {
"Sunday", "Sunday",
"Monday", "Monday",

View File

@@ -115,7 +115,7 @@ void T::addTag (const std::string& tag)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void T::addTags (const std::vector <std::string>& tags) void T::addTags (const std::vector <std::string>& tags)
{ {
for (unsigned int i = 0; i < tags.size (); ++i) for (size_t i = 0; i < tags.size (); ++i)
{ {
if (tags[i].find (' ') != std::string::npos) if (tags[i].find (' ') != std::string::npos)
throw std::string ("T::addTags - tags may not contain spaces"); throw std::string ("T::addTags - tags may not contain spaces");
@@ -137,7 +137,7 @@ void T::addTags (const std::vector <std::string>& tags)
void T::removeTag (const std::string& tag) void T::removeTag (const std::string& tag)
{ {
std::vector <std::string> copy; std::vector <std::string> copy;
for (unsigned int i = 0; i < mTags.size (); ++i) for (size_t i = 0; i < mTags.size (); ++i)
if (mTags[i] != tag) if (mTags[i] != tag)
copy.push_back (mTags[i]); copy.push_back (mTags[i]);
@@ -242,7 +242,7 @@ const std::string T::compose () const
else if (mStatus == deleted) line += "X ["; else if (mStatus == deleted) line += "X [";
// Tags // Tags
for (unsigned int i = 0; i < mTags.size (); ++i) for (size_t i = 0; i < mTags.size (); ++i)
{ {
line += (i > 0 ? " " : ""); line += (i > 0 ? " " : "");
line += mTags[i]; line += mTags[i];
@@ -297,7 +297,7 @@ const std::string T::composeCSV ()
// Tags // Tags
line += "'"; line += "'";
for (unsigned int i = 0; i < mTags.size (); ++i) for (size_t i = 0; i < mTags.size (); ++i)
{ {
line += (i > 0 ? " " : ""); line += (i > 0 ? " " : "");
line += mTags[i]; line += mTags[i];
@@ -364,13 +364,13 @@ void T::parse (const std::string& line)
if (line[0] == 'X') if (line[0] == 'X')
setStatus (deleted); setStatus (deleted);
unsigned int openTagBracket = line.find ("["); size_t openTagBracket = line.find ("[");
unsigned int closeTagBracket = line.find ("]", openTagBracket); size_t closeTagBracket = line.find ("]", openTagBracket);
if (openTagBracket != std::string::npos && if (openTagBracket != std::string::npos &&
closeTagBracket != std::string::npos) closeTagBracket != std::string::npos)
{ {
unsigned int openAttrBracket = line.find ("[", closeTagBracket); size_t openAttrBracket = line.find ("[", closeTagBracket);
unsigned int closeAttrBracket = line.find ("]", openAttrBracket); size_t closeAttrBracket = line.find ("]", openAttrBracket);
if (openAttrBracket != std::string::npos && if (openAttrBracket != std::string::npos &&
closeAttrBracket != std::string::npos) closeAttrBracket != std::string::npos)
{ {
@@ -383,7 +383,7 @@ void T::parse (const std::string& line)
openAttrBracket + 1, closeAttrBracket - openAttrBracket - 1); openAttrBracket + 1, closeAttrBracket - openAttrBracket - 1);
std::vector <std::string> pairs; std::vector <std::string> pairs;
split (pairs, attributes, ' '); split (pairs, attributes, ' ');
for (unsigned int i = 0; i < pairs.size (); ++i) for (size_t i = 0; i < pairs.size (); ++i)
{ {
std::vector <std::string> pair; std::vector <std::string> pair;
split (pair, pairs[i], ':'); split (pair, pairs[i], ':');
@@ -415,13 +415,13 @@ void T::parse (const std::string& line)
: line[37] == 'X' ? deleted : line[37] == 'X' ? deleted
: pending; : pending;
unsigned int openTagBracket = line.find ("["); size_t openTagBracket = line.find ("[");
unsigned int closeTagBracket = line.find ("]", openTagBracket); size_t closeTagBracket = line.find ("]", openTagBracket);
if (openTagBracket != std::string::npos && if (openTagBracket != std::string::npos &&
closeTagBracket != std::string::npos) closeTagBracket != std::string::npos)
{ {
unsigned int openAttrBracket = line.find ("[", closeTagBracket); size_t openAttrBracket = line.find ("[", closeTagBracket);
unsigned int closeAttrBracket = line.find ("]", openAttrBracket); size_t closeAttrBracket = line.find ("]", openAttrBracket);
if (openAttrBracket != std::string::npos && if (openAttrBracket != std::string::npos &&
closeAttrBracket != std::string::npos) closeAttrBracket != std::string::npos)
{ {
@@ -434,7 +434,7 @@ void T::parse (const std::string& line)
openAttrBracket + 1, closeAttrBracket - openAttrBracket - 1); openAttrBracket + 1, closeAttrBracket - openAttrBracket - 1);
std::vector <std::string> pairs; std::vector <std::string> pairs;
split (pairs, attributes, ' '); split (pairs, attributes, ' ');
for (unsigned int i = 0; i < pairs.size (); ++i) for (size_t i = 0; i < pairs.size (); ++i)
{ {
std::vector <std::string> pair; std::vector <std::string> pair;
split (pair, pairs[i], ':'); split (pair, pairs[i], ':');

View File

@@ -7,6 +7,7 @@
#include <fstream> #include <fstream>
#include <sys/file.h> #include <sys/file.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include "task.h" #include "task.h"
#include "TDB.h" #include "TDB.h"

View File

@@ -22,6 +22,8 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream> #include <iostream>
#include <string.h>
#include <assert.h>
#include <Table.h> #include <Table.h>
#include <Date.h> #include <Date.h>
#include <task.h> #include <task.h>
@@ -415,7 +417,7 @@ void Table::calculateColumnWidths ()
std::vector <int> ideal = mMaxDataWidth; std::vector <int> ideal = mMaxDataWidth;
int width = 0; int width = 0;
int countFlexible = 0; int countFlexible = 0;
for (unsigned int c = 0; c < mColumns.size (); ++c) for (size_t c = 0; c < mColumns.size (); ++c)
{ {
if (mSpecifiedWidth[c] == flexible) if (mSpecifiedWidth[c] == flexible)
++countFlexible; ++countFlexible;
@@ -440,7 +442,7 @@ void Table::calculateColumnWidths ()
{ {
ideal = mMaxDataWidth; ideal = mMaxDataWidth;
width = 0; width = 0;
for (unsigned int c = 0; c < mColumns.size (); ++c) for (size_t c = 0; c < mColumns.size (); ++c)
{ {
if (mSpecifiedWidth[c] > 0) if (mSpecifiedWidth[c] > 0)
ideal[c] = mSpecifiedWidth[c]; ideal[c] = mSpecifiedWidth[c];
@@ -462,7 +464,7 @@ void Table::calculateColumnWidths ()
int remainder = available % countFlexible; int remainder = available % countFlexible;
int lastFlexible = mColumns.size () - 1; int lastFlexible = mColumns.size () - 1;
for (unsigned int c = 0; c < mColumns.size (); ++c) for (size_t c = 0; c < mColumns.size (); ++c)
{ {
if (mSpecifiedWidth[c] == flexible) if (mSpecifiedWidth[c] == flexible)
{ {
@@ -593,7 +595,7 @@ void Table::formatCell (
std::string postJust; std::string postJust;
std::vector <std::string> chunks; std::vector <std::string> chunks;
wrapText (chunks, data, width); wrapText (chunks, data, width);
for (unsigned int chunk = 0; chunk < chunks.size (); ++chunk) for (size_t chunk = 0; chunk < chunks.size (); ++chunk)
{ {
// Place the data within the available space - justify. // Place the data within the available space - justify.
int gap = width - chunks[chunk].length (); int gap = width - chunks[chunk].length ();
@@ -614,7 +616,7 @@ void Table::formatCell (
for (int i = 0; i < gap / 2; ++i) for (int i = 0; i < gap / 2; ++i)
preJust += " "; preJust += " ";
for (unsigned int i = 0; i < gap - preJust.length (); ++i) for (size_t i = 0; i < gap - preJust.length (); ++i)
postJust += " "; postJust += " ";
} }
@@ -670,7 +672,7 @@ const std::string Table::formatCell (
for (int i = 0; i < gap / 2; ++i) for (int i = 0; i < gap / 2; ++i)
preJust += " "; preJust += " ";
for (unsigned int i = 0; i < gap - preJust.length (); ++i) for (size_t i = 0; i < gap - preJust.length (); ++i)
postJust += " "; postJust += " ";
} }
@@ -714,7 +716,7 @@ void Table::optimize (std::string& output)
*/ */
// \s\n -> \n // \s\n -> \n
unsigned int i = 0; size_t i = 0;
while ((i = output.find (" \n")) != std::string::npos) while ((i = output.find (" \n")) != std::string::npos)
{ {
output = output.substr (0, i) + output = output.substr (0, i) +
@@ -757,7 +759,7 @@ void Table::sort (std::vector <int>& order)
while (r + gap < (int) order.size ()) while (r + gap < (int) order.size ())
{ {
bool keepScanning = true; bool keepScanning = true;
for (unsigned int c = 0; keepScanning && c < mSortColumns.size (); ++c) for (size_t c = 0; keepScanning && c < mSortColumns.size (); ++c)
{ {
keepScanning = false; keepScanning = false;
@@ -855,8 +857,8 @@ void Table::sort (std::vector <int>& order)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Table::clean (std::string& value) void Table::clean (std::string& value)
{ {
unsigned int start = 0; size_t start = 0;
unsigned int pos; size_t pos;
while ((pos = value.find ('\t', start)) != std::string::npos) while ((pos = value.find ('\t', start)) != std::string::npos)
{ {
value.replace (pos, 1, " "); value.replace (pos, 1, " ");
@@ -884,7 +886,7 @@ const std::string Table::render ()
// Print column headers in column order. // Print column headers in column order.
std::string output; std::string output;
for (unsigned int col = 0; col < mColumns.size (); ++col) for (size_t col = 0; col < mColumns.size (); ++col)
output += formatHeader ( output += formatHeader (
col, col,
mCalculatedWidth[col], mCalculatedWidth[col],
@@ -907,8 +909,8 @@ const std::string Table::render ()
std::vector <std::vector <std::string> > columns; std::vector <std::vector <std::string> > columns;
std::vector <std::string> blanks; std::vector <std::string> blanks;
unsigned int maxHeight = 0; size_t maxHeight = 0;
for (unsigned int col = 0; col < mColumns.size (); ++col) for (size_t col = 0; col < mColumns.size (); ++col)
{ {
std::vector <std::string> lines; std::vector <std::string> lines;
std::string blank; std::string blank;
@@ -928,9 +930,9 @@ const std::string Table::render ()
if (maxHeight) if (maxHeight)
{ {
for (unsigned int lines = 0; lines < maxHeight; ++lines) for (size_t lines = 0; lines < maxHeight; ++lines)
{ {
for (unsigned int col = 0; col < mColumns.size (); ++col) for (size_t col = 0; col < mColumns.size (); ++col)
if (lines < columns[col].size ()) if (lines < columns[col].size ())
output += columns[col][lines]; output += columns[col][lines];
else else

View File

@@ -4,6 +4,7 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream> #include <iostream>
#include <stdlib.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
@@ -13,7 +14,7 @@
#include "T.h" #include "T.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static char* colors[] = static const char* colors[] =
{ {
"bold", "bold",
"underline", "underline",
@@ -75,7 +76,7 @@ static char* colors[] =
"", "",
}; };
static char* attributes[] = static const char* attributes[] =
{ {
"project", "project",
"priority", "priority",
@@ -88,7 +89,7 @@ static char* attributes[] =
"", "",
}; };
static char* commands[] = static const char* commands[] =
{ {
"active", "active",
"add", "add",
@@ -115,7 +116,7 @@ static char* commands[] =
"", "",
}; };
void guess (const std::string& type, char** list, std::string& candidate) void guess (const std::string& type, const char** list, std::string& candidate)
{ {
std::vector <std::string> options; std::vector <std::string> options;
for (int i = 0; list[i][0]; ++i) for (int i = 0; list[i][0]; ++i)
@@ -136,7 +137,7 @@ void guess (const std::string& type, char** list, std::string& candidate)
error += " '"; error += " '";
error += candidate; error += candidate;
error += "' - could be either of "; error += "' - could be either of ";
for (unsigned int i = 0; i < matches.size (); ++i) for (size_t i = 0; i < matches.size (); ++i)
{ {
if (i) if (i)
error += ", "; error += ", ";
@@ -165,8 +166,8 @@ static bool isCommand (const std::string& candidate)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool validDate (std::string& date) bool validDate (std::string& date)
{ {
unsigned int firstSlash = date.find ("/"); size_t firstSlash = date.find ("/");
unsigned int secondSlash = date.find ("/", firstSlash + 1); size_t secondSlash = date.find ("/", firstSlash + 1);
if (firstSlash != std::string::npos && if (firstSlash != std::string::npos &&
secondSlash != std::string::npos) secondSlash != std::string::npos)
{ {
@@ -236,7 +237,7 @@ static bool validAttribute (std::string& name, std::string& value)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static bool validId (const std::string& input) static bool validId (const std::string& input)
{ {
for (unsigned int i = 0; i < input.length (); ++i) for (size_t i = 0; i < input.length (); ++i)
if (!::isdigit (input[i])) if (!::isdigit (input[i]))
return false; return false;
@@ -275,13 +276,13 @@ static bool validSubstitution (
std::string& from, std::string& from,
std::string& to) std::string& to)
{ {
unsigned int first = input.find ('/'); size_t first = input.find ('/');
if (first != std::string::npos) if (first != std::string::npos)
{ {
unsigned int second = input.find ('/', first + 1); size_t second = input.find ('/', first + 1);
if (second != std::string::npos) if (second != std::string::npos)
{ {
unsigned int third = input.find ('/', second + 1); size_t third = input.find ('/', second + 1);
if (third != std::string::npos) if (third != std::string::npos)
{ {
if (first == 0 && if (first == 0 &&
@@ -318,10 +319,10 @@ void parse (
command = ""; command = "";
std::string descCandidate = ""; std::string descCandidate = "";
for (unsigned int i = 0; i < args.size (); ++i) for (size_t i = 0; i < args.size (); ++i)
{ {
std::string arg (args[i]); std::string arg (args[i]);
unsigned int colon; // Pointer to colon in argument. size_t colon; // Pointer to colon in argument.
std::string from; std::string from;
std::string to; std::string to;

View File

@@ -4,6 +4,7 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream> #include <iostream>
#include <stdlib.h>
#include "Config.h" #include "Config.h"
#include "Table.h" #include "Table.h"
#include "Date.h" #include "Date.h"

View File

@@ -9,6 +9,7 @@
#include <fstream> #include <fstream>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h>
#include <pwd.h> #include <pwd.h>
#include <time.h> #include <time.h>
@@ -1694,7 +1695,7 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf)
table.setColumnJustification (4, Table::right); table.setColumnJustification (4, Table::right);
table.setColumnJustification (5, Table::right); table.setColumnJustification (5, Table::right);
char *months[] = const char *months[] =
{ {
"January", "February", "March", "April", "May", "June", "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December", "July", "August", "September", "October", "November", "December",
@@ -2143,17 +2144,6 @@ void handleReportOverdue (const TDB& tdb, T& task, Config& conf)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void handleReportStats (const TDB& tdb, T& task, Config& conf) void handleReportStats (const TDB& tdb, T& task, Config& conf)
{ {
// Determine window size, and set table accordingly.
int width = 80;
#ifdef HAVE_LIBNCURSES
if (conf.get ("curses", true))
{
WINDOW* w = initscr ();
width = w->_maxx + 1;
endwin ();
}
#endif
// Get all the tasks. // Get all the tasks.
std::vector <T> tasks; std::vector <T> tasks;
tdb.allT (tasks); tdb.allT (tasks);
@@ -2458,7 +2448,7 @@ void handleModify (const TDB& tdb, T& task, Config& conf)
if (from != "") if (from != "")
{ {
std::string description = original.getDescription (); std::string description = original.getDescription ();
unsigned int pattern = description.find (from); size_t pattern = description.find (from);
if (pattern != std::string::npos) if (pattern != std::string::npos)
{ {
description = description.substr (0, pattern) + description = description.substr (0, pattern) +

View File

@@ -76,8 +76,8 @@ void extractParagraphs (const std::string& input, std::vector<std::string>& outp
std::string copy = input; std::string copy = input;
while (1) while (1)
{ {
unsigned int so = copy.find ("<p>"); size_t so = copy.find ("<p>");
unsigned int eo = copy.find ("</p>"); size_t eo = copy.find ("</p>");
if (so == std::string::npos && eo == std::string::npos) if (so == std::string::npos && eo == std::string::npos)
break; break;
@@ -126,7 +126,7 @@ void unquoteText (std::string& text)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void extractLine (std::string& text, std::string& line, int length) void extractLine (std::string& text, std::string& line, int length)
{ {
unsigned int eol = text.find ("\n"); size_t eol = text.find ("\n");
// Special case: found \n in first length characters. // Special case: found \n in first length characters.
if (eol != std::string::npos && eol < (unsigned) length) if (eol != std::string::npos && eol < (unsigned) length)

View File

@@ -10,6 +10,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "Table.h" #include "Table.h"
#include "task.h" #include "task.h"
#include "../auto.h" #include "../auto.h"