]> code.citadel.org Git - citadel.git/blobdiff - citadel/routines.c
* First cut at Solaris fixes. There may still be some *printf("%s", NULL)
[citadel.git] / citadel / routines.c
index 2b0920d681d2dacab39bfb359ac1bf2fcc8525d8..6757a59f0d70e47e861b35e1d0cfadc22c14e752 100644 (file)
@@ -19,6 +19,9 @@
 #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);
@@ -67,17 +70,6 @@ int struncmp(char *lstr, char *rstr, int len)
        }
 
 
-/* 
- * 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 */
             {
@@ -90,7 +82,10 @@ int a;
 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)
@@ -161,15 +156,17 @@ int set_attr(int sval, char *prompt, unsigned int sbit)
        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);
@@ -435,7 +432,11 @@ void locate_host(char *hbuf)
        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:
@@ -448,19 +449,23 @@ void locate_host(char *hbuf)
 
        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