ReactOS 0.4.15-dev-8434-g155a7c7
pref.c File Reference
#include "syshdrs.h"
#include "pref.h"
#include "util.h"
Include dependency graph for pref.c:

Go to the source code of this file.

Functions

void SetAnonPass (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetAutoAscii (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetAutoResume (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetAutoSaveChangesToExistingBookmarks (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetConfirmClose (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetConnTimeout (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetCtrlTimeout (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetLogSize (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetNoAds (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetOneTimeMessages (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetPager (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetPassive (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetProgressMeter (int UNUSED(t), const char *const UNUSED(val), FILE *const UNUSED(fp))
 
void SetRedialDelay (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetSavePasswords (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetSOBufsize (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetXferTimeout (int UNUSED(t), const char *const val, FILE *const fp)
 
void SetXtTitle (int UNUSED(t), const char *const val, FILE *const fp)
 
static void Show1 (int t)
 
void Set (const char *const tok1, const char *const tok2)
 
int HasSeenOneTimeMessage (const char *const msg)
 
void SetSeenOneTimeMessage (const char *const msg)
 
int OneTimeMessage (const char *const msg)
 
void ProcessPrefsFile (FILE *const fp)
 
void LoadPrefs (void)
 
void InitPrefs (void)
 
void PostInitPrefs (void)
 
void SavePrefs (void)
 
void CheckForNewV3User (void)
 

Variables

int gNumProgramRuns
 
char gPager [128]
 
int gConnTimeout
 
int gXferTimeout
 
int gCtrlTimeout
 
int gDataPortMode
 
int gFwDataPortMode
 
int gAutoResume
 
int gConfirmClose
 
int gAutoSaveChangesToExistingBookmarks
 
int gSavePasswords
 
int gMaySetXtermTitle
 
int gRedialDelay
 
char gOneTimeMessagesSeen [256]
 
int gSOBufsize
 
int gMaxLogSize
 
char gAutoAscii [512]
 
int gDoNotDisplayAds
 
int gPrefsDirty = 0
 
FTPLibraryInfo gLib
 
FTPConnectionInfo gConn
 
char gOurDirectoryPath []
 
char gUser []
 
char gVersion []
 
PrefOpt gPrefOpts []
 
int gNumPrefOpts = ((int)(sizeof(gPrefOpts) / sizeof(PrefOpt)) - 1)
 

Function Documentation

◆ CheckForNewV3User()

void CheckForNewV3User ( void  )

Definition at line 738 of file pref.c.

739{
740 FILE *fp;
741 struct stat st;
742 char pathName[256];
743 char line[256];
744
745 gNumProgramRuns = 0;
746
747 /* Don't create in root directory. */
748 if (gOurDirectoryPath[0] != '\0') {
749 (void) OurDirectoryPath(pathName, sizeof(pathName), kFirstFileName);
750
751 if ((stat(pathName, &st) < 0) && (errno == ENOENT)) {
752 gNumProgramRuns = 1;
753 gPrefsDirty++;
754
755 /* Create a blank one. */
756 fp = fopen(pathName, FOPEN_WRITE_TEXT);
757 if (fp == NULL)
758 return;
759 (void) fprintf(fp, "# NcFTP uses this file to mark that you have run it before, and that you do not\n# need any special first-time instructions or setup.\n#\nruns=%d\n", gNumProgramRuns);
760 (void) fclose(fp);
761 } else {
762 fp = fopen(pathName, FOPEN_READ_TEXT);
763 if (fp != NULL) {
764 while (fgets(line, sizeof(line) - 1, fp) != NULL) {
765 if (strncmp(line, "runs=", 5) == 0) {
766 (void) sscanf(line + 5, "%d",
768 break;
769 }
770 }
771 (void) fclose(fp);
772 }
773
774 /* Increment the count of program runs. */
776 if (gNumProgramRuns == 1)
777 gPrefsDirty++;
778
779 /* Race condition between other ncftp processes.
780 * This isn't a big deal because this counter isn't
781 * critical.
782 */
783
784 fp = fopen(pathName, FOPEN_WRITE_TEXT);
785 if (fp != NULL) {
786 (void) fprintf(fp, "# NcFTP uses this file to mark that you have run it before, and that you do not\n# need any special first-time instructions or setup.\n#\nruns=%d\n", gNumProgramRuns);
787 (void) fclose(fp);
788 }
789 }
790 }
791} /* CheckForNewV3User */
#define ENOENT
Definition: acclib.h:79
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define stat
Definition: acwin.h:99
#define NULL
Definition: types.h:112
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
char * OurDirectoryPath(char *const dst, const size_t siz, const char *const fname)
Definition: util.c:486
#define FOPEN_READ_TEXT
Definition: syshdrs.h:82
#define FOPEN_WRITE_TEXT
Definition: syshdrs.h:83
int gPrefsDirty
Definition: pref.c:67
int gNumProgramRuns
Definition: preffw.c:14
char gOurDirectoryPath[]
Definition: util.c:17
#define kFirstFileName
Definition: pref.h:25
#define errno
Definition: errno.h:18
Definition: parser.c:49
Definition: stat.h:55

Referenced by PreInit().

◆ HasSeenOneTimeMessage()

int HasSeenOneTimeMessage ( const char *const  msg)

Definition at line 477 of file pref.c.

478{
479 char buf[256];
480 char *a, *b;
481
483 for (a = buf; (b = strtok(a, ",\n")) != NULL; a = NULL) {
484 if (strcmp(msg, b) == 0)
485 return (1);
486 }
487 return (0);
488} /* HasSeenOneTimeMessage */
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strtok(char *String, const char *Delimiters)
Definition: utclib.c:338
#define msg(x)
Definition: auth_time.c:54
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char gOneTimeMessagesSeen[256]
Definition: pref.c:47

Referenced by OneTimeMessage().

◆ InitPrefs()

void InitPrefs ( void  )

Definition at line 616 of file pref.c.

617{
618 char *tok1;
619
620 /* Set default values. */
621 gPager[0] = '\0';
623 gXferTimeout = 3600;
624 gConnTimeout = 20;
625 gCtrlTimeout = 135;
628 gAutoResume = 0;
629 gSOBufsize = 0;
630 gMaxLogSize = 10240;
631 gConfirmClose = 1;
634 STRNCPY(gAutoAscii, "|.txt|.asc|.html|.htm|.css|.xml|.ini|.sh|.pl|.hqx|.cfg|.c|.h|.cpp|.hpp|.bat|.m3u|.pls|");
635
636 /* PLEASE do not change the default from 0, and please
637 * don't hack out the portion in main.c which displays
638 * a plug every 7th time you run the program. This is
639 * not much to ask for all the work I've put into this
640 * since 1991.
641 */
643
644#if (defined(WIN32) || defined(_WINDOWS)) && defined(_CONSOLE)
646#else
648#endif
649
650 gSavePasswords = -1;
651#ifdef ncftp
653#endif
654
655 tok1 = getenv("PAGER");
656 if ((tok1 != NULL) && (tok1[0] != '\0')) {
657#ifdef HAVE_STRSTR
658 /* I prefer "less", but it doesn't work well here
659 * because it clears the screen after it finishes,
660 * and the default at EOF is to stay in less
661 * instead of exiting.
662 */
663 if (strstr(gPager, "less") != NULL)
664 (void) STRNCPY(gPager, "more");
665 else
666 (void) STRNCPY(gPager, tok1);
667#else
668 (void) STRNCPY(gPager, tok1);
669#endif
670 } else {
671 (void) STRNCPY(gPager, "more");
672 }
673} /* InitPrefs */
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
FTPProgressMeterProc gProgressMeter
void PrStatBar(const FTPCIPtr cip, int mode)
Definition: progress.c:203
#define kDefaultRedialDelay
Definition: ncftp.h:342
#define kFallBackToSendPortMode
Definition: ncftp.h:297
int gSOBufsize
Definition: pref.c:50
FTPConnectionInfo gConn
Definition: main.c:37
char gPager[128]
Definition: pref.c:21
int gAutoResume
Definition: pref.c:30
int gMaySetXtermTitle
Definition: pref.c:41
int gConnTimeout
Definition: pref.c:24
int gConfirmClose
Definition: pref.c:33
int gSavePasswords
Definition: pref.c:39
int gMaxLogSize
Definition: pref.c:53
int gDataPortMode
Definition: preffw.c:26
int gAutoSaveChangesToExistingBookmarks
Definition: pref.c:36
char gAutoAscii[512]
Definition: pref.c:56
int gXferTimeout
Definition: pref.c:24
int gRedialDelay
Definition: pref.c:44
int gDoNotDisplayAds
Definition: pref.c:64
int gCtrlTimeout
Definition: pref.c:24
#define memset(x, y, z)
Definition: compat.h:39
int dataPortMode
Definition: ncftp.h:152

Referenced by PreInit().

◆ LoadPrefs()

void LoadPrefs ( void  )

Definition at line 555 of file pref.c.

556{
557 FILE *fp;
558 char pathName[256];
559
560 /* As with the firewall preference file, there can be
561 * site-wide preferences and user-specific preferences.
562 * The user pref file is of course kept in the user's
563 * NcFTP home directory.
564 *
565 * The way we do this is we first look for a global
566 * preferences file. We then process the user's pref
567 * file, which could override the global prefs. Finally,
568 * we open a "global fixed" prefs file which then
569 * overrides anything the user may have done.
570 */
571
573 if (fp != NULL) {
574 /* Opened the global (but user-overridable) prefs file. */
576 (void) fclose(fp);
577 }
578
579 if (gOurDirectoryPath[0] != '\0') {
580 (void) OurDirectoryPath(pathName, sizeof(pathName), kPrefFileName);
581
582 fp = fopen(pathName, FOPEN_READ_TEXT);
583 if (fp == NULL) {
584 /* Try loading the version 2 prefs.
585 * There will be options we no longer recognize, but
586 * we'd like to import the prefs when possible.
587 */
588 gPrefsDirty++;
589 (void) OurDirectoryPath(pathName, sizeof(pathName), kPrefFileNameV2);
590 fp = fopen(pathName, FOPEN_READ_TEXT);
591 }
592
593 if (fp == NULL) {
594 /* Write a new one when we're done. */
595 gPrefsDirty++;
596 } else {
597 /* Opened the preferences file. */
599 (void) fclose(fp);
600 }
601 }
602
604 if (fp != NULL) {
605 /* Opened the global (and not overridable) prefs file. */
607 (void) fclose(fp);
608 }
609} /* LoadPrefs */
void ProcessPrefsFile(FILE *const fp)
Definition: pref.c:520
#define kGlobalFixedPrefFileName
Definition: pref.h:22
#define kPrefFileNameV2
Definition: pref.h:24
#define kPrefFileName
Definition: pref.h:23
#define kGlobalPrefFileName
Definition: pref.h:21

Referenced by PreInit().

◆ OneTimeMessage()

int OneTimeMessage ( const char *const  msg)

Definition at line 508 of file pref.c.

509{
511 return (0);
513 return (1);
514} /* OneTimeMessage */
void SetSeenOneTimeMessage(const char *const msg)
Definition: pref.c:494
int HasSeenOneTimeMessage(const char *const msg)
Definition: pref.c:477

Referenced by NcFTPConfirmResumeDownloadProc(), NcFTPConfirmResumeUploadProc(), and PrSizeAndRateMeter().

◆ PostInitPrefs()

void PostInitPrefs ( void  )

Definition at line 680 of file pref.c.

681{
682 if (gLib.defaultAnonPassword[0] == '\0') {
684 gPrefsDirty++;
685 }
686 if (gFwDataPortMode >= 0)
688} /* PostInitPrefs */
void FTPInitializeAnonPassword(const FTPLIPtr)
Definition: open.c:81
FTPLibraryInfo gLib
Definition: main.c:36
int gFwDataPortMode
Definition: pref.c:27
char defaultAnonPassword[80]
Definition: ncftp.h:121

Referenced by PostInit().

◆ ProcessPrefsFile()

void ProcessPrefsFile ( FILE *const  fp)

Definition at line 520 of file pref.c.

521{
522 char line[1024];
523 char *tok1, *tok2;
524 int t;
525
526 line[sizeof(line) - 1] = '\0';
527 while (fgets(line, sizeof(line) - 1, fp) != NULL) {
528 tok1 = strtok(line, " =\t\r\n");
529 if ((tok1 == NULL) || (tok1[0] == '#'))
530 continue;
531 tok2 = strtok(NULL, "\r\n");
532 if (tok2 == NULL)
533 continue;
534
535 for (t=0; t<gNumPrefOpts; t++) {
536 if (ISTREQ(tok1, gPrefOpts[t].varname)) {
537 if (gPrefOpts[t].visible == kPrefOptObselete) {
538 /* Probably converting an
539 * old 2.4.2 file.
540 */
541 gPrefsDirty++;
542 } else if (gPrefOpts[t].proc != (PrefProc) 0) {
543 (*gPrefOpts[t].proc)(t, tok2, NULL);
544 }
545 }
546 }
547 }
548} /* ProcessPrefsFile */
GLdouble GLdouble t
Definition: gl.h:2047
#define ISTREQ(a, b)
Definition: util.h:33
static HANDLE proc()
Definition: pdb.c:34
PrefOpt gPrefOpts[]
Definition: pref.c:73
int gNumPrefOpts
Definition: pref.c:113
void(* PrefProc)(int i, const char *const, FILE *const fp)
Definition: pref.h:30
#define kPrefOptObselete
Definition: pref.h:37
PrefProc proc
Definition: pref.h:33

Referenced by LoadPrefs().

◆ SavePrefs()

void SavePrefs ( void  )

Definition at line 695 of file pref.c.

696{
697 char pathName[256];
698 char pathName2[256];
699 char tName[32];
700 int t;
701 FILE *fp;
702
703 if (gPrefsDirty == 0)
704 return; /* Don't need to save -- no changes made. */
705
706 (void) OurDirectoryPath(pathName, sizeof(pathName), kPrefFileName);
707
708 (void) sprintf(tName, "tpref%06u.txt", (unsigned int) getpid());
709 (void) OurDirectoryPath(pathName2, sizeof(pathName2), tName);
710
711 fp = fopen(pathName2, FOPEN_WRITE_TEXT);
712 if (fp == NULL) {
713 perror("could not save preferences file");
714 } else {
715 (void) fprintf(fp, "%s", "# NcFTP 3 preferences file\n# This file is loaded and overwritten each time NcFTP is run.\n#\n");
716 for (t=0; t<gNumPrefOpts; t++) {
717 if (gPrefOpts[t].visible != kPrefOptObselete) {
718 (void) fprintf(fp, "%s=", gPrefOpts[t].varname);
719 (*gPrefOpts[t].proc)(t, NULL, fp);
720 (void) fprintf(fp, "\n");
721 }
722 }
723 (void) fclose(fp);
724 (void) unlink(pathName);
725 if (rename(pathName2, pathName) < 0) {
726 perror("could not finish saving preferences file");
727 (void) unlink(pathName2);
728 };
729 }
730} /* SavePrefs */
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
#define unlink
Definition: syshdrs.h:54
#define sprintf(buf, format,...)
Definition: sprintf.c:55
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
#define getpid
Definition: wintirpc.h:52

Referenced by PostShell().

◆ Set()

void Set ( const char *const  tok1,
const char *const  tok2 
)

Definition at line 430 of file pref.c.

431{
432 int t;
433
434 if ((tok1 == NULL) || (ISTREQ(tok1, "all"))) {
435 /* Show all. */
436 for (t=0; t<gNumPrefOpts; t++) {
437 if (gPrefOpts[t].visible == kPrefOptVisible)
438 Show1(t);
439 }
440 } else if (tok2 == NULL) {
441 /* Show one. */
442 for (t=0; t<gNumPrefOpts; t++) {
443 if (ISTREQ(tok1, gPrefOpts[t].varname)) {
444 if (gPrefOpts[t].visible == kPrefOptObselete) {
445 (void) printf("The \"%s\" option is obselete or not implemented.\n", tok1);
446 } else {
447 Show1(t);
448 }
449 break;
450 }
451 }
452 if (t >= gNumPrefOpts) {
453 (void) printf("Unknown option \"%s\" -- try \"show all\" to list available options.\n", tok1);
454 }
455 } else {
456 /* Set one. */
457 for (t=0; t<gNumPrefOpts; t++) {
458 if (ISTREQ(tok1, gPrefOpts[t].varname)) {
459 if (gPrefOpts[t].visible == kPrefOptObselete) {
460 (void) printf("The \"%s\" option is obselete or not implemented.\n", tok1);
461 } else if (gPrefOpts[t].proc != (PrefProc) 0) {
462 (*gPrefOpts[t].proc)(t, tok2, NULL);
463 gPrefsDirty++;
464 }
465 break;
466 }
467 }
468 if (t >= gNumPrefOpts) {
469 (void) printf("Unknown option \"%s\" -- try \"show all\" to list available options.\n", tok1);
470 }
471 }
472} /* Set */
#define printf
Definition: freeldr.h:97
static void Show1(int t)
Definition: pref.c:415
#define kPrefOptVisible
Definition: pref.h:39

◆ SetAnonPass()

void SetAnonPass ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 118 of file pref.c.

119{
121 if (fp != NULL) {
123 } else {
125 }
126} /* SetAnonPass */
GLuint GLfloat * val
Definition: glext.h:7180
#define LIBNCFTP_USE_VAR(a)
Definition: ncftp.h:521

◆ SetAutoAscii()

void SetAutoAscii ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 131 of file pref.c.

132{
134 if (fp != NULL) {
135 (void) fprintf(fp, "%s", gAutoAscii);
136 } else {
138 if ((gAutoAscii[0] == '\0') || (ISTREQ(gAutoAscii, "no")) || (ISTREQ(gAutoAscii, "off")) || (ISTREQ(gAutoAscii, "false"))) {
140 } else {
142 }
143 }
144} /* SetAutoAscii */
const char * asciiFilenameExtensions
Definition: ncftp.h:246

◆ SetAutoResume()

void SetAutoResume ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 149 of file pref.c.

150{
152 if (fp != NULL) {
153 (void) fprintf(fp, "%s", YESNO(gAutoResume));
154 } else {
156 }
157} /* SetAutoResume */
int StrToBool(const char *const s)
Definition: util.c:748
#define YESNO(i)
Definition: util.h:28

◆ SetAutoSaveChangesToExistingBookmarks()

void SetAutoSaveChangesToExistingBookmarks ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 162 of file pref.c.

163{
165 if (fp != NULL) {
167 } else {
169 }
170} /* SetAutoSaveChangesToExistingBookmarks */

◆ SetConfirmClose()

void SetConfirmClose ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 175 of file pref.c.

176{
178 if (fp != NULL) {
179 (void) fprintf(fp, "%s", YESNO(gConfirmClose));
180 } else {
182 }
183} /* SetConfirmClose */

◆ SetConnTimeout()

void SetConnTimeout ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 188 of file pref.c.

189{
191 if (fp != NULL) {
192 (void) fprintf(fp, "%d", gConnTimeout);
193 } else {
195 }
196} /* SetConnTimeout */
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
unsigned int connTimeout
Definition: ncftp.h:142

◆ SetCtrlTimeout()

void SetCtrlTimeout ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 201 of file pref.c.

202{
204 if (fp != NULL) {
205 (void) fprintf(fp, "%d", gCtrlTimeout);
206 } else {
208 }
209} /* SetCtrlTimeout */
unsigned int ctrlTimeout
Definition: ncftp.h:143

◆ SetLogSize()

void SetLogSize ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 214 of file pref.c.

215{
217 if (fp != NULL) {
218 (void) fprintf(fp, "%d", gMaxLogSize);
219 } else {
221 }
222} /* SetLogSize */

◆ SetNoAds()

void SetNoAds ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 227 of file pref.c.

228{
230 if (fp != NULL) {
231 (void) fprintf(fp, "%s", YESNO(gDoNotDisplayAds));
232 } else {
234 }
235} /* SetNoAds */

◆ SetOneTimeMessages()

void SetOneTimeMessages ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 240 of file pref.c.

241{
243 if (fp != NULL) {
244 (void) fprintf(fp, "%s", gOneTimeMessagesSeen);
245 } else {
247 }
248} /* SetOneTimeMessages */

◆ SetPager()

void SetPager ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 253 of file pref.c.

254{
256 if (fp != NULL) {
257 (void) fprintf(fp, "%s", gPager);
258 } else {
260 }
261} /* SetPager */

◆ SetPassive()

void SetPassive ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 266 of file pref.c.

267{
268 int m;
269
271 if (fp != NULL) {
273 if (m == kSendPortMode) {
274 (void) fprintf(fp, "%s", "off");
275 } else if (m == kPassiveMode) {
276 (void) fprintf(fp, "%s", "on");
277 } else {
278 (void) fprintf(fp, "%s", "optional");
279 }
280 } else {
281 if (gFwDataPortMode >= 0) {
283 return;
284 }
285 if (ISTRNEQ(val, "opt", 3))
287 else if (ISTREQ(val, "on"))
289 else if ((int) isdigit(val[0]))
291 else
294 }
295} /* SetPassive */
#define isdigit(c)
Definition: acclib.h:68
const GLfloat * m
Definition: glext.h:10848
#define ISTRNEQ(a, b, s)
Definition: util.h:34
#define kSendPortMode
Definition: ncftp.h:295
#define kPassiveMode
Definition: ncftp.h:296

◆ SetProgressMeter()

void SetProgressMeter ( int   UNUSEDt,
const char *const   UNUSEDval,
FILE *const   UNUSEDfp 
)

Definition at line 324 of file pref.c.

325{
329} /* SetProgressMeter */

◆ SetRedialDelay()

void SetRedialDelay ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 335 of file pref.c.

336{
337 int i;
338
340 if (fp != NULL) {
341 (void) fprintf(fp, "%d", gRedialDelay);
342 } else {
343 i = atoi(val);
344 if (i < 10)
345 i = 10;
347 }
348} /* SetRedialDelay */
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ SetSavePasswords()

void SetSavePasswords ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 353 of file pref.c.

354{
356 if (fp != NULL) {
357 if (gSavePasswords < 0)
358 (void) fprintf(fp, "%s", "ask");
359 else
360 (void) fprintf(fp, "%s", YESNO(gSavePasswords));
361 } else {
362 if (ISTREQ(val, "ask"))
363 gSavePasswords = -1;
364 else
366 }
367} /* SetSavePasswords */

◆ SetSeenOneTimeMessage()

void SetSeenOneTimeMessage ( const char *const  msg)

Definition at line 494 of file pref.c.

495{
496 gPrefsDirty++;
497 if (gOneTimeMessagesSeen[0] == '\0')
499 else {
502 }
503} /* SetSeenOneTimeMessage */
#define STRNCAT(d, s)
Definition: Strn.h:48

Referenced by OneTimeMessage().

◆ SetSOBufsize()

void SetSOBufsize ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 372 of file pref.c.

373{
375 if (fp != NULL) {
376 (void) fprintf(fp, "%d", gSOBufsize);
377 if (gSOBufsize <= 0)
378 (void) fprintf(fp, "%s", " (use system default)");
379 } else {
381 }
382} /* SetSOBufsize */
size_t dataSocketRBufSize
Definition: ncftp.h:230
size_t dataSocketSBufSize
Definition: ncftp.h:231

◆ SetXferTimeout()

void SetXferTimeout ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 388 of file pref.c.

389{
391 if (fp != NULL) {
392 (void) fprintf(fp, "%d", gXferTimeout);
393 } else {
395 }
396} /* SetXferTimeout */
unsigned int xferTimeout
Definition: ncftp.h:141

◆ SetXtTitle()

void SetXtTitle ( int   UNUSEDt,
const char *const  val,
FILE *const  fp 
)

Definition at line 401 of file pref.c.

402{
404 if (fp != NULL) {
405 (void) fprintf(fp, "%s", YESNO(gMaySetXtermTitle));
406 } else {
408 }
409} /* SetXtTitle */

◆ Show1()

static void Show1 ( int  t)
static

Definition at line 415 of file pref.c.

416{
417 PrefOpt *p = &gPrefOpts[t];
418
419 (void) printf("%-30s ", p->varname);
420 if (p->proc != (PrefProc) 0)
421 (*p->proc)(t, NULL, stdout);
422 (void) printf("\n");
423} /* Show1 */
GLfloat GLfloat p
Definition: glext.h:8902
#define stdout
Definition: stdio.h:99
Definition: pref.h:31

Referenced by Set().

Variable Documentation

◆ gAutoAscii

char gAutoAscii[512]

Definition at line 56 of file pref.c.

Referenced by InitConnectionInfo(), InitPrefs(), and SetAutoAscii().

◆ gAutoResume

int gAutoResume

◆ gAutoSaveChangesToExistingBookmarks

int gAutoSaveChangesToExistingBookmarks

Definition at line 36 of file pref.c.

Referenced by InitPrefs(), SaveUnsavedBookmark(), and SetAutoSaveChangesToExistingBookmarks().

◆ gConfirmClose

int gConfirmClose

Definition at line 33 of file pref.c.

Referenced by InitPrefs(), and SetConfirmClose().

◆ gConn

◆ gConnTimeout

int gConnTimeout

Definition at line 24 of file pref.c.

Referenced by InitConnectionInfo(), InitPrefs(), and SetConnTimeout().

◆ gCtrlTimeout

int gCtrlTimeout

Definition at line 24 of file pref.c.

Referenced by InitPrefs(), and SetCtrlTimeout().

◆ gDataPortMode

int gDataPortMode
extern

Definition at line 26 of file preffw.c.

Referenced by InitPrefs(), ProcessFirewallPrefFile(), and SetPassive().

◆ gDoNotDisplayAds

int gDoNotDisplayAds

Definition at line 64 of file pref.c.

Referenced by InitPrefs(), and SetNoAds().

◆ gFwDataPortMode

int gFwDataPortMode

Definition at line 27 of file pref.c.

Referenced by PostInitPrefs(), and SetPassive().

◆ gLib

FTPLibraryInfo gLib
extern

Definition at line 36 of file main.c.

Referenced by PostInitPrefs(), and SetAnonPass().

◆ gMaxLogSize

int gMaxLogSize

Definition at line 53 of file pref.c.

Referenced by EndLog(), InitPrefs(), LogOpen(), LogXfer(), and SetLogSize().

◆ gMaySetXtermTitle

int gMaySetXtermTitle

Definition at line 41 of file pref.c.

Referenced by InitPrefs(), SetXtermTitle(), and SetXtTitle().

◆ gNumPrefOpts

int gNumPrefOpts = ((int)(sizeof(gPrefOpts) / sizeof(PrefOpt)) - 1)

Definition at line 113 of file pref.c.

Referenced by PrefOptCompletionFunction(), ProcessPrefsFile(), SavePrefs(), and Set().

◆ gNumProgramRuns

int gNumProgramRuns
extern

Definition at line 14 of file preffw.c.

Referenced by CheckForNewV3User().

◆ gOneTimeMessagesSeen

char gOneTimeMessagesSeen[256]

Definition at line 47 of file pref.c.

Referenced by HasSeenOneTimeMessage(), InitPrefs(), SetOneTimeMessages(), and SetSeenOneTimeMessage().

◆ gOurDirectoryPath

char gOurDirectoryPath[]
extern

Definition at line 17 of file util.c.

Referenced by CheckForNewV3User(), and LoadPrefs().

◆ gPager

char gPager[128]

Definition at line 21 of file pref.c.

Referenced by InitPrefs(), LocalPageCmd(), OpenPager(), and SetPager().

◆ gPrefOpts

PrefOpt gPrefOpts[]

Definition at line 73 of file pref.c.

Referenced by PrefOptCompletionFunction(), ProcessPrefsFile(), SavePrefs(), Set(), and Show1().

◆ gPrefsDirty

int gPrefsDirty = 0

◆ gRedialDelay

int gRedialDelay

Definition at line 44 of file pref.c.

Referenced by InitPrefs(), and SetRedialDelay().

◆ gSavePasswords

int gSavePasswords

Definition at line 39 of file pref.c.

Referenced by InitPrefs(), and SetSavePasswords().

◆ gSOBufsize

int gSOBufsize

Definition at line 50 of file pref.c.

Referenced by InitConnectionInfo(), InitPrefs(), and SetSOBufsize().

◆ gUser

char gUser[]

Definition at line 71 of file pref.c.

◆ gVersion

char gVersion[]

Definition at line 71 of file pref.c.

◆ gXferTimeout

int gXferTimeout

Definition at line 24 of file pref.c.

Referenced by InitPrefs(), and SetXferTimeout().