21static const char copyright[] =
"getline: Copyright (C) 1991, 1992, 1993, Chris Thewalt";
32# define sleep(a) Sleep(a * 1000)
34# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
35# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
48# define utimbuf _utimbuf
54# define LOCAL_PATH_DELIM '\\'
55# define LOCAL_PATH_DELIM_STR "\\"
56# define LOCAL_PATH_ALTDELIM '/'
57# define IsLocalPathDelim(c) ((c == LOCAL_PATH_DELIM) || (c == LOCAL_PATH_ALTDELIM))
58# define UNC_PATH_PREFIX "\\\\"
59# define IsUNCPrefixed(s) (IsLocalPathDelim(s[0]) && IsLocalPathDelim(s[1]))
122static void gl_del(
int loc,
int);
134static void gl_word(
int direction);
160# ifdef HAVE_TERMIOS_H
161 if (tcgetattr(0, &old_termios) == 0) {
165 gl_suspc = old_termios.c_cc[VSUSP];
168 gl_dsuspc = old_termios.c_cc[VDSUSP];
171 new_termios = old_termios;
172 new_termios.c_iflag &= ~(BRKINT|ISTRIP|IXON|IXOFF);
173 new_termios.c_iflag |= (IGNBRK|IGNPAR);
174 new_termios.c_lflag &= ~(ICANON|ISIG|IEXTEN|
ECHO);
175 new_termios.c_cc[VMIN] = 1;
176 new_termios.c_cc[VTIME] = 0;
177 tcsetattr(0, TCSANOW, &new_termios);
178# elif defined(TIOCSETN)
179 if (
ioctl(0, TIOCGETC, &tch) == 0) {
183 ioctl(0, TIOCGLTC, <ch);
184 gl_suspc = ltch.t_suspc;
185 gl_dsuspc = ltch.t_dsuspc;
186 ioctl(0, TIOCGETP, &old_tty);
188 new_tty.sg_flags |=
RAW;
189 new_tty.sg_flags &= ~ECHO;
190 ioctl(0, TIOCSETN, &new_tty);
192 if (
ioctl(0, TCGETA, &old_termio) == 0) {
196 new_termio = old_termio;
197 new_termio.c_iflag &= ~(BRKINT|ISTRIP|IXON|IXOFF);
198 new_termio.c_iflag |= (IGNBRK|IGNPAR);
199 new_termio.c_lflag &= ~(ICANON|ISIG|
ECHO);
200 new_termio.c_cc[VMIN] = 1;
201 new_termio.c_cc[VTIME] = 0;
202 ioctl(0, TCSETA, &new_termio);
211# ifdef HAVE_TERMIOS_H
212 tcsetattr(0, TCSANOW, &old_termios);
213# elif defined(TIOCSETN)
214 ioctl(0, TIOCSETN, &old_tty);
216 ioctl(0, TCSETA, &old_termio);
232#if defined(MSDOS) || defined(__windows__)
292 while ((
c = (
int)
read(0, &ch, 1)) == -1) {
300 c = _bios_keybrd(_NKEYBRD_READ);
301 if ((
c & 0377) == 224) {
309 if ((
c == 0) || (
c == 0xE0)) {
313 }
else if (
c ==
'\r') {
341 tv.tv_sec = tlen / 10;
342 tv.tv_usec = (tlen % 10) * 100000L;
382 for (
i=0;
i<tlen;
i++) {
385 if ((
c == 0) || (
c == 0xE0)) {
405 char ch = (
char) (
unsigned char)
c;
445 cp = (
const char *)
getenv(
"COLUMNS");
460 gl_error(
"\n*** Error: getline(): not interactive, use stdio.\n");
540 gl_error(
"\n*** Error: minimum screen width is 21\n");
552 gl_error(
"\n*** Error: minimum screen height is 10\n");
562 int c, loc, tmp, lastch;
565 char vi_countbuf[32];
606 if ((
c !=
'\t') && ((
isprint(
c) != 0) || ((
c & 0x80) != 0))) {
612 for (
count = 0; ; ) {
614 if (vi_countbuf[
sizeof(vi_countbuf) - 2] ==
'\0')
616 }
else if (vi_countbuf[0] !=
'\0') {
617 vi_count =
atoi(vi_countbuf);
618 memset(vi_countbuf, 0,
sizeof(vi_countbuf));
662 if (vi_delete == 1) {
675 for (
c = 0;
c < vi_count;
c++) {
726 if (
count >= vi_count)
740 if (
c ==
'\033' ||
c ==
'\016' ||
c ==
'\020') {
743 }
else if (
c ==
'\010' ||
c ==
'\177') {
746 }
else if (
c !=
'\022' &&
c !=
'\023') {
751 case '\n':
case '\r':
774 case '\010':
case '\177':
gl_del(-1, 0);
782 if (loc >= 0 || tmp !=
gl_pos)
784 if (lastch ==
'\t') {
793 if (loc >= 0 || tmp !=
gl_pos)
829 if ((
c ==
'[') || (
c ==
'O')) {
860 }
else if (
c != (-1)) {
862#if defined(__windows__) || defined(MSDOS)
875 memset(vi_countbuf, 0,
sizeof(vi_countbuf));
918 if (
c == gl_suspc ||
c == gl_dsuspc) {
953 gl_error(
"\n*** Error: getline(): input buffer overflow\n");
976 gl_error(
"\n*** Error: getline(): input buffer overflow\n");
985 gl_error(
"\n*** Error: getline(): input buffer overflow\n");
1025 gl_error(
"\n*** Error: getline(): input buffer overflow\n");
1051 if ((
j == 0) && (killsave != 0) && (
gl_vi_mode != 0)) {
1084 if (direction > 0) {
1099 if (
pos < startpos) {
1109 for (
i=0, tmp=
pos - startpos;
i<tmp;
i++)
1120 if (direction > 0) {
1164 static int gl_shift;
1165 static int off_right;
1166 static int off_left;
1167 static char last_prompt[80] =
"";
1181 strcpy(last_prompt, prompt);
1184 }
else if (
strcmp(prompt, last_prompt) != 0) {
1188 strcpy(last_prompt, prompt);
1219 if (new_shift > 0) {
1224 if (new_shift != gl_shift) {
1225 gl_shift = new_shift;
1226 off_left = (gl_shift)? 1 : 0;
1230 }
else if (change >= 0) {
1231 if (change < gl_shift + off_left) {
1243 pad = (pad < 0)? 0 : pad;
1247 if (
left == gl_shift && off_left) {
1251 for (
i=
left;
i < new_right;
i++)
1254 if (off_right && new_right ==
right) {
1258 for (
i=0;
i < pad;
i++)
1282 for (
i=
len;
i >= *loc;
i--)
1296#define HIST_SIZE 100
1316 static char *prev = 0;
1325 while (*
p ==
' ' || *
p ==
'\t' || *
p ==
'\n')
1400 gl_error(
"\n*** Error: hist_save() failed on malloc\n");
1425 if ((
p ==
NULL) || (*
p ==
'\0'))
1623 * ((
const char **)
a),
1624 * ((
const char **)
b)
1635 size_t ilen, imaxlen;
1638 int nmax, ncol, colw, nrow;
1639 char *cp1, *cp2, *lim, *itemp;
1650 for (glen = 0; ; glen++) {
1652 for (
i=1;
i<nused;
i++) {
1670 for (
i=1;
i<nused;
i++) {
1679 ncol = (
gl_termw - 8) / ((
int) imaxlen + 2);
1685 if ((nused % ncol) != 0)
1693 for (
i=0;
i<(
int)
sizeof(buf2);
i++)
1696 for (
j=0;
j<nrow;
j++) {
1698 for (
i=0,
k=
j,
l=4;
i<ncol;
i++,
k += nrow,
l += colw) {
1704 if (lim > (
buf +
sizeof(
buf) - 1))
1710 for (cp1 =
buf +
sizeof(
buf); *--cp1 ==
' '; )
1719 (
void)
sprintf(
buf,
" ... %d others omitted ...", (nused - nmax));
1734 size_t startoff, amt;
1738 char *lastspacestart;
1740 int ntoalloc, nused, nprocused, nalloced,
i;
1741 char **newgl_matchlist;
1742 char *strtoadd, *strtoadd1;
1744 size_t llen, mlen, glen;
1747 size_t lenaftercursor;
1750 char ellipsessave[4];
1758 curposp =
buf + *loc;
1759 wasateol = (*curposp ==
'\0');
1760 lenaftercursor = llen - (curposp -
buf);
1762 memcpy(ellipsessave, curposp, (
size_t) 4);
1763 memcpy(curposp,
"... ", (
size_t) 4);
1765 memcpy(curposp, ellipsessave, (
size_t) 4);
1770 lastspacestart =
NULL;
1774 while (
cp < curposp) {
1778 if ((
c ==
'"') || (
c ==
'\'')) {
1783 }
else if (qmode != 0) {
1790 }
else if ((
isspace(
c)) && (qmode == 0)) {
1792 lastspacestart =
cp - 1;
1799 startp = qstart + 1;
1800 else if (lastspacestart !=
NULL)
1801 startp = lastspacestart + 1;
1806 mlen = (curposp -
cp);
1808 matchpfx = (
char *)
malloc(mlen + 1);
1810 matchpfx[mlen] =
'\0';
1812#define GL_COMPLETE_VECTOR_BLOCK_SIZE 64
1816 newgl_matchlist = (
char **)
malloc((
size_t) (
sizeof(
char *) * (ntoalloc + 1)));
1817 if (newgl_matchlist ==
NULL) {
1823 nalloced = ntoalloc;
1824 for (
i=nused;
i<=nalloced;
i++)
1828 for (nprocused = 0;; nprocused++) {
1829 if (nused == nalloced) {
1832 if (newgl_matchlist ==
NULL) {
1834 for (
i=0;
i<nused;
i++)
1843 nalloced = ntoalloc;
1844 for (
i=nused;
i<=nalloced;
i++)
1850 if ((
cp[0] ==
'.') && ((
cp[1] ==
'\0') || ((
cp[1] ==
'.') && (
cp[2] ==
'\0'))))
1870 }
else if (tabtab != 0) {
1873 }
else if ((nused > 1) && (mlen > 0)) {
1875 for (glen =
strlen(matchpfx); ; glen++) {
1877 for (
i=1;
i<nused;
i++) {
1886 strtoadd1 = (
char *)
malloc(glen + 1);
1887 if (strtoadd1 !=
NULL) {
1889 strtoadd1[glen] =
'\0';
1890 strtoadd = strtoadd1;
1894 if (strtoadd !=
NULL) {
1895 if ((qmode == 0) && (addquotes != 0)) {
1897 qmode = (
strchr(strtoadd,
'"') ==
NULL) ?
'"' :
'\'';
1898 memmove(curposp + 1, curposp, lenaftercursor + 1 );
1900 *startp++ = (
char) qmode;
1905 if ((amt + startoff + lenaftercursor) >=
bufsize)
1906 amt =
bufsize - (amt + startoff + lenaftercursor);
1907 memmove(curposp + amt - mlen, curposp, lenaftercursor + 1 );
1908 curposp += amt - mlen;
1909 memcpy(startp, strtoadd, amt);
1914 memmove(curposp + 1, curposp, lenaftercursor + 1 );
1916 buf[amt + startoff] = (
char) qmode;
1919 memmove(curposp + 1, curposp, lenaftercursor + 1 );
1923 }
else if ((!wasateol) && (!
isspace(*curposp))) {
1927 memmove(curposp + 1, curposp, lenaftercursor + 1 );
1929 buf[amt + startoff] =
' ';
1931 *loc = (
int) (startoff + amt);
1933 if (strtoadd1 !=
NULL)
1938 for (
i=0;
i<nused;
i++)
1961#ifndef _StrFindLocalPathDelim
1977 return ((
char *)
last);
1989 const char *homedrive, *homepath;
2001 if (homedir ==
NULL) {
2003 homedrive =
getenv(
"HOMEDRIVE");
2004 homepath =
getenv(
"HOMEPATH");
2005 if ((homedrive !=
NULL) && (homepath !=
NULL)) {
2018 else if (wdir[1] ==
':') {
2037 homedir = pw->pw_dir;
2062 if ((prompt !=
NULL) && (prompt[0] !=
'\0'))
2067 if ((
c ==
'\r') || (
c ==
'\n'))
2069 if ((
c ==
'\010') || (
c ==
'\177')) {
2077 }
else if (
cp < (
pass + dsize)) {
2095 if ((prompt !=
NULL) && (prompt[0] !=
'\0'))
2100 if ((
c ==
'\r') || (
c ==
'\n'))
2102 if ((
c ==
'\010') || (
c ==
'\177')) {
2110 }
else if (
cp < (
pass + dsize)) {
2135 static int filepfxoffset;
2136 static size_t filepfxlen;
2138 const char *filepfx;
2141 const char *dirtoopen, *
name;
2166 if (dirtoopen1 ==
NULL)
2170 dirtoopen1[
len] =
'\0';
2171 dirtoopen = dirtoopen1;
2175 if (
strcmp(dirtoopen,
"~") == 0) {
2184 if (dirtoopen1 !=
NULL)
2187 filepfx =
start + filepfxoffset;
2188 filepfxlen =
strlen(filepfx);
2193 filepfx =
start + filepfxoffset;
2230 if ((
name[0] ==
'.') && ((
name[1] ==
'\0') || ((
name[1] ==
'.') && (
name[2] ==
'\0'))))
2233 if ((filepfxlen == 0) || (
strncmp(
name, filepfx, filepfxlen) == 0)) {
2236 cp = (
char *)
malloc(filepfxoffset +
len + 1 + 1 );
2238 if (filepfxoffset > 0)
2261 static int filepfxoffset;
2262 static size_t filepfxlen;
2267 const char *filepfx;
2268 const char *dirtoopen, *
name;
2269 char *dirtoopen1, *dirtoopen2;
2273 if (searchHandle !=
NULL) {
2276 searchHandle =
NULL;
2281 if (searchHandle ==
NULL) {
2294 if (dirtoopen1 ==
NULL)
2298 dirtoopen1[
len] =
'\0';
2299 dirtoopen = dirtoopen1;
2303 if (
strcmp(dirtoopen,
"~") == 0) {
2313 if (dirtoopen2 ==
NULL) {
2314 if (dirtoopen1 !=
NULL)
2321 memcpy(dirtoopen2 +
len,
"*.*", (
size_t) 4);
2323 memcpy(dirtoopen2 +
len,
"\\*.*", (
size_t) 5);
2326 memset(&ffd, 0,
sizeof(ffd));
2330 if (dirtoopen1 !=
NULL)
2337 filepfx =
start + filepfxoffset;
2338 filepfxlen =
strlen(filepfx);
2341 filepfx =
start + filepfxoffset;
2347 name = ffd.cFileName;
2348 if ((
name[0] ==
'.') && ((
name[1] ==
'\0') || ((
name[1] ==
'.') && (
name[2] ==
'\0'))))
2351 if ((filepfxlen == 0) || (
_strnicmp(
name, filepfx, filepfxlen) == 0)) {
2354 cp = (
char *)
malloc(filepfxoffset +
len + 4 + 1 );
2356 if (filepfxoffset > 0)
2361 c2 =
cp + filepfxoffset +
len + 1;
2366 c2 =
cp + filepfxoffset +
len + 1;
2379 searchHandle =
NULL;
2385 searchHandle =
NULL;
2395 if (ch == (
char)
'd')
2409 c2 =
cp +
len + len2;
char * strcat(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
char * strstr(char *String1, char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
char * strpbrk(const char *String, const char *Delimiters)
BOOL WINAPI FlushConsoleInputBuffer(IN HANDLE hConsoleInput)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
int __cdecl raise(int _SigNum)
#define INVALID_HANDLE_VALUE
#define _strnicmp(_String1, _String2, _MaxCount)
BOOL WINAPI FindClose(HANDLE hFindFile)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
int gl_ellipses_during_completion
static char search_string[100]
static char * hist_prev(void)
void gl_tab_completion(gl_tab_completion_proc proc)
static void gl_check_inputrc_for_vi(void)
static const char copyright[]
int gl_completion_exact_match_extra_char
static int gl_search_mode
gl_tab_completion_proc gl_completion_proc
static void gl_error(const char *const buf)
static int gl_tab(char *buf, int offset, int *loc, size_t bufsize)
static char gl_killbuf[GL_BUF_SIZE]
static void search_forw(int new_search)
static char * hist_next(void)
static void search_back(int new_search)
static char hist_empty_elem[2]
static void gl_yank(void)
static int gl_do_tab_completion(char *buf, int *loc, size_t bufsize, int tabtab)
static char ** gl_matchlist
static void gl_addchar(int c)
static void gl_newline(void)
void gl_histsavefile(const char *const path)
static void gl_del(int loc, int)
static void gl_init(void)
static void gl_puts(const char *const buf)
void gl_histadd(char *buf)
static int search_forw_flg
char * gl_getpass(const char *const prompt, char *const pass, int dsize)
#define GL_COMPLETE_VECTOR_BLOCK_SIZE
static void gl_char_cleanup(void)
static void gl_word(int direction)
static void gl_char_init(void)
static void gl_cleanup(void)
static char * _StrRFindLocalPathDelim(const char *src)
static void gl_fixup(const char *prompt, int change, int cursor)
char * gl_local_filename_completion_proc(const char *start, int idx)
gl_in_hook_proc gl_in_hook
static char * hist_buf[HIST_SIZE]
static void gl_display_matches(int nused)
static void search_addchar(int c)
static void gl_killword(int direction)
const char * gl_filename_quote_characters
static const char * gl_prompt
static void gl_beep(void)
static char search_prompt[101]
void gl_set_home_dir(const char *homedir)
gl_out_hook_proc gl_out_hook
static int gl_vi_preferred
static void search_update(int c)
#define IsLocalPathDelim(c)
gl_tab_hook_proc gl_tab_hook
static void gl_kill(int pos)
static void search_term(void)
int gl_filename_quoting_desired
static char * hist_save(char *p)
static void gl_redraw(void)
static void gl_transpose(void)
static int gl_display_matches_sort_proc(const void *a, const void *b)
static char * gl_home_dir
void gl_histloadfile(const char *const path)
static void hist_init(void)
#define LOCAL_PATH_DELIM_STR
static void gl_putc(int c)
int(* gl_in_hook_proc)(char *)
int(* gl_tab_hook_proc)(char *, int, int *, size_t)
char *(* gl_tab_completion_proc)(const char *, int)
int(* gl_out_hook_proc)(char *)
GLuint GLuint GLsizei count
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLsizei bufsize
GLboolean GLboolean GLboolean GLboolean a
GLubyte GLubyte GLubyte GLubyte w
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
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 GLint GLint j
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
int __cdecl closedir(DIR *)
DIR *__cdecl opendir(const char *)
struct dirent *__cdecl readdir(DIR *)
_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_ int __cdecl atoi(_In_z_ const char *_Str)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
struct msdos_volume_info vi
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
#define sprintf(buf, format,...)
int __cdecl _cputs(const char *)
#define FILE_ATTRIBUTE_DIRECTORY
static unsigned __int64 next
_CRTIMP int __cdecl _putch(_In_ int _Ch)
_CRTIMP int __cdecl _kbhit(void)
_Check_return_ _CRTIMP int __cdecl _isatty(_In_ int _FileHandle)
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
#define GetWindowsDirectory
DWORD WINAPI GetLastError(void)
#define ERROR_NO_MORE_FILES
BOOL WINAPI MessageBeep(_In_ UINT uType)