revert between 56095 -> 55830 in arch
[AROS.git] / workbench / c / AddBuffers.c
bloba634a08b5f193aa4a0b03c745b81b41820f9694f
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: AddBuffers CLI command
6 Lang: English
7 */
10 /******************************************************************************
12 NAME
14 AddBuffers (drive) [(N)]
16 SYNOPSIS
18 DRIVE/A, BUFFERS/N
20 LOCATION
24 FUNCTION
26 Add buffers to the list of available buffers for a specific
27 drive. Adding buffers speeds disk access but has the drawback
28 of using up system memory (typically 512 bytes per buffer).
29 Specifying a negative number subtracts buffers from the drive.
30 If only the DRIVE argument is specified, the number of
31 buffers for that drive are displayed without changing the buffer
32 allocation.
34 INPUTS
36 DRIVE -- the drive to alter the buffer allocation of
37 BUFFERS -- the number of buffers to add (or subtract in case of
38 a negative number) to a drive.
40 RESULT
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 INTERNALS
52 HISTORY
54 ******************************************************************************/
56 #include <proto/dos.h>
57 #include <dos/dos.h>
60 const TEXT version[] = "$VER: AddBuffers 41.2 (2.4.2014)\n";
62 #define ARG_TEMPLATE "DRIVE/A,BUFFERS/N"
64 enum
66 ARG_DRIVE = 0,
67 ARG_BUFFERS,
68 NOOFARGS
72 int __nocommandline = 1;
74 int main(void)
76 IPTR args[NOOFARGS] = { (IPTR)NULL, (IPTR)0 };
77 struct RDArgs *rda;
79 LONG return_code = RETURN_OK;
80 LONG error = 0;
81 ULONG buffers = 0;
83 rda = ReadArgs(ARG_TEMPLATE, args, NULL);
85 if (rda != NULL)
87 STRPTR drive = (STRPTR)args[ARG_DRIVE];
88 ULONG *bufsptr = (ULONG *)args[ARG_BUFFERS];
90 if (bufsptr != NULL)
92 buffers = *bufsptr;
95 if(AddBuffers(drive, buffers))
97 Printf("%s has %ld buffers\n", drive, IoErr());
99 else
101 error = IoErr();
102 return_code = RETURN_FAIL;
105 FreeArgs(rda);
107 else
109 error = IoErr();
110 return_code = RETURN_FAIL;
113 if (error != 0)
114 PrintFault(IoErr(), "AddBuffers");
115 return return_code;