File: Tips.c

package info (click to toggle)
ncftp2 1%3A2.4.3-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 872 kB
  • ctags: 1,231
  • sloc: ansic: 13,766; makefile: 176; sh: 9
file content (192 lines) | stat: -rw-r--r-- 5,624 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/* Tips.c */

#include "Sys.h"
#include "Curses.h"

#include <ctype.h>

#include "Util.h"
#include "Tips.h"

extern int gScreenWidth;

static char *gTipList[] = {

#ifdef USE_CURSES

/* Keep the curses tips separate so they won't show up if it isn't supported. */

"If you have visual mode turned on, NcFTP can use its own built-in mini \
pager. This makes the \"pdir\"-type commands unnecessary.",

"Remote and local filename completion is available. Use the tab key. \
Thanks to Tim MacKenzie (t.mackenzie@trl.oz.au)",

"If you don't like visual mode, you can start the program with \"ncftp -L\" to \
turn it off at startup. To do that permanently, do a \"set visual 0\" from \
within the program.",

"If you don't like visual mode, you can still edit the \"bookmarks\" and \"prefs\" \
files by hand.  Use your editor on the files in ~/.ncftp.",

"Don't /add sites by hand using the Bookmark Editor. It's easier to just open a \
new site from the command line, and let the program add a new entry \
automatically.",

"Did you know the program keeps transfer statistics for each site? View a \
site in the Bookmark Editor (use /ed) to check the stats.",

"Full-screen (visual) mode has its own built-in command line editor and \
history. Use up/down arrow to scroll through the history. You can use the \
left and right arrow keys to move around on the same line.",

"The Bookmark Editor also acts as an \"open menu.\"  Select the site you want and \
hit the return key to open that site.",

"Unless you're using \"line mode,\" the program saves the command line \
history and restores it the next time you run the program.",

"If you don't remember a host's full name, open the Bookmark Editor (\"bookmarks\") \
and select it from the menu.",

"After opening a new site, NcFTP will assign it a bookmark.  You can then open \
the site by opening it by its bookmark name.  You can use the Bookmark Editor (\"bookmarks\") to \
change the nicknames if you want.",

#endif	/* USE_CURSES */

"You can abbreviate host names if you've opened them at least once before. \
If you opened wuarchive.wustl.edu yesterday, you could try just \"open wuarchive\" \
or just \"open wu\" today.",

"The \"open\" command accepts several flags.  Do a \"help open\" for details.",

"The \"get\" command accepts several neat flags.  Do a \"help get\" for details.",

"The \"get\" command skips files you already have.  To override that feature, \
use the \"-f\" flag.",

"The \"get\" command now acts like \"mget\" did on older versions of NcFTP, \
so you can get multiple files with one command as well as use wildcards.",

"The \"get\" command can now fetch whole directories. Try \"get -R\" sometime.", 
"Use the \"more\" command to view a remote file with your pager.",

#ifdef SYSLOG
"NcFTP was configured to log all of your connections and transfers to the \
system log.",
#endif

"This program is pronounced Nik-F-T-P.",

/* Weight this one a little more. */

"You can get the newest version of NcFTP from ftp.NcFTP.com, in the \
/ncftp directory.  NcFTP is FREEware!",

"You can get the newest version of NcFTP from ftp.NcFTP.com, in the \
/ncftp directory.  NcFTP is FREEware!",

"You can get the newest version of NcFTP from ftp.NcFTP.com, in the \
/ncftp directory.  NcFTP is FREEware!",

"Sometimes an alternate progress meter is used if the remote site isn't \
using the latest FTP protocol command set." ,

/* Weight this one a little more */

"Thank you for using NcFTP.  Ask your system administrator to try NcFTPd \
Server as an alternative to your ftpd or wu-ftpd! <http://www.ncftp.com>",

"Thank you for using NcFTP.  Ask your system administrator to try NcFTPd \
Server as an alternative to your ftpd or wu-ftpd! <http://www.ncftp.com>",

"Thank you for using NcFTP.  Ask your system administrator to try NcFTPd \
Server as an alternative to your ftpd or wu-ftpd! <http://www.ncftp.com>",

"Thank you for using NcFTP.  Ask your system administrator to try NcFTPd \
Server as an alternative to your ftpd or wu-ftpd! <http://www.ncftp.com>",

"Thank you for using NcFTP.  Ask your system administrator to try NcFTPd \
Server as an alternative to your ftpd or wu-ftpd! <http://www.ncftp.com>",

"If you need to report a bug, send me a ~/.ncftp/trace file too.  To enable \
tracing, turn on trace logging from the Prefs window, or type \"set trace 1\" \
from the command line. Then re-create your bug, quit the program, and \
send the trace file to ncftp@NcFTP.com.",

"NcFTP will write all sorts of cool debugging information to a file named \
\"trace\" in your .ncftp directory if you do a \"set trace 1\" at the start.",

"Sick and tired of these tips?  Type \"set tips 0\" any time."
};

void PrintTip(char *tip)
{
	char buf[256];
	char *cp, *dp;
	int i, sWidth, lines;
	
	sWidth = gScreenWidth - 2;
	for (cp = tip, lines = 0; *cp != '\0'; ++lines) {
		while (isspace(*cp))
			cp++;

		dp = buf;
		if (lines == 0) {
			strcpy(dp, "Tip: ");
			i = 5;
			dp += i;
		} else {
			strcpy(dp, "     ");
			i = 5;
			dp += i;
		}
		
		for ( ; (*cp != '\0') && (i<sWidth); i++)
			*dp++ = *cp++;

		if (*cp != '\0') {
			cp--;
			while (!isspace(*cp)) {
				cp--;
				dp--;
			}
		}
		*dp = '\0';
		
		MultiLinePrintF("%s\n", buf);
	}
	MultiLinePrintF("\n");
}	/* PrintTip */




void PrintRandomTip(void)
{
	char *tip;
	int tipNum;
	
	tipNum = rand() % NTIPS;
	tip = gTipList[tipNum];
	MultiLineInit();
	PrintTip(tip);
}	/* PrintRandomTip */






void PrintAllTips(void)
{
	char *tip;
	int tipNum;
	
	MultiLineInit();
	for (tipNum = 0; tipNum < NTIPS; tipNum++) {
		tip = gTipList[tipNum];
		PrintTip(tip);
	}
}	/* PrintAllTips */