ReactOS 0.4.15-dev-7842-g558ab78
readln.c
Go to the documentation of this file.
1/* rdline.c
2 *
3 * Copyright (c) 1992-2001 by Mike Gleason.
4 * All rights reserved.
5 *
6 * Note: It should still be simple to backport the old GNU Readline
7 * support in here. Feel free to do that if you hate NcFTP's built-in
8 * implementation.
9 *
10 */
11
12#include "syshdrs.h"
13
14#include "shell.h"
15#include "util.h"
16#include "bookmark.h"
17#include "cmds.h"
18#include "pref.h"
19#include "ls.h"
20#include "readln.h"
21#include "getline.h"
22
23const char *tcap_normal = "";
24const char *tcap_boldface = "";
25const char *tcap_underline = "";
26const char *tcap_reverse = "";
27const char *gTerm;
29int gXtermTitle; /* Idea by forsberg@lysator.liu.se */
31
32#if (defined(WIN32) || defined(_WINDOWS)) && defined(_CONSOLE)
33 char gSavedConsoleTitle[64];
34#endif
35
36extern int gEventNumber;
37extern int gMaySetXtermTitle;
40extern char gRemoteCWD[512];
41extern char gOurDirectoryPath[];
42extern char gVersion[];
43extern int gNumBookmarks;
45extern PrefOpt gPrefOpts[];
46extern int gNumPrefOpts;
47extern int gScreenColumns;
48extern int gIsTTYr;
49extern int gUid;
50
51
52
53
54void
56{
57#if defined(WIN32) || defined(_WINDOWS)
59
61 gScreenColumns = (int) csbi.dwSize.X;
62 if (gScreenColumns < 80)
63 gScreenColumns = 80;
64 }
65#else /* Unix */
66#ifdef BINDIR
67 char ncftpbookmarks[256];
68 FILE *infp;
69 vsigproc_t osigpipe;
70 int columns;
71#endif /* BINDIR */
72 char *cp;
73
74 if ((cp = (char *) getenv("COLUMNS")) == NULL) {
75 gScreenColumns = 80;
76 } else {
78 return;
79 }
80
81#ifdef TIOCGWINSZ
82 {
83 struct winsize felix;
84
85 memset(&felix, 0, sizeof(felix));
86 if (ioctl(0, TIOCGWINSZ, &felix) == 0) {
87 columns = felix.ws_col;
88 if ((columns > 0) && (columns < GL_BUF_SIZE))
89 gScreenColumns = columns;
90 else
91 gScreenColumns = 80;
92 return;
93 }
94 }
95#endif
96
97#ifdef BINDIR
98 /* Don't run things as root unless really necessary. */
99 if (gUid == 0)
100 return;
101
102 /* This is a brutal hack where we've hacked a
103 * special command line option into ncftp_bookmarks
104 * (which is linked with curses) so that it computes
105 * the screen size and prints it to stdout.
106 *
107 * This function runs ncftp_bookmarks and gets
108 * that information. The reason we do this is that
109 * we may or may not have a sane installation of
110 * curses/termcap, and we don't want to increase
111 * NcFTP's complexity by the curses junk just to
112 * get the screen size. Instead, we delegate this
113 * to ncftp_bookmarks which already deals with the
114 * ugliness of curses.
115 */
116
117 STRNCPY(ncftpbookmarks, BINDIR);
118 STRNCAT(ncftpbookmarks, "/");
119 STRNCAT(ncftpbookmarks, "ncftpbookmarks");
120
121 if (access(ncftpbookmarks, X_OK) < 0)
122 return;
123
124 STRNCAT(ncftpbookmarks, " --dimensions-terse");
125
126 osigpipe = NcSignal(SIGPIPE, SIG_IGN);
127 infp = popen(ncftpbookmarks, "r");
128 if (infp != NULL) {
129 columns = 0;
130 (void) fscanf(infp, "%d", &columns);
131 while (getc(infp) != EOF) {}
132 (void) pclose(infp);
133
134 if ((columns > 0) && (columns < GL_BUF_SIZE))
135 gScreenColumns = columns;
136 }
137 (void) NcSignal(SIGPIPE, (sigproc_t) osigpipe);
138#endif /* BINDIR */
139#endif /* Windows */
140} /* GetScreenColumns */
141
142
143
144/* For a few selected terminal types, we'll print in boldface, etc.
145 * This isn't too important, though.
146 */
147void
149{
150#if (defined(WIN32) || defined(_WINDOWS)) && defined(_CONSOLE)
151 gXterm = gXtermTitle = 0;
152 gCurXtermTitleStr[0] = '\0';
153
154 tcap_normal = "";
155 tcap_boldface = "";
156 tcap_underline = "";
157 tcap_reverse = "";
158
159 gTerm = "MS-DOS Prompt";
160 ZeroMemory(gSavedConsoleTitle, (DWORD) sizeof(gSavedConsoleTitle));
161 GetConsoleTitle(gSavedConsoleTitle, (DWORD) sizeof(gSavedConsoleTitle) - 1);
162 SetConsoleTitle("NcFTP");
163 gXterm = gXtermTitle = 1;
164#else
165 const char *term;
166
167 gXterm = gXtermTitle = 0;
168 gCurXtermTitleStr[0] = '\0';
169
170 if ((gTerm = getenv("TERM")) == NULL) {
171 tcap_normal = "";
172 tcap_boldface = "";
173 tcap_underline = "";
174 tcap_reverse = "";
175 return;
176 }
177
178 term = gTerm;
179 if ( (strstr(term, "xterm") != NULL) ||
180 (strstr(term, "rxvt") != NULL) ||
181 (strstr(term, "dtterm") != NULL) ||
182 (ISTRCMP(term, "scoterm") == 0)
183 ) {
184 gXterm = gXtermTitle = 1;
185 }
186
187 if ( (gXterm != 0) ||
188 (strcmp(term, "vt100") == 0) ||
189 (strcmp(term, "linux") == 0) ||
190 (strcmp(term, "vt220") == 0) ||
191 (strcmp(term, "vt102") == 0)
192 ) {
193 tcap_normal = "\033[0m"; /* Default ANSI escapes */
194 tcap_boldface = "\033[1m";
195 tcap_underline = "\033[4m";
196 tcap_reverse = "\033[7m";
197 } else {
198 tcap_normal = "";
199 tcap_boldface = "";
200 tcap_underline = "";
201 tcap_reverse = "";
202 }
203#endif
204} /* InitTermcap */
205
206
207
208
209static char *
211{
212 char *scp;
213 char *start;
214 int qc;
215
216 for (scp = gl_buf;;) {
217 start = scp;
218 for (;;) {
219 if (*scp == '\0')
220 goto done;
221 if (!isspace((int) *scp))
222 break;
223 scp++;
224 }
225 start = scp;
226
227 for (;;) {
228 if (*scp == '\0') {
229 goto done;
230 } else if ((*scp == '"') || (*scp == '\'')) {
231 qc = *scp++;
232
233 for (;;) {
234 if (*scp == '\0') {
235 goto done;
236 } else if (*scp == '\\') {
237 scp++;
238 if (*scp == '\0')
239 goto done;
240 scp++;
241 } else if (*scp == qc) {
242 scp++;
243 break;
244 } else {
245 scp++;
246 }
247 }
248 } else if (*scp == '\\') {
249 scp++;
250 if (*scp == '\0')
251 goto done;
252 scp++;
253 } else if ((*scp == ';') || (*scp == '\n')) {
254 /* command ended */
255 scp++;
256 if (*scp == '\0')
257 goto done;
258 break;
259 } else {
260 scp++;
261 }
262 }
263 }
264done:
265 return (start);
266} /* FindStartOfCurrentCommand */
267
268
269
270static FileInfoListPtr
271GetLsCacheFileList(const char *const item)
272{
273 int ci;
274 int sortBy;
275 int sortOrder;
276 FileInfoListPtr filp;
277
278 ci = LsCacheLookup(item);
279 if (ci < 0) {
280 /* This dir was not in the
281 * cache -- go get it.
282 */
283 Ls(item, 'l', "", NULL);
284 ci = LsCacheLookup(item);
285 if (ci < 0)
286 return NULL;
287 }
288
289 sortBy = 'n'; /* Sort by filename. */
290 sortOrder = 'a'; /* Sort in ascending order. */
291 filp = &gLsCache[ci].fil;
292 SortFileInfoList(filp, sortBy, sortOrder);
293 return filp;
294} /* GetLsCacheFileList */
295
296
297
298
299static char *
300RemoteCompletionFunction(const char *text, int state, int fTypeFilter)
301{
302 char rpath[256];
303 char *cp;
304 char *cp2;
305 const char *textbasename;
306 int fType;
307 FileInfoPtr diritemp;
308 FileInfoListPtr filp;
309 int textdirlen;
310 size_t tbnlen;
311 size_t flen, mlen;
312 static FileInfoVec diritemv;
313 static int i;
314
315 textbasename = strrchr(text, '/');
316 if (textbasename == NULL) {
317 textbasename = text;
318 textdirlen = -1;
319 } else {
320 textdirlen = (int) (textbasename - text);
321 textbasename++;
322 }
323 tbnlen = strlen(textbasename);
324
325 if (state == 0) {
326 if (text[0] == '\0') {
327 /* Special case when they do "get <TAB><TAB> " */
328 STRNCPY(rpath, gRemoteCWD);
329 } else {
330 PathCat(rpath, sizeof(rpath), gRemoteCWD, text);
331 if (text[strlen(text) - 1] == '/') {
332 /* Special case when they do "get /dir1/dir2/<TAB><TAB>" */
333 STRNCAT(rpath, "/");
334 }
335 cp2 = strrchr(rpath, '/');
336 if (cp2 == NULL) {
337 return NULL;
338 } else if (cp2 == rpath) {
339 /* Item in root directory. */
340 cp2++;
341 }
342 *cp2 = '\0';
343 }
344
345 filp = GetLsCacheFileList(rpath);
346 if (filp == NULL)
347 return NULL;
348
349 diritemv = filp->vec;
350 if (diritemv == NULL)
351 return NULL;
352
353 i = 0;
354 }
355
356 for ( ; ; ) {
357 diritemp = diritemv[i];
358 if (diritemp == NULL)
359 break;
360
361 i++;
362 fType = (int) diritemp->type;
363 if ((fTypeFilter == 0) || (fType == fTypeFilter) || (fType == /* symlink */ 'l')) {
364 if (strncmp(textbasename, diritemp->relname, tbnlen) == 0) {
365 flen = strlen(diritemp->relname);
366 if (textdirlen < 0) {
367 mlen = flen + 2;
368 cp = (char *) malloc(mlen);
369 if (cp == NULL)
370 return (NULL);
371 (void) memcpy(cp, diritemp->relname, mlen);
372 } else {
373 mlen = textdirlen + 1 + flen + 2;
374 cp = (char *) malloc(mlen);
375 if (cp == NULL)
376 return (NULL);
377 (void) memcpy(cp, text, (size_t) textdirlen);
378 cp[textdirlen] = '/';
379 (void) strcpy(cp + textdirlen + 1, diritemp->relname);
380 }
381 if (fType == 'd') {
383 } else {
385 }
386 return cp;
387 }
388 }
389 }
390 return NULL;
391} /* RemoteCompletionFunction */
392
393
394
395
396static char *
398{
399 char *cp;
400
402 return cp;
403} /* RemoteFileCompletionFunction */
404
405
406
407
408static char *
410{
411 char *cp;
412
414 return cp;
415} /* RemoteDirCompletionFunction */
416
417
418
419
420static char *
422{
423 char *cp;
424 size_t textlen;
425 int i, matches;
426
427 if ((gBookmarkTable == NULL) || (state >= gNumBookmarks))
428 return (NULL);
429
430 textlen = strlen(text);
431 if (textlen == 0) {
432 cp = StrDup(gBookmarkTable[state].bookmarkName);
433 } else {
434 cp = NULL;
435 for (i=0, matches=0; i<gNumBookmarks; i++) {
436 if (ISTRNCMP(gBookmarkTable[i].bookmarkName, text, textlen) == 0) {
437 if (matches >= state) {
438 cp = StrDup(gBookmarkTable[i].bookmarkName);
439 break;
440 }
441 matches++;
442 }
443 }
444 }
445 return cp;
446} /* BookmarkCompletionFunction */
447
448
449
450
451static char *
453{
454 char *cp;
455 size_t textlen;
456 int i, matches;
457 CommandPtr cmdp;
458
459 textlen = strlen(text);
460 if (textlen == 0) {
461 cp = NULL;
462 } else {
463 cp = NULL;
464 for (i=0, matches=0; ; i++) {
465 cmdp = GetCommandByIndex(i);
466 if (cmdp == kNoCommand)
467 break;
468 if (ISTRNCMP(cmdp->name, text, textlen) == 0) {
469 if (matches >= state) {
470 cp = StrDup(cmdp->name);
471 break;
472 }
473 matches++;
474 }
475 }
476 }
477 return cp;
478} /* CommandCompletionFunction */
479
480
481
482
483static char *
485{
486 char *cp;
487 size_t textlen;
488 int i, matches;
489
490 if (state >= gNumPrefOpts)
491 return (NULL);
492
493 textlen = strlen(text);
494 if (textlen == 0) {
495 cp = StrDup(gPrefOpts[state].varname);
496 } else {
497 cp = NULL;
498 for (i=0, matches=0; i<gNumPrefOpts; i++) {
499 if (ISTRNCMP(gPrefOpts[i].varname, text, textlen) == 0) {
500 if (matches >= state) {
501 cp = StrDup(gPrefOpts[i].varname);
502 break;
503 }
504 matches++;
505 }
506 }
507 }
508 return cp;
509} /* PrefOptCompletionFunction */
510
511
512
513
514void
516{
518}
519
520
521
522static int
523HaveCommandNameOnly(char *cmdstart)
524{
525 char *cp;
526 for (cp = cmdstart; *cp != '\0'; cp++) {
527 if (isspace((int) *cp))
528 return (0); /* At least one argument in progress. */
529 }
530 return (1);
531} /* HaveCommandNameOnly */
532
533
534
535
536static char *
538{
539 char *cp;
540 char *cmdstart;
541 ArgvInfo ai;
542 int bUsed;
543 CommandPtr cmdp;
544 static int flags;
545
546 if (state == 0) {
547 flags = -1;
548 cmdstart = FindStartOfCurrentCommand();
549 if (cmdstart == NULL)
550 return NULL;
551 if (HaveCommandNameOnly(cmdstart)) {
552 flags = -2; /* special case */
554 return cp;
555 }
556
557 (void) memset(&ai, 0, sizeof(ai));
558 bUsed = MakeArgv(cmdstart, &ai.cargc, ai.cargv,
559 (int) (sizeof(ai.cargv) / sizeof(char *)),
560 ai.argbuf, sizeof(ai.argbuf),
561 ai.noglobargv, 1);
562 if (bUsed <= 0)
563 return NULL;
564 if (ai.cargc == 0)
565 return NULL;
566
567 cmdp = GetCommandByName(ai.cargv[0], 0);
568 if (cmdp == kAmbiguousCommand) {
569 return NULL;
570 } else if (cmdp == kNoCommand) {
571 return NULL;
572 }
573 flags = cmdp->flags;
574 }
575 if (flags == (-2)) {
577 return cp;
578 }
579 if (flags < 0)
580 return NULL;
583 return cp;
584 } else if ((flags & kCompleteRemoteFile) != 0) {
587 return cp;
588 } else if ((flags & kCompleteRemoteDir) != 0) {
591 return cp;
592 } else if ((flags & kCompleteBookmark) != 0) {
594 return cp;
595 } else if ((flags & kCompletePrefOpt) != 0) {
597 return cp;
598 }
599 return NULL;
600} /* CompletionFunction */
601
602
603
604
605void
607{
608 char pathName[256];
609
610 if (gOurDirectoryPath[0] == '\0')
611 return;
612 (void) OurDirectoryPath(pathName, sizeof(pathName), kHistoryFileName);
613
614 gl_histloadfile(pathName);
615} /* LoadHistory */
616
617
618
619static size_t
621{
622 const char *cp;
623 size_t esc;
624
625 for (esc = 0, cp = src; *cp != '\0'; cp++) {
626 if (*cp == '\033')
627 esc++;
628 }
629
630 /* The VT100 escape codes we use are all in the form "\033[7m"
631 * These aren't visible, so subtract them from the count.
632 */
633 return ((size_t) (cp - src) - (esc * 4));
634} /* Vt100VisibleStrlen */
635
636
637
638/* Save the commands they typed in a history file, then they can use
639 * readline to go through them again next time.
640 */
641void
643{
644 char pathName[256];
645
646 if (gOurDirectoryPath[0] == '\0')
647 return; /* Don't create in root directory. */
648 (void) OurDirectoryPath(pathName, sizeof(pathName), kHistoryFileName);
649
651 gl_histsavefile(pathName);
652 (void) _chmod(pathName, 00600);
653} /* SaveHistory */
654
655
656
657
658void
660{
663 LoadHistory();
665} /* InitReadline */
666
667
668
669
670char *
671Readline(char *prompt)
672{
673 char *linecopy, *line, *cp;
674 char lbuf[256];
675
676 if (gIsTTYr) {
677 line = getline(prompt);
678 } else {
679 line = fgets(lbuf, sizeof(lbuf) - 1, stdin);
680 if (line != NULL) {
681 cp = line + strlen(line) - 1;
682 if (*cp == '\n')
683 *cp = '\0';
684 }
685 }
686
687 if (line != NULL) {
688 if (line[0] == '\0')
689 return NULL; /* EOF */
690 linecopy = StrDup(line);
691 line = linecopy;
692 }
693 return (line);
694} /* Readline */
695
696
697
698void
700{
702} /* AddHistory */
703
704
705
706void
708{
709 SaveHistory();
710} /* DisposeReadline */
711
712
713
714
715
716/*VARARGS*/
717void
718SetXtermTitle(const char *const fmt, ...)
719{
720 va_list ap;
721 char buf[256];
722
723 if ((gXtermTitle != 0) && (gMaySetXtermTitle != 0)) {
724 if ((fmt == NULL) || (ISTRCMP(fmt, "RESTORE") == 0)) {
725#if (defined(WIN32) || defined(_WINDOWS)) && defined(_CONSOLE)
726 STRNCPY(buf, gSavedConsoleTitle);
727#else
728 STRNCPY(buf, gTerm);
729#endif
730 } else if (ISTRCMP(fmt, "DEFAULT") == 0) {
731 (void) Strncpy(buf, gVersion + 5, 12);
732 } else {
733 va_start(ap, fmt);
734#ifdef HAVE_VSNPRINTF
735 (void) vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
736 buf[sizeof(buf) - 1] = '\0';
737#else
738 (void) vsprintf(buf, fmt, ap);
739#endif
740 va_end(ap);
741 }
742 if (buf[0] != '\0') {
743#if (defined(WIN32) || defined(_WINDOWS)) && defined(_CONSOLE)
745#else
746 if (strcmp(gCurXtermTitleStr, buf) != 0) {
747 fprintf(stderr, "\033]0;%s\007", buf);
749 }
750#endif
751 }
752 }
753} /* SetXtermTitle */
754
755
756
757
758void
760{
761 char v[80], *cp;
762 char vdate[32];
763
764 /* Print selected information from the version ID. */
765 vdate[0] = '\0';
766 (void) STRNCPY(v, gVersion + 5);
767 cp = strchr(v, ',');
768 if (cp != NULL) {
769 *cp = '\0';
770 cp[-5] = '\0';
771 (void) STRNCPY(vdate, " (");
772 (void) STRNCAT(vdate, v + 16);
773 (void) STRNCAT(vdate, ", ");
774 (void) STRNCAT(vdate, cp - 4);
775 (void) STRNCAT(vdate, ")");
776 }
777
778#if defined(BETA) && (BETA > 0)
779 (void) fprintf(stdout, "%s%.11s beta %d%s%s by Mike Gleason (ncftp@ncftp.com).\n",
781 gVersion + 5,
782 BETA,
784 vdate
785 );
786#else
787 (void) fprintf(stdout, "%s%.11s%s%s by Mike Gleason (ncftp@ncftp.com).\n",
789 gVersion + 5,
791 vdate
792 );
793#endif
794 (void) fflush(stdout);
795} /* PrintStartupBanner */
796
797
798
799
800/* Print the command shell's prompt. */
801void
802MakePrompt(char *dst, size_t dsize)
803{
804 char acwd[64];
805
806# ifdef HAVE_SNPRINTF
807 if (gConn.loggedIn != 0) {
808 AbbrevStr(acwd, gRemoteCWD, 25, 0);
809 snprintf(dst, dsize, "%sncftp%s %s %s>%s ",
812 } else {
813 snprintf(dst, dsize, "%sncftp%s> ",
815 }
816# else /* HAVE_SNPRINTF */
817 (void) Strncpy(dst, tcap_boldface, dsize);
818 (void) Strncat(dst, "ncftp", dsize);
819 (void) Strncat(dst, tcap_normal, dsize);
820 if (gConn.loggedIn != 0) {
821 AbbrevStr(acwd, gRemoteCWD, 25, 0);
822 (void) Strncat(dst, " ", dsize);
823 (void) Strncat(dst, acwd, dsize);
824 (void) Strncat(dst, " ", dsize);
825 }
826 (void) Strncat(dst, tcap_boldface, dsize);
827 (void) Strncat(dst, ">", dsize);
828 (void) Strncat(dst, tcap_normal, dsize);
829 (void) Strncat(dst, " ", dsize);
830# endif /* HAVE_SNPRINTF */
831} /* MakePrompt */
#define STRNCAT(d, s)
Definition: Strn.h:48
char * Strncat(char *const, const char *const, const size_t)
Definition: Strncat.c:13
char * Strncpy(char *const, const char *const, const size_t)
Definition: Strncpy.c:11
#define isspace(c)
Definition: acclib.h:69
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
static int state
Definition: maze.c:121
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
Definition: console.c:595
int LoadBookmarkTable(void)
Definition: bookmark.c:524
#define SIGPIPE
Definition: signal.h:35
#define SIG_IGN
Definition: signal.h:48
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
const WCHAR * text
Definition: package.c:1799
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
int gl_completion_exact_match_extra_char
Definition: getline.c:88
gl_tab_completion_proc gl_completion_proc
Definition: getline.c:84
void gl_setwidth(int w)
Definition: getline.c:532
void gl_histsavefile(const char *const path)
Definition: getline.c:1408
void gl_histadd(char *buf)
Definition: getline.c:1314
char * gl_local_filename_completion_proc(const char *start, int idx)
Definition: getline.c:2258
char gl_buf[GL_BUF_SIZE]
Definition: getline.c:89
int gl_filename_quoting_desired
Definition: getline.c:85
void gl_histloadfile(const char *const path)
Definition: getline.c:1437
gl_strlen_proc gl_strlen
#define GL_BUF_SIZE
Definition: getline.h:8
GLuint start
Definition: gl.h:1545
const GLdouble * v
Definition: gl.h:2040
GLenum src
Definition: glext.h:6340
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
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
#define stdout
Definition: stdio.h:99
_Check_return_ _CRTIMP int __cdecl getc(_Inout_ FILE *_File)
#define EOF
Definition: stdio.h:24
#define stderr
Definition: stdio.h:100
_Check_return_ _CRTIMP int __cdecl fscanf(_Inout_ FILE *_File, _In_z_ _Scanf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
#define stdin
Definition: stdio.h:98
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
void SortFileInfoList(FileInfoListPtr list, int sortKey, int sortOrder)
Definition: linelist.c:353
if(dx< 0)
Definition: linetemp.h:194
void Ls(const char *const item, int listmode, const char *const options, FILE *stream)
Definition: ls.c:465
int LsCacheLookup(const char *const itempath)
Definition: ls.c:110
#define kLsCacheSize
Definition: ls.h:17
POINT cp
Definition: magnifier.c:59
#define matches(FN)
Definition: match.h:70
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ISTRCMP
Definition: util.h:28
#define ISTRNCMP
Definition: util.h:29
int MakeArgv(char *line, int *cargc, const char **cargv, int cargcmax, char *dbuf, size_t dbufsize, int *noglobargv, int readlineHacks)
Definition: shell.c:221
CommandPtr GetCommandByName(const char *const name, int wantExactMatch)
Definition: shell.c:156
CommandPtr GetCommandByIndex(const int i)
Definition: shell.c:140
void AbbrevStr(char *dst, const char *src, size_t max, int mode)
Definition: util.c:451
char * OurDirectoryPath(char *const dst, const size_t siz, const char *const fname)
Definition: util.c:486
void PathCat(char *const dst, const size_t dsize, const char *const cwd, const char *const src)
Definition: util.c:368
volatile sigproc_t vsigproc_t
Definition: util.h:11
void(* sigproc_t)(int)
Definition: util.h:10
static ATOM item
Definition: dde.c:856
#define popen
Definition: syshdrs.h:72
#define pclose
Definition: syshdrs.h:73
#define NcSignal
Definition: ncftp.h:604
static char * RemoteFileCompletionFunction(const char *text, int state)
Definition: readln.c:397
FTPConnectionInfo gConn
Definition: main.c:37
char gCurXtermTitleStr[256]
Definition: readln.c:30
static char * PrefOptCompletionFunction(const char *text, int state)
Definition: readln.c:484
int gScreenColumns
Definition: cmds.c:78
BookmarkPtr gBookmarkTable
Definition: bookmark.c:28
static char * CommandCompletionFunction(const char *text, int state)
Definition: readln.c:452
void InitReadline(void)
Definition: readln.c:659
void SaveHistory(void)
Definition: readln.c:642
const char * tcap_reverse
Definition: readln.c:26
int gEventNumber
Definition: shell.c:27
static int HaveCommandNameOnly(char *cmdstart)
Definition: readln.c:523
int gMaySetXtermTitle
Definition: pref.c:41
const char * tcap_normal
Definition: readln.c:23
int gUid
Definition: util.c:13
static char * FindStartOfCurrentCommand(void)
Definition: readln.c:210
void AddHistory(char *line)
Definition: readln.c:699
int gIsTTYr
Definition: main.c:33
LsCacheItem gLsCache[kLsCacheSize]
Definition: ls.c:26
void ReCacheBookmarks(void)
Definition: readln.c:515
void LoadHistory(void)
Definition: readln.c:606
char * Readline(char *prompt)
Definition: readln.c:671
int gXtermTitle
Definition: readln.c:29
PrefOpt gPrefOpts[]
Definition: pref.c:73
int gNumPrefOpts
Definition: pref.c:113
char gRemoteCWD[512]
Definition: cmds.c:33
void DisposeReadline(void)
Definition: readln.c:707
char gVersion[]
Definition: init.c:22
static char * RemoteDirCompletionFunction(const char *text, int state)
Definition: readln.c:409
static size_t Vt100VisibleStrlen(const char *src)
Definition: readln.c:620
const char * tcap_underline
Definition: readln.c:25
int gNumBookmarks
Definition: bookmark.c:27
static FileInfoListPtr GetLsCacheFileList(const char *const item)
Definition: readln.c:271
static char * BookmarkCompletionFunction(const char *text, int state)
Definition: readln.c:421
void SetXtermTitle(const char *const fmt,...)
Definition: readln.c:718
int gXterm
Definition: readln.c:28
const char * tcap_boldface
Definition: readln.c:24
void MakePrompt(char *dst, size_t dsize)
Definition: readln.c:802
void PrintStartupBanner(void)
Definition: readln.c:759
static char * RemoteCompletionFunction(const char *text, int state, int fTypeFilter)
Definition: readln.c:300
void GetScreenColumns(void)
Definition: readln.c:55
void InitTermcap(void)
Definition: readln.c:148
char gOurDirectoryPath[]
Definition: util.c:17
const char * gTerm
Definition: readln.c:27
#define kHistoryFileName
Definition: readln.h:11
#define getline
Definition: schily.h:567
_Check_return_ _CRTIMP int __cdecl _chmod(_In_z_ const char *_Filename, _In_ int _Mode)
#define X_OK
Definition: io.h:169
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define memset(x, y, z)
Definition: compat.h:39
#define kCompleteRemoteDir
Definition: shell.h:62
#define kCompleteRemoteFile
Definition: shell.h:61
#define kAmbiguousCommand
Definition: shell.h:54
#define kCompleteLocalDir
Definition: shell.h:64
#define kCompleteLocalFile
Definition: shell.h:63
#define kCompleteBookmark
Definition: shell.h:65
#define kCompletePrefOpt
Definition: shell.h:66
#define kNoCommand
Definition: shell.h:55
#define StrDup
Definition: shlwapi.h:1533
Definition: shell.h:8
int cargc
Definition: shell.h:11
int noglobargv[64]
Definition: shell.h:10
const char * cargv[64]
Definition: shell.h:9
char argbuf[256]
Definition: shell.h:12
Definition: shell.h:41
int flags
Definition: shell.h:45
const char * name
Definition: shell.h:42
FileInfoVec vec
Definition: ncftp.h:266
int type
Definition: ncftp.h:258
char * relname
Definition: ncftp.h:253
Definition: ls.h:10
FileInfoList fil
Definition: ls.h:12
Definition: pref.h:31
Definition: dsound.c:943
Definition: parser.c:49
SHORT X
Definition: blue.h:26
#define vsnprintf
Definition: tif_win32.c:406
#define ZeroMemory
Definition: winbase.h:1712
#define STD_OUTPUT_HANDLE
Definition: winbase.h:268
#define SetConsoleTitle
Definition: wincon.h:783
#define GetConsoleTitle
Definition: wincon.h:775
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
#define ioctl
Definition: wintirpc.h:60
#define snprintf
Definition: wintirpc.h:48
_In_ UCHAR _In_ POWER_STATE _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction
Definition: pofuncs.h:44