0
|
1 function user_name = whoami
|
|
2 % WHOAMI Determines user name.
|
|
3 %
|
|
4 % user_name = whoami
|
|
5 %
|
|
6 %
|
|
7 % This program is free software; you can redistribute it and/or modify
|
|
8 % it under the terms of the GNU General Public License as published by
|
|
9 % the Free Software Foundation; either version 3 of the License, or
|
|
10 % (at your option) any later version.
|
|
11 %
|
|
12 % Written (W) 2009-2010 Gunnar Raetsch
|
|
13 % Copyright (C) 2009-2010 Max Planck Society
|
|
14 %
|
|
15
|
|
16
|
|
17 global whoami_user_name
|
|
18
|
|
19 if isempty(whoami_user_name)
|
|
20
|
|
21 [ret, whoami_user_name]=unix('whoami') ;
|
|
22 if ret~=0,
|
|
23 if keyboard_allowed(),
|
|
24 keyboard ;
|
|
25 end ;
|
|
26 whoami_user_name='unknown' ;
|
|
27 end ;
|
|
28 end ;
|
|
29
|
|
30 user_name= whoami_user_name ;
|
|
31 idx=find(user_name<30, 1, 'first') ;
|
|
32 user_name = user_name(1:idx-1) ;
|