aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2018-11-19 08:47:11 -0800
committerPaul Eggert2018-11-19 11:38:20 -0800
commit9f47bb229dfc31716f58dd5587bf3b45cb855135 (patch)
tree1f47153c2f1b8daf14a39de6865670c9e7fa6dab /lib-src
parent4a5034d84edfc34c1264388ef7cccbd90bdd7d9d (diff)
downloademacs-9f47bb229dfc31716f58dd5587bf3b45cb855135.tar.gz
emacs-9f47bb229dfc31716f58dd5587bf3b45cb855135.zip
emacsclient.c: make identifiers more local
* lib-src/emacsclient.c (progname, main_argc, main_argv): (nowait, quiet, suppress_output, eval, current_frame, display): (alt_display, parent_id, tty, alternate_editor, socket_name): (server_file, tramp_prefix, emacs_pid, frame_parameters): (longopts, xstrdup, send_bufffer, sblen, emacs_socket): Now static. (SEND_BUFFER_SIZE, send_buffer, sblen): Now local to send_to_emacs.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 5110b4cc9f0..f2771445d8a 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -92,65 +92,65 @@ char *w32_getenv (const char *);
92#define EXTRA_SPACE 100 92#define EXTRA_SPACE 100
93 93
94/* Name used to invoke this program. */ 94/* Name used to invoke this program. */
95const char *progname; 95static char const *progname;
96 96
97/* The first argument to main. */ 97/* The first argument to main. */
98int main_argc; 98static int main_argc;
99 99
100/* The second argument to main. */ 100/* The second argument to main. */
101char **main_argv; 101static char *const *main_argv;
102 102
103/* Nonzero means don't wait for a response from Emacs. --no-wait. */ 103/* True means don't wait for a response from Emacs. --no-wait. */
104int nowait = 0; 104static int nowait;
105 105
106/* Nonzero means don't print messages for successful operations. --quiet. */ 106/* True means don't print messages for successful operations. --quiet. */
107int quiet = 0; 107static int quiet;
108 108
109/* Nonzero means don't print values returned from emacs. --suppress-output. */ 109/* True means don't print values returned from emacs. --suppress-output. */
110int suppress_output = 0; 110static int suppress_output;
111 111
112/* Nonzero means args are expressions to be evaluated. --eval. */ 112/* True means args are expressions to be evaluated. --eval. */
113int eval = 0; 113static int eval;
114 114
115/* Nonzero means don't open a new frame. Inverse of --create-frame. */ 115/* Nonzero means don't open a new frame. Inverse of --create-frame. */
116int current_frame = 1; 116static int current_frame = 1;
117 117
118/* The display on which Emacs should work. --display. */ 118/* The display on which Emacs should work. --display. */
119const char *display = NULL; 119static char const *display;
120 120
121/* The alternate display we should try if Emacs does not support display. */ 121/* The alternate display we should try if Emacs does not support display. */
122const char *alt_display = NULL; 122static char const *alt_display;
123 123
124/* The parent window ID, if we are opening a frame via XEmbed. */ 124/* The parent window ID, if we are opening a frame via XEmbed. */
125char *parent_id = NULL; 125static char *parent_id;
126 126
127/* Nonzero means open a new Emacs frame on the current terminal. */ 127/* True means open a new Emacs frame on the current terminal. */
128int tty = 0; 128static int tty;
129 129
130/* If non-NULL, the name of an editor to fallback to if the server 130/* If non-NULL, the name of an editor to fallback to if the server
131 is not running. --alternate-editor. */ 131 is not running. --alternate-editor. */
132const char *alternate_editor = NULL; 132static char *alternate_editor;
133 133
134/* If non-NULL, the filename of the UNIX socket. */ 134/* If non-NULL, the filename of the UNIX socket. */
135const char *socket_name = NULL; 135static char const *socket_name;
136 136
137/* If non-NULL, the filename of the authentication file. */ 137/* If non-NULL, the filename of the authentication file. */
138const char *server_file = NULL; 138static char const *server_file;
139 139
140/* If non-NULL, the tramp prefix emacs must use to find the files. */ 140/* If non-NULL, the tramp prefix emacs must use to find the files. */
141const char *tramp_prefix = NULL; 141static char const *tramp_prefix;
142 142
143/* PID of the Emacs server process. */ 143/* PID of the Emacs server process. */
144int emacs_pid = 0; 144static int emacs_pid;
145 145
146/* If non-NULL, a string that should form a frame parameter alist to 146/* If non-NULL, a string that should form a frame parameter alist to
147 be used for the new frame. */ 147 be used for the new frame. */
148const char *frame_parameters = NULL; 148static char const *frame_parameters;
149 149
150static _Noreturn void print_help_and_exit (void); 150static _Noreturn void print_help_and_exit (void);
151 151
152 152
153struct option longopts[] = 153static struct option const longopts[] =
154{ 154{
155 { "no-wait", no_argument, NULL, 'n' }, 155 { "no-wait", no_argument, NULL, 'n' },
156 { "quiet", no_argument, NULL, 'q' }, 156 { "quiet", no_argument, NULL, 'q' },
@@ -203,9 +203,8 @@ xrealloc (void *ptr, size_t size)
203} 203}
204 204
205/* Like strdup but get a fatal error if memory is exhausted. */ 205/* Like strdup but get a fatal error if memory is exhausted. */
206char *xstrdup (const char *) ATTRIBUTE_MALLOC;
207 206
208char * 207static char * ATTRIBUTE_MALLOC
209xstrdup (const char *s) 208xstrdup (const char *s)
210{ 209{
211 char *result = strdup (s); 210 char *result = strdup (s);
@@ -741,13 +740,9 @@ main (int argc, char **argv)
741#else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ 740#else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */
742 741
743enum { AUTH_KEY_LENGTH = 64 }; 742enum { AUTH_KEY_LENGTH = 64 };
744enum { SEND_BUFFER_SIZE = 4096 };
745 743
746/* Buffer to accumulate data to send in TCP connections. */
747char send_buffer[SEND_BUFFER_SIZE + 1];
748int sblen = 0; /* Fill pointer for the send buffer. */
749/* Socket used to communicate with the Emacs server process. */ 744/* Socket used to communicate with the Emacs server process. */
750HSOCKET emacs_socket = 0; 745static HSOCKET emacs_socket = 0;
751 746
752/* On Windows, the socket library was historically separate from the 747/* On Windows, the socket library was historically separate from the
753 standard C library, so errors are handled differently. */ 748 standard C library, so errors are handled differently. */
@@ -779,6 +774,14 @@ sock_err_message (const char *function_name)
779static void 774static void
780send_to_emacs (HSOCKET s, const char *data) 775send_to_emacs (HSOCKET s, const char *data)
781{ 776{
777 enum { SEND_BUFFER_SIZE = 4096 };
778
779 /* Buffer to accumulate data to send in TCP connections. */
780 static char send_buffer[SEND_BUFFER_SIZE + 1];
781
782 /* Fill pointer for the send buffer. */
783 static int sblen;
784
782 size_t dlen; 785 size_t dlen;
783 786
784 if (!data) 787 if (!data)