rc_t write_rows (param_block * pb) { rc_t rc = 0; pb->seq = NULL; do { rc = get_a_sequence (pb); if (rc) { LOGERR (klogFatal, rc, "Failed to read a sequence"); } else { if (pb->seq == NULL) break; rc = VCursorOpenRow (pb->cursor); if (rc) { LOGERR (klogFatal, rc, "Failed to open row"); break; } else { rc_t rc2; rc = VCursorWrite (pb->cursor, pb->idx, 8, pb->seq, 0, pb->seq_size); if (rc) LOGERR (klogFatal, rc, "Failed to write row"); else rc = VCursorCommitRow (pb->cursor); rc2 = VCursorCloseRow (pb->cursor); if (rc == 0) rc = rc2; } } } while (rc == 0); return rc; }
main() { portstr = getenv("FASTPORT"); if(portstr!=NULL) { if(strlen(portstr)<3) { fprintf(stderr, "FASTPORT environment variable must be"); fprintf(stderr, " form: c;p. c and p are numerals for card"); fprintf(stderr, " and port respectively\n"); return -1; } else { card = portstr[0] - '0'; port = portstr[2] - '0'; } } if(card<0 || card>=NCARDS) { fprintf(stderr, "card number out of range\n"); return -1; } if(port<0 || port>2) { fprintf(stderr, "port number out of range\n"); return -1; } if(!Init(card, port)) { fprintf(stderr, "Unable to access device\n"); Finish(); exit(-1); } getflag = 0; oldxoffset = 0; oldyoffset = 0; strcpy(imagename,"image.cel"); xmax = 40; ymax = 25; while(1) { printmenu(); gets(tempstr); c = tempstr[0]; printf("\n"); if(c == 'i') { system("down -S < /u1/gg/bin/face64.out"); newcel(); } if(c == 'd') { system("ls -C *.cel | more"); } if(c == '!') { printf("Unix command >"); fflush(stdin) ; gets(tempstr); printf("\n"); system(tempstr); printf("\nhit return to continue"); fflush(stdin); gets(tempstr); } if(c == 'h') { if(fopen("/u1/gg/bin/face.doc","r") == NULL) { printf("\nHelp file not in /u1/gg/bin\n"); } else { system("more /u1/gg/bin/face.doc"); } } if(c == 'l') { getimagename(); loadcel(); } if(c == 's') { getimagename(); savecel(); } if(c == 'n') { newcel(); } if(c == 'r') { getsequencename(); read_sequence_file(); getflag = 0; } if(c == 'w') { getsequencename(); write_sequence_file(); getflag = 0; } if(c == 'g') { get_a_sequence(); getflag = 1; } if(c == 'p') { put_a_sequence(); } if(c == 'P') { buf[0] = 1; down(buf,(word)1,(word)0x15); Cont(); system("sleep 1"); ffile = fopen(".ptemp","w"); putc(40,ffile); putc(14,ffile); putc(0,ffile); /* black edges */ putc(0,ffile); putc(0,ffile); putc(0,ffile); up(buf,(word)4480,(word)0xa000); /* get bitmap */ for(i=0;i<4480;i++) putc(buf[i],ffile); for(i=0;i<560;i++) putc(0xde,ffile); /* pink/blue */ for(i=0;i<560;i++) putc(0x01,ffile); /* gray bkgrnd */ fclose(ffile); system("pixit < .ptemp | lpr &"); buf[0] = 0; down(buf,(word)1,(word)0x15); Cont(); } if(c == 'q') { if (getflag) { printf("sequences not written. Quit? (y/n)"); gets(tempstr); c = tempstr[0]; printf("\n"); if (c == 'y') { exit(0); } } else { exit(0); } } } }