Changeset 467

Show
Ignore:
Timestamp:
08/08/07 06:52:41 (1 year ago)
Author:
takkaria
Message:

Move the user_name function to main.c, where it belongs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/externs.h

    r466 r467  
    726726 */ 
    727727 
    728 #ifdef SET_UID 
    729 extern void user_name(char *buf, size_t len, int id); 
    730 #endif /* SET_UID */ 
    731  
    732  
    733728#ifdef RISCOS 
    734729/* main-ros.c */ 
  • trunk/src/main.c

    r298 r467  
    250250        } 
    251251} 
     252 
     253 
     254 
     255 
     256#ifdef SET_UID 
     257 
     258/* 
     259 * Find a default user name from the system. 
     260 */ 
     261static 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 */ 
    252277 
    253278 
  • trunk/src/z-file.c

    r440 r467  
    333333 
    334334 
    335 #ifdef SET_UID 
    336  
    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  
    363335#if defined(SET_UID) || defined(USE_PRIVATE_PATHS) 
    364336