use of getstring() defines
This commit is contained in:
parent
23e729651b
commit
6bbf3e5f2e
@ -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
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -850,7 +850,8 @@ void config_notify_bar(void)
|
|||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
status_mesg(date_str, "");
|
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);
|
pthread_mutex_lock(&nbar->mutex);
|
||||||
strncpy(nbar->datefmt, buf, strlen(buf) + 1);
|
strncpy(nbar->datefmt, buf, strlen(buf) + 1);
|
||||||
pthread_mutex_unlock(&nbar->mutex);
|
pthread_mutex_unlock(&nbar->mutex);
|
||||||
@ -859,7 +860,8 @@ void config_notify_bar(void)
|
|||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
status_mesg(time_str, "");
|
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);
|
pthread_mutex_lock(&nbar->mutex);
|
||||||
strncpy(nbar->timefmt, buf, strlen(buf) + 1);
|
strncpy(nbar->timefmt, buf, strlen(buf) + 1);
|
||||||
pthread_mutex_unlock(&nbar->mutex);
|
pthread_mutex_unlock(&nbar->mutex);
|
||||||
@ -868,9 +870,9 @@ void config_notify_bar(void)
|
|||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
status_mesg(count_str, "");
|
status_mesg(count_str, "");
|
||||||
if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) == 0 &&
|
if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) ==
|
||||||
is_all_digit(buf) && atoi(buf) >= 0 &&
|
GETSTRING_VALID && is_all_digit(buf) &&
|
||||||
atoi(buf) <= DAYINSEC) {
|
atoi(buf) >= 0 && atoi(buf) <= DAYINSEC) {
|
||||||
pthread_mutex_lock(&nbar->mutex);
|
pthread_mutex_lock(&nbar->mutex);
|
||||||
nbar->cntdwn = atoi(buf);
|
nbar->cntdwn = atoi(buf);
|
||||||
pthread_mutex_unlock(&nbar->mutex);
|
pthread_mutex_unlock(&nbar->mutex);
|
||||||
@ -1120,7 +1122,8 @@ void add_item(void)
|
|||||||
/* Get the starting time */
|
/* Get the starting time */
|
||||||
while (check_time(item_time) != 1) {
|
while (check_time(item_time) != 1) {
|
||||||
status_mesg(mesg_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){
|
if (strlen(item_time) == 0){
|
||||||
is_appointment = 0;
|
is_appointment = 0;
|
||||||
break;
|
break;
|
||||||
@ -1129,7 +1132,8 @@ void add_item(void)
|
|||||||
wgetch(swin);
|
wgetch(swin);
|
||||||
} else
|
} else
|
||||||
sscanf(item_time, "%u:%u", &heures, &minutes);
|
sscanf(item_time, "%u:%u", &heures, &minutes);
|
||||||
}
|
} else
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Check if an event or appointment is entered,
|
* Check if an event or appointment is entered,
|
||||||
@ -1140,7 +1144,8 @@ void add_item(void)
|
|||||||
item_time[0] = '\0';
|
item_time[0] = '\0';
|
||||||
while (check_time(item_time) == 0) {
|
while (check_time(item_time) == 0) {
|
||||||
status_mesg(mesg_2, "");
|
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
|
return; //nothing entered, cancel adding of event
|
||||||
else if (check_time(item_time) == 0) {
|
else if (check_time(item_time) == 0) {
|
||||||
status_mesg(format_message_2, enter_str);
|
status_mesg(format_message_2, enter_str);
|
||||||
@ -1168,7 +1173,8 @@ void add_item(void)
|
|||||||
}
|
}
|
||||||
// get the item description
|
// get the item description
|
||||||
status_mesg(mesg_3, "");
|
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){
|
if (is_appointment){
|
||||||
// insert the appointment in list
|
// insert the appointment in list
|
||||||
apoint_start = date2sec(sel_year, sel_month, sel_day,
|
apoint_start = date2sec(sel_year, sel_month, sel_day,
|
||||||
|
@ -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
|
* 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
|
* 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
|
* 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) {
|
while (wrong_day) {
|
||||||
status_mesg(request_date, "");
|
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;
|
return;
|
||||||
else {
|
else {
|
||||||
if (strlen(selected_day) == 0) {
|
if (strlen(selected_day) == 0) {
|
||||||
|
16
src/recur.c
16
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
|
* 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
|
* 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
|
* 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) {
|
while (freq == 0) {
|
||||||
status_mesg(mesg_freq_1, "");
|
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);
|
freq = atoi(user_input);
|
||||||
if (freq == 0) {
|
if (freq == 0) {
|
||||||
status_mesg(mesg_wrong_freq, wrong_type_2);
|
status_mesg(mesg_wrong_freq, wrong_type_2);
|
||||||
wgetch(swin);
|
wgetch(swin);
|
||||||
}
|
}
|
||||||
user_input[0] = '\0';
|
user_input[0] = '\0';
|
||||||
} else {
|
} else
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!date_entered) {
|
while (!date_entered) {
|
||||||
status_mesg(mesg_until_1, "");
|
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 &&
|
if (strlen(user_input) == 1 &&
|
||||||
strncmp(user_input, "0", 1) == 0 ) {
|
strncmp(user_input, "0", 1) == 0 ) {
|
||||||
until = 0;
|
until = 0;
|
||||||
@ -602,9 +603,8 @@ void recur_repeat_item(int sel_year, int sel_month, int sel_day,
|
|||||||
date_entered = 0;
|
date_entered = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
date = date2sec(sel_year, sel_month, sel_day, 0, 0);
|
date = date2sec(sel_year, sel_month, sel_day, 0, 0);
|
||||||
|
@ -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
|
* 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
|
* 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
|
* 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] = "";
|
char todo_input[MAX_LENGTH] = "";
|
||||||
|
|
||||||
status_mesg(mesg, "");
|
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') ) {
|
while ( (ch < '1') || (ch > '9') ) {
|
||||||
status_mesg(mesg_id, "");
|
status_mesg(mesg_id, "");
|
||||||
ch = wgetch(swin);
|
ch = wgetch(swin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user