1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
/* $Id: rolodex.h,v 1.11 2025/01/09 00:20:21 tom Exp $ */
#include <cdk_test.h>
#include <time.h>
#include <fcntl.h>
#include <unistd.h>
#define MAXGROUPS 100
#define GLINETYPECOUNT 9
/*
* Declare some global variables.
*/
static char *GCurrentGroup = NULL;
static char *GRCFile = NULL;
static char *GDBMDir = NULL;
static int GGroupModified = FALSE;
static const char *GLineType[] = {
"Voice",
"Cell",
"Pager",
"First FAX",
"Second FAX",
"Third FAX",
"First Data Line",
"Second Data Line",
"Third Data Line"
};
/*
* Create some definitions.
*/
typedef enum {vUnknown = -1, vVoice = 0, vCell, vPager, vFAX1, vFAX2, vFAX3, vData1, vData2, vData3} ELineType;
/*
* Define the group record structure.
*/
struct _group_st {
char *name;
char *desc;
char *dbm;
};
typedef struct _group_st SRolodex;
/*
* Define a phone record structure;
*/
struct _record_st {
char *name;
ELineType lineType;
char *phoneNumber;
char *address;
char *city;
char *province;
char *postalCode;
char *desc;
};
typedef struct _record_st SPhoneRecord;
struct _phone_data_st {
SPhoneRecord record[MAX_ITEMS];
int recordCount;
};
typedef struct _phone_data_st SPhoneData;
/*
* Define the callback prototypes.
*/
BINDFN_PROTO(helpCB);
BINDFN_PROTO(groupInfoCB);
BINDFN_PROTO(insertPhoneEntryCB);
BINDFN_PROTO(deletePhoneEntryCB);
BINDFN_PROTO(phoneEntryHelpCB);
int entryPreProcessCB (EObjectType cdkType, void *object, void *clientData, chtype input);
/*
* These functions use/modify the rolodex RC file.
*/
int readRCFile (char *filename, SRolodex *groupInfo);
int openNewRCFile (CDKSCREEN *screen, SRolodex *groups, int groupCount);
int writeRCFile (CDKSCREEN *screen, char *file, SRolodex *groups, int count);
int writeRCFileAs (CDKSCREEN *screen, SRolodex *groups, int count);
/*
* These functions use/modify rolodex phone groups.
*/
int addRolodexGroup (CDKSCREEN *screen, SRolodex *groups, int count);
int deleteRolodexGroup (CDKSCREEN *screen, SRolodex *groups, int count);
int pickRolodexGroup (CDKSCREEN *screen, const char *title, SRolodex *groups, int count);
void useRolodexGroup (CDKSCREEN *screen, char *name, char *desc, char *dbm);
/*
* These functions display misc information about the rolodex program.
*/
void displayRolodexStats (CDKSCREEN *screen, int groupCount);
void aboutCdkRolodex (CDKSCREEN *screen);
void displayPhoneInfo (CDKSCREEN *screen, SPhoneRecord record);
/*
* These functions use/modify phone data lists.
*/
int readPhoneDataFile (char *filename, SPhoneData *record);
int savePhoneDataFile (char *filename, SPhoneData *record);
int addPhoneRecord (CDKSCREEN *screen, SPhoneData *phoneData);
int deletePhoneRecord (CDKSCREEN *screen, SPhoneData *phoneData);
int getLargePhoneRecord (CDKSCREEN *screen, SPhoneRecord *phoneRecord);
int getSmallPhoneRecord (CDKSCREEN *screen, SPhoneRecord *phoneRecord);
/*
* These functions allow us to print out phone numbers.
*/
void printGroupNumbers (CDKSCREEN *screen, SRolodex *groups, int count);
int printGroup (SRolodex groupRecord, const char *filename, char *printer);
|