diff options
| author | Richard M. Stallman | 1996-08-31 16:25:21 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-08-31 16:25:21 +0000 |
| commit | 292d74a3386c62462f4a11286e4c908643befb71 (patch) | |
| tree | e659c64d5036edcec24385a822cf38ab1ba008ff /lib-src | |
| parent | 8ca5efd0686399e909f08dff91988aa0b926fdff (diff) | |
| download | emacs-292d74a3386c62462f4a11286e4c908643befb71.tar.gz emacs-292d74a3386c62462f4a11286e4c908643befb71.zip | |
(both versions): Handle -nowait and --nowait by sending data to the server.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsclient.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index d1fb4df2ac7..c2940294ff9 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -71,6 +71,7 @@ main (argc, argv) | |||
| 71 | char *getenv (), *getwd (); | 71 | char *getenv (), *getwd (); |
| 72 | char *getcwd (); | 72 | char *getcwd (); |
| 73 | int geteuid (); | 73 | int geteuid (); |
| 74 | int nowait = 0; | ||
| 74 | 75 | ||
| 75 | if (argc < 2) | 76 | if (argc < 2) |
| 76 | { | 77 | { |
| @@ -167,6 +168,17 @@ main (argc, argv) | |||
| 167 | 168 | ||
| 168 | for (i = 1; i < argc; i++) | 169 | for (i = 1; i < argc; i++) |
| 169 | { | 170 | { |
| 171 | /* If -nowait or --nowait option is used, | ||
| 172 | report it to the server. */ | ||
| 173 | if (!strcmp (argv[i], "-nowait") | ||
| 174 | || (!strncmp (argv[i], "--nowait", strlen (argv[i])) | ||
| 175 | && strlen (argv[i]) >= 3)) | ||
| 176 | { | ||
| 177 | fprintf (out, "-nowait "); | ||
| 178 | nowait = 1; | ||
| 179 | continue; | ||
| 180 | } | ||
| 181 | |||
| 170 | if (*argv[i] == '+') | 182 | if (*argv[i] == '+') |
| 171 | { | 183 | { |
| 172 | char *p = argv[i] + 1; | 184 | char *p = argv[i] + 1; |
| @@ -181,6 +193,10 @@ main (argc, argv) | |||
| 181 | fprintf (out, "\n"); | 193 | fprintf (out, "\n"); |
| 182 | fflush (out); | 194 | fflush (out); |
| 183 | 195 | ||
| 196 | /* Maybe wait for an answer. */ | ||
| 197 | if (nowait) | ||
| 198 | return 0; | ||
| 199 | |||
| 184 | printf ("Waiting for Emacs..."); | 200 | printf ("Waiting for Emacs..."); |
| 185 | fflush (stdout); | 201 | fflush (stdout); |
| 186 | 202 | ||
| @@ -224,6 +240,7 @@ main (argc, argv) | |||
| 224 | char *cwd; | 240 | char *cwd; |
| 225 | char *temp; | 241 | char *temp; |
| 226 | char *progname = argv[0]; | 242 | char *progname = argv[0]; |
| 243 | int nowait = 0; | ||
| 227 | 244 | ||
| 228 | if (argc < 2) | 245 | if (argc < 2) |
| 229 | { | 246 | { |
| @@ -287,7 +304,17 @@ main (argc, argv) | |||
| 287 | { | 304 | { |
| 288 | int need_cwd = 0; | 305 | int need_cwd = 0; |
| 289 | char *modified_arg = argv[0]; | 306 | char *modified_arg = argv[0]; |
| 290 | if (*modified_arg == '+') | 307 | |
| 308 | /* If -nowait or --nowait option is used, | ||
| 309 | report it to the server. */ | ||
| 310 | if (!strcmp (modified_arg, "-nowait") | ||
| 311 | || (!strncmp (modified_arg, "--nowait", strlen (modified_arg)) | ||
| 312 | && strlen (modified_arg) >= 3)) | ||
| 313 | { | ||
| 314 | modified_arg = "-nowait"; | ||
| 315 | nowait = 1; | ||
| 316 | } | ||
| 317 | else if (*modified_arg == '+') | ||
| 291 | { | 318 | { |
| 292 | char *p = modified_arg + 1; | 319 | char *p = modified_arg + 1; |
| 293 | while (*p >= '0' && *p <= '9') p++; | 320 | while (*p >= '0' && *p <= '9') p++; |
| @@ -330,9 +357,11 @@ main (argc, argv) | |||
| 330 | perror ("msgsnd"); | 357 | perror ("msgsnd"); |
| 331 | exit (1); | 358 | exit (1); |
| 332 | } | 359 | } |
| 333 | /* | 360 | |
| 334 | * Now, wait for an answer | 361 | /* Maybe wait for an answer. */ |
| 335 | */ | 362 | if (nowait) |
| 363 | return 0; | ||
| 364 | |||
| 336 | printf ("Waiting for Emacs..."); | 365 | printf ("Waiting for Emacs..."); |
| 337 | fflush (stdout); | 366 | fflush (stdout); |
| 338 | 367 | ||