21 |
|
|
22 |
|
|
23 |
#define NO_SHORTNAMES |
#define NO_SHORTNAMES |
24 |
#include <../src/config.h> |
|
25 |
|
#ifdef HAVE_CONFIG_H |
26 |
|
#include "config.h" |
27 |
|
#endif |
28 |
|
|
29 |
#undef signal |
#undef signal |
30 |
|
|
31 |
#include <ctype.h> |
#include <ctype.h> |
32 |
#include <stdio.h> |
#include <stdio.h> |
33 |
#include <getopt.h> |
#include <getopt.h> |
34 |
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
88 |
break; |
break; |
89 |
|
|
90 |
alternate_editor = getenv ("ALTERNATE_EDITOR"); |
alternate_editor = getenv ("ALTERNATE_EDITOR"); |
91 |
|
|
92 |
switch (opt) |
switch (opt) |
93 |
{ |
{ |
94 |
case 0: |
case 0: |
95 |
/* If getopt returns 0, then it has already processed a |
/* If getopt returns 0, then it has already processed a |
96 |
long-named option. We should do nothing. */ |
long-named option. We should do nothing. */ |
97 |
break; |
break; |
98 |
|
|
99 |
case 'a': |
case 'a': |
100 |
alternate_editor = optarg; |
alternate_editor = optarg; |
101 |
break; |
break; |
102 |
|
|
103 |
case 'n': |
case 'n': |
104 |
nowait = 1; |
nowait = 1; |
105 |
break; |
break; |
161 |
} |
} |
162 |
*q++ = 0; |
*q++ = 0; |
163 |
|
|
|
|
|
164 |
return copy; |
return copy; |
165 |
} |
} |
166 |
|
|
201 |
} |
} |
202 |
|
|
203 |
|
|
|
|
|
204 |
|
|
205 |
#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC) |
#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC) |
206 |
|
|
274 |
if (argc - optind < 1) |
if (argc - optind < 1) |
275 |
print_help_and_exit (); |
print_help_and_exit (); |
276 |
|
|
277 |
/* |
/* |
278 |
* Open up an AF_UNIX socket in this person's home directory |
* Open up an AF_UNIX socket in this person's home directory |
279 |
*/ |
*/ |
280 |
|
|
284 |
perror ("socket"); |
perror ("socket"); |
285 |
fail (argc, argv); |
fail (argc, argv); |
286 |
} |
} |
287 |
|
|
288 |
server.sun_family = AF_UNIX; |
server.sun_family = AF_UNIX; |
289 |
|
|
290 |
{ |
{ |
319 |
our euid. If so, look for a socket based on the UID |
our euid. If so, look for a socket based on the UID |
320 |
associated with the name. This is reminiscent of the logic |
associated with the name. This is reminiscent of the logic |
321 |
that init_editfns uses to set the global Vuser_full_name. */ |
that init_editfns uses to set the global Vuser_full_name. */ |
322 |
|
|
323 |
char *user_name = (char *) getenv ("LOGNAME"); |
char *user_name = (char *) getenv ("LOGNAME"); |
324 |
if (!user_name) |
if (!user_name) |
325 |
user_name = (char *) getenv ("USER"); |
user_name = (char *) getenv ("USER"); |
326 |
|
|
327 |
if (user_name) |
if (user_name) |
328 |
{ |
{ |
329 |
struct passwd *pw = getpwnam (user_name); |
struct passwd *pw = getpwnam (user_name); |
336 |
} |
} |
337 |
} |
} |
338 |
} |
} |
339 |
|
|
340 |
switch (sock_status) |
switch (sock_status) |
341 |
{ |
{ |
342 |
case 1: |
case 1: |
348 |
fail (argc, argv); |
fail (argc, argv); |
349 |
} |
} |
350 |
break; |
break; |
351 |
|
|
352 |
case 2: |
case 2: |
353 |
/* `stat' failed */ |
/* `stat' failed */ |
354 |
if (errno == ENOENT) |
if (errno == ENOENT) |
450 |
the first line we read will actually be the output we just sent. |
the first line we read will actually be the output we just sent. |
451 |
We can't predict whether that will happen, so if it does, we |
We can't predict whether that will happen, so if it does, we |
452 |
detect it by recognizing `Client: ' at the beginning. */ |
detect it by recognizing `Client: ' at the beginning. */ |
453 |
|
|
454 |
while (str = fgets (string, BUFSIZ, in)) |
while ((str = fgets (string, BUFSIZ, in))) |
455 |
printf ("%s", str); |
printf ("%s", str); |
456 |
|
|
457 |
return 0; |
return 0; |