~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_pack.cc

Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include "mysys/mysys_priv.h"
 
17
 
 
18
#include <pwd.h>
 
19
 
17
20
#include <mystrings/m_string.h>
18
21
#include "my_static.h"
19
 
#ifdef HAVE_PWD_H
20
 
#include <pwd.h>
21
 
#endif
22
22
 
23
23
static char * expand_tilde(char * *path);
24
24
static size_t system_filename(char * to, const char *from);
224
224
{
225
225
  if (path[0][0] == FN_LIBCHAR)
226
226
    return home_dir;                    /* ~/ expanded to home */
227
 
#ifdef HAVE_GETPWNAM
 
227
  char *str,save;
 
228
  struct passwd *user_entry;
 
229
 
 
230
  if (!(str=strchr(*path,FN_LIBCHAR)))
 
231
    str= strchr(*path, '\0');
 
232
  save= *str; *str= '\0';
 
233
  user_entry=getpwnam(*path);
 
234
  *str=save;
 
235
  endpwent();
 
236
  if (user_entry)
228
237
  {
229
 
    char *str,save;
230
 
    struct passwd *user_entry;
231
 
 
232
 
    if (!(str=strchr(*path,FN_LIBCHAR)))
233
 
      str= strchr(*path, '\0');
234
 
    save= *str; *str= '\0';
235
 
    user_entry=getpwnam(*path);
236
 
    *str=save;
237
 
    endpwent();
238
 
    if (user_entry)
239
 
    {
240
 
      *path=str;
241
 
      return user_entry->pw_dir;
242
 
    }
 
238
    *path=str;
 
239
    return user_entry->pw_dir;
243
240
  }
244
 
#endif
245
241
  return NULL;
246
242
}
247
243