20 #include <med_config.h>
31 #include <sys/timeb.h>
35 #if TIME_WITH_SYS_TIME
36 # include <sys/time.h>
40 # include <sys/time.h>
47 #error "unistd.h required."
52 #if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
53 # include <sys/types.h>
69 const char *
const meshname)
79 char _lpBuffer [UNLEN+1]=
"";
80 long _nSize = UNLEN+1;
83 struct passwd* mypasswd;
107 strcat(_path,meshname);
119 if ( GetUserName(_lpBuffer,&_nSize) == 0 )
goto ERROR_;
121 strncpy(_unvname,_lpBuffer,_nSize);
122 strcat(_unvname,
" ");
124 strcat(_unvname,ctime(&_time));
126 _nSize = strlen(_unvname)-1;
127 if ( sprintf(&_unvname[_nSize],
" %hu",_tp.millitm) < 0 )
goto ERROR_;
130 #if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
131 mypasswd=getpwuid(geteuid());
132 if ( mypasswd == NULL ) {
133 MESSAGE(
"Impossible d'obtenir le nom de l'utilisateur effectif");
136 strcat(_unvname,mypasswd->pw_name);
137 #elif defined(HAVE_CUSERID)
138 if ( !cuserid(_unvname) ) {
143 #error "There is no ( getpwuid && geteuid) nor cuserid"
145 strcat(_unvname,
" ");
147 strcat(_unvname,ctime(&_time));
148 if ( gettimeofday(&_tp,NULL) < 0 ) {
152 if ( sprintf(&_unvname[strlen(_unvname)-1],
" %li",_tp.tv_usec) < 0 ) {