extern int urgency;
extern FILE *fp;
-struct note {
+struct task {
int length;
- char *note;
+ char *task;
int date;
int due;
int urgency;
};
-struct note makenote(int n, char **arg){
- struct note temp;
+struct task maketask(int n, char **arg){
+ struct task temp;
- temp.note = getnote(n,arg);
- temp.length = strlen(temp.note);
+ temp.task = getnote(n,arg);
+ temp.length = strlen(temp.task);
temp.date = 0;
temp.due = 0;
temp.urgency = urgency;
return temp;
}
-void putnote(struct note n){
+void puttask(struct task n){
fp = fopen(TODOLIST, "w");
if (fp == NULL){
- printf("ERROR: COULD NOT OPEN FILE %s\n", TODOLIST);
+ error('f');
}
- fprintf(fp, "%i\t%s\t%i\t%i\t%i\n",n.length,n.note,n.date,n.due,n.urgency);
+ fprintf(fp, "%i\t%s\t%i\t%i\t%i\n",n.length,n.task,n.date,n.due,n.urgency);
}
-struct note findnote(char *c){
- struct note tmp;
+struct task gettask(char *c){
+ struct task tmp;
- sscanf(c,"%i\t%s\t%i\t%i\t%i\n",&tmp.length,tmp.note,&tmp.date,&tmp.due,&tmp.urgency);
+ sscanf(c,"%i\t%s\t%i\t%i\t%i\n",&tmp.length,tmp.task,&tmp.date,&tmp.due,&tmp.urgency);
return tmp;
}
extern int urgency;
extern FILE *fp;
-struct note {
+struct task {
int length;
- char *note;
+ char *task;
int date;
int due;
int urgency;
};
-struct note makenote(int n, char **arg){
- struct note temp;
+struct task maketask(int n, char **arg){
+ struct task temp;
- temp.note = getnote(n,arg);
- temp.length = strlen(temp.note);
+ temp.task = getnote(n,arg);
+ temp.length = strlen(temp.task);
temp.date = 0;
temp.due = 0;
temp.urgency = urgency;
return temp;
}
-void putnote(struct note n){
+void puttask(struct task n){
fp = fopen(TODOLIST, "w");
if (fp == NULL){
- printf("ERROR: COULD NOT OPEN FILE %s\n", TODOLIST);
+ error('f');
}
- fprintf(fp, "%i\t%s\t%i\t%i\t%i\n",n.length,n.note,n.date,n.due,n.urgency);
+ fprintf(fp, "%i\t%s\t%i\t%i\t%i\n",n.length,n.task,n.date,n.due,n.urgency);
}
-struct note findnote(char *c){
- struct note tmp;
+struct task gettask(char *c){
+ struct task tmp;
- sscanf(c,"%i\t%s\t%i\t%i\t%i\n",&tmp.length,tmp.note,&tmp.date,&tmp.due,&tmp.urgency);
+ sscanf(c,"%i\t%s\t%i\t%i\t%i\n",&tmp.length,tmp.task,&tmp.date,&tmp.due,&tmp.urgency);
return tmp;
}