Changeset 467
- Timestamp:
- 08/08/07 06:52:41 (1 year ago)
- Files:
-
- trunk/src/externs.h (modified) (1 diff)
- trunk/src/main.c (modified) (1 diff)
- trunk/src/z-file.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/externs.h
r466 r467 726 726 */ 727 727 728 #ifdef SET_UID729 extern void user_name(char *buf, size_t len, int id);730 #endif /* SET_UID */731 732 733 728 #ifdef RISCOS 734 729 /* main-ros.c */ trunk/src/main.c
r298 r467 250 250 } 251 251 } 252 253 254 255 256 #ifdef SET_UID 257 258 /* 259 * Find a default user name from the system. 260 */ 261 static void user_name(char *buf, size_t len, int id) 262 { 263 struct passwd *pw = getpwuid(id); 264 265 /* Default to PLAYER */ 266 if (!pw) 267 { 268 my_strcpy(buf, "PLAYER", len); 269 return; 270 } 271 272 /* Capitalise and copy */ 273 strnfmt(buf, len, "%^s", pw->pw_name); 274 } 275 276 #endif /* SET_UID */ 252 277 253 278 trunk/src/z-file.c
r440 r467 333 333 334 334 335 #ifdef SET_UID336 337 /*338 * Find a default user name from the system.339 */340 void user_name(char *buf, size_t len, int id)341 {342 struct passwd *pw;343 344 /* Look up the user name */345 if ((pw = getpwuid(id)))346 {347 /* Get the first 15 characters of the user name */348 my_strcpy(buf, pw->pw_name, len);349 350 /* Capitalize the user name */351 buf[0] = toupper((unsigned char)buf[0]);352 353 return;354 }355 356 /* Oops. Hack -- default to "PLAYER" */357 my_strcpy(buf, "PLAYER", len);358 }359 360 #endif /* SET_UID */361 362 363 335 #if defined(SET_UID) || defined(USE_PRIVATE_PATHS) 364 336
