2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
6 /******************************************************************************
27 DRIVE -- The volume to rename
42 ******************************************************************************/
45 #include <dos/dosextens.h>
46 #include <dos/rdargs.h>
47 #include <dos/stdio.h>
48 #include <proto/dos.h>
49 #include <proto/exec.h>
52 const TEXT version
[] = "$VER: Relabel 41.1 (2.6.2000)\n";
54 enum { ARG_DRIVE
= 0, ARG_NAME
};
60 int retval
= RETURN_FAIL
;
61 IPTR args
[] = { (IPTR
) NULL
, (IPTR
) NULL
};
64 rda
= ReadArgs("DRIVE/A,NAME/A", args
, NULL
);
68 if(strchr((STRPTR
)args
[ARG_NAME
], ':') == NULL
)
70 ULONG len
= strlen((STRPTR
)args
[ARG_DRIVE
]);
74 if (!len
|| ((STRPTR
)args
[ARG_DRIVE
])[len
- 1] != ':')
78 memcpy(tmp
, (STRPTR
)args
[ARG_DRIVE
], len
);
81 dl
= LockDosList(LDF_READ
| LDF_DEVICES
| LDF_VOLUMES
);
82 dl
= FindDosEntry(dl
, tmp
, LDF_DEVICES
| LDF_VOLUMES
);
83 UnLockDosList(LDF_READ
| LDF_DEVICES
| LDF_VOLUMES
);
87 if (Relabel((STRPTR
)args
[ARG_DRIVE
], (STRPTR
)args
[ARG_NAME
]))
93 PrintFault(IoErr(), NULL
);
99 PutStr("Invalid device or volume name\n");
105 PutStr("':' is not a valid character in a volume name.\n");
106 retval
= RETURN_FAIL
;
111 PrintFault(IoErr(), "Relabel");
112 retval
= RETURN_FAIL
;