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