Annotation of libwww/Library/src/HTAlert.c, revision 2.4

1.1       timbl       1: /*     Displaying messages and getting input for LineMode Browser
                      2: **     ==========================================================
                      3: **
                      4: **     REPLACE THIS MODULE with a GUI version in a GUI environment!
                      5: **
                      6: ** History:
                      7: **        Jun 92 Created May 1992 By C.T. Barker
                      8: **        Feb 93 Simplified, portablised TBL
                      9: **
                     10: */
                     11: 
                     12: 
                     13: #include "HTAlert.h"
                     14: 
                     15: #include "tcp.h"               /* for TOUPPER */
                     16: #include <ctype.h>             /* for toupper - should be in tcp.h */
                     17: 
                     18: PUBLIC void HTAlert ARGS1(CONST char *, Msg)
                     19: {
                     20:     fprintf(stderr, "WWW Alert:  %s\n", Msg);
                     21: }
                     22: 
                     23: 
                     24: PUBLIC void HTProgress ARGS1(CONST char *, Msg)
                     25: {
                     26:     fprintf(stderr, "   %s ...\n", Msg);
                     27: }
                     28: 
                     29: 
                     30: PUBLIC BOOL HTConfirm ARGS1(CONST char *, Msg)
                     31: {
                     32:   char Reply[3];
                     33:   char *URep;
                     34:   
                     35:   fprintf(stderr, "WWW: %s (y/n) ", Msg);
                     36:   fprintf(stderr, "(y/n) ");
                     37: 
                     38:   scanf("%3s",Reply); /* get reply, max 3 characters */
                     39:   URep=Reply;
                     40:   while (*URep)
                     41:     *URep++=TOUPPER(*URep);
                     42:     
                     43:   if ((strcmp(Reply,"YES")==0) || (strcmp(Reply,"Y")==0))
                     44:     return(YES);
                     45:   else
                     46:     return(NO);
                     47: }
                     48: 
                     49: /*     Prompt for answer and get text back
                     50: */
                     51: PUBLIC char * HTPrompt ARGS2(CONST char *, Msg, CONST char *, deflt)
                     52: {
                     53:     char Tmp[200];
                     54:     char * rep = 0;
                     55:     fprintf(stderr, "WWW: %s", Msg);
                     56:     if (deflt) fprintf(stderr, "\n (RETURN for %s)\n", deflt);
                     57:     
                     58:     scanf("%199s",Tmp); /* get reply */
                     59:    
                     60:     StrAllocCopy(rep, *Tmp ? Tmp : deflt);
                     61:     return rep;
                     62: }

Webmaster