Treat a null -k option as no -k option

This commit is contained in:
Dianne Skoll
2023-03-15 09:22:44 -04:00
parent ddb0817c99
commit ec76554d41
4 changed files with 10 additions and 9 deletions

View File

@@ -916,6 +916,11 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queue
msg_command = QueuedMsgCommand;
}
/* A null command is no command */
if (msg_command && !*msg_command) {
msg_command = NULL;
}
int red = -1, green = -1, blue = -1;
int is_color = 0;

View File

@@ -196,7 +196,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
mode != CAL_MODE &&
mode != ADVANCE_MODE &&
t->typ != RUN_TYPE &&
!MsgCommand) {
!(MsgCommand && *MsgCommand)) {
if (DBufPutc(dbuf, '\n') != OK) return E_NO_MEM;
}
break;
@@ -794,7 +794,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
break;
case '_':
if (PsCal == PSCAL_LEVEL2 || PsCal == PSCAL_LEVEL3 || (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)) {
if (PsCal == PSCAL_LEVEL2 || PsCal == PSCAL_LEVEL3 || (mode != CAL_MODE && mode != ADVANCE_MODE && !(MsgCommand && *MsgCommand))) {
snprintf(s, sizeof(s), "%s", NL);
} else {
snprintf(s, sizeof(s), " ");

View File

@@ -602,13 +602,9 @@ void InitRemind(int argc, char const *argv[])
case 'K':
if (*arg == ':') {
arg++;
if (*arg) {
QueuedMsgCommand = arg;
}
QueuedMsgCommand = arg;
} else {
if (*arg) {
MsgCommand = arg;
}
MsgCommand = arg;
}
while (*arg) arg++; /* Chew up remaining chars in this arg */
break;

View File

@@ -135,7 +135,7 @@ void IssueSortedReminders(void)
next = cur->next;
switch(cur->typ) {
case MSG_TYPE:
if (MsgCommand) {
if (MsgCommand && *MsgCommand) {
DoMsgCommand(MsgCommand, cur->text);
} else {
if (cur->trigdate != olddate) {