aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorJason Rumney2007-05-16 21:35:06 +0000
committerJason Rumney2007-05-16 21:35:06 +0000
commit486ba65f34f8605bc4145bb72114474e65dfce6b (patch)
tree06d144a7a92362aab0587d37c2018f812699df51 /lib-src
parent4b7b77f679e0af9badce49c08763a96eddf2fcc1 (diff)
downloademacs-486ba65f34f8605bc4145bb72114474e65dfce6b.tar.gz
emacs-486ba65f34f8605bc4145bb72114474e65dfce6b.zip
(emacs_socket): Rename from s.
Move definition below includes it depends on. (SEND_STRING, SEND_QUOTED): Remove obfuscation macros. (quote_argument, set_tcp_socket, handle_sigcont, handle_sigtstp): (main): Expand removed macros inline.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c88
1 files changed, 43 insertions, 45 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index a8d3257cde0..44d5783dd88 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -108,8 +108,6 @@ char *(getcwd) ();
108#define VERSION "unspecified" 108#define VERSION "unspecified"
109#endif 109#endif
110 110
111#define SEND_STRING(data) (send_to_emacs (emacs_socket, (data)))
112#define SEND_QUOTED(data) (quote_argument (emacs_socket, (data)))
113 111
114#ifndef EXIT_SUCCESS 112#ifndef EXIT_SUCCESS
115#define EXIT_SUCCESS 0 113#define EXIT_SUCCESS 0
@@ -645,7 +643,7 @@ quote_argument (s, str)
645 } 643 }
646 *q++ = 0; 644 *q++ = 0;
647 645
648 SEND_STRING (copy); 646 send_to_emacs (s, copy);
649 647
650 free (copy); 648 free (copy);
651} 649}
@@ -878,9 +876,9 @@ set_tcp_socket ()
878 */ 876 */
879 auth_string[AUTH_KEY_LENGTH] = '\0'; 877 auth_string[AUTH_KEY_LENGTH] = '\0';
880 878
881 SEND_STRING ("-auth "); 879 send_to_emacs (s, "-auth ");
882 SEND_STRING (auth_string); 880 send_to_emacs (s, auth_string);
883 SEND_STRING ("\n"); 881 send_to_emacs (s, "\n");
884 882
885 return s; 883 return s;
886} 884}
@@ -953,7 +951,7 @@ handle_sigcont (int signalnum)
953 if (tcgetpgrp (1) == getpgrp ()) 951 if (tcgetpgrp (1) == getpgrp ())
954 { 952 {
955 /* We are in the foreground. */ 953 /* We are in the foreground. */
956 SEND_STRING ("-resume \n"); 954 send_to_emacs (emacs_socket, "-resume \n");
957 } 955 }
958 else 956 else
959 { 957 {
@@ -978,7 +976,7 @@ handle_sigtstp (int signalnum)
978 sigset_t set; 976 sigset_t set;
979 977
980 if (s) 978 if (s)
981 SEND_STRING ("-suspend \n"); 979 send_to_emacs (emacs_socket, "-suspend \n");
982 980
983 /* Unblock this signal and call the default handler by temprarily 981 /* Unblock this signal and call the default handler by temprarily
984 changing the handler and resignalling. */ 982 changing the handler and resignalling. */
@@ -1298,9 +1296,9 @@ main (argc, argv)
1298#endif 1296#endif
1299 1297
1300 /* First of all, send our version number for verification. */ 1298 /* First of all, send our version number for verification. */
1301 SEND_STRING ("-version "); 1299 send_to_emacs (emacs_socket, "-version ");
1302 SEND_STRING (VERSION); 1300 send_to_emacs (emacs_socket, VERSION);
1303 SEND_STRING (" "); 1301 send_to_emacs (emacs_socket, " ");
1304 1302
1305 /* Send over our environment. */ 1303 /* Send over our environment. */
1306 if (!current_frame) 1304 if (!current_frame)
@@ -1311,33 +1309,33 @@ main (argc, argv)
1311 { 1309 {
1312 char *name = xstrdup (environ[i]); 1310 char *name = xstrdup (environ[i]);
1313 char *value = strchr (name, '='); 1311 char *value = strchr (name, '=');
1314 SEND_STRING ("-env "); 1312 send_to_emacs (emacs_socket, "-env ");
1315 SEND_QUOTED (environ[i]); 1313 quote_argument (emacs_socket, environ[i]);
1316 SEND_STRING (" "); 1314 send_to_emacs (emacs_socket, " ");
1317 } 1315 }
1318 } 1316 }
1319 1317
1320 /* Send over our current directory. */ 1318 /* Send over our current directory. */
1321 if (!current_frame) 1319 if (!current_frame)
1322 { 1320 {
1323 SEND_STRING ("-dir "); 1321 send_to_emacs (emacs_socket, "-dir ");
1324 SEND_QUOTED (cwd); 1322 quote_argument (emacs_socket, cwd);
1325 SEND_STRING ("/"); 1323 send_to_emacs (emacs_socket, "/");
1326 SEND_STRING (" "); 1324 send_to_emacs (emacs_socket, " ");
1327 } 1325 }
1328 1326
1329 retry: 1327 retry:
1330 if (nowait) 1328 if (nowait)
1331 SEND_STRING ("-nowait "); 1329 send_to_emacs (emacs_socket, "-nowait ");
1332 1330
1333 if (current_frame) 1331 if (current_frame)
1334 SEND_STRING ("-current-frame "); 1332 send_to_emacs (emacs_socket, "-current-frame ");
1335 1333
1336 if (display) 1334 if (display)
1337 { 1335 {
1338 SEND_STRING ("-display "); 1336 send_to_emacs (emacs_socket, "-display ");
1339 SEND_QUOTED (display); 1337 quote_argument (emacs_socket, display);
1340 SEND_STRING (" "); 1338 send_to_emacs (emacs_socket, " ");
1341 } 1339 }
1342 1340
1343 if (tty) 1341 if (tty)
@@ -1372,15 +1370,15 @@ main (argc, argv)
1372 init_signals (); 1370 init_signals ();
1373#endif 1371#endif
1374 1372
1375 SEND_STRING ("-tty "); 1373 send_to_emacs (emacs_socket, "-tty ");
1376 SEND_QUOTED (tty_name); 1374 quote_argument (emacs_socket, tty_name);
1377 SEND_STRING (" "); 1375 send_to_emacs (emacs_socket, " ");
1378 SEND_QUOTED (type); 1376 quote_argument (emacs_socket, type);
1379 SEND_STRING (" "); 1377 send_to_emacs (emacs_socket, " ");
1380 } 1378 }
1381 1379
1382 if (window_system) 1380 if (window_system)
1383 SEND_STRING ("-window-system "); 1381 send_to_emacs (emacs_socket, "-window-system ");
1384 1382
1385 if ((argc - optind > 0)) 1383 if ((argc - optind > 0))
1386 { 1384 {
@@ -1391,9 +1389,9 @@ main (argc, argv)
1391 if (eval) 1389 if (eval)
1392 { 1390 {
1393 /* Don't prepend cwd or anything like that. */ 1391 /* Don't prepend cwd or anything like that. */
1394 SEND_STRING ("-eval "); 1392 send_to_emacs (emacs_socket, "-eval ");
1395 SEND_QUOTED (argv[i]); 1393 quote_argument (emacs_socket, argv[i]);
1396 SEND_STRING (" "); 1394 send_to_emacs (emacs_socket, " ");
1397 continue; 1395 continue;
1398 } 1396 }
1399 1397
@@ -1403,9 +1401,9 @@ main (argc, argv)
1403 while (isdigit ((unsigned char) *p) || *p == ':') p++; 1401 while (isdigit ((unsigned char) *p) || *p == ':') p++;
1404 if (*p == 0) 1402 if (*p == 0)
1405 { 1403 {
1406 SEND_STRING ("-position "); 1404 send_to_emacs (emacs_socket, "-position ");
1407 SEND_QUOTED (argv[i]); 1405 quote_argument (emacs_socket, argv[i]);
1408 SEND_STRING (" "); 1406 send_to_emacs (emacs_socket, " ");
1409 continue; 1407 continue;
1410 } 1408 }
1411 else 1409 else
@@ -1414,14 +1412,14 @@ main (argc, argv)
1414 else if (! file_name_absolute_p (argv[i])) 1412 else if (! file_name_absolute_p (argv[i]))
1415 relative = 1; 1413 relative = 1;
1416 1414
1417 SEND_STRING ("-file "); 1415 send_to_emacs (emacs_socket, "-file ");
1418 if (relative) 1416 if (relative)
1419 { 1417 {
1420 SEND_QUOTED (cwd); 1418 quote_argument (emacs_socket, cwd);
1421 SEND_STRING ("/"); 1419 send_to_emacs (emacs_socket, "/");
1422 } 1420 }
1423 SEND_QUOTED (argv[i]); 1421 quote_argument (emacs_socket, argv[i]);
1424 SEND_STRING (" "); 1422 send_to_emacs (emacs_socket, " ");
1425 } 1423 }
1426 } 1424 }
1427 else 1425 else
@@ -1431,16 +1429,16 @@ main (argc, argv)
1431 while ((str = fgets (string, BUFSIZ, stdin))) 1429 while ((str = fgets (string, BUFSIZ, stdin)))
1432 { 1430 {
1433 if (eval) 1431 if (eval)
1434 SEND_STRING ("-eval "); 1432 send_to_emacs (emacs_socket, "-eval ");
1435 else 1433 else
1436 SEND_STRING ("-file "); 1434 send_to_emacs (emacs_socket, "-file ");
1437 SEND_QUOTED (str); 1435 quote_argument (emacs_socket, str);
1438 } 1436 }
1439 SEND_STRING (" "); 1437 send_to_emacs (emacs_socket, " ");
1440 } 1438 }
1441 } 1439 }
1442 1440
1443 SEND_STRING ("\n"); 1441 send_to_emacs (emacs_socket, "\n");
1444 1442
1445 /* Wait for an answer. */ 1443 /* Wait for an answer. */
1446 if (!eval && !tty && !nowait) 1444 if (!eval && !tty && !nowait)