#ifdef HAVE_UTMP_H
#include <utmp.h>
#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif
#ifndef HAVE_GETUTLINE
struct utmp *getutline(struct utmp *ut);
}
-/*
- * check for the presence of a character within a string (returns count)
- */
-int haschar(char *st, int ch)
-{
- int a,b;
- b=0;
- for (a=0; a<strlen(st); ++a) if (st[a]==ch) ++b;
- return(b);
- }
-
void back(int spaces) /* Destructive backspace */
{
void hit_any_key(void) { /* hit any key to continue */
int a,b;
+ color(COLOR_PUSH);
+ color(DIM_RED);
printf("%s\r",serv_info.serv_moreprompt);
+ color(COLOR_POP);
sttybbs(0);
b=inkey();
for (a=0; a<strlen(serv_info.serv_moreprompt); ++a)
int temp;
temp = sval;
- color(3);
- printf("%45s [", prompt);
- color(1);
+ color(DIM_WHITE);
+ printf("%45s ", prompt);
+ color(DIM_MAGENTA);
+ printf("[");
+ color(BRIGHT_MAGENTA);
printf("%3s", ((temp&sbit) ? "Yes":"No"));
- color(3);
+ color(DIM_MAGENTA);
printf("]? ");
- color(2);
+ color(BRIGHT_CYAN);
a=yesno_d(temp&sbit);
- color(7);
+ color(DIM_WHITE);
temp=(temp|sbit);
if (!a) temp=(temp^sbit);
return(temp);
else strncpy(hbuf,buf,24);
#else
char *tty = ttyname(0);
+#ifdef HAVE_GETUTXLINE
+ struct utmpx ut, *put;
+#else
struct utmp ut, *put;
+#endif
if (tty == NULL) {
fail:
safestrncpy(ut.ut_line, &tty[5], sizeof ut.ut_line);
+#ifdef HAVE_GETUTXLINE /* Solaris uses this */
+ if ((put = getutxline(&ut)) == NULL)
+#else
if ((put = getutline(&ut)) == NULL)
+#endif
goto fail;
-#ifdef HAVE_UT_TYPE
+#if defined(HAVE_UT_TYPE) || defined(HAVE_GETUTXLINE)
if (put->ut_type == USER_PROCESS) {
#endif
-#ifdef HAVE_UT_HOST
+#if defined(HAVE_UT_HOST) || defined(HAVE_GETUTXLINE)
if (*put->ut_host)
safestrncpy(hbuf, put->ut_host, 24);
else
#endif
safestrncpy(hbuf, put->ut_line, 24);
-#ifdef HAVE_UT_TYPE
+#if defined(HAVE_UT_TYPE) || defined(HAVE_GETUTXLINE)
}
else goto fail;
#endif