2 * WCMD - Wine-compatible command line interface - built-in functions.
4 * Copyright (C) 1999 D A Pickles
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * On entry to each function, global variables quals, param1, param2 contain
24 * the qualifiers (uppercased and concatenated) and parameters entered, with
25 * environment-variable and batch parameter substitution already done.
30 * - No support for pipes, shell parameters
31 * - Lots of functionality missing from builtins
32 * - Messages etc need international support
37 void WCMD_execute (char *orig_command
, char *parameter
, char *substitution
);
41 struct env_stack
*next
;
45 struct env_stack
*saved_environment
;
47 extern HINSTANCE hinst
;
48 extern char *inbuilt
[];
50 extern char newline
[];
51 extern char version_string
[];
53 extern int echo_mode
, verify_mode
;
54 extern char quals
[MAX_PATH
], param1
[MAX_PATH
], param2
[MAX_PATH
];
55 extern BATCH_CONTEXT
*context
;
56 extern DWORD errorlevel
;
60 /****************************************************************************
63 * Clear the terminal screen.
66 void WCMD_clear_screen (void) {
68 /* Emulate by filling the screen from the top left to bottom right with
69 spaces, then moving the cursor to the top left afterwards */
70 CONSOLE_SCREEN_BUFFER_INFO consoleInfo
;
71 HANDLE hStdOut
= GetStdHandle(STD_OUTPUT_HANDLE
);
73 if (GetConsoleScreenBufferInfo(hStdOut
, &consoleInfo
))
78 screenSize
= consoleInfo
.dwSize
.X
* (consoleInfo
.dwSize
.Y
+ 1);
82 FillConsoleOutputCharacter(hStdOut
, ' ', screenSize
, topLeft
, &screenSize
);
83 SetConsoleCursorPosition(hStdOut
, topLeft
);
87 /****************************************************************************
90 * Change the default i/o device (ie redirect STDin/STDout).
93 void WCMD_change_tty (void) {
99 /****************************************************************************
102 * Copy a file or wildcarded set.
103 * FIXME: No wildcard support
106 void WCMD_copy (void) {
112 static const char *overwrite
= "Overwrite file (Y/N)?";
113 char string
[8], outpath
[MAX_PATH
], inpath
[MAX_PATH
], *infile
;
115 if ((strchr(param1
,'*') != NULL
) && (strchr(param1
,'%') != NULL
)) {
116 WCMD_output ("Wildcards not yet supported\n");
120 /* If no destination supplied, assume current directory */
121 if (param2
[0] == 0x00) {
125 GetFullPathName (param2
, sizeof(outpath
), outpath
, NULL
);
126 hff
= FindFirstFile (outpath
, &fd
);
127 if (hff
!= INVALID_HANDLE_VALUE
) {
128 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
) {
129 GetFullPathName (param1
, sizeof(inpath
), inpath
, &infile
);
130 strcat (outpath
, "\\");
131 strcat (outpath
, infile
);
136 force
= (strstr (quals
, "/Y") != NULL
);
138 hff
= FindFirstFile (outpath
, &fd
);
139 if (hff
!= INVALID_HANDLE_VALUE
) {
141 WCMD_output (overwrite
);
142 ReadFile (GetStdHandle(STD_INPUT_HANDLE
), string
, sizeof(string
), &count
, NULL
);
143 if (toupper(string
[0]) == 'Y') force
= TRUE
;
148 status
= CopyFile (param1
, outpath
, FALSE
);
149 if (!status
) WCMD_print_error ();
153 /****************************************************************************
156 * Create a directory.
159 void WCMD_create_dir (void) {
161 if (!CreateDirectory (param1
, NULL
)) WCMD_print_error ();
164 /****************************************************************************
167 * Delete a file or wildcarded set.
171 void WCMD_delete (int recurse
) {
175 char fpath
[MAX_PATH
];
178 hff
= FindFirstFile (param1
, &fd
);
179 if (hff
== INVALID_HANDLE_VALUE
) {
180 WCMD_output ("%s :File Not Found\n",param1
);
183 if ((strchr(param1
,'*') == NULL
) && (strchr(param1
,'?') == NULL
)
184 && (!recurse
) && (fd
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)) {
185 strcat (param1
, "\\*");
190 if ((strchr(param1
,'*') != NULL
) || (strchr(param1
,'?') != NULL
)) {
191 strcpy (fpath
, param1
);
193 p
= strrchr (fpath
, '\\');
196 strcat (fpath
, fd
.cFileName
);
198 else strcpy (fpath
, fd
.cFileName
);
199 if (!(fd
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)) {
200 if (!DeleteFile (fpath
)) WCMD_print_error ();
202 } while (FindNextFile(hff
, &fd
) != 0);
206 if (!DeleteFile (param1
)) WCMD_print_error ();
211 /****************************************************************************
214 * Echo input to the screen (or not). We don't try to emulate the bugs
215 * in DOS (try typing "ECHO ON AGAIN" for an example).
218 void WCMD_echo (const char *command
) {
220 static const char *eon
= "Echo is ON\n", *eoff
= "Echo is OFF\n";
223 if ((command
[0] == '.') && (command
[1] == 0)) {
224 WCMD_output (newline
);
229 count
= strlen(command
);
231 if (echo_mode
) WCMD_output (eon
);
232 else WCMD_output (eoff
);
235 if (lstrcmpi(command
, "ON") == 0) {
239 if (lstrcmpi(command
, "OFF") == 0) {
243 WCMD_output_asis (command
);
244 WCMD_output (newline
);
248 /**************************************************************************
251 * Batch file loop processing.
252 * FIXME: We don't exhaustively check syntax. Any command which works in MessDOS
253 * will probably work here, but the reverse is not necessarily the case...
256 void WCMD_for (char *p
) {
261 char set
[MAX_PATH
], param
[MAX_PATH
];
264 if (lstrcmpi (WCMD_parameter (p
, 1, NULL
), "in")
265 || lstrcmpi (WCMD_parameter (p
, 3, NULL
), "do")
266 || (param1
[0] != '%')) {
267 WCMD_output ("Syntax error\n");
270 lstrcpyn (set
, WCMD_parameter (p
, 2, NULL
), sizeof(set
));
271 WCMD_parameter (p
, 4, &cmd
);
272 lstrcpy (param
, param1
);
275 * If the parameter within the set has a wildcard then search for matching files
276 * otherwise do a literal substitution.
280 while (*(item
= WCMD_parameter (set
, i
, NULL
))) {
281 if (strpbrk (item
, "*?")) {
282 hff
= FindFirstFile (item
, &fd
);
283 if (hff
== INVALID_HANDLE_VALUE
) {
287 WCMD_execute (cmd
, param
, fd
.cFileName
);
288 } while (FindNextFile(hff
, &fd
) != 0);
292 WCMD_execute (cmd
, param
, item
);
298 /*****************************************************************************
301 * Execute a command after substituting variable text for the supplied parameter
304 void WCMD_execute (char *orig_cmd
, char *param
, char *subst
) {
306 char *new_cmd
, *p
, *s
, *dup
;
309 size
= lstrlen (orig_cmd
);
310 new_cmd
= (char *) LocalAlloc (LMEM_FIXED
| LMEM_ZEROINIT
, size
);
311 dup
= s
= strdup (orig_cmd
);
313 while ((p
= strstr (s
, param
))) {
315 size
+= lstrlen (subst
);
316 new_cmd
= (char *) LocalReAlloc ((HANDLE
)new_cmd
, size
, 0);
318 strcat (new_cmd
, subst
);
319 s
= p
+ lstrlen (param
);
322 WCMD_process_command (new_cmd
);
324 LocalFree ((HANDLE
)new_cmd
);
328 /**************************************************************************
331 * Simple on-line help. Help text is stored in the resource file.
334 void WCMD_give_help (char *command
) {
339 command
= WCMD_strtrim_leading_spaces(command
);
340 if (lstrlen(command
) == 0) {
341 LoadString (hinst
, 1000, buffer
, sizeof(buffer
));
342 WCMD_output_asis (buffer
);
345 for (i
=0; i
<=WCMD_EXIT
; i
++) {
346 if (CompareString (LOCALE_USER_DEFAULT
, NORM_IGNORECASE
| SORT_STRINGSORT
,
347 param1
, -1, inbuilt
[i
], -1) == 2) {
348 LoadString (hinst
, i
, buffer
, sizeof(buffer
));
349 WCMD_output (buffer
);
353 WCMD_output ("No help available for %s\n", param1
);
358 /****************************************************************************
361 * Batch file jump instruction. Not the most efficient algorithm ;-)
362 * Prints error message if the specified label cannot be found - the file pointer is
363 * then at EOF, effectively stopping the batch file.
364 * FIXME: DOS is supposed to allow labels with spaces - we don't.
367 void WCMD_goto (void) {
369 char string
[MAX_PATH
];
371 if (context
!= NULL
) {
372 SetFilePointer (context
-> h
, 0, NULL
, FILE_BEGIN
);
373 while (WCMD_fgets (string
, sizeof(string
), context
-> h
)) {
374 if ((string
[0] == ':') && (strcmp (&string
[1], param1
) == 0)) return;
376 WCMD_output ("Target to GOTO not found\n");
382 /****************************************************************************
385 * Batch file conditional.
386 * FIXME: Much more syntax checking needed!
389 void WCMD_if (char *p
) {
392 int negate
= 0, test
= 0;
393 char condition
[MAX_PATH
], *command
, *s
;
395 if (!lstrcmpi (param1
, "not")) {
397 lstrcpy (condition
, param2
);
400 lstrcpy (condition
, param1
);
402 if (!lstrcmpi (condition
, "errorlevel")) {
403 if (errorlevel
>= atoi(WCMD_parameter (p
, 1+negate
, NULL
))) test
= 1;
405 WCMD_parameter (p
, 2+negate
, &command
);
407 else if (!lstrcmpi (condition
, "exist")) {
408 if ((h
= CreateFile (WCMD_parameter (p
, 1+negate
, NULL
), GENERIC_READ
,
409 FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
,
410 OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
)) != INVALID_HANDLE_VALUE
) {
414 WCMD_parameter (p
, 2+negate
, &command
);
416 else if ((s
= strstr (p
, "=="))) {
418 if (!lstrcmpi (condition
, WCMD_parameter (s
, 0, NULL
))) test
= 1;
419 WCMD_parameter (s
, 1, &command
);
422 WCMD_output ("Syntax error\n");
425 if (test
!= negate
) {
426 command
= strdup (command
);
427 WCMD_process_command (command
);
432 /****************************************************************************
435 * Move a file, directory tree or wildcarded set of files.
436 * FIXME: Needs input and output files to be fully specified.
439 void WCMD_move (void) {
442 char outpath
[MAX_PATH
], inpath
[MAX_PATH
], *infile
;
446 if ((strchr(param1
,'*') != NULL
) || (strchr(param1
,'%') != NULL
)) {
447 WCMD_output ("Wildcards not yet supported\n");
451 /* If no destination supplied, assume current directory */
452 if (param2
[0] == 0x00) {
456 /* If 2nd parm is directory, then use original filename */
457 GetFullPathName (param2
, sizeof(outpath
), outpath
, NULL
);
458 hff
= FindFirstFile (outpath
, &fd
);
459 if (hff
!= INVALID_HANDLE_VALUE
) {
460 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
) {
461 GetFullPathName (param1
, sizeof(inpath
), inpath
, &infile
);
462 strcat (outpath
, "\\");
463 strcat (outpath
, infile
);
468 status
= MoveFile (param1
, outpath
);
469 if (!status
) WCMD_print_error ();
472 /****************************************************************************
475 * Wait for keyboard input.
478 void WCMD_pause (void) {
483 WCMD_output (anykey
);
484 ReadFile (GetStdHandle(STD_INPUT_HANDLE
), string
, sizeof(string
), &count
, NULL
);
487 /****************************************************************************
490 * Delete a directory.
493 void WCMD_remove_dir (void) {
495 if (!RemoveDirectory (param1
)) WCMD_print_error ();
498 /****************************************************************************
502 * FIXME: Needs input and output files to be fully specified.
505 void WCMD_rename (void) {
509 if ((strchr(param1
,'*') != NULL
) || (strchr(param1
,'%') != NULL
)) {
510 WCMD_output ("Wildcards not yet supported\n");
513 status
= MoveFile (param1
, param2
);
514 if (!status
) WCMD_print_error ();
517 /*****************************************************************************
520 * Make a copy of the environment.
522 WCHAR
*WCMD_dupenv( const WCHAR
*env
)
532 len
+= (lstrlenW(&env
[len
]) + 1);
534 env_copy
= LocalAlloc (LMEM_FIXED
, (len
+1) * sizeof (WCHAR
) );
537 WCMD_output ("out of memory\n");
540 memcpy (env_copy
, env
, len
*sizeof (WCHAR
));
546 /*****************************************************************************
549 * setlocal pushes the environment onto a stack
550 * Save the environment as unicode so we don't screw anything up.
552 void WCMD_setlocal (const char *s
) {
554 struct env_stack
*env_copy
;
556 /* DISABLEEXTENSIONS ignored */
558 env_copy
= LocalAlloc (LMEM_FIXED
, sizeof (struct env_stack
));
561 WCMD_output ("out of memory\n");
565 env
= GetEnvironmentStringsW ();
567 env_copy
->strings
= WCMD_dupenv (env
);
568 if (env_copy
->strings
)
570 env_copy
->next
= saved_environment
;
571 saved_environment
= env_copy
;
574 LocalFree (env_copy
);
576 FreeEnvironmentStringsW (env
);
579 /*****************************************************************************
582 inline WCHAR
*WCMD_strchrW(WCHAR
*str
, WCHAR ch
)
593 /*****************************************************************************
596 * endlocal pops the environment off a stack
598 void WCMD_endlocal (void) {
599 WCHAR
*env
, *old
, *p
;
600 struct env_stack
*temp
;
603 if (!saved_environment
)
606 /* pop the old environment from the stack */
607 temp
= saved_environment
;
608 saved_environment
= temp
->next
;
610 /* delete the current environment, totally */
611 env
= GetEnvironmentStringsW ();
612 old
= WCMD_dupenv (GetEnvironmentStringsW ());
615 n
= lstrlenW(&old
[len
]) + 1;
616 p
= WCMD_strchrW(&old
[len
], '=');
620 SetEnvironmentVariableW (&old
[len
], NULL
);
625 FreeEnvironmentStringsW (env
);
627 /* restore old environment */
631 n
= lstrlenW(&env
[len
]) + 1;
632 p
= WCMD_strchrW(&env
[len
], '=');
636 SetEnvironmentVariableW (&env
[len
], p
);
644 /*****************************************************************************
645 * WCMD_setshow_attrib
647 * Display and optionally sets DOS attributes on a file or directory
649 * FIXME: Wine currently uses the Unix stat() function to get file attributes.
650 * As a result only the Readonly flag is correctly reported, the Archive bit
651 * is always set and the rest are not implemented. We do the Right Thing anyway.
653 * FIXME: No SET functionality.
657 void WCMD_setshow_attrib (void) {
662 char flags
[9] = {" "};
664 if (param1
[0] == '-') {
669 if (lstrlen(param1
) == 0) {
670 GetCurrentDirectory (sizeof(param1
), param1
);
671 strcat (param1
, "\\*");
674 hff
= FindFirstFile (param1
, &fd
);
675 if (hff
== INVALID_HANDLE_VALUE
) {
676 WCMD_output ("%s: File Not Found\n",param1
);
680 if (!(fd
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)) {
681 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_HIDDEN
) {
684 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_SYSTEM
) {
687 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_ARCHIVE
) {
690 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_READONLY
) {
693 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_TEMPORARY
) {
696 if (fd
.dwFileAttributes
& FILE_ATTRIBUTE_COMPRESSED
) {
699 WCMD_output ("%s %s\n", flags
, fd
.cFileName
);
700 for (count
=0; count
< 8; count
++) flags
[count
] = ' ';
702 } while (FindNextFile(hff
, &fd
) != 0);
707 /*****************************************************************************
708 * WCMD_setshow_default
710 * Set/Show the current default directory
713 void WCMD_setshow_default (void) {
718 if (strlen(param1
) == 0) {
719 GetCurrentDirectory (sizeof(string
), string
);
720 strcat (string
, "\n");
721 WCMD_output (string
);
724 status
= SetCurrentDirectory (param1
);
733 /****************************************************************************
736 * Set/Show the system date
737 * FIXME: Can't change date yet
740 void WCMD_setshow_date (void) {
742 char curdate
[64], buffer
[64];
745 if (lstrlen(param1
) == 0) {
746 if (GetDateFormat (LOCALE_USER_DEFAULT
, 0, NULL
, NULL
,
747 curdate
, sizeof(curdate
))) {
748 WCMD_output ("Current Date is %s\nEnter new date: ", curdate
);
749 ReadFile (GetStdHandle(STD_INPUT_HANDLE
), buffer
, sizeof(buffer
), &count
, NULL
);
754 else WCMD_print_error ();
761 /****************************************************************************
764 int WCMD_compare( const void *a
, const void *b
)
767 const char * const *str_a
= a
, * const *str_b
= b
;
768 r
= CompareString( LOCALE_USER_DEFAULT
, NORM_IGNORECASE
| SORT_STRINGSORT
,
769 *str_a
, -1, *str_b
, -1 );
770 if( r
== CSTR_LESS_THAN
) return -1;
771 if( r
== CSTR_GREATER_THAN
) return 1;
775 /****************************************************************************
776 * WCMD_setshow_sortenv
778 * sort variables into order for display
780 void WCMD_setshow_sortenv(const char *s
)
782 UINT count
=0, len
=0, i
;
785 /* count the number of strings, and the total length */
787 len
+= (lstrlen(&s
[len
]) + 1);
791 /* add the strings to an array */
792 str
= LocalAlloc (LMEM_FIXED
| LMEM_ZEROINIT
, count
* sizeof (char*) );
796 for( i
=1; i
<count
; i
++ )
797 str
[i
] = str
[i
-1] + lstrlen(str
[i
-1]) + 1;
800 qsort( str
, count
, sizeof (char*), WCMD_compare
);
803 for( i
=0; i
<count
; i
++ )
804 WCMD_output("%s\n", str
[i
] );
809 /****************************************************************************
812 * Set/Show the environment variables
815 void WCMD_setshow_env (char *s
) {
822 if (strlen(param1
) == 0) {
823 env
= GetEnvironmentStrings ();
824 WCMD_setshow_sortenv( env
);
830 /* FIXME: Emulate Win98 for now, ie "SET C" looks ONLY for an
831 environment variable C, whereas on NT it shows ALL variables
834 status
= GetEnvironmentVariable(s
, buffer
, sizeof(buffer
));
836 WCMD_output("%s=%s\n", s
, buffer
);
838 WCMD_output ("Environment variable %s not defined\n", s
);
844 if (strlen(p
) == 0) p
= 0x00;
845 status
= SetEnvironmentVariable (s
, p
);
846 if (!status
) WCMD_print_error();
848 /* WCMD_output (newline); @JED*/
851 /****************************************************************************
854 * Set/Show the path environment variable
857 void WCMD_setshow_path (char *command
) {
862 if (strlen(param1
) == 0) {
863 status
= GetEnvironmentVariable ("PATH", string
, sizeof(string
));
865 WCMD_output ("PATH=%s\n", string
);
868 WCMD_output ("PATH not found\n");
872 status
= SetEnvironmentVariable ("PATH", command
);
873 if (!status
) WCMD_print_error();
877 /****************************************************************************
878 * WCMD_setshow_prompt
880 * Set or show the command prompt.
883 void WCMD_setshow_prompt (void) {
887 if (strlen(param1
) == 0) {
888 SetEnvironmentVariable ("PROMPT", NULL
);
892 while ((*s
== '=') || (*s
== ' ')) s
++;
893 if (strlen(s
) == 0) {
894 SetEnvironmentVariable ("PROMPT", NULL
);
896 else SetEnvironmentVariable ("PROMPT", s
);
900 /****************************************************************************
903 * Set/Show the system time
904 * FIXME: Can't change time yet
907 void WCMD_setshow_time (void) {
909 char curtime
[64], buffer
[64];
913 if (strlen(param1
) == 0) {
915 if (GetTimeFormat (LOCALE_USER_DEFAULT
, 0, &st
, NULL
,
916 curtime
, sizeof(curtime
))) {
917 WCMD_output ("Current Time is %s\nEnter new time: ", curtime
);
918 ReadFile (GetStdHandle(STD_INPUT_HANDLE
), buffer
, sizeof(buffer
), &count
, NULL
);
923 else WCMD_print_error ();
930 /****************************************************************************
933 * Shift batch parameters.
936 void WCMD_shift (void) {
938 if (context
!= NULL
) context
-> shift_count
++;
942 /****************************************************************************
945 * Set the console title
947 void WCMD_title (char *command
) {
948 SetConsoleTitle(command
);
951 /****************************************************************************
954 * Copy a file to standard output.
957 void WCMD_type (void) {
963 h
= CreateFile (param1
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
,
964 FILE_ATTRIBUTE_NORMAL
, NULL
);
965 if (h
== INVALID_HANDLE_VALUE
) {
969 while (ReadFile (h
, buffer
, sizeof(buffer
), &count
, NULL
)) {
970 if (count
== 0) break; /* ReadFile reports success on EOF! */
972 WCMD_output_asis (buffer
);
977 /****************************************************************************
980 * Display verify flag.
981 * FIXME: We don't actually do anything with the verify flag other than toggle
985 void WCMD_verify (char *command
) {
987 static const char *von
= "Verify is ON\n", *voff
= "Verify is OFF\n";
990 count
= strlen(command
);
992 if (verify_mode
) WCMD_output (von
);
993 else WCMD_output (voff
);
996 if (lstrcmpi(command
, "ON") == 0) {
1000 else if (lstrcmpi(command
, "OFF") == 0) {
1004 else WCMD_output ("Verify must be ON or OFF\n");
1007 /****************************************************************************
1010 * Display version info.
1013 void WCMD_version (void) {
1015 WCMD_output (version_string
);
1019 /****************************************************************************
1022 * Display volume info and/or set volume label. Returns 0 if error.
1025 int WCMD_volume (int mode
, char *path
) {
1027 DWORD count
, serial
;
1028 char string
[MAX_PATH
], label
[MAX_PATH
], curdir
[MAX_PATH
];
1030 static char syntax
[] = "Syntax Error\n\n";
1032 if (lstrlen(path
) == 0) {
1033 status
= GetCurrentDirectory (sizeof(curdir
), curdir
);
1035 WCMD_print_error ();
1038 status
= GetVolumeInformation (NULL
, label
, sizeof(label
), &serial
, NULL
,
1042 if ((path
[1] != ':') || (lstrlen(path
) != 2)) {
1043 WCMD_output_asis(syntax
);
1046 wsprintf (curdir
, "%s\\", path
);
1047 status
= GetVolumeInformation (curdir
, label
, sizeof(label
), &serial
, NULL
,
1051 WCMD_print_error ();
1054 WCMD_output ("Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n",
1055 curdir
[0], label
, HIWORD(serial
), LOWORD(serial
));
1057 WCMD_output ("Volume label (11 characters, ENTER for none)?");
1058 ReadFile (GetStdHandle(STD_INPUT_HANDLE
), string
, sizeof(string
), &count
, NULL
);
1060 string
[count
-1] = '\0'; /* ReadFile output is not null-terminated! */
1061 if (string
[count
-2] == '\r') string
[count
-2] = '\0'; /* Under Windoze we get CRLF! */
1063 if (lstrlen(path
) != 0) {
1064 if (!SetVolumeLabel (curdir
, string
)) WCMD_print_error ();
1067 if (!SetVolumeLabel (NULL
, string
)) WCMD_print_error ();