Annotation of libwww/Library/src/HTAlert.c, revision 2.7
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: {
2.6 timbl 20: #ifdef NeXTStep
21: NXRunAlertPanel(NULL, "%s", NULL, NULL, NULL, Msg);
22: #else
1.1 timbl 23: fprintf(stderr, "WWW Alert: %s\n", Msg);
2.6 timbl 24: #endif
1.1 timbl 25: }
26:
27:
28: PUBLIC void HTProgress ARGS1(CONST char *, Msg)
29: {
30: fprintf(stderr, " %s ...\n", Msg);
31: }
32:
33:
34: PUBLIC BOOL HTConfirm ARGS1(CONST char *, Msg)
35: {
36: char Reply[3];
37: char *URep;
38:
39: fprintf(stderr, "WWW: %s (y/n) ", Msg);
40: fprintf(stderr, "(y/n) ");
41:
42: scanf("%3s",Reply); /* get reply, max 3 characters */
43: URep=Reply;
44: while (*URep)
45: *URep++=TOUPPER(*URep);
46:
47: if ((strcmp(Reply,"YES")==0) || (strcmp(Reply,"Y")==0))
48: return(YES);
49: else
50: return(NO);
51: }
52:
53: /* Prompt for answer and get text back
54: */
55: PUBLIC char * HTPrompt ARGS2(CONST char *, Msg, CONST char *, deflt)
56: {
57: char Tmp[200];
58: char * rep = 0;
59: fprintf(stderr, "WWW: %s", Msg);
60: if (deflt) fprintf(stderr, "\n (RETURN for %s)\n", deflt);
61:
2.7 ! timbl 62: fgets(Tmp, 199, stdin);
1.1 timbl 63:
64: StrAllocCopy(rep, *Tmp ? Tmp : deflt);
65: return rep;
66: }
Webmaster