The following is from a FreeBSD modem dialup program.
in ward.h
Code:
#define SPEAKER_ON "M1"
#define SPEAKER_OFF "M0"
#define SPKR_VOL_0 "M1L0"
#define SPKR_VOL_1 "M1L1"
#define SPKR_VOL_2 "M1L2"
#define SPKR_VOL_3 "M1L3"
And in modem.c
Code:
const char *Vol [] = {
SPEAKER_OFF, SPKR_VOL_0, SPKR_VOL_1, SPKR_VOL_2, SPKR_VOL_3
};
[[email protected] award-1.0]# grep -iR SPEAKER_OFF /tmp/award-1.0
/tmp/award-1.0/modem.c: SPEAKER_OFF, SPKR_VOL_0, SPKR_VOL_1, SPKR_VOL_2, SPKR_VOL_3
/tmp/award-1.0/ward.h:#define SPEAKER_OFF "M0"
#define already makes stuff like SPEAKER_OFF constant. Why make it constant again in modem.c? Also, why not use these constants?