static int smtp_mail(FILE *fp, char *to, char *subj) { int rc, fd; char buffie[1024] ; fd = smtp_open(conffile.smtp_mta, conffile.smtp_portnum, conffile.smtp_helo); if (fd < 0) { return child_perror("Smtp_open"); } rc = set_envelope(fd, conffile.smtp_from, to); if (rc < 0) { return child_perror("Smtp_envelope"); } rc = set_data(fd); if (rc < 0) { return child_perror("Smtp_data"); } if (subj) add_header(fd, "Subject", subj); if (conffile.smtp_reply_to) add_header(fd, "Reply-To", conffile.smtp_reply_to); add_header(fd, "X-NNGS-SMTP", "Yes, Baby!" ); add_header(fd, NULL, 0); while(fgets(buffie, sizeof buffie, fp)) { rc = add_data(fd, buffie, 0); if (rc < 0) { return child_perror("Smtp_loop"); } } add_data(fd, NULL, 0); close(fd); return 0; }
int main() { int rc, fd; char buffie[512] ; fd = smtp_open(NULL, WANTED_SMTP_PORT, NULL); if (fd < 0) goto kut; set_envelope(fd, "nngs@localhost", "nngs@localhost"); rc = set_data(fd); if (rc < 0) goto kut; add_header(fd, "Subject", "Kuttje (met twee thee)"); add_header(fd, "Reply-To", "nngs@localhost"); add_header(fd, NULL, 0); add_data(fd, "En een droge sherry, alstublieft!\n", 0); while(fgets(buffie, sizeof buffie, stdin)) { rc = add_data(fd, buffie, 0); /* sleep(1); */ if (rc < 0) break; } add_data(fd, NULL, 0); sleep(10); close(fd); kut: exit(0); }
/* plays a locking sound when a Tetrimino Locks into place */ void play_Lock_Tetrimino_FX( ) { set_noise( B ); enable_channel( EXTRA_CHANNEL, false, true ); set_volume( EXTRA_CHANNEL, ENVELOPE_VOLUME ); set_envelope( LOCK_TETRIMINO_ENV_FREQ, TETRI_LOCK_ENVELOPE ); }
/* plays a soft little noise as the tetrimino moves */ void play_Move_Tetrimino_FX() { set_noise( A ); enable_channel( SFX_CHANNEL, false, true ); enable_channel( EXTRA_CHANNEL, false, false ); set_volume( SFX_CHANNEL, ENVELOPE_VOLUME ); set_envelope( MOVE_TETRIMINO_ENV_FREQ, TETRI_MOVE_ENVELOPE ); }
/* Plays a low chord that fades out when the player tops out */ void play_Top_Out_FX( ) { set_tone( SFX_CHANNEL, E << 1 ); set_tone( EXTRA_CHANNEL, A << 1); enable_channel( SFX_CHANNEL, true, false ); enable_channel( EXTRA_CHANNEL, true, false ); set_volume( SFX_CHANNEL, ENVELOPE_VOLUME ); set_volume( EXTRA_CHANNEL, ENVELOPE_VOLUME ); set_envelope( TOP_OUT_ENV_FREQ, TOP_OUT_ENVELOPE ); }