All MCI functions are now cleanly separated.
[wine/multimedia.git] / programs / wcmd / builtins.c
blobefba4cd81bcd656ea5ba5b1cc871c3e053cc6c47
1 /*
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
22 * NOTES:
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.
29 * FIXME:
30 * - No support for pipes, shell parameters
31 * - Lots of functionality missing from builtins
32 * - Messages etc need international support
35 #include "wcmd.h"
37 void WCMD_execute (char *orig_command, char *parameter, char *substitution);
39 extern HINSTANCE hinst;
40 extern char *inbuilt[];
41 extern char nyi[];
42 extern char newline[];
43 extern char version_string[];
44 extern char anykey[];
45 extern int echo_mode, verify_mode;
46 extern char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
47 extern BATCH_CONTEXT *context;
48 extern DWORD errorlevel;
52 /****************************************************************************
53 * WCMD_clear_screen
55 * Clear the terminal screen.
58 void WCMD_clear_screen () {
60 /* Emulate by filling the screen from the top left to bottom right with
61 spaces, then moving the cursor to the top left afterwards */
62 COORD topLeft;
63 long screenSize;
64 CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
65 HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
67 GetConsoleScreenBufferInfo(hStdOut, &consoleInfo);
68 screenSize = consoleInfo.dwSize.X * (consoleInfo.dwSize.Y + 1);
70 topLeft.X = 0;
71 topLeft.Y = 0;
72 FillConsoleOutputCharacter(hStdOut, ' ', screenSize, topLeft, &screenSize);
73 SetConsoleCursorPosition(hStdOut, topLeft);
76 /****************************************************************************
77 * WCMD_change_tty
79 * Change the default i/o device (ie redirect STDin/STDout).
82 void WCMD_change_tty () {
84 WCMD_output (nyi);
88 /****************************************************************************
89 * WCMD_copy
91 * Copy a file or wildcarded set.
92 * FIXME: No wildcard support
95 void WCMD_copy () {
97 DWORD count;
98 WIN32_FIND_DATA fd;
99 HANDLE hff;
100 BOOL force, status;
101 static char *overwrite = "Overwrite file (Y/N)?";
102 char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile;
104 if ((strchr(param1,'*') != NULL) && (strchr(param1,'%') != NULL)) {
105 WCMD_output ("Wildcards not yet supported\n");
106 return;
109 /* If no destination supplied, assume current directory */
110 if (param2[0] == 0x00) {
111 strcpy(param2, ".");
114 GetFullPathName (param2, sizeof(outpath), outpath, NULL);
115 hff = FindFirstFile (outpath, &fd);
116 if (hff != INVALID_HANDLE_VALUE) {
117 if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
118 GetFullPathName (param1, sizeof(inpath), inpath, &infile);
119 strcat (outpath, "\\");
120 strcat (outpath, infile);
122 FindClose (hff);
125 force = (strstr (quals, "/Y") != NULL);
126 if (!force) {
127 hff = FindFirstFile (outpath, &fd);
128 if (hff != INVALID_HANDLE_VALUE) {
129 FindClose (hff);
130 WCMD_output (overwrite);
131 ReadFile (GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string), &count, NULL);
132 if (toupper(string[0]) == 'Y') force = TRUE;
134 else force = TRUE;
136 if (force) {
137 status = CopyFile (param1, outpath, FALSE);
138 if (!status) WCMD_print_error ();
142 /****************************************************************************
143 * WCMD_create_dir
145 * Create a directory.
148 void WCMD_create_dir () {
150 if (!CreateDirectory (param1, NULL)) WCMD_print_error ();
153 /****************************************************************************
154 * WCMD_delete
156 * Delete a file or wildcarded set.
160 void WCMD_delete (int recurse) {
162 WIN32_FIND_DATA fd;
163 HANDLE hff;
164 char fpath[MAX_PATH];
165 char *p;
167 hff = FindFirstFile (param1, &fd);
168 if (hff == INVALID_HANDLE_VALUE) {
169 WCMD_output ("%s :File Not Found\n",param1);
170 return;
172 if ((strchr(param1,'*') == NULL) && (strchr(param1,'?') == NULL)
173 && (!recurse) && (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
174 strcat (param1, "\\*");
175 FindClose(hff);
176 WCMD_delete (1);
177 return;
179 if ((strchr(param1,'*') != NULL) || (strchr(param1,'?') != NULL)) {
180 strcpy (fpath, param1);
181 do {
182 p = strrchr (fpath, '\\');
183 if (p != NULL) {
184 *++p = '\0';
185 strcat (fpath, fd.cFileName);
187 else strcpy (fpath, fd.cFileName);
188 if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
189 if (!DeleteFile (fpath)) WCMD_print_error ();
191 } while (FindNextFile(hff, &fd) != 0);
192 FindClose (hff);
194 else {
195 if (!DeleteFile (param1)) WCMD_print_error ();
196 FindClose (hff);
200 /****************************************************************************
201 * WCMD_echo
203 * Echo input to the screen (or not). We don't try to emulate the bugs
204 * in DOS (try typing "ECHO ON AGAIN" for an example).
207 void WCMD_echo (char *command) {
209 static char *eon = "Echo is ON\n", *eoff = "Echo is OFF\n";
210 int count;
212 count = strlen(command);
213 if (count == 0) {
214 if (echo_mode) WCMD_output (eon);
215 else WCMD_output (eoff);
216 return;
218 if ((count == 1) && (command[0] == '.')) {
219 WCMD_output (newline);
220 return;
222 if (lstrcmpi(command, "ON") == 0) {
223 echo_mode = 1;
224 return;
226 if (lstrcmpi(command, "OFF") == 0) {
227 echo_mode = 0;
228 return;
230 WCMD_output_asis (command);
231 WCMD_output (newline);
235 /**************************************************************************
236 * WCMD_for
238 * Batch file loop processing.
239 * FIXME: We don't exhaustively check syntax. Any command which works in MessDOS
240 * will probably work here, but the reverse is not necessarily the case...
243 void WCMD_for (char *p) {
245 WIN32_FIND_DATA fd;
246 HANDLE hff;
247 char *cmd, *item;
248 char set[MAX_PATH], param[MAX_PATH];
249 int i;
251 if (lstrcmpi (WCMD_parameter (p, 1, NULL), "in")
252 || lstrcmpi (WCMD_parameter (p, 3, NULL), "do")
253 || (param1[0] != '%')) {
254 WCMD_output ("Syntax error\n");
255 return;
257 lstrcpyn (set, WCMD_parameter (p, 2, NULL), sizeof(set));
258 WCMD_parameter (p, 4, &cmd);
259 lstrcpy (param, param1);
262 * If the parameter within the set has a wildcard then search for matching files
263 * otherwise do a literal substitution.
266 i = 0;
267 while (*(item = WCMD_parameter (set, i, NULL))) {
268 if (strpbrk (item, "*?")) {
269 hff = FindFirstFile (item, &fd);
270 if (hff == INVALID_HANDLE_VALUE) {
271 return;
273 do {
274 WCMD_execute (cmd, param, fd.cFileName);
275 } while (FindNextFile(hff, &fd) != 0);
276 FindClose (hff);
278 else {
279 WCMD_execute (cmd, param, item);
281 i++;
285 /*****************************************************************************
286 * WCMD_Execute
288 * Execute a command after substituting variable text for the supplied parameter
291 void WCMD_execute (char *orig_cmd, char *param, char *subst) {
293 char *new_cmd, *p, *s, *dup;
294 int size;
296 size = lstrlen (orig_cmd);
297 new_cmd = (char *) LocalAlloc (LMEM_FIXED | LMEM_ZEROINIT, size);
298 dup = s = strdup (orig_cmd);
300 while ((p = strstr (s, param))) {
301 *p = '\0';
302 size += lstrlen (subst);
303 new_cmd = (char *) LocalReAlloc ((HANDLE)new_cmd, size, 0);
304 strcat (new_cmd, s);
305 strcat (new_cmd, subst);
306 s = p + lstrlen (param);
308 strcat (new_cmd, s);
309 WCMD_process_command (new_cmd);
310 free (dup);
311 LocalFree ((HANDLE)new_cmd);
315 /**************************************************************************
316 * WCMD_give_help
318 * Simple on-line help. Help text is stored in the resource file.
321 void WCMD_give_help (char *command) {
323 int i;
324 char buffer[2048];
326 command = WCMD_strtrim_leading_spaces(command);
327 if (lstrlen(command) == 0) {
328 LoadString (0, 1000, buffer, sizeof(buffer));
329 WCMD_output (buffer);
331 else {
332 for (i=0; i<=WCMD_EXIT; i++) {
333 if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
334 param1, -1, inbuilt[i], -1) == 2) {
335 LoadString (hinst, i, buffer, sizeof(buffer));
336 WCMD_output (buffer);
337 return;
340 WCMD_output ("No help available for %s\n", param1);
342 return;
345 /****************************************************************************
346 * WCMD_go_to
348 * Batch file jump instruction. Not the most efficient algorithm ;-)
349 * Prints error message if the specified label cannot be found - the file pointer is
350 * then at EOF, effectively stopping the batch file.
351 * FIXME: DOS is supposed to allow labels with spaces - we don't.
354 void WCMD_goto () {
356 char string[MAX_PATH];
358 if (context != NULL) {
359 SetFilePointer (context -> h, 0, NULL, FILE_BEGIN);
360 while (WCMD_fgets (string, sizeof(string), context -> h)) {
361 if ((string[0] == ':') && (strcmp (&string[1], param1) == 0)) return;
363 WCMD_output ("Target to GOTO not found\n");
365 return;
369 /****************************************************************************
370 * WCMD_if
372 * Batch file conditional.
373 * FIXME: Much more syntax checking needed!
376 void WCMD_if (char *p) {
378 HANDLE h;
379 int negate = 0, test = 0;
380 char condition[MAX_PATH], *command, *s;
382 if (!lstrcmpi (param1, "not")) {
383 negate = 1;
384 lstrcpy (condition, param2);
386 else {
387 lstrcpy (condition, param1);
389 if (!lstrcmpi (condition, "errorlevel")) {
390 if (errorlevel >= atoi(WCMD_parameter (p, 1+negate, NULL))) test = 1;
391 return;
393 else if (!lstrcmpi (condition, "exist")) {
394 if ((h = CreateFile (WCMD_parameter (p, 1+negate, NULL), GENERIC_READ, 0, NULL,
395 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE) {
396 CloseHandle (h);
397 test = 1;
400 else if ((s = strstr (p, "=="))) {
401 s += 2;
402 if (!lstrcmpi (condition, WCMD_parameter (s, 0, NULL))) test = 1;
404 else {
405 WCMD_output ("Syntax error\n");
406 return;
408 if (test != negate) {
409 WCMD_parameter (p, 2+negate, &s);
410 command = strdup (s);
411 WCMD_process_command (command);
412 free (command);
416 /****************************************************************************
417 * WCMD_move
419 * Move a file, directory tree or wildcarded set of files.
420 * FIXME: Needs input and output files to be fully specified.
423 void WCMD_move () {
425 int status;
426 char outpath[MAX_PATH], inpath[MAX_PATH], *infile;
427 WIN32_FIND_DATA fd;
428 HANDLE hff;
430 if ((strchr(param1,'*') != NULL) || (strchr(param1,'%') != NULL)) {
431 WCMD_output ("Wildcards not yet supported\n");
432 return;
435 /* If no destination supplied, assume current directory */
436 if (param2[0] == 0x00) {
437 strcpy(param2, ".");
440 /* If 2nd parm is directory, then use original filename */
441 GetFullPathName (param2, sizeof(outpath), outpath, NULL);
442 hff = FindFirstFile (outpath, &fd);
443 if (hff != INVALID_HANDLE_VALUE) {
444 if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
445 GetFullPathName (param1, sizeof(inpath), inpath, &infile);
446 strcat (outpath, "\\");
447 strcat (outpath, infile);
449 FindClose (hff);
452 status = MoveFile (param1, outpath);
453 if (!status) WCMD_print_error ();
456 /****************************************************************************
457 * WCMD_pause
459 * Wait for keyboard input.
462 void WCMD_pause () {
464 DWORD count;
465 char string[32];
467 WCMD_output (anykey);
468 ReadFile (GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string), &count, NULL);
471 /****************************************************************************
472 * WCMD_remove_dir
474 * Delete a directory.
477 void WCMD_remove_dir () {
479 if (!RemoveDirectory (param1)) WCMD_print_error ();
482 /****************************************************************************
483 * WCMD_rename
485 * Rename a file.
486 * FIXME: Needs input and output files to be fully specified.
489 void WCMD_rename () {
491 int status;
493 if ((strchr(param1,'*') != NULL) || (strchr(param1,'%') != NULL)) {
494 WCMD_output ("Wildcards not yet supported\n");
495 return;
497 status = MoveFile (param1, param2);
498 if (!status) WCMD_print_error ();
501 /*****************************************************************************
502 * WCMD_setshow_attrib
504 * Display and optionally sets DOS attributes on a file or directory
506 * FIXME: Wine currently uses the Unix stat() function to get file attributes.
507 * As a result only the Readonly flag is correctly reported, the Archive bit
508 * is always set and the rest are not implemented. We do the Right Thing anyway.
510 * FIXME: No SET functionality.
514 void WCMD_setshow_attrib () {
516 DWORD count;
517 HANDLE hff;
518 WIN32_FIND_DATA fd;
519 char flags[9] = {" "};
521 if (param1[0] == '-') {
522 WCMD_output (nyi);
523 return;
526 if (lstrlen(param1) == 0) {
527 GetCurrentDirectory (sizeof(param1), param1);
528 strcat (param1, "\\*");
531 hff = FindFirstFile (param1, &fd);
532 if (hff == INVALID_HANDLE_VALUE) {
533 WCMD_output ("%s: File Not Found\n",param1);
535 else {
536 do {
537 if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
538 if (fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) {
539 flags[0] = 'H';
541 if (fd.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) {
542 flags[1] = 'S';
544 if (fd.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) {
545 flags[2] = 'A';
547 if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
548 flags[3] = 'R';
550 if (fd.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) {
551 flags[4] = 'T';
553 if (fd.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) {
554 flags[5] = 'C';
556 WCMD_output ("%s %s\n", flags, fd.cFileName);
557 for (count=0; count < 8; count++) flags[count] = ' ';
559 } while (FindNextFile(hff, &fd) != 0);
561 FindClose (hff);
564 /*****************************************************************************
565 * WCMD_setshow_default
567 * Set/Show the current default directory
570 void WCMD_setshow_default () {
572 BOOL status;
573 char string[1024];
575 if (strlen(param1) == 0) {
576 GetCurrentDirectory (sizeof(string), string);
577 strcat (string, "\n");
578 WCMD_output (string);
580 else {
581 status = SetCurrentDirectory (param1);
582 if (!status) {
583 WCMD_print_error ();
584 return;
587 return;
590 /****************************************************************************
591 * WCMD_setshow_date
593 * Set/Show the system date
594 * FIXME: Can't change date yet
597 void WCMD_setshow_date () {
599 char curdate[64], buffer[64];
600 DWORD count;
602 if (lstrlen(param1) == 0) {
603 if (GetDateFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL,
604 curdate, sizeof(curdate))) {
605 WCMD_output ("Current Date is %s\nEnter new date: ", curdate);
606 ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer), &count, NULL);
607 if (count > 2) {
608 WCMD_output (nyi);
611 else WCMD_print_error ();
613 else {
614 WCMD_output (nyi);
618 /****************************************************************************
619 * WCMD_setshow_env
621 * Set/Show the environment variables
623 * FIXME: need to sort variables into order for display?
626 void WCMD_setshow_env (char *s) {
628 LPVOID env;
629 char *p;
630 int status;
631 char buffer[1048];
633 if (strlen(param1) == 0) {
634 env = GetEnvironmentStrings ();
635 p = (char *) env;
636 while (*p) {
637 WCMD_output ("%s\n", p);
638 p += lstrlen(p) + 1;
641 else {
642 p = strchr (s, '=');
643 if (p == NULL) {
645 /* FIXME: Emulate Win98 for now, ie "SET C" looks ONLY for an
646 environment variable C, whereas on NT it shows ALL variables
647 starting with C.
649 status = GetEnvironmentVariable(s, buffer, sizeof(buffer));
650 if (status) {
651 WCMD_output("%s=%s\n", s, buffer);
652 } else {
653 WCMD_output ("Environment variable %s not defined\n", s);
655 return;
657 *p++ = '\0';
659 if (strlen(p) == 0) p = 0x00;
660 status = SetEnvironmentVariable (s, p);
661 if (!status) WCMD_print_error();
663 /* WCMD_output (newline); @JED*/
666 /****************************************************************************
667 * WCMD_setshow_path
669 * Set/Show the path environment variable
672 void WCMD_setshow_path () {
674 char string[1024];
675 DWORD status;
677 if (strlen(param1) == 0) {
678 status = GetEnvironmentVariable ("PATH", string, sizeof(string));
679 if (status != 0) {
680 WCMD_output ("PATH=%s\n", string);
682 else {
683 WCMD_output ("PATH not found\n");
686 else {
687 status = SetEnvironmentVariable ("PATH", param1);
688 if (!status) WCMD_print_error();
692 /****************************************************************************
693 * WCMD_setshow_prompt
695 * Set or show the command prompt.
698 void WCMD_setshow_prompt () {
700 char *s;
702 if (strlen(param1) == 0) {
703 SetEnvironmentVariable ("PROMPT", NULL);
705 else {
706 s = param1;
707 while ((*s == '=') || (*s == ' ')) s++;
708 if (strlen(s) == 0) {
709 SetEnvironmentVariable ("PROMPT", NULL);
711 else SetEnvironmentVariable ("PROMPT", s);
715 /****************************************************************************
716 * WCMD_setshow_time
718 * Set/Show the system time
719 * FIXME: Can't change time yet
722 void WCMD_setshow_time () {
724 char curtime[64], buffer[64];
725 DWORD count;
726 SYSTEMTIME st;
728 if (strlen(param1) == 0) {
729 GetLocalTime(&st);
730 if (GetTimeFormat (LOCALE_USER_DEFAULT, 0, &st, NULL,
731 curtime, sizeof(curtime))) {
732 WCMD_output ("Current Time is %s\nEnter new time: ", curtime);
733 ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer), &count, NULL);
734 if (count > 2) {
735 WCMD_output (nyi);
738 else WCMD_print_error ();
740 else {
741 WCMD_output (nyi);
745 /****************************************************************************
746 * WCMD_shift
748 * Shift batch parameters.
751 void WCMD_shift () {
753 if (context != NULL) context -> shift_count++;
757 /****************************************************************************
758 * WCMD_title
760 * Set the console title
762 void WCMD_title (char *command) {
763 SetConsoleTitle(command);
766 /****************************************************************************
767 * WCMD_type
769 * Copy a file to standard output.
772 void WCMD_type () {
774 HANDLE h;
775 char buffer[512];
776 DWORD count;
778 h = CreateFile (param1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
779 FILE_ATTRIBUTE_NORMAL, NULL);
780 if (h == INVALID_HANDLE_VALUE) {
781 WCMD_print_error ();
782 return;
784 while (ReadFile (h, buffer, sizeof(buffer), &count, NULL)) {
785 if (count == 0) break; /* ReadFile reports success on EOF! */
786 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), buffer, count, &count, NULL);
788 CloseHandle (h);
791 /****************************************************************************
792 * WCMD_verify
794 * Display verify flag.
795 * FIXME: We don't actually do anything with the verify flag other than toggle
796 * it...
799 void WCMD_verify (char *command) {
801 static char *von = "Verify is ON\n", *voff = "Verify is OFF\n";
802 int count;
804 count = strlen(command);
805 if (count == 0) {
806 if (verify_mode) WCMD_output (von);
807 else WCMD_output (voff);
808 return;
810 if (lstrcmpi(command, "ON") == 0) {
811 verify_mode = 1;
812 return;
814 else if (lstrcmpi(command, "OFF") == 0) {
815 verify_mode = 0;
816 return;
818 else WCMD_output ("Verify must be ON or OFF\n");
821 /****************************************************************************
822 * WCMD_version
824 * Display version info.
827 void WCMD_version () {
829 WCMD_output (version_string);
833 /****************************************************************************
834 * WCMD_volume
836 * Display volume info and/or set volume label. Returns 0 if error.
839 int WCMD_volume (int mode, char *path) {
841 DWORD count, serial;
842 char string[MAX_PATH], label[MAX_PATH], curdir[MAX_PATH];
843 BOOL status;
844 static char syntax[] = "Syntax Error\n\n";
846 if (lstrlen(path) == 0) {
847 status = GetCurrentDirectory (sizeof(curdir), curdir);
848 if (!status) {
849 WCMD_print_error ();
850 return 0;
852 status = GetVolumeInformation (NULL, label, sizeof(label), &serial, NULL,
853 NULL, NULL, 0);
855 else {
856 if ((path[1] != ':') || (lstrlen(path) != 2)) {
857 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), syntax, strlen(syntax), &count, NULL);
858 return 0;
860 wsprintf (curdir, "%s\\", path);
861 status = GetVolumeInformation (curdir, label, sizeof(label), &serial, NULL,
862 NULL, NULL, 0);
864 if (!status) {
865 WCMD_print_error ();
866 return 0;
868 WCMD_output ("Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n",
869 curdir[0], label, HIWORD(serial), LOWORD(serial));
870 if (mode) {
871 WCMD_output ("Volume label (11 characters, ENTER for none)?");
872 ReadFile (GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string), &count, NULL);
873 if (count > 1) {
874 string[count-1] = '\0'; /* ReadFile output is not null-terminated! */
875 if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */
877 if (lstrlen(path) != 0) {
878 if (!SetVolumeLabel (curdir, string)) WCMD_print_error ();
880 else {
881 if (!SetVolumeLabel (NULL, string)) WCMD_print_error ();
884 return 1;