File: sockio-c.c_moves_to_bookvol8

package info (click to toggle)
axiom 20170501-4
  • links: PTS
  • area: main
  • in suites: buster
  • size: 1,048,504 kB
  • sloc: lisp: 3,600; makefile: 505; cpp: 223; ansic: 138; sh: 96
file content (117 lines) | stat: -rw-r--r-- 4,078 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 axiom (20170401-1) unstable; urgency=medium
 .
   * New upstream release
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2017-05-10

Index: axiom-20170401/books/bookvol8.pamphlet
===================================================================
--- axiom-20170401.orig/books/bookvol8.pamphlet
+++ axiom-20170401/books/bookvol8.pamphlet
@@ -1762,11 +1762,16 @@ typedef struct {
 
 /* table of dedicated socket types */
 
+#ifndef GCL_SOURCE
+#define STATIC
 extern Sock *purpose_table[];
 extern Sock server[];
 extern Sock clients[];
 extern fd_set socket_mask;
 extern fd_set server_mask;
+#else
+#define STATIC static
+#endif
 
 /* Commands sent over the AXIOM session manager or menu socket */
 
@@ -26295,15 +26300,17 @@ of files are badly broken with respect t
   ( purpose_table[purpose] == NULL ? sock_accept_connection(purpose) : 1 )
 
 
-Sock clients[MaxClients];       /* socket description of spad clients */
-Sock server[2];                 /* AF_UNIX and AF_INET sockets for server */
-Sock *purpose_table[TotalMaxPurposes]; /* table of dedicated socket types */
-fd_set socket_mask;             /* bit mask of active sockets */
-fd_set server_mask;             /* bit mask of server sockets */
-int socket_closed;              /* used to identify closed socket on SIGPIPE */
-int spad_server_number = -1;    /* spad server number used in sman */
-int str_len = 0;
-int still_reading  = 0;
+STATIC Sock clients[MaxClients];       /* socket description of spad clients */
+STATIC Sock server[2];                 /* AF_UNIX and AF_INET sockets for server */
+STATIC Sock *purpose_table[TotalMaxPurposes]; /* table of dedicated socket types */
+STATIC fd_set socket_mask;             /* bit mask of active sockets */
+STATIC fd_set server_mask;             /* bit mask of server sockets */
+STATIC int socket_closed;              /* used to identify closed socket on SIGPIPE */
+STATIC int spad_server_number = -1;    /* spad server number used in sman */
+STATIC int str_len = 0;
+#ifndef GCL_SOURCE
+STATIC int still_reading  = 0;
+#endif
 
 \getchunk{include/bsdsignal.h1}
 \getchunk{include/sockio-c.h1}
@@ -26933,7 +26940,11 @@ remote_stdio(Sock *sock)
       return;
     }
     if (FD_ISSET(0, &rd)) {
+#ifdef GCL_SOURCE
+      gcl_gets(buf,1024);
+#else
       fgets(buf,1024,stdin);
+#endif
       len = strlen(buf);
       /*
           gets(buf);
@@ -26949,8 +26960,12 @@ remote_stdio(Sock *sock)
         return;
       else {
         *(buf + len) = '\0';
+#ifdef GCL_SOURCE
+       gcl_puts(buf);
+#else
         fputs(buf, stdout);
         fflush(stdout);
+#endif
       }
     }
   }
@@ -27141,15 +27156,15 @@ redirect_stdio(Sock *sock)
 /*  setbuf(stdout, NULL);  */
   fd = dup2(sock->socket, 1);
   if (fd != 1) {
-    fprintf(stderr, "Error connecting stdout to socket\n");
+    perror("Error connecting stdout to socket\n");
     return;
   }
   fd = dup2(sock->socket, 0);
   if (fd != 0) {
-    fprintf(stderr, "Error connecting stdin to socket\n");
+    perror("Error connecting stdin to socket\n");
     return;
   }
-  fprintf(stderr, "Redirected standard IO\n");
+  perror("Redirected standard IO\n");
   FD_CLR(sock->socket, &socket_mask);
 }