annotate rDiff/tools/whoami.m @ 3:29a698dc5c7e default tip

Merge multiple heads.
author Dave Bouvier <dave@bx.psu.edu>
date Mon, 27 Jan 2014 14:15:36 -0500
parents 0f80a5141704
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
1 function user_name = whoami
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 % WHOAMI Determines user name.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 % user_name = whoami
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 % This program is free software; you can redistribute it and/or modify
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 % it under the terms of the GNU General Public License as published by
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 % the Free Software Foundation; either version 3 of the License, or
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 % (at your option) any later version.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 % Written (W) 2009-2010 Gunnar Raetsch
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 % Copyright (C) 2009-2010 Max Planck Society
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 global whoami_user_name
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 if isempty(whoami_user_name)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 [ret, whoami_user_name]=unix('whoami') ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 if ret~=0,
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23 if keyboard_allowed(),
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 keyboard ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
25 end ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
26 whoami_user_name='unknown' ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
27 end ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
28 end ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
29
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
30 user_name= whoami_user_name ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
31 idx=find(user_name<30, 1, 'first') ;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
32 user_name = user_name(1:idx-1) ;