Make sure this builds with -DSERGEEV.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 4 Feb 2005 14:52:23 +0000 (14:52 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 4 Feb 2005 14:52:23 +0000 (14:52 +0000)
finish.c
io.c
sst.c
sst.h

index 7ae6c87780ec8f6e4b22fdb5505a4c0abefabc0a..e3ace26732e2fef5cb47715c2ab18ef5d1723374 100644 (file)
--- a/finish.c
+++ b/finish.c
@@ -393,7 +393,7 @@ void plaque(void) {
        
        while (fp == NULL) {
                 proutn("File or device name for your plaque: ");
-                getline(winner, sizeof(winner));
+                cgetline(winner, sizeof(winner));
                fp = fopen(winner, "w");
                if (fp==NULL) {
                         prout("Invalid name.");
@@ -401,7 +401,7 @@ void plaque(void) {
        }
 
         proutn("Enter name to go on plaque (up to 30 characters): ");
-        getline(winner, sizeof(winner));
+        cgetline(winner, sizeof(winner));
        /* The 38 below must be 64 for 132-column paper */
        nskip = 38 - strlen(winner)/2;
 
diff --git a/io.c b/io.c
index 93ea8427d06b743f51c7ae0bd1b87771639a9384..07bc1504a8b599f15968eebff8cc49c4c08e7f69 100644 (file)
--- a/io.c
+++ b/io.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <unistd.h>
 #include <termios.h>
@@ -13,8 +14,8 @@
 
 #ifndef SERGEEV
 static int linecount;  /* for paging */
-#endif /* SERGEEV */
 static int screenheight = 24, screenwidth = 80;
+#endif /* SERGEEV */
 #ifndef SERGEEV
 static int curses = FALSE;
 #else /* SERGEEV */
@@ -32,6 +33,7 @@ wnd wnds[6]={{1,1,80,25},     /* FULLSCREEN_WINDOW */
 short curwnd;
 #endif /* SERGEEV */
 
+#ifndef SERGEEV
 static void outro(int sig) {
 /* wrap up, either normally or due to signal */
     if (curses) {
@@ -48,6 +50,7 @@ static void fastexit(int sig) {
     putchar('\n');
     exit(0);
 }
+#endif /* SERGEEV */
 
 void iostart(int usecurses) {
 #ifdef SERGEEV
@@ -346,7 +349,7 @@ void drawmaps(short l) {
      if (l==1) sensor();
      if (l!=2) setwnd(LEFTUPPER_WINDOW);
      gotoxy(1,1);
-     strcpy(line,"s");
+     enqueue("s");
      srscan(1);
      if (l!=2){
         setwnd(SRSCAN_WINDOW);
@@ -354,7 +357,7 @@ void drawmaps(short l) {
         srscan(2);
         setwnd(LRSCAN_WINDOW);
         clrscr();
-        strcpy(line,"l");
+        enqueue("l");
         lrscan();
         _setcursortype(_NORMALCURSOR);
      }
diff --git a/sst.c b/sst.c
index 07b7da5cef805bca47a59a279237eee70611f9c1..0f8aed65523ed7d25e1ce48ce5af7c18f8578eed 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -10,8 +10,6 @@
 #define SSTDOC "sst.doc"
 #endif
        
-static char line[128], *linep = line;
-
 /*
 
 Here are Tom Almy's changes:
@@ -94,6 +92,9 @@ Eric Raymond's changes:
 
    */
 
+/* the input queue */
+static char line[128], *linep = line;
+
 static struct 
 {
     char *name;
@@ -261,6 +262,10 @@ static void helpme(void) {
        fclose(fp);
 }
 
+void enqueue(char *s) {
+    strcpy(line, s);
+}
+
 static void makemoves(void) {
        int i, hitme;
         clrscr();
@@ -302,7 +307,7 @@ static void makemoves(void) {
                commandhook(commands[i].name, TRUE);
                switch (i) { /* command switch */
                         case SRSCAN:                 // srscan
-                               srscan(1);
+                               srscan(SRSCAN);
                                break;
                        case LRSCAN:                    // lrscan
                                lrscan();
diff --git a/sst.h b/sst.h
index aef476b76f19db679d01b2063088feaf992e8bd0..7e0734b824338f36efc6e259bd8990e9789b7f7c 100644 (file)
--- a/sst.h
+++ b/sst.h
@@ -445,6 +445,7 @@ void setpassword(void);
 void commandhook(char *, int);
 void c_printf (char *format, ... );
 void makechart(void);
+void enqueue(char *s);
 
 typedef struct {
         int wndleft,wndtop,wndright,wndbottom;