Changeset 48
- Timestamp:
- Sep 25, 2019, 12:43:50 AM (6 years ago)
- Location:
- rxutilex/trunk
- Files:
-
- 5 edited
-
rxutilex.c (modified) (5 diffs)
-
rxutilex.def (modified) (2 diffs)
-
rxutilex.txt (modified) (3 diffs)
-
test1 (modified) ( previous)
-
testlib.cmd (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rxutilex/trunk/rxutilex.c
r47 r48 1 1 /****************************************************************************** 2 2 * REXX Utility Functions - Extended (RXUTILEX.DLL) * 3 * (C) 2011, 201 7Alex Taylor. *3 * (C) 2011, 2019 Alex Taylor. * 4 4 * * 5 5 * LICENSE: * … … 147 147 "Sys2Close", 148 148 "Sys2Seek", 149 "Sys2SetSize", 149 150 "Sys2BytesRemaining", 150 151 "Sys2Read", … … 196 197 RexxFunctionHandler Sys2Write; 197 198 RexxFunctionHandler Sys2SyncBuffer; 199 RexxFunctionHandler Sys2SetSize; 198 200 199 201 … … 202 204 203 205 #ifndef LEGACY_C_LOCALE 204 int GetLocaleString( PSZ *ppszItem, LocaleItem item );206 int GetLocaleString( PSZ *ppszItem, LocaleItem item ); 205 207 void GroupNumber( PSZ buf, ULONGLONG val, PSZ sep ); 206 208 #endif … … 2208 2210 sprintf( achActual, "%lld", llActual ); 2209 2211 SaveResultString( prsResult, achActual, strlen(achActual) ); // 2016-02-20 SHL 2212 2213 return ( 0 ); 2214 } 2215 2216 2217 /* ------------------------------------------------------------------------- * 2218 * Sys2SetSize * 2219 * * 2220 * Wrapper to DosSetFileSizeL: set the size of a file opened with Sys2Open. * 2221 * * 2222 * REXX ARGUMENTS: * 2223 * 1. File handle (returned by Sys2Open) (REQUIRED) * 2224 * 2. The new size of the file (REQUIRED) * 2225 * * 2226 * REXX RETURN VALUE: * 2227 * 1 on success, or 0 if an error occurred. * 2228 * ------------------------------------------------------------------------- */ 2229 ULONG APIENTRY Sys2SetSize( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 2230 { 2231 HFILE hf; 2232 LONGLONG llSize; 2233 APIRET rc; 2234 2235 // Reset the error indicator 2236 WriteErrorCode( 0, NULL ); 2237 2238 // Make sure we have two valid arguments 2239 if ( argc < 2 || ( !RXVALIDSTRING(argv[0]) ) || ( !RXVALIDSTRING(argv[1]) )) 2240 return ( 40 ); 2241 2242 // First argument: file handle 2243 if (( sscanf( argv[0].strptr, "%8X", &hf )) != 1 ) return ( 40 ); 2244 2245 // Second argument: requested size 2246 if (( sscanf( argv[1].strptr, "%lld", &llSize )) != 1 ) return ( 40 ); 2247 2248 rc = DosSetFileSizeL( hf, llSize ); 2249 if ( rc != NO_ERROR ) { 2250 WriteErrorCode( rc, "DosSetFileSizeL"); 2251 SaveResultString( prsResult, PSZ_ZERO, 1 ); 2252 } 2253 else { 2254 SaveResultString( prsResult, PSZ_ONE, 1 ); 2255 } 2210 2256 2211 2257 return ( 0 ); -
rxutilex/trunk/rxutilex.def
r47 r48 1 1 LIBRARY RXUTILEX INITINSTANCE TERMINSTANCE 2 2 DATA MULTIPLE NONSHARED 3 DESCRIPTION '@#Alex Taylor:0.1.7#@##1## 2 2 Sep 2019 23:22:58reinforce::::::@@Extended REXX Utility Functions'3 DESCRIPTION '@#Alex Taylor:0.1.7#@##1## 24 Sep 2019 18:41:10 reinforce::::::@@Extended REXX Utility Functions' 4 4 5 5 EXPORTS Sys2LoadFuncs … … 33 33 Sys2QuerySysValue 34 34 Sys2Exec 35 35 Sys2SetSize -
rxutilex/trunk/rxutilex.txt
r47 r48 172 172 173 173 Executes an external program and returns the process ID or termination 174 code. Wrapper to DosExecPgm. If the called program requires user input, 175 it must be the same type (PM or text mode) as the program which calls this 176 function. 174 code. Wrapper to DosExecPgm(). Note that text mode programs requiring 175 user input cannot be started from a PM program using this function; 176 they can only be started from another text mode program (in which case 177 it is inadvisable to start them using any mode other than EXEC_SYNC). 177 178 178 179 REXX ARGUMENTS: … … 687 688 688 689 ------------------------------------------------------------------------- 690 Sys2SetSize 691 692 Set the size of a file to a specific number of bytes; files larger than 693 2GB are supported (this function is a wrapper to DosSetFileSizeL). 694 695 REXX ARGUMENTS: 696 1. File handle (returned by Sys2Open). (REQUIRED) 697 2. The new file size, in bytes. (REQUIRED) 698 699 REXX RETURN VALUE: 700 1 on success, or 0 if an error occurred. 701 702 703 ------------------------------------------------------------------------- 689 704 Sys2SyncBuffer 690 705 … … 700 715 REXX RETURN VALUE: 1 on success, 0 on failure 701 716 717 702 718 ------------------------------------------------------------------------- 703 719 Sys2Version -
rxutilex/trunk/testlib.cmd
r47 r48 58 58 say 'Started program with PID =' pid 59 59 60 /* 61 hf = Sys2Open('test1') 62 CALL Sys2SetSize hf, 100 63 CALL Sys2Close hf 64 */ 65 60 66 call Sys2DropFuncs 61 67 return 0
Note:
See TracChangeset
for help on using the changeset viewer.
