diff options
| author | Paul Eggert | 2018-11-19 08:47:11 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-11-19 11:38:20 -0800 |
| commit | 9f47bb229dfc31716f58dd5587bf3b45cb855135 (patch) | |
| tree | 1f47153c2f1b8daf14a39de6865670c9e7fa6dab /lib-src | |
| parent | 4a5034d84edfc34c1264388ef7cccbd90bdd7d9d (diff) | |
| download | emacs-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.c | 65 |
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. */ |
| 95 | const char *progname; | 95 | static char const *progname; |
| 96 | 96 | ||
| 97 | /* The first argument to main. */ | 97 | /* The first argument to main. */ |
| 98 | int main_argc; | 98 | static int main_argc; |
| 99 | 99 | ||
| 100 | /* The second argument to main. */ | 100 | /* The second argument to main. */ |
| 101 | char **main_argv; | 101 | static 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. */ |
| 104 | int nowait = 0; | 104 | static 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. */ |
| 107 | int quiet = 0; | 107 | static 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. */ |
| 110 | int suppress_output = 0; | 110 | static 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. */ |
| 113 | int eval = 0; | 113 | static 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. */ |
| 116 | int current_frame = 1; | 116 | static int current_frame = 1; |
| 117 | 117 | ||
| 118 | /* The display on which Emacs should work. --display. */ | 118 | /* The display on which Emacs should work. --display. */ |
| 119 | const char *display = NULL; | 119 | static 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. */ |
| 122 | const char *alt_display = NULL; | 122 | static 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. */ |
| 125 | char *parent_id = NULL; | 125 | static 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. */ |
| 128 | int tty = 0; | 128 | static 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. */ |
| 132 | const char *alternate_editor = NULL; | 132 | static 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. */ |
| 135 | const char *socket_name = NULL; | 135 | static 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. */ |
| 138 | const char *server_file = NULL; | 138 | static 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. */ |
| 141 | const char *tramp_prefix = NULL; | 141 | static char const *tramp_prefix; |
| 142 | 142 | ||
| 143 | /* PID of the Emacs server process. */ | 143 | /* PID of the Emacs server process. */ |
| 144 | int emacs_pid = 0; | 144 | static 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. */ |
| 148 | const char *frame_parameters = NULL; | 148 | static char const *frame_parameters; |
| 149 | 149 | ||
| 150 | static _Noreturn void print_help_and_exit (void); | 150 | static _Noreturn void print_help_and_exit (void); |
| 151 | 151 | ||
| 152 | 152 | ||
| 153 | struct option longopts[] = | 153 | static 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. */ |
| 206 | char *xstrdup (const char *) ATTRIBUTE_MALLOC; | ||
| 207 | 206 | ||
| 208 | char * | 207 | static char * ATTRIBUTE_MALLOC |
| 209 | xstrdup (const char *s) | 208 | xstrdup (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 | ||
| 743 | enum { AUTH_KEY_LENGTH = 64 }; | 742 | enum { AUTH_KEY_LENGTH = 64 }; |
| 744 | enum { SEND_BUFFER_SIZE = 4096 }; | ||
| 745 | 743 | ||
| 746 | /* Buffer to accumulate data to send in TCP connections. */ | ||
| 747 | char send_buffer[SEND_BUFFER_SIZE + 1]; | ||
| 748 | int 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. */ |
| 750 | HSOCKET emacs_socket = 0; | 745 | static 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) | |||
| 779 | static void | 774 | static void |
| 780 | send_to_emacs (HSOCKET s, const char *data) | 775 | send_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) |