13 #include "auto_usera.h"
14 #include "auto_break.h"
17 #define GETPW_USERLEN 32
26 char username
[GETPW_USERLEN
];
29 extension
= local
+ str_len(local
);
31 if (extension
- local
< sizeof(username
))
32 if (!*extension
|| (*extension
== *auto_break
)) {
33 byte_copy(username
,extension
- local
,local
);
34 username
[extension
- local
] = 0;
35 case_lowers(username
);
37 pw
= getpwnam(username
);
38 if (errno
== error_txtbsy
) _exit(QLX_SYS
);
41 if (stat(pw
->pw_dir
,&st
) == 0) {
42 if (st
.st_uid
== pw
->pw_uid
) {
44 if (*extension
) { ++extension
; dash
= "-"; }
49 if (error_temp(errno
)) _exit(QLX_NFS
);
51 if (extension
== local
) return 0;
63 if (!local
) _exit(100);
68 pw
= getpwnam(auto_usera
);
71 if (!pw
) _exit(QLX_NOALIAS
);
73 substdio_puts(subfdoutsmall
,pw
->pw_name
);
74 substdio_put(subfdoutsmall
,"",1);
75 substdio_put(subfdoutsmall
,num
,fmt_ulong(num
,(long) pw
->pw_uid
));
76 substdio_put(subfdoutsmall
,"",1);
77 substdio_put(subfdoutsmall
,num
,fmt_ulong(num
,(long) pw
->pw_gid
));
78 substdio_put(subfdoutsmall
,"",1);
79 substdio_puts(subfdoutsmall
,pw
->pw_dir
);
80 substdio_put(subfdoutsmall
,"",1);
81 substdio_puts(subfdoutsmall
,dash
);
82 substdio_put(subfdoutsmall
,"",1);
83 substdio_puts(subfdoutsmall
,extension
);
84 substdio_put(subfdoutsmall
,"",1);
85 substdio_flush(subfdoutsmall
);