Reorder to avoid prototype.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22983 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -86,41 +86,6 @@ void utmp_login(char *tty, const char *username, const char *hostname)
|
||||
|
||||
/* update utmp and wtmp - the BSD way */
|
||||
|
||||
static void prepare_utmp (struct utmp *, char *, const char *, const char *);
|
||||
|
||||
void utmp_login(char *tty, const char *username, const char *hostname)
|
||||
{
|
||||
struct utmp utmp;
|
||||
int fd;
|
||||
|
||||
prepare_utmp (&utmp, tty, username, hostname);
|
||||
|
||||
#ifdef HAVE_SETUTENT
|
||||
utmpname(_PATH_UTMP);
|
||||
setutent();
|
||||
pututline(&utmp);
|
||||
endutent();
|
||||
#else
|
||||
|
||||
#ifdef HAVE_TTYSLOT
|
||||
{
|
||||
int ttyno;
|
||||
ttyno = ttyslot();
|
||||
if (ttyno > 0 && (fd = open(_PATH_UTMP, O_WRONLY, 0)) >= 0) {
|
||||
lseek(fd, (long)(ttyno * sizeof(struct utmp)), SEEK_SET);
|
||||
write(fd, &utmp, sizeof(struct utmp));
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_TTYSLOT */
|
||||
#endif /* HAVE_SETUTENT */
|
||||
|
||||
if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) {
|
||||
write(fd, &utmp, sizeof(struct utmp));
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_utmp (struct utmp *utmp, char *tty,
|
||||
const char *username, const char *hostname)
|
||||
@@ -162,4 +127,37 @@ prepare_utmp (struct utmp *utmp, char *tty,
|
||||
# endif
|
||||
}
|
||||
|
||||
void utmp_login(char *tty, const char *username, const char *hostname)
|
||||
{
|
||||
struct utmp utmp;
|
||||
int fd;
|
||||
|
||||
prepare_utmp (&utmp, tty, username, hostname);
|
||||
|
||||
#ifdef HAVE_SETUTENT
|
||||
utmpname(_PATH_UTMP);
|
||||
setutent();
|
||||
pututline(&utmp);
|
||||
endutent();
|
||||
#else
|
||||
|
||||
#ifdef HAVE_TTYSLOT
|
||||
{
|
||||
int ttyno;
|
||||
ttyno = ttyslot();
|
||||
if (ttyno > 0 && (fd = open(_PATH_UTMP, O_WRONLY, 0)) >= 0) {
|
||||
lseek(fd, (long)(ttyno * sizeof(struct utmp)), SEEK_SET);
|
||||
write(fd, &utmp, sizeof(struct utmp));
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_TTYSLOT */
|
||||
#endif /* HAVE_SETUTENT */
|
||||
|
||||
if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) {
|
||||
write(fd, &utmp, sizeof(struct utmp));
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !HAVE_UTMPX_H */
|
||||
|
Reference in New Issue
Block a user