aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c137
1 files changed, 0 insertions, 137 deletions
diff --git a/src/main.c b/src/main.c
index 81f598e..6de8697 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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