aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2007-01-16 07:49:54 +0000
committerFrederic Culot <calcurse@culot.org>2007-01-16 07:49:54 +0000
commit6bbf3e5f2e6777feeaf19e42d9c8bb5b2da0a428 (patch)
tree952621a0090505b0502db07201f04bffbf15aee1 /src
parent23e729651bf50a468afef469eaea3ef0e7544b64 (diff)
downloadcalcurse-6bbf3e5f2e6777feeaf19e42d9c8bb5b2da0a428.tar.gz
calcurse-6bbf3e5f2e6777feeaf19e42d9c8bb5b2da0a428.zip
use of getstring() defines
Diffstat (limited to 'src')
-rwxr-xr-xsrc/calcurse.c28
-rwxr-xr-xsrc/calendar.c7
-rwxr-xr-xsrc/recur.c16
-rwxr-xr-xsrc/todo.c7
4 files changed, 33 insertions, 25 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 7dc1f6f..cdb21c4 100755
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -1,8 +1,8 @@
-/* $calcurse: calcurse.c,v 1.33 2007/01/10 13:44:49 culot Exp $ */
+/* $calcurse: calcurse.c,v 1.34 2007/01/16 07:49:54 culot Exp $ */
/*
* Calcurse - text-based organizer
- * Copyright (c) 2004-2006 Frederic Culot
+ * Copyright (c) 2004-2007 Frederic Culot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -850,7 +850,8 @@ void config_notify_bar(void)
break;
case '2':
status_mesg(date_str, "");
- if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) == 0) {
+ if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) ==
+ GETSTRING_VALID) {
pthread_mutex_lock(&nbar->mutex);
strncpy(nbar->datefmt, buf, strlen(buf) + 1);
pthread_mutex_unlock(&nbar->mutex);
@@ -859,7 +860,8 @@ void config_notify_bar(void)
break;
case '3':
status_mesg(time_str, "");
- if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) == 0 ) {
+ if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) ==
+ GETSTRING_VALID) {
pthread_mutex_lock(&nbar->mutex);
strncpy(nbar->timefmt, buf, strlen(buf) + 1);
pthread_mutex_unlock(&nbar->mutex);
@@ -868,9 +870,9 @@ void config_notify_bar(void)
break;
case '4':
status_mesg(count_str, "");
- if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) == 0 &&
- is_all_digit(buf) && atoi(buf) >= 0 &&
- atoi(buf) <= DAYINSEC) {
+ if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) ==
+ GETSTRING_VALID && is_all_digit(buf) &&
+ atoi(buf) >= 0 && atoi(buf) <= DAYINSEC) {
pthread_mutex_lock(&nbar->mutex);
nbar->cntdwn = atoi(buf);
pthread_mutex_unlock(&nbar->mutex);
@@ -1120,7 +1122,8 @@ void add_item(void)
/* Get the starting time */
while (check_time(item_time) != 1) {
status_mesg(mesg_1, "");
- if (getstring(swin, colr, item_time, LTIME, 0, 1) == 0) {
+ if (getstring(swin, colr, item_time, LTIME, 0, 1) !=
+ GETSTRING_ESC) {
if (strlen(item_time) == 0){
is_appointment = 0;
break;
@@ -1129,7 +1132,8 @@ void add_item(void)
wgetch(swin);
} else
sscanf(item_time, "%u:%u", &heures, &minutes);
- }
+ } else
+ return;
}
/*
* Check if an event or appointment is entered,
@@ -1140,7 +1144,8 @@ void add_item(void)
item_time[0] = '\0';
while (check_time(item_time) == 0) {
status_mesg(mesg_2, "");
- if (getstring(swin, colr, item_time, LTIME, 0, 1) != 0)
+ if (getstring(swin, colr, item_time, LTIME, 0, 1) !=
+ GETSTRING_VALID)
return; //nothing entered, cancel adding of event
else if (check_time(item_time) == 0) {
status_mesg(format_message_2, enter_str);
@@ -1168,7 +1173,8 @@ void add_item(void)
}
// get the item description
status_mesg(mesg_3, "");
- if (getstring(swin, colr, item_mesg, MAX_LENGTH, 0, 1) == 0) {
+ if (getstring(swin, colr, item_mesg, MAX_LENGTH, 0, 1) ==
+ GETSTRING_VALID) {
if (is_appointment){
// insert the appointment in list
apoint_start = date2sec(sel_year, sel_month, sel_day,
diff --git a/src/calendar.c b/src/calendar.c
index 6b0d40b..7a4c406 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,8 +1,8 @@
-/* $calcurse: calendar.c,v 1.5 2007/01/10 13:43:51 culot Exp $ */
+/* $calcurse: calendar.c,v 1.6 2007/01/16 07:50:59 culot Exp $ */
/*
* Calcurse - text-based organizer
- * Copyright (c) 2004-2006 Frederic Culot
+ * Copyright (c) 2004-2007 Frederic Culot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -195,7 +195,8 @@ goto_day(int colr, int day, int month, int year,
while (wrong_day) {
status_mesg(request_date, "");
- if (getstring(swin, colr, selected_day, LDAY, 0, 1) == 1)
+ if (getstring(swin, colr, selected_day, LDAY, 0, 1) ==
+ GETSTRING_ESC)
return;
else {
if (strlen(selected_day) == 0) {
diff --git a/src/recur.c b/src/recur.c
index ac66521..8f13cca 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,8 +1,8 @@
-/* $calcurse: recur.c,v 1.18 2006/12/15 15:26:05 culot Exp $ */
+/* $calcurse: recur.c,v 1.19 2007/01/16 07:51:47 culot Exp $ */
/*
* Calcurse - text-based organizer
- * Copyright (c) 2004-2006 Frederic Culot
+ * Copyright (c) 2004-2007 Frederic Culot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -562,21 +562,22 @@ void recur_repeat_item(int sel_year, int sel_month, int sel_day,
while (freq == 0) {
status_mesg(mesg_freq_1, "");
- if (getstring(swin, colr, user_input, MAX_LENGTH, 0, 1) == 0) {
+ if (getstring(swin, colr, user_input, MAX_LENGTH, 0, 1) ==
+ GETSTRING_VALID) {
freq = atoi(user_input);
if (freq == 0) {
status_mesg(mesg_wrong_freq, wrong_type_2);
wgetch(swin);
}
user_input[0] = '\0';
- } else {
+ } else
return;
- }
}
while (!date_entered) {
status_mesg(mesg_until_1, "");
- if (getstring(swin, colr, user_input, 11, 0, 1) == 0) {
+ if (getstring(swin, colr, user_input, 11, 0, 1) ==
+ GETSTRING_VALID) {
if (strlen(user_input) == 1 &&
strncmp(user_input, "0", 1) == 0 ) {
until = 0;
@@ -602,9 +603,8 @@ void recur_repeat_item(int sel_year, int sel_month, int sel_day,
date_entered = 0;
}
}
- } else {
+ } else
return;
- }
}
date = date2sec(sel_year, sel_month, sel_day, 0, 0);
diff --git a/src/todo.c b/src/todo.c
index d146824..2a5a00c 100755
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,8 +1,8 @@
-/* $calcurse: todo.c,v 1.8 2006/12/15 15:25:50 culot Exp $ */
+/* $calcurse: todo.c,v 1.9 2007/01/16 07:52:29 culot Exp $ */
/*
* Calcurse - text-based organizer
- * Copyright (c) 2004-2006 Frederic Culot
+ * Copyright (c) 2004-2007 Frederic Culot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,7 +45,8 @@ int todo_new_item(int total, int colr)
char todo_input[MAX_LENGTH] = "";
status_mesg(mesg, "");
- if (getstring(swin, colr, todo_input, MAX_LENGTH, 0, 1) == 0) {
+ if (getstring(swin, colr, todo_input, MAX_LENGTH, 0, 1) ==
+ GETSTRING_VALID) {
while ( (ch < '1') || (ch > '9') ) {
status_mesg(mesg_id, "");
ch = wgetch(swin);