2 * PuTTY miscellaneous Unix stuff
13 unsigned long getticks(void)
16 gettimeofday(&tv
, NULL
);
18 * We want to use milliseconds rather than microseconds,
19 * because we need a decent number of them to fit into a 32-bit
20 * word so it can be used for keepalives.
22 return tv
.tv_sec
* 1000 + tv
.tv_usec
/ 1000;
25 Filename
filename_from_str(const char *str
)
28 strncpy(ret
.path
, str
, sizeof(ret
.path
));
29 ret
.path
[sizeof(ret
.path
)-1] = '\0';
33 const char *filename_to_str(const Filename
*fn
)
38 int filename_equal(Filename f1
, Filename f2
)
40 return !strcmp(f1
.path
, f2
.path
);
43 int filename_is_null(Filename fn
)
49 static FILE *debug_fp
= NULL
;
54 debug_fp
= fopen("debug.log", "w");
57 write(1, buf
, strlen(buf
));
64 char *get_username(void)
68 char *user
, *ret
= NULL
;
71 * First, find who we think we are using getlogin. If this
72 * agrees with our uid, we'll go along with it. This should
73 * allow sharing of uids between several login names whilst
74 * coping correctly with people who have su'ed.
82 if (p
&& p
->pw_uid
== uid
) {
84 * The result of getlogin() really does correspond to
90 * If that didn't work, for whatever reason, we'll do
91 * the simpler version: look up our uid in the password
92 * file and map it straight to a name.
105 * Display the fingerprints of the PGP Master Keys to the user.
106 * (This is here rather than in uxcons because it's appropriate even for
109 void pgp_fingerprints(void)
111 fputs("These are the fingerprints of the PuTTY PGP Master Keys. They can\n"
112 "be used to establish a trust path from this executable to another\n"
113 "one. See the manual for more information.\n"
114 "(Note: these fingerprints have nothing to do with SSH!)\n"
116 "PuTTY Master Key (RSA), 1024-bit:\n"
117 " " PGP_RSA_MASTER_KEY_FP
"\n"
118 "PuTTY Master Key (DSA), 1024-bit:\n"
119 " " PGP_DSA_MASTER_KEY_FP
"\n", stdout
);