diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-02-11 15:08:34 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-02-11 15:08:34 -0500 |
| commit | 8e285f7ff4c456263338a241415f61d58e72ed01 (patch) | |
| tree | 5984097a9942e18182228e7c922bb5e486250d2b /src/main.c | |
| parent | a3f60614762853c9f78f8444f2974fb1d8712217 (diff) | |
| download | fujinet-chat-8e285f7ff4c456263338a241415f61d58e72ed01.tar.gz | |
remove more netcat cruft, add README.txt and numerics.h
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 137 |
1 files changed, 0 insertions, 137 deletions
@@ -172,140 +172,3 @@ int main(void) { OS.soundr = 3; // Restore SIO beeping sound return 0; } - -/* cruft from netcat: */ -/** - * Main entrypoint - */ -#if 0 -int main(int argc, char* argv[]) -{ - OS.soundr=0; // Turn off SIO beeping sound - cursor(1); // Keep cursor on - - while (running==true) - { - if (get_url(argc, argv)) - nc(); - else - running=false; - } - - OS.soundr=3; // Restore SIO beeping sound - return 0; -} -#endif - -#if 0 -/** - * NetCat - */ -void nc() -{ - OS.lmargn=0; // Set left margin to 0 - OS.shflok=0; // turn off shift-lock. - - // Attempt open. - print("\x9bOpening:\x9b"); - print(url); - print("\x9b"); - - err=nopen(url,trans); - - if (err != SUCCESS) - { - print("OPEN ERROR: "); - print_error(err); - return; - } - - // Open successful, set up interrupt - old_vprced = OS.vprced; // save the old interrupt vector - old_enabled = PIA.pactl & 1; // keep track of old interrupt state - PIA.pactl &= (~1); // Turn off interrupts before changing vector - OS.vprced = ih; // Set PROCEED interrupt vector to our interrupt handler. - PIA.pactl |= 1; // Indicate to PIA we are ready for PROCEED interrupt. - - // MAIN LOOP /////////////////////////////////////////////////////////// - - while (running==true) - { - // If key pressed, send it. - while (kbhit()) - { - tx_buf[txbuflen++]=cgetc(); - } - - if (txbuflen>0) - { - if (echo==true) - for (i=0;i<txbuflen;i++) - printc(&tx_buf[i]); - - err=nwrite(url,tx_buf,txbuflen); // Send character. - - if (err!=1) - { - print("WRITE ERROR: "); - print_error(err); - running=false; - continue; - } - txbuflen=0; - } - - if (trip==0) // is nothing waiting for us? - continue; - - // Something waiting for us, get status and bytes waiting. - err=nstatus(url); - - if (err==136) - { - print("DISCONNECTED.\x9b"); - running=false; - continue; - } - else if (err!=1) - { - print("STATUS ERROR: "); - print_error(err); - running=false; - continue; - } - - // Get # of bytes waiting, no more than size of rx_buf - bw=OS.dvstat[1]*256+OS.dvstat[0]; - - if (bw>sizeof(rx_buf)) - bw=sizeof(rx_buf); - - if (bw>0) - { - err=nread(url,rx_buf,bw); - - if (err!=1) - { - print("READ ERROR: "); - print_error(err); - running=false; - continue; - } - - // Print the buffer to screen. - printl(rx_buf,bw); - - trip=0; - PIA.pactl |= 1; // Flag interrupt as serviced, ready for next one. - } // if bw > 0 - } // while running - - // END MAIN LOOP /////////////////////////////////////////////////////// - - // Restore old PROCEED interrupt. - PIA.pactl &= ~1; // disable interrupts - OS.vprced=old_vprced; - PIA.pactl |= old_enabled; - -} -#endif |
