home *** CD-ROM | disk | FTP | other *** search
- /* tips.c */
-
- /* $RCSfile: tips.c,v $
- * $Revision: 14020.11 $
- * $Date: 93/05/21 05:44:39 $
- */
-
- #include "sys.h"
-
- #ifndef NO_TIPS
-
- #include "util.h"
- #ifndef NO_UNISTDH
- # include <unistd.h>
- #endif
-
- /* Make sure that the indentations are spaces, not tabs.
- * Try newform -i-4 < tips.c > tips.c.new
- *
- * Always add new tips right above the last one.
- */
-
- static char *tiplist[] = {
- "Have you tried typing 'open' by itself lately?",
-
- "If you don't want a .ncrecent file in your home directory, put the \n\
- command '#unset recent-list' in your .netrc/.ncftprc file.",
-
- "pseudo-filename-completion is supported in some commands. To use it,\n\
- use a wildcard expression that will match exactly one file. I.e., if you\n\
- want to fetch obnoxiouslylongfilename.zip, try 'get obn*.zip.' Note that\n\
- you can't use the cd command with this feature (yet).",
-
- "You don't need to type the exact site name with open. If a site is in\n\
- your .netrc/.ncftprc or the recent-list (.ncrecent), just type a unique\n\
- abbreviation (substring really). I.e. 'open wuar' if you have the site\n\
- wuarchive.wustl.edu in your rc or recent-list.",
-
- "You can put set commands in your .netrc/.ncftprc, by adding lines such\n\
- as '#set local-dir /usr/tmp' to the file, which will be run at startup.",
-
- "Abuse the power of the .netrc! Put in entries for your favorite sites.\n\
- Sample .netrc (or .ncftprc):\n\
- #set pager \"less -M\"\n\
- \n\
- machine wuarchive.wustl.edu\n\
- macdef init\n\
- cd /pub\n\
- get README\n\
- dir\n\
- (blank line to end macro)",
-
- "If you want to keep your .netrc's for ftp and ncftp separate, name\n\
- ncftp's rc to .ncftprc.",
-
- "Type 'open' by itself to get a list of the sites in your recent-list and\n\
- your .netrc. You can then supply '#5' at the prompt, or use 'open #5'\n\
- later.",
-
- "Colon-mode is a quick way to get a file from your shell. Try something\n\
- like 'ncftp wuarchive.wustl.edu:/pub/README.'",
-
- "The open command accepts several flags. Do a 'help open' for details.",
-
- "Sometimes a directory listing is several screens long and you won't\n\
- remember the thing you wanted. Use the 'predir' command to re-view the\n\
- listing. The program keeps the copy locally, so you won't have to wait\n\
- for the remote server to re-send it to you.",
-
- "Use the 'page' (or 'more') command to view a remote file with your pager.",
-
- "ncftp may be keeping detailed information on everything you transfer.\n\
- Run the 'version' command and if you see SYSLOG, your actions are being\n\
- recorded on the system log.",
-
- "Try the 'redir' command to re-display the last directory listing (ls,\n\
- dir, ls -lrt, etc). 'predir' does the same, only with your pager.",
-
- "This program is pronounced Nik-F-T-P. NCEMRSoft is Nik'-mer-soft.",
-
- "Never pick Nebraska to win a big game.",
-
- #ifdef GETLINE
- "NcFTP was compiled with the Getline command-line/history editor! (by\n\
- Chris Thewalt <thewalt@ce.berkeley.edu>). To activate it, use the up\n\
- and down arrows to scroll through the history, and/or use EMACS-style\n\
- commands to edit the line.",
- #endif
-
- #ifdef READLINE
- "NcFTP was compiled with the GNU Readline command-line/history editor!\n\
- To activate it, use the up & down arrows to scroll through the history,\n\
- and/or use EMACS-style (or maybe VI-style) commands to edit the line.",
- #endif
-
- "You can get the newest version of NcFTP from cse.unl.edu, in the\n\
- /pub/mgleason directory.",
-
- "The type of progress-meter that will be used depends if the remote host\n\
- supports the SIZE command, and whether your terminal is capable of ANSI\n\
- escape codes.",
-
- "To report a bug, mail your message to mgleason@cse.unl.edu. Include the\n\
- output of the 'version' command in your message. An easy way to do that\n\
- is to compose your message, then do a 'ncftp -H >> msg.'",
-
- "Sick and tired of these tips? Put '#unset tips' in your .netrc/.ncftprc."
- };
-
- /* Not another dinky header, por favor. */
- #define NTIPS ((int) (sizeof(tiplist) / sizeof(char *)))
- void PrintTip(void);
- extern int fromatty, debug;
-
- int tips = 1;
- #endif /* NO_TIPS */
-
- void PrintTip(void)
- {
- #ifndef NO_TIPS
- int cheap_rn, i, tn;
- string str;
-
- if (tips && fromatty) {
- cheap_rn = (int) getpid() % NTIPS;
- if (debug) {
- (void) printf("pid: %d; ntips: %d\n", getpid(), NTIPS);
- (void) Gets("*** Tip# (-1 == all): ", str, sizeof(str));
- tn = atoi(str) - 1;
- if (tn == -1)
- tn = 0;
- if (tn < -1)
- for(i=0; i<NTIPS; i++)
- (void) printf("Tip: %s\n", tiplist[i]);
- else if (tn < NTIPS)
- (void) printf("Tip: %s\n", tiplist[tn]);
- } else
- (void) printf("Tip: %s\n", tiplist[cheap_rn]);
- }
- #endif /* NO_TIPS */
- } /* PrintTip */
-
- /* tips.c */
-