mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Add -l option for printing out line numbers (Paul Pelzl)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.9 2000-02-18 03:45:43 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.10 2005-04-12 00:44:07 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -41,6 +41,8 @@ typedef struct cal_entry {
|
||||
char tag[TAG_LEN+1];
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
int duration;
|
||||
char *filename;
|
||||
int lineno;
|
||||
} CalEntry;
|
||||
|
||||
/* Global variables */
|
||||
@@ -425,6 +427,7 @@ int col;
|
||||
PrintLeft("", ColSpaces, ' ');
|
||||
CalColumn[col] = e->next;
|
||||
free(e->text);
|
||||
free(e->filename);
|
||||
free(e);
|
||||
return 1;
|
||||
}
|
||||
@@ -464,6 +467,7 @@ int col;
|
||||
if (!*s && !e->next) {
|
||||
CalColumn[col] = e->next;
|
||||
free(e->text);
|
||||
free(e->filename);
|
||||
free(e);
|
||||
} else {
|
||||
e->pos = s;
|
||||
@@ -780,6 +784,12 @@ int col;
|
||||
}
|
||||
e->duration = tim.duration;
|
||||
e->priority = trig.priority;
|
||||
e->filename = StrDup(FileName);
|
||||
if(!e->filename) {
|
||||
free(e);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
e->lineno = LineNo;
|
||||
if (trig.typ == PASSTHRU_TYPE) {
|
||||
StrnCpy(e->passthru, trig.passthru, PASSTHRU_LEN);
|
||||
e->pos = e->passthru;
|
||||
@@ -819,6 +829,7 @@ int col, jul;
|
||||
/* Do all the PASSTHRU entries first, if any */
|
||||
FromJulian(jul, &y, &m, &d);
|
||||
while(e) {
|
||||
if (DoPrefixLineNo) printf("# fileinfo %d %s\n", e->lineno, e->filename);
|
||||
printf("%04d/%02d/%02d ", y, m+1, d);
|
||||
printf("%s ", e->passthru);
|
||||
printf("%s ", e->tag);
|
||||
@@ -834,6 +845,7 @@ int col, jul;
|
||||
}
|
||||
printf("%s\n", e->text);
|
||||
free(e->text);
|
||||
free(e->filename);
|
||||
n = e->next;
|
||||
free(e);
|
||||
e = n;
|
||||
@@ -842,6 +854,7 @@ int col, jul;
|
||||
|
||||
e = CalColumn[col];
|
||||
while(e) {
|
||||
if (DoPrefixLineNo) printf("# fileinfo %d %s\n", e->lineno, e->filename);
|
||||
printf("%04d/%02d/%02d", y, m+1, d);
|
||||
printf(" * %s ", e->tag);
|
||||
if (e->duration != NO_TIME) {
|
||||
@@ -856,6 +869,7 @@ int col, jul;
|
||||
}
|
||||
printf("%s\n", e->text);
|
||||
free(e->text);
|
||||
free(e->filename);
|
||||
n = e->next;
|
||||
free(e);
|
||||
e = n;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: globals.h,v 1.7 2000-02-18 03:45:57 dfs Exp $ */
|
||||
/* $Id: globals.h,v 1.8 2005-04-12 00:44:08 dfs Exp $ */
|
||||
|
||||
#ifdef MK_GLOBALS
|
||||
#undef EXTERN
|
||||
@@ -42,6 +42,7 @@ EXTERN INIT( int ShowAllErrors, 0);
|
||||
EXTERN INIT( int DebugFlag, 0);
|
||||
EXTERN INIT( int DoCalendar, 0);
|
||||
EXTERN INIT( int DoSimpleCalendar, 0);
|
||||
EXTERN INIT( int DoPrefixLineNo, 0);
|
||||
EXTERN INIT( int MondayFirst, 0);
|
||||
EXTERN INIT( int Iterations, 1);
|
||||
EXTERN INIT( int PsCal, 0);
|
||||
|
||||
10
src/init.c
10
src/init.c
@@ -13,7 +13,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: init.c,v 1.13 2000-02-18 03:53:45 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: init.c,v 1.14 2005-04-12 00:44:08 dfs Exp $";
|
||||
|
||||
#define L_IN_INIT 1
|
||||
#include <stdio.h>
|
||||
@@ -58,6 +58,8 @@ static char const RCSID[] = "$Id: init.c,v 1.13 2000-02-18 03:53:45 dfs Exp $";
|
||||
* -w[n,n,n] = Specify output device width, padding and spacing
|
||||
* -s[n] = Produce calendar in "simple calendar" format
|
||||
* -p[n] = Produce calendar in format compatible with rem2ps
|
||||
* -l = Prefix simple calendar lines with a comment containing
|
||||
* their trigger line numbers and filenames
|
||||
* -v = Verbose mode
|
||||
* -o = Ignore ONCE directives
|
||||
* -a = Don't issue timed reminders which will be queued
|
||||
@@ -320,6 +322,11 @@ char *argv[];
|
||||
if (!CalMonths) CalMonths = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
case 'L':
|
||||
DoPrefixLineNo = 1;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
case 'W':
|
||||
if (*arg != ',') {
|
||||
@@ -502,6 +509,7 @@ void Usage()
|
||||
fprintf(ErrFp, " -w[n[,p[,s]]] Specify width, padding and spacing of calendar\n");
|
||||
fprintf(ErrFp, " -s[+][n] Produce `simple calendar' for n (1) months (weeks)\n");
|
||||
fprintf(ErrFp, " -p[n] Same as -s, but input compatible with rem2ps\n");
|
||||
fprintf(ErrFp, " -l Prefix each simple calendar line with line number and filename comment\n");
|
||||
fprintf(ErrFp, " -v Verbose mode\n");
|
||||
fprintf(ErrFp, " -o Ignore ONCE directives\n");
|
||||
fprintf(ErrFp, " -t Trigger all future reminders regardless of delta\n");
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: var.c,v 1.7 2000-02-18 03:46:15 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: var.c,v 1.8 2005-04-12 00:44:08 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -515,6 +515,7 @@ static SysVar SysVarArr[] = {
|
||||
{ "NextMode", 0, INT_TYPE, &NextMode, 0, 0 },
|
||||
{ "NumQueued", 0, INT_TYPE, &NumQueued, 0, 0 },
|
||||
{ "NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 },
|
||||
{ "PrefixLineNo", 0, INT_TYPE, &DoPrefixLineNo,0, 0 },
|
||||
{ "PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
|
||||
{ "RunOff", 0, INT_TYPE, &RunDisabled, 0, 0 },
|
||||
{ "SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0 },
|
||||
|
||||
Reference in New Issue
Block a user