summaryrefslogtreecommitdiff
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-08-31 16:25:21 +0000
committerRichard M. Stallman <rms@gnu.org>1996-08-31 16:25:21 +0000
commit292d74a3386c62462f4a11286e4c908643befb71 (patch)
treee659c64d5036edcec24385a822cf38ab1ba008ff /lib-src/emacsclient.c
parent8ca5efd0686399e909f08dff91988aa0b926fdff (diff)
downloademacs-292d74a3386c62462f4a11286e4c908643befb71.tar.gz
(both versions): Handle -nowait and --nowait by sending data to the server.
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c37
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)
char *getenv (), *getwd ();
char *getcwd ();
int geteuid ();
+ int nowait = 0;
if (argc < 2)
{
@@ -167,6 +168,17 @@ main (argc, argv)
for (i = 1; i < argc; i++)
{
+ /* If -nowait or --nowait option is used,
+ report it to the server. */
+ if (!strcmp (argv[i], "-nowait")
+ || (!strncmp (argv[i], "--nowait", strlen (argv[i]))
+ && strlen (argv[i]) >= 3))
+ {
+ fprintf (out, "-nowait ");
+ nowait = 1;
+ continue;
+ }
+
if (*argv[i] == '+')
{
char *p = argv[i] + 1;
@@ -181,6 +193,10 @@ main (argc, argv)
fprintf (out, "\n");
fflush (out);
+ /* Maybe wait for an answer. */
+ if (nowait)
+ return 0;
+
printf ("Waiting for Emacs...");
fflush (stdout);
@@ -224,6 +240,7 @@ main (argc, argv)
char *cwd;
char *temp;
char *progname = argv[0];
+ int nowait = 0;
if (argc < 2)
{
@@ -287,7 +304,17 @@ main (argc, argv)
{
int need_cwd = 0;
char *modified_arg = argv[0];
- if (*modified_arg == '+')
+
+ /* If -nowait or --nowait option is used,
+ report it to the server. */
+ if (!strcmp (modified_arg, "-nowait")
+ || (!strncmp (modified_arg, "--nowait", strlen (modified_arg))
+ && strlen (modified_arg) >= 3))
+ {
+ modified_arg = "-nowait";
+ nowait = 1;
+ }
+ else if (*modified_arg == '+')
{
char *p = modified_arg + 1;
while (*p >= '0' && *p <= '9') p++;
@@ -330,9 +357,11 @@ main (argc, argv)
perror ("msgsnd");
exit (1);
}
- /*
- * Now, wait for an answer
- */
+
+ /* Maybe wait for an answer. */
+ if (nowait)
+ return 0;
+
printf ("Waiting for Emacs...");
fflush (stdout);