35 |
#include "alloc.h" |
#include "alloc.h" |
36 |
#include "error.h" |
#include "error.h" |
37 |
#include "filename.h" |
#include "filename.h" |
38 |
|
#include "getl.h" |
39 |
#include "getline.h" |
#include "getline.h" |
40 |
|
#include "getlogin_r.h" |
41 |
#include "output.h" |
#include "output.h" |
42 |
#include "som.h" |
#include "som.h" |
43 |
#include "tab.h" |
#include "tab.h" |
44 |
#include "version.h" |
#include "version.h" |
45 |
#include "mkfile.h" |
#include "mkfile.h" |
46 |
|
|
47 |
|
#include "gettext.h" |
48 |
|
#define _(msgid) gettext (msgid) |
49 |
|
|
50 |
/* Prototypes. */ |
/* Prototypes. */ |
51 |
static int postopen (struct file_ext *); |
static int postopen (struct file_ext *); |
52 |
static int preclose (struct file_ext *); |
static int preclose (struct file_ext *); |
239 |
{"source-file", 0}, |
{"source-file", 0}, |
240 |
{0, 0}, |
{0, 0}, |
241 |
}; |
}; |
242 |
#if HAVE_UNISTD_H |
char login[128], host[128]; |
|
char host[128]; |
|
|
#endif |
|
243 |
time_t curtime; |
time_t curtime; |
244 |
struct tm *loctime; |
struct tm *loctime; |
245 |
|
|
280 |
*cp = 0; |
*cp = 0; |
281 |
} |
} |
282 |
|
|
283 |
/* PORTME: Determine username, net address. */ |
if (getenv ("LOGNAME") != NULL) |
284 |
#if HAVE_UNISTD_H |
str_copy_rpad (login, sizeof login, getenv ("LOGNAME")); |
285 |
dict[2].value = getenv ("LOGNAME"); |
else if (getlogin_r (login, sizeof login)) |
286 |
if (!dict[2].value) |
strcpy (login, _("nobody")); |
287 |
dict[2].value = getlogin (); |
dict[2].value = login; |
|
if (!dict[2].value) |
|
|
dict[2].value = _("nobody"); |
|
288 |
|
|
289 |
|
#ifdef HAVE_UNISTD_H |
290 |
if (gethostname (host, 128) == -1) |
if (gethostname (host, 128) == -1) |
291 |
{ |
{ |
292 |
if (errno == ENAMETOOLONG) |
if (errno == ENAMETOOLONG) |
294 |
else |
else |
295 |
strcpy (host, _("nowhere")); |
strcpy (host, _("nowhere")); |
296 |
} |
} |
297 |
|
#else |
298 |
|
strcpy (host, _("nowhere")); |
299 |
|
#endif |
300 |
dict[3].value = host; |
dict[3].value = host; |
|
#else /* !HAVE_UNISTD_H */ |
|
|
dict[2].value = _("nobody"); |
|
|
dict[3].value = _("nowhere"); |
|
|
#endif /* !HAVE_UNISTD_H */ |
|
301 |
|
|
302 |
dict[4].value = outp_title ? outp_title : ""; |
dict[4].value = outp_title ? outp_title : ""; |
303 |
dict[5].value = outp_subtitle ? outp_subtitle : ""; |
dict[5].value = outp_subtitle ? outp_subtitle : ""; |