ReactOS  0.4.13-dev-563-g0561610
main.c File Reference
#include "syshdrs.h"
#include "ls.h"
#include "bookmark.h"
#include "shell.h"
#include "cmds.h"
#include "main.h"
#include "getopt.h"
#include "progress.h"
#include "pref.h"
#include "readln.h"
#include "trace.h"
#include "log.h"
#include "spool.h"
#include "util.h"
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define DisposeWinsock(a)
 

Functions

static void Usage (void)
 
static void DumpFirewallPrefsTemplate (void)
 
void InitConnectionInfo (void)
 
void CloseHost (void)
 
static void SetStartupURL (const char *const urlgiven)
 
static void OpenURL (void)
 
static void PreInit (void)
 
static void PostInit (void)
 
static void Plug (void)
 
static void PostShell (void)
 
int main (int argc, const char **const argv)
 

Variables

int gStartupUrlParameterGiven = 0
 
int gIsTTY
 
int gIsTTYr
 
int gScreenColumns
 
FTPLibraryInfo gLib
 
FTPConnectionInfo gConn
 
LineList gStartupURLCdList
 
int gTransferTypeInitialized = 0
 
int gTransferType
 
int gURLMode = 0
 
int gUnprocessedJobs
 
char gLocalCWD [512]
 
char gPrevLocalCWD [512]
 
chargOptArg
 
int gOptInd
 
char gRemoteCWD [512]
 
char gPrevRemoteCWD [512]
 
Bookmark gBm
 
int gLoadedBm
 
int gFirstTimeUser
 
int gFirewallType
 
char gAutoAscii []
 
char gFirewallHost [64]
 
char gFirewallUser [32]
 
char gFirewallPass [32]
 
char gFirewallExceptionList []
 
char gCopyright []
 
char gVersion []
 
unsigned int gFirewallPort
 
int gConnTimeout
 
int gXferTimeout
 
int gCtrlTimeout
 
int gDataPortMode
 
int gRedialDelay
 
int gDebug
 
int gNumProgramRuns
 
int gDoNotDisplayAds
 
int gSOBufsize
 
FTPProgressMeterProc gProgressMeter
 

Macro Definition Documentation

◆ DisposeWinsock

#define DisposeWinsock (   a)

Definition at line 29 of file main.c.

Function Documentation

◆ CloseHost()

void CloseHost ( void  )

Definition at line 153 of file main.c.

154 {
155  if (gConn.connected != 0) {
156  if (gConn.loggedIn != 0) {
158  }
160  }
161  gConn.ctrlTimeout = 3;
162  (void) FTPCloseHost(&gConn);
163 } /* CloseHost */
unsigned int ctrlTimeout
Definition: ncftp.h:143
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
FTPConnectionInfo gConn
Definition: main.c:37
void SaveUnsavedBookmark(void)
Definition: cmds.c:270
int FTPCloseHost(const FTPCIPtr cip)
Definition: open.c:523
void RunBatchIfNeeded(const FTPCIPtr cip)
Definition: spool.c:482

Referenced by CloseCmd(), CommandShell(), OpenCmd(), and PostShell().

◆ DumpFirewallPrefsTemplate()

static void DumpFirewallPrefsTemplate ( void  )
static

Definition at line 97 of file main.c.

98 {
100 } /* DumpFirewallPrefsTemplate */
FILE * stdout
void WriteDefaultFirewallPrefs(FILE *)
Definition: preffw.c:39

Referenced by main().

◆ InitConnectionInfo()

void InitConnectionInfo ( void  )

Definition at line 109 of file main.c.

110 {
111  int result;
112 
114  if (result < 0) {
115  (void) fprintf(stderr, "ncftp: init connection info error %d (%s).\n", result, FTPStrError(result));
116  exit(1);
117  }
118 
119  gConn.debugLog = NULL;
120  gConn.errLog = stderr;
121  SetDebug(gDebug);
122  UseTrace();
123  (void) STRNCPY(gConn.user, "anonymous");
124  gConn.host[0] = '\0';
125  gConn.progress = NULL;
128  gConn.leavePass = 1; /* Don't let the lib zap it. */
133  gConn.maxDials = (-1); /* Dial forever, until they hit ^C. */
134  gUnprocessedJobs = 0;
135  gPrevRemoteCWD[0] = '\0';
137  if (gRedialDelay >= 10)
139  if ((gAutoAscii[0] == '\0') || (ISTREQ(gAutoAscii, "no")) || (ISTREQ(gAutoAscii, "off")) || (ISTREQ(gAutoAscii, "false"))) {
141  } else {
143  }
144 } /* InitConnectionInfo */
unsigned int ctrlTimeout
Definition: ncftp.h:143
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
const char * asciiFilenameExtensions
Definition: ncftp.h:246
void SetDebug(int i)
Definition: trace.c:88
int gUnprocessedJobs
Definition: spool.c:19
int gCtrlTimeout
Definition: pref.c:24
int gRedialDelay
Definition: pref.c:44
char user[64]
Definition: ncftp.h:137
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
FTPProgressMeterProc progress
Definition: ncftp.h:198
#define ISTREQ(a, b)
Definition: util.h:33
size_t dataSocketSBufSize
Definition: ncftp.h:231
FTPConnectionInfo gConn
Definition: main.c:37
int gTransferType
Definition: main.c:40
int gDebug
Definition: trace.c:19
char host[64]
Definition: ncftp.h:136
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char gPrevRemoteCWD[512]
Definition: cmds.c:38
int gConnTimeout
Definition: pref.c:24
FILE * errLog
Definition: ncftp.h:146
smooth NULL
Definition: ftsmooth.c:416
int gSOBufsize
Definition: pref.c:50
#define kDefaultFTPBufSize
Definition: ncftp.h:314
FTPLibraryInfo gLib
Definition: main.c:36
int gDataPortMode
Definition: preffw.c:26
#define kTypeBinary
Definition: ncftp.h:354
int gTransferTypeInitialized
Definition: main.c:39
const char * FTPStrError(int e)
Definition: errno.c:114
unsigned int xferTimeout
Definition: ncftp.h:141
FILE * debugLog
Definition: ncftp.h:145
size_t dataSocketRBufSize
Definition: ncftp.h:230
void UseTrace(void)
Definition: trace.c:97
FILE * stderr
char gAutoAscii[]
Definition: pref.c:56
void exit(int exitcode)
Definition: _exit.c:33
GLuint64EXT * result
Definition: glext.h:11304
unsigned int connTimeout
Definition: ncftp.h:142
int FTPInitConnectionInfo(const FTPLIPtr lip, const FTPCIPtr cip, size_t bufsize)
Definition: open.c:984
int dataPortMode
Definition: ncftp.h:152
int gXferTimeout
Definition: pref.c:24

Referenced by OpenCmd(), and PreInit().

◆ main()

int main ( int argc  ,
const char **const  argv 
)

Definition at line 390 of file main.c.

391 {
392  int c;
393  int n;
394 
395  PreInit();
396  while ((c = Getopt(argc, argv, "P:u:p:J:rd:g:FVLD")) > 0) switch(c) {
397  case 'P':
398  case 'u':
399  case 'p':
400  case 'J':
402  break;
403  case 'r':
404  case 'g':
405  case 'd':
406  case 'V':
407  case 'L':
408  case 'D':
409  case 'F':
410  break;
411  default:
412  Usage();
413  }
414 
415  if (gOptInd < argc) {
418  } else if (gStartupUrlParameterGiven != 0) {
419  /* One of the flags they specified
420  * requires a URL or hostname to
421  * open.
422  */
423  Usage();
424  }
425 
426  GetoptReset();
427  /* Allow command-line parameters to override
428  * bookmark settings.
429  */
430 
431  while ((c = Getopt(argc, argv, "P:u:p:j:J:rd:g:FVLD")) > 0) switch(c) {
432  case 'P':
433  gConn.port = atoi(gOptArg);
434  break;
435  case 'u':
437  break;
438  case 'p':
439  (void) STRNCPY(gConn.pass, gOptArg); /* Don't recommend doing this! */
440  break;
441  case 'J':
442  case 'j':
444  break;
445  case 'r':
446  /* redial is always on */
447  break;
448  case 'g':
450  break;
451  case 'd':
452  n = atoi(gOptArg);
453  if (n >= 10)
454  gConn.redialDelay = n;
455  break;
456  case 'F':
458  exit(0);
459  /*NOTREACHED*/
460  break;
461  case 'V':
462  /*FALLTHROUGH*/
463  case 'L':
464  /*FALLTHROUGH*/
465  case 'D':
466  /* silently ignore these legacy options */
467  break;
468  default:
469  Usage();
470  }
471 
472  PostInit();
473  OpenURL();
474  CommandShell();
475  PostShell();
476  exit(0);
477 } /* main */
static int argc
Definition: ServiceArgs.c:12
unsigned int port
Definition: ncftp.h:140
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gOptInd
Definition: getopt.c:14
char pass[64]
Definition: ncftp.h:138
char user[64]
Definition: ncftp.h:137
GLdouble n
Definition: glext.h:7729
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
#define argv
Definition: mplay32.c:18
FTPConnectionInfo gConn
Definition: main.c:37
void GetoptReset(void)
Definition: getopt.c:21
void LoadFirewallPrefs(int)
Definition: preffw.c:268
char acct[64]
Definition: ncftp.h:139
static void OpenURL(void)
Definition: main.c:233
const GLubyte * c
Definition: glext.h:8905
static void SetStartupURL(const char *const urlgiven)
Definition: main.c:172
static void PostInit(void)
Definition: main.c:325
char * gOptArg
Definition: getopt.c:16
void CommandShell(void)
Definition: shell.c:499
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
void Usage(WCHAR *name)
Definition: main.c:4
int gStartupUrlParameterGiven
Definition: main.c:32
static void PreInit(void)
Definition: main.c:267
static void PostShell(void)
Definition: main.c:374
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define c
Definition: ke_i.h:80
void exit(int exitcode)
Definition: _exit.c:33
static void DumpFirewallPrefsTemplate(void)
Definition: main.c:97

◆ OpenURL()

static void OpenURL ( void  )
static

Definition at line 233 of file main.c.

234 {
235  LinePtr lp;
236  int result;
237 
238  if (gURLMode == 1) {
240  if (DoOpen() >= 0) {
241  for (lp = gStartupURLCdList.first; lp != NULL; lp = lp->next) {
242  result = FTPChdir(&gConn, lp->line);
243  if (result != kNoErr) {
244  FTPPerror(&gConn, result, kErrCWDFailed, "Could not chdir to", lp->line);
245  break;
246  }
247  }
249  if (result != kNoErr) {
251  } else {
252  (void) printf("Current remote directory is %s.\n", gRemoteCWD);
253  }
254  }
255  } else if (gURLMode == 2) {
256  (void) DoOpen();
257  }
258 } /* OpenURL */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
LinePtr next
Definition: ncftp.h:80
#define kErrPWDFailed
Definition: ncftp_errno.h:41
FTPConnectionInfo gConn
Definition: main.c:37
smooth NULL
Definition: ftsmooth.c:416
int gURLMode
Definition: main.c:41
Bookmark gBm
Definition: bookmark.c:24
Definition: ncftp.h:79
LinePtr first
Definition: ncftp.h:85
int FTPChdir(const FTPCIPtr cip, const char *const cdCwd)
Definition: cmds.c:11
void SetBookmarkDefaults(BookmarkPtr bmp)
Definition: bookmark.c:74
int FTPGetCWD(const FTPCIPtr cip, char *const newCwd, const size_t newCwdSize)
Definition: cmds.c:254
#define kNoErr
Definition: ncftp_errno.h:9
int DoOpen(void)
Definition: cmds.c:2168
LineList gStartupURLCdList
Definition: main.c:38
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81
#define kErrCWDFailed
Definition: ncftp_errno.h:42
#define printf
Definition: config.h:203
char gRemoteCWD[512]
Definition: cmds.c:33

Referenced by main().

◆ Plug()

static void Plug ( void  )
static

Definition at line 358 of file main.c.

359 {
360 #if defined(WIN32) || defined(_WINDOWS)
361  /* NcFTPd hasn't been ported to Windows. */
362 #else
363  if ((gDoNotDisplayAds == 0) && ((gNumProgramRuns % 7) == 2)) {
364  (void) printf("\n\n\n\tThank you for using NcFTP Client.\n\tAsk your system administrator to try NcFTPd Server!\n\thttp://www.ncftpd.com\n\n\n\n");
365  }
366 #endif
367 } /* Plug */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gDoNotDisplayAds
Definition: pref.c:64
#define printf
Definition: config.h:203
int gNumProgramRuns
Definition: preffw.c:14

Referenced by PostShell().

◆ PostInit()

static void PostInit ( void  )
static

Definition at line 325 of file main.c.

326 {
327  PostInitPrefs();
328  OpenTrace();
329  InitTermcap();
330  InitReadline();
332  gPrevLocalCWD[0] = '\0';
334  if (gNumProgramRuns <= 1)
335  (void) printf("\n%s\n", gCopyright + 5);
336 
337  Trace(0, "Fw: %s Type: %d User: %s Pass: %s Port: %u\n",
341  (gFirewallPass[0] == '\0') ? "(none)" : "********",
343  );
344  Trace(0, "FwExceptions: %s\n", gFirewallExceptionList);
345  if (strchr(gLib.ourHostName, '.') == NULL) {
346  Trace(0, "NOTE: Your domain name could not be detected.\n");
348  Trace(0, " Make sure you manually add your domain name to firewall-exception-list.\n");
349  }
350  }
351 } /* PostInit */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char ourHostName[64]
Definition: ncftp.h:118
int gFirewallType
Definition: preffw.c:17
#define kFirewallNotInUse
Definition: ncftp.h:388
char gLocalCWD[512]
Definition: main.c:43
FTPConnectionInfo gConn
Definition: main.c:37
void InitReadline(void)
Definition: readln.c:659
unsigned int gFirewallPort
Definition: preffw.c:22
char gPrevLocalCWD[512]
Definition: main.c:43
smooth NULL
Definition: ftsmooth.c:416
int firewallType
Definition: ncftp.h:221
#define OpenTrace
Definition: evntrace.h:768
FTPLibraryInfo gLib
Definition: main.c:36
void PrintStartupBanner(void)
Definition: readln.c:759
char gFirewallHost[64]
Definition: preffw.c:18
#define Trace(x)
Definition: zutil.h:197
char gFirewallPass[32]
Definition: preffw.c:20
void InitTermcap(void)
Definition: readln.c:148
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char gFirewallUser[32]
Definition: preffw.c:19
char gFirewallExceptionList[]
Definition: preffw.c:21
void PostInitPrefs(void)
Definition: pref.c:680
char gCopyright[]
Definition: version.c:17
char * FTPGetLocalCWD(char *buf, size_t size)
Definition: util.c:29
#define printf
Definition: config.h:203
int gNumProgramRuns
Definition: preffw.c:14

Referenced by CTestSpy::Check(), and main().

◆ PostShell()

static void PostShell ( void  )
static

Definition at line 374 of file main.c.

375 {
376  SetXtermTitle("RESTORE");
377  CloseHost();
378  DisposeReadline();
379  CloseTrace();
380  SavePrefs();
381  EndLog();
382  Plug();
383  DisposeWinsock(0);
384 } /* PostShell */
#define DisposeWinsock(a)
Definition: main.c:29
void CloseTrace(void)
Definition: trace.c:159
void SavePrefs(void)
Definition: pref.c:695
void DisposeReadline(void)
Definition: readln.c:707
void SetXtermTitle(const char *const fmt,...)
Definition: readln.c:718
static void Plug(void)
Definition: main.c:358
void EndLog(void)
Definition: log.c:65
void CloseHost(void)
Definition: main.c:153

Referenced by main().

◆ PreInit()

static void PreInit ( void  )
static

Definition at line 267 of file main.c.

268 {
269  int result;
270 
271 #if defined(WIN32) || defined(_WINDOWS)
272  if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
273  fprintf(stderr, "could not initialize winsock\n");
274  exit(1);
275  }
276  wsaInit++;
277 #endif
278 
279 #ifdef HAVE_SETLOCALE
280  setlocale(LC_ALL, "");
281 #endif
282 #if defined(WIN32) || defined(_WINDOWS)
283  gIsTTY = 1;
284  gIsTTYr = 1;
285 #else
286  gIsTTY = ((isatty(2) != 0) && (getppid() > 1)) ? 1 : 0;
287  gIsTTYr = ((isatty(0) != 0) && (getppid() > 1)) ? 1 : 0;
288 #endif
289 #ifdef SIGPOLL
290  (void) NcSignal(SIGPOLL, (FTPSigProc) SIG_IGN);
291 #endif
292  InitUserInfo();
294  if (result < 0) {
295  (void) fprintf(stderr, "ncftp: init library error %d (%s).\n", result, FTPStrError(result));
296  exit(1);
297  }
298 #if defined(WIN32) || defined(_WINDOWS)
299  srand((unsigned int) (GetTickCount() & 0x7FFF));
300 #else
301  srand((unsigned int) getpid());
302 #endif
305  InitLog();
306  InitPrefs();
308  LoadPrefs();
310  InitCommandList();
311  InitLs();
312  TruncBatchLog();
313  GetoptReset();
315 } /* PreInit */
int gIsTTYr
Definition: main.c:33
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define MAKEWORD(a, b)
Definition: typedefs.h:247
int FTPInitLibrary(const FTPLIPtr lip)
Definition: open.c:1110
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
void __cdecl srand(_In_ unsigned int _Seed)
void InitLs(void)
Definition: ls.c:68
void GetScreenColumns(void)
Definition: readln.c:55
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void GetoptReset(void)
Definition: getopt.c:21
_Check_return_ _CRTIMP int __cdecl isatty(_In_ int _FileHandle)
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
void LoadFirewallPrefs(int)
Definition: preffw.c:268
void InitConnectionInfo(void)
Definition: main.c:109
FTPLibraryInfo gLib
Definition: main.c:36
void InitLog(void)
Definition: log.c:20
#define LC_ALL
Definition: locale.h:25
_CRTIMP int __cdecl getpid(void)
int gIsTTY
Definition: main.c:33
void TruncBatchLog(void)
Definition: spool.c:30
void CheckForNewV3User(void)
Definition: pref.c:738
void InitCommandList(void)
Definition: shell.c:90
void(* FTPSigProc)(int)
Definition: ncftp.h:76
const char * FTPStrError(int e)
Definition: errno.c:114
void LoadPrefs(void)
Definition: pref.c:555
#define NcSignal
Definition: ncftp.h:604
void InitLineList(LineListPtr list)
Definition: linelist.c:54
FILE * stderr
void InitUserInfo(void)
Definition: util.c:630
#define setlocale(n, s)
Definition: locale.h:46
LineList gStartupURLCdList
Definition: main.c:38
void exit(int exitcode)
Definition: _exit.c:33
#define SIG_IGN
Definition: signal.h:48
GLuint64EXT * result
Definition: glext.h:11304
void InitPrefs(void)
Definition: pref.c:616

Referenced by CTestSpy::Check(), and main().

◆ SetStartupURL()

static void SetStartupURL ( const char *const  urlgiven)
static

Definition at line 172 of file main.c.

173 {
174  int rc;
175  char url[256];
176  char urlfile[128];
177 
178  gLoadedBm = 0;
179  (void) STRNCPY(url, urlgiven);
180 
181  rc = DecodeDirectoryURL(&gConn, url, &gStartupURLCdList, urlfile, sizeof(urlfile));
182  if (rc == kMalformedURL) {
183  (void) fprintf(stderr, "Malformed URL: %s\n", url);
184  exit(1);
185  } else if (rc == kNotURL) {
186  /* This is what should happen most of the time. */
187  (void) STRNCPY(gConn.host, urlgiven);
188  gURLMode = 2;
189  if (GetBookmark(gConn.host, &gBm) >= 0) {
190  gLoadedBm = 1;
199  gConn.port = gBm.port;
200  } else {
202  }
203 
210  }
211  } else {
212  /* URL okay */
213  if (urlfile[0] != '\0') {
214  /* It was obviously not a directory */
215  (void) fprintf(stderr, "Use ncftpget or ncftpput to handle file URLs.\n");
216  exit(1);
217  }
218  gURLMode = 1;
225  }
226  }
227 } /* SetStartupURL */
unsigned int port
Definition: ncftp.h:140
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char pass[64]
Definition: ncftp.h:138
char user[64]
Definition: ncftp.h:137
char name[64]
Definition: bookmark.h:11
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
int gLoadedBm
Definition: bookmark.c:25
int gFirewallType
Definition: preffw.c:17
int hasMDTM
Definition: bookmark.h:21
int hasPASV
Definition: bookmark.h:22
int hasSIZE
Definition: bookmark.h:20
FTPConnectionInfo gConn
Definition: main.c:37
char host[64]
Definition: ncftp.h:136
unsigned int gFirewallPort
Definition: preffw.c:22
unsigned int port
Definition: bookmark.h:18
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char firewallHost[64]
Definition: ncftp.h:217
#define kMalformedURL
Definition: ncftp.h:385
char pass[64]
Definition: bookmark.h:13
int firewallType
Definition: ncftp.h:221
int gURLMode
Definition: main.c:41
char firewallPass[64]
Definition: ncftp.h:219
char user[64]
Definition: bookmark.h:12
int GetBookmark(const char *const bmabbr, Bookmark *bmp)
Definition: bookmark.c:387
char acct[64]
Definition: ncftp.h:139
static const WCHAR url[]
Definition: encode.c:1432
#define kNotURL
Definition: ncftp.h:384
Bookmark gBm
Definition: bookmark.c:24
char firewallUser[64]
Definition: ncftp.h:218
char gFirewallHost[64]
Definition: preffw.c:18
int DecodeDirectoryURL(const FTPCIPtr cip, char *url, LineListPtr cdlist, char *fn, size_t fnsize)
Definition: util.c:1086
char gFirewallPass[32]
Definition: preffw.c:20
void SetBookmarkDefaults(BookmarkPtr bmp)
Definition: bookmark.c:74
int hasUTIME
Definition: bookmark.h:27
unsigned int firewallPort
Definition: ncftp.h:220
char gFirewallUser[32]
Definition: preffw.c:19
char gFirewallExceptionList[]
Definition: preffw.c:21
FILE * stderr
char acct[64]
Definition: bookmark.h:14
LineList gStartupURLCdList
Definition: main.c:38
void exit(int exitcode)
Definition: _exit.c:33
int MayUseFirewall(const char *const hn, int firewallType, const char *const firewallExceptionList)
Definition: util.c:695

Referenced by main().

◆ Usage()

static void Usage ( void  )
static

Definition at line 67 of file main.c.

68 {
69  FILE *fp;
70 #ifdef UNAME
71  char s[80];
72 #endif
73 
74  fp = stderr;
75  (void) fprintf(fp, "\nUsage: ncftp [flags] [<host> | <directory URL to browse>]\n");
76  (void) fprintf(fp, "\nFlags:\n\
77  -u XX Use username XX instead of anonymous.\n\
78  -p XX Use password XX with the username.\n\
79  -P XX Use port number XX instead of the default FTP service port (21).\n\
80  -j XX Use account XX with the username (rarely needed).\n\
81  -F Dump a sample $HOME/.ncftp/firewall prefs file to stdout and exit.\n");
82 
83  (void) fprintf(fp, "\nProgram version: %s\nLibrary version: %s\n", gVersion + 5, gLibNcFTPVersion + 5);
84 #ifdef UNAME
85  AbbrevStr(s, UNAME, 60, 1);
86  (void) fprintf(fp, "System: %s\n", s);
87 #endif
88  (void) fprintf(fp, "\nThis is a freeware program by Mike Gleason (ncftp@ncftp.com).\n");
89  (void) fprintf(fp, "Use ncftpget and ncftpput for command-line FTP.\n\n");
90  exit(2);
91 } /* Usage */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void AbbrevStr(char *dst, const char *src, size_t max, int mode)
Definition: util.c:451
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char gVersion[]
Definition: init.c:22
GLdouble s
Definition: gl.h:2039
char gLibNcFTPVersion[64]
Definition: ftp.c:11
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33

Variable Documentation

◆ gAutoAscii

char gAutoAscii[]

Definition at line 56 of file pref.c.

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

◆ gBm

Bookmark gBm

Definition at line 24 of file bookmark.c.

Referenced by OpenURL(), and SetStartupURL().

◆ gConn

◆ gConnTimeout

int gConnTimeout

Definition at line 24 of file pref.c.

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

◆ gCopyright

char gCopyright[]

Definition at line 17 of file version.c.

Referenced by PostInit().

◆ gCtrlTimeout

int gCtrlTimeout

Definition at line 24 of file pref.c.

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

◆ gDataPortMode

int gDataPortMode

Definition at line 26 of file preffw.c.

Referenced by InitConnectionInfo().

◆ gDebug

int gDebug

Definition at line 19 of file trace.c.

Referenced by InitConnectionInfo(), SetDebug(), and Trace().

◆ gDoNotDisplayAds

int gDoNotDisplayAds

Definition at line 64 of file pref.c.

Referenced by InitPrefs(), Plug(), and SetNoAds().

◆ gFirewallExceptionList

char gFirewallExceptionList[]

Definition at line 21 of file preffw.c.

Referenced by LoadFirewallPrefs(), PostInit(), ProcessFirewallPrefFile(), and SetStartupURL().

◆ gFirewallHost

char gFirewallHost[64]

Definition at line 18 of file preffw.c.

Referenced by LoadFirewallPrefs(), PostInit(), ProcessFirewallPrefFile(), and SetStartupURL().

◆ gFirewallPass

char gFirewallPass[32]

Definition at line 20 of file preffw.c.

Referenced by LoadFirewallPrefs(), PostInit(), ProcessFirewallPrefFile(), and SetStartupURL().

◆ gFirewallPort

unsigned int gFirewallPort

Definition at line 22 of file preffw.c.

Referenced by LoadFirewallPrefs(), PostInit(), ProcessFirewallPrefFile(), and SetStartupURL().

◆ gFirewallType

int gFirewallType

Definition at line 17 of file preffw.c.

Referenced by LoadFirewallPrefs(), PostInit(), ProcessFirewallPrefFile(), and SetStartupURL().

◆ gFirewallUser

char gFirewallUser[32]

Definition at line 19 of file preffw.c.

Referenced by LoadFirewallPrefs(), PostInit(), ProcessFirewallPrefFile(), and SetStartupURL().

◆ gFirstTimeUser

int gFirstTimeUser

◆ gIsTTY

int gIsTTY

Definition at line 33 of file main.c.

Referenced by PreInit().

◆ gIsTTYr

int gIsTTYr

Definition at line 33 of file main.c.

Referenced by PreInit(), and Readline().

◆ gLib

◆ gLoadedBm

int gLoadedBm

Definition at line 25 of file bookmark.c.

Referenced by SetStartupURL().

◆ gLocalCWD

char gLocalCWD[512]

Definition at line 43 of file main.c.

Referenced by DoOpen(), LocalChdirCmd(), LocalPwdCmd(), and PostInit().

◆ gNumProgramRuns

int gNumProgramRuns

Definition at line 14 of file preffw.c.

Referenced by Plug(), and PostInit().

◆ gOptArg

char* gOptArg

Definition at line 16 of file getopt.c.

Referenced by Getopt(), and main().

◆ gOptInd

int gOptInd

Definition at line 14 of file getopt.c.

Referenced by Getopt(), GetoptReset(), and main().

◆ gPrevLocalCWD

char gPrevLocalCWD[512]

Definition at line 43 of file main.c.

Referenced by DoOpen(), LocalChdirCmd(), and PostInit().

◆ gPrevRemoteCWD

char gPrevRemoteCWD[512]

Definition at line 38 of file cmds.c.

Referenced by ChdirCmd(), and InitConnectionInfo().

◆ gProgressMeter

FTPProgressMeterProc gProgressMeter

Referenced by InitPrefs().

◆ gRedialDelay

int gRedialDelay

Definition at line 44 of file pref.c.

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

◆ gRemoteCWD

char gRemoteCWD[512]

Definition at line 33 of file cmds.c.

Referenced by OpenURL().

◆ gScreenColumns

int gScreenColumns

Definition at line 34 of file main.c.

Referenced by GetScreenColumns(), InitReadline(), LsC(), OpenMsg(), and PrPhilBar().

◆ gSOBufsize

int gSOBufsize

Definition at line 50 of file pref.c.

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

◆ gStartupURLCdList

LineList gStartupURLCdList

Definition at line 38 of file main.c.

Referenced by OpenURL(), PreInit(), and SetStartupURL().

◆ gStartupUrlParameterGiven

int gStartupUrlParameterGiven = 0

Definition at line 32 of file main.c.

Referenced by main().

◆ gTransferType

int gTransferType

Definition at line 40 of file main.c.

Referenced by InitConnectionInfo().

◆ gTransferTypeInitialized

int gTransferTypeInitialized = 0

Definition at line 39 of file main.c.

Referenced by InitConnectionInfo().

◆ gUnprocessedJobs

int gUnprocessedJobs

Definition at line 19 of file spool.c.

Referenced by InitConnectionInfo(), RunBatchIfNeeded(), and SpoolX().

◆ gURLMode

int gURLMode = 0

Definition at line 41 of file main.c.

Referenced by OpenURL(), and SetStartupURL().

◆ gVersion

char gVersion[]

Definition at line 22 of file init.c.

Referenced by main(), PrintUsage(), and Usage().

◆ gXferTimeout

int gXferTimeout

Definition at line 24 of file pref.c.

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