Changeset 5
- Timestamp:
- Apr 4, 2013, 9:28:32 PM (12 years ago)
- Location:
- rxprtutl/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
rxprtutl/trunk/rxprtutl.c
r3 r5 60 60 #define SZ_LIBRARY_NAME "RXPRTUTL" // Name of this library 61 61 #define SZ_ERROR_NAME "RPUERROR" // REXX variable used to store error codes 62 #define SZ_VERSION "0. 1.0" // Current version of this library62 #define SZ_VERSION "0.2.0" // Current version of this library 63 63 64 64 #define APPNAME_LEAD_STR "PM_" … … 88 88 #define US_PRTINFO_MAXZ 180 // ...of a printer info string 89 89 #define US_PORT_MAXZ 64 // ...of a port name 90 #define US_SS_MAXZ 256 // ...of a default WPS setup string 90 91 91 92 // List of functions to be registered by RPULoadFuncs 92 93 static PSZ RxFunctionTbl[] = { 93 94 "RPUDropFuncs", 94 "RPUEnum Devices",95 "RPUEnumModels", 95 96 "RPUEnumDrivers", 96 97 "RPUEnumPorts", 97 98 "RPUEnumPrinters", 98 "RPUHoldQueue", 99 "RPUQueueDefault", 100 "RPUQueueHold", 101 "RPUOpenView", 99 102 "RPUPortDialog", 100 103 "RPUPortInstall", 101 104 "RPUPortSet", 102 "RPUPrinterDefault", 103 "RPUPrinterOpen", 105 "RPUPrinterCreate", 104 106 "RPUPrinterQuery", 105 107 "RPUVersion" … … 113 115 RexxFunctionHandler RPUDropFuncs; 114 116 RexxFunctionHandler RPUVersion; 115 RexxFunctionHandler RPUEnum Devices;117 RexxFunctionHandler RPUEnumModels; 116 118 RexxFunctionHandler RPUEnumDrivers; 117 119 RexxFunctionHandler RPUEnumPorts; 118 120 RexxFunctionHandler RPUEnumPrinters; 119 RexxFunctionHandler RPUHoldQueue; 120 RexxFunctionHandler RPUPrinterOpen; 121 RexxFunctionHandler RPUOpenView; 121 122 RexxFunctionHandler RPUPortDialog; 122 123 RexxFunctionHandler RPUPortInstall; 123 124 RexxFunctionHandler RPUPortSet; 125 RexxFunctionHandler RPUPrinterCreate; 124 126 RexxFunctionHandler RPUPrinterQuery; 125 RexxFunctionHandler RPUPrinterDefault; 127 RexxFunctionHandler RPUQueueDefault; 128 RexxFunctionHandler RPUQueueHold; 126 129 127 130 // TODO … … 219 222 220 223 /* ------------------------------------------------------------------------- * 221 * RPUEnum Devices*222 * * 223 * Gets a list of the printer devices (models) supported by the specified*224 * print driver.*224 * RPUEnumModels * 225 * * 226 * Gets a list of the printer models supported by the specified print * 227 * driver. * 225 228 * * 226 229 * REXX ARGUMENTS: * … … 231 234 * 1 on success, or 0 if an error occurred. * 232 235 * ------------------------------------------------------------------------- */ 233 ULONG APIENTRY RPUEnum Devices( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult )236 ULONG APIENTRY RPUEnumModels( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 234 237 { 235 238 HAB hab; // desktop anchor-block handle … … 655 658 656 659 /* ------------------------------------------------------------------------- * 657 * RPUPrinterQuery * 658 * * 659 * Gets information about the specified printer device. * 660 * * 661 * (stem).i.!description Printer description (name of WPS object) * 662 * (stem).i.!port Name of the port the printer is using * 663 * (stem).i.!driver List of the drivers used by this printer * 664 * TODO: * 665 * (stem).i.!flags Zero or more of the following flags (any order): * 666 * E A printer error has occurred * 667 * H Printer destination is paused * 668 * I Intervention required * 669 * N Printer has raised a notification alert * 670 * O Printer is offline * 671 * P Printer is out of paper * 672 * X Printer is not processing/paused * 673 * * 674 * REXX ARGUMENTS: * 675 * 1. The name of the printer device being queried. (REQUIRED) * 676 * 2. The name of the stem in which to return the results. (REQUIRED) * 677 * * 678 * REXX RETURN VALUE: * 679 * 1 on success, or 0 if an error occurred. * 680 * ------------------------------------------------------------------------- */ 681 ULONG APIENTRY RPUPrinterQuery( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 682 { 683 PPRDINFO3 pInfo = NULL; 684 PVOID pbuf = NULL; 685 ULONG cbBuf = 0, 686 cbNeeded = 0; 687 PSZ pszDeviceName; 688 CHAR szStem[ US_STEM_MAXZ ]; // compound variable stem name 689 SPLERR rc; 690 691 692 // Reset the error indicator 693 WriteErrorCode( 0, NULL ); 694 695 // Validate the REXX arguments 696 if (( argc != 2 ) || 697 ( ! RXVALIDSTRING( argv[0] )) || ( ! RXVALIDSTRING( argv[1] ))) 698 return ( 40 ); 699 700 pszDeviceName = argv[0].strptr; 701 //printf("Device: \"%s\"\n", pszDeviceName ); 702 703 // Initialize the result stem name 704 if ( RXSTRLEN(argv[1]) > US_STEM_MAXZ ) return ( 40 ); 705 if ( argv[1].strptr[ argv[1].strlength-1 ] == '.') argv[1].strlength--; 706 strncpy( szStem, argv[1].strptr, RXSTRLEN( argv[1] )); 707 szStem[ RXSTRLEN( argv[1] ) ] = '\0'; 708 709 710 // Query the amount of available data 711 rc = SplQueryDevice( NULL, pszDeviceName, 3L, NULL, 0L, &cbNeeded ); 712 if (( rc != ERROR_MORE_DATA ) && ( rc != NERR_BufTooSmall )) 713 { 714 WriteErrorCode( rc, "SplQueryDevice"); 715 MAKERXSTRING( *prsResult, "0", 1 ); 716 return ( 0 ); 717 } 718 719 // Now get the actual data 720 pbuf = malloc( cbNeeded ); 721 if ( !pbuf ) { 722 WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc"); 723 MAKERXSTRING( *prsResult, "0", 1 ); 724 return ( 0 ); 725 } 726 cbBuf = cbNeeded; 727 rc = SplQueryDevice( NULL, pszDeviceName, 3L, pbuf, cbBuf, &cbNeeded ); 728 if ( rc == NO_ERROR ) { 729 pInfo = (PPRDINFO3) pbuf; 730 WriteCompoundVariable( szStem, "!name", pInfo->pszPrinterName ); 731 WriteCompoundVariable( szStem, "!port", pInfo->pszLogAddr ); 732 WriteCompoundVariable( szStem, "!description", pInfo->pszComment ); 733 WriteCompoundVariable( szStem, "!drivers", pInfo->pszDrivers ); 734 MAKERXSTRING( *prsResult, "1", 1 ); 735 } 736 else { 737 WriteErrorCode( rc, "SplQueryDevice"); 738 MAKERXSTRING( *prsResult, "0", 1 ); 739 } 740 741 free( pbuf ); 742 return ( 0 ); 743 } 744 745 746 /* ------------------------------------------------------------------------- * 747 * RPUPrinterOpen * 660 * RPUOpenView * 748 661 * * 749 662 * Opens the requested view of the WPS object corresponding to the specified * … … 763 676 * 1 on success, or 0 if an error occurred. * 764 677 * ------------------------------------------------------------------------- */ 765 ULONG APIENTRY RPU PrinterOpen( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult )678 ULONG APIENTRY RPUOpenView( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 766 679 { 767 680 HOBJECT hObj; … … 807 720 808 721 /* ------------------------------------------------------------------------- * 809 * RPUPrinterDefault *810 * *811 * Sets the requested printer queue as the system default printer. *812 * *813 * REXX ARGUMENTS: *814 * 1. The name of the printer queue to set as default. (REQUIRED) *815 * *816 * REXX RETURN VALUE: *817 * 1 on success, or 0 if an error occurred. *818 * ------------------------------------------------------------------------- */819 ULONG APIENTRY RPUPrinterDefault( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult )820 {821 HOBJECT hObj;822 BOOL fRC;823 824 // Reset the error indicator825 WriteErrorCode( 0, NULL );826 827 // Make sure we have at least one valid argument (the queue name)828 if ( argc != 1 || ( !RXVALIDSTRING(argv[0]) )) return ( 40 );829 pszName = argv[0].strptr;830 831 hObj = PrinterObjectHandle( pszName );832 if ( !hObj ) return ( 40 );833 834 fRC = WinSetObjectData( hObj, "APPDEFAULT=YES;");835 836 MAKERXSTRING( *prsResult, fRC? "1": "0", 1 );837 return ( 0 );838 }839 840 841 842 /* ------------------------------------------------------------------------- *843 * RPUHoldQueue *844 * *845 * Holds or releases the specified print queue. *846 * *847 * REXX ARGUMENTS: *848 * 1. The name of the printer queue to hold or release. (REQUIRED) *849 * 2. Action flag, one of: *850 * Y Hold printer (DEFAULT) *851 * N Release printer *852 * *853 * REXX RETURN VALUE: *854 * 1 on success, or 0 if an error occurred. *855 * ------------------------------------------------------------------------- */856 ULONG APIENTRY RPUHoldQueue( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult )857 {858 PSZ pszQueueName; // Print queue name859 BOOL fHold = TRUE;860 SPLERR rc;861 862 863 // Reset the error indicator864 WriteErrorCode( 0, NULL );865 866 // Make sure we have at least one valid argument (the queue name)867 if ( argc < 1 || argc > 2 || ( !RXVALIDSTRING(argv[0]) )) return ( 40 );868 pszQueueName = argv[0].strptr;869 870 // Second argument: view (optional, but must be correct if specified)871 if ( argc == 2 ) {872 if ( RXVALIDSTRING(argv[1]) ) {873 switch ( argv[1].strptr[0] ) {874 case 'y':875 case 'Y': fHold = TRUE; break;876 case 'n':877 case 'N': fHold = FALSE; break;878 default : return ( 40 );879 }880 }881 else return ( 40 );882 }883 884 rc = fHold ? SplHoldQueue( NULL, pszQueueName ) :885 SplReleaseQueue( NULL, pszQueueName );886 if ( rc != NO_ERROR ) {887 WriteErrorCode( rc, fHold ? "SplHoldQueue" : "SplReleaseQueue");888 MAKERXSTRING( *prsResult, "0", 1 );889 }890 else MAKERXSTRING( *prsResult, "1", 1 );891 892 return ( 0 );893 }894 895 896 /* ------------------------------------------------------------------------- *897 722 * RPUPortInstall * 898 723 * * … … 1182 1007 1183 1008 1009 /* ------------------------------------------------------------------------- * 1010 * RPUPrinterCreate * 1011 * * 1012 * Creates a new local printer object. The associated print queue and * 1013 * device are also created if they do not exist. However, the associated * 1014 * output port must exist, and the specified printer driver/model must have * 1015 * been installed already. * 1016 * * 1017 * The WPS object is created with default settings, other than those which * 1018 * are specified here. * 1019 * * 1020 * This function will not create a LAN printer object. Use the function * 1021 * RPUPrinterCreateRemote (not yet implemented) for that purpose. * 1022 * * 1023 * REXX ARGUMENTS: * 1024 * 1. The name of the print queue, to be created if necessary. (REQUIRED) * 1025 * 2. The "physical name" of the printer device, ditto. (REQUIRED) * 1026 * 3. The name of the printer port, which must exist already. (REQUIRED) * 1027 * 4. The default printer driver.model to be associated with * 1028 * the device. If specified, this must be installed in the * 1029 * system already. If NOT specified, IBMNULL will be assumed * 1030 * if the specified printer device does not already exist. (OPTIONAL) * 1031 * 5. The printer object title (i.e. human-readable name). If * 1032 * not specified, the physical name will be used. (OPTIONAL) * 1033 * 6. The printer's WPS object ID (max length 225). (OPTIONAL) * 1034 * * 1035 * REXX RETURN VALUE: * 1036 * 1 on success, or 0 if an error occurred. * 1037 * ------------------------------------------------------------------------- */ 1038 ULONG APIENTRY RPUPrinterCreate( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 1039 { 1040 PRDINFO3 devinfo = {0}; 1041 PRQINFO3 qinfo = {0}; 1042 ULONG cbBuf = 0; 1043 BOOL fNewD = FALSE, 1044 fNewQ = FALSE; 1045 PSZ pszQueueName = NULL, 1046 pszDeviceName = NULL, 1047 pszPortName = NULL, 1048 pszModel = NULL, 1049 pszTitle = NULL, 1050 pszOID = NULL; 1051 CHAR szSetup[ US_SS_MAXZ ] = {0}; 1052 SPLERR rc; 1053 1054 1055 // Reset the error indicator 1056 WriteErrorCode( 0, NULL ); 1057 1058 // Validate the REXX arguments 1059 if (( argc < 3 ) || ( argc > 6 ) || ( ! RXVALIDSTRING( argv[0] )) || 1060 ( ! RXVALIDSTRING( argv[1] )) || ( ! RXVALIDSTRING( argv[2] ))) 1061 return ( 40 ); 1062 if (( argc > 3 ) && ( ! RXVALIDSTRING( argv[3] ))) 1063 return ( 40 ); 1064 if (( argc > 4 ) && ( ! RXVALIDSTRING( argv[4] ))) 1065 return ( 40 ); 1066 if (( argc > 5 ) && ( ! RXVALIDSTRING( argv[5] ))) 1067 return ( 40 ); 1068 1069 pszQueueName = argv[0].strptr; 1070 pszDeviceName = argv[1].strptr; 1071 pszPortName = argv[2].strptr; 1072 if ( argc > 3 ) pszModel = argv[3].strptr; 1073 pszTitle = ( argc > 4 ) ? argv[4].strptr : pszDeviceName; 1074 if ( argc > 5 ) pszOID = argv[5].strptr; 1075 1076 // Find out if device exists already 1077 rc = SplQueryDevice( NULL, pszDeviceName, 0, NULL, 0, &cbBuf ); 1078 if ( rc == NERR_DestNotFound ) { 1079 1080 // Nope, create it now 1081 devinfo.pszPrinterName = pszDeviceName; 1082 devinfo.pszUserName = NULL; 1083 devinfo.pszLogAddr = pszPortName; 1084 devinfo.pszComment = pszTitle; 1085 devinfo.pszDrivers = pszModel ? pszModel : "IBMNULL"; 1086 devinfo.usTimeOut = 45; 1087 rc = SplCreateDevice( NULL, 3, &devinfo, sizeof( devinfo )); 1088 if ( rc != NO_ERROR ) { 1089 WriteErrorCode( rc, "SplCreateDevice"); 1090 MAKERXSTRING( *prsResult, "0", 1 ); 1091 return ( 0 ); 1092 } 1093 fNewD = TRUE; 1094 } 1095 else if ( rc != NO_ERROR ) { 1096 WriteErrorCode( rc, "SplQueryDevice"); 1097 MAKERXSTRING( *prsResult, "0", 1 ); 1098 return ( 0 ); 1099 } 1100 1101 // Find out if the queue name already exists 1102 rc = SplQueryQueue( NULL, pszQueueName, 3, NULL, 0, &cbBuf ); 1103 if ( rc == NERR_QNotFound ) { 1104 1105 // Nope, create it now 1106 qinfo.pszName = pszQueueName; 1107 qinfo.uPriority = PRQ_DEF_PRIORITY; 1108 qinfo.fsType = PRQ3_TYPE_RAW; 1109 qinfo.pszPrProc = "PMPRINT"; 1110 qinfo.pszComment = pszTitle; 1111 qinfo.pszPrinters = pszDeviceName; 1112 qinfo.pszDriverName = pszModel ? pszModel : "IBMNULL"; 1113 qinfo.pDriverData = NULL; 1114 rc = SplCreateQueue( NULL, 3, &qinfo, sizeof( qinfo )); 1115 if ( rc != NO_ERROR ) { 1116 WriteErrorCode( rc, "SplCreateQueue"); 1117 MAKERXSTRING( *prsResult, "0", 1 ); 1118 if ( fNewD ); // TODO delete device 1119 return ( 0 ); 1120 } 1121 fNewQ = TRUE; 1122 } 1123 else if ( rc != NO_ERROR ) { 1124 WriteErrorCode( rc, "SplQueryQueue"); 1125 MAKERXSTRING( *prsResult, "0", 1 ); 1126 if ( fNewD ); // TODO delete device 1127 return ( 0 ); 1128 } 1129 1130 if ( pszOID ) 1131 sprintf( szSetup, "TAKEDEFAULTS=YES;OBJECTID=%.225s;", pszOID ); 1132 else 1133 sprintf( szSetup, "TAKEDEFAULTS=YES;"); 1134 if ( WinCreateObject("WPPrinter", pszTitle, szSetup, 1135 "<WP_DESKTOP>", CO_FAILIFEXISTS ) == NULLHANDLE ) 1136 { 1137 WriteErrorCode( 0, "WinCreateObject"); 1138 MAKERXSTRING( *prsResult, "0", 1 ); 1139 if ( fNewD ); // TODO delete device 1140 if ( fNewQ ); // TODO delete queue 1141 return ( 0 ); 1142 } 1143 1144 return ( 0 ); 1145 } 1146 1147 1148 /* ------------------------------------------------------------------------- * 1149 * RPUPrinterQuery * 1150 * * 1151 * Gets information about the specified printer device. * 1152 * * 1153 * (stem).i.!description Printer description (name of WPS object) * 1154 * (stem).i.!port Name of the port the printer is using * 1155 * (stem).i.!driver List of the drivers used by this printer * 1156 * TODO: * 1157 * (stem).i.!flags Zero or more of the following flags (any order): * 1158 * E A printer error has occurred * 1159 * H Printer destination is paused * 1160 * I Intervention required * 1161 * N Printer has raised a notification alert * 1162 * O Printer is offline * 1163 * P Printer is out of paper * 1164 * X Printer is not processing/paused * 1165 * * 1166 * REXX ARGUMENTS: * 1167 * 1. The name of the printer device being queried. (REQUIRED) * 1168 * 2. The name of the stem in which to return the results. (REQUIRED) * 1169 * * 1170 * REXX RETURN VALUE: * 1171 * 1 on success, or 0 if an error occurred. * 1172 * ------------------------------------------------------------------------- */ 1173 ULONG APIENTRY RPUPrinterQuery( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 1174 { 1175 PPRDINFO3 pInfo = NULL; 1176 PVOID pbuf = NULL; 1177 ULONG cbBuf = 0, 1178 cbNeeded = 0; 1179 PSZ pszDeviceName; 1180 CHAR szStem[ US_STEM_MAXZ ]; // compound variable stem name 1181 SPLERR rc; 1182 1183 1184 // Reset the error indicator 1185 WriteErrorCode( 0, NULL ); 1186 1187 // Validate the REXX arguments 1188 if (( argc != 2 ) || 1189 ( ! RXVALIDSTRING( argv[0] )) || ( ! RXVALIDSTRING( argv[1] ))) 1190 return ( 40 ); 1191 1192 pszDeviceName = argv[0].strptr; 1193 //printf("Device: \"%s\"\n", pszDeviceName ); 1194 1195 // Initialize the result stem name 1196 if ( RXSTRLEN(argv[1]) > US_STEM_MAXZ ) return ( 40 ); 1197 if ( argv[1].strptr[ argv[1].strlength-1 ] == '.') argv[1].strlength--; 1198 strncpy( szStem, argv[1].strptr, RXSTRLEN( argv[1] )); 1199 szStem[ RXSTRLEN( argv[1] ) ] = '\0'; 1200 1201 1202 // Query the amount of available data 1203 rc = SplQueryDevice( NULL, pszDeviceName, 3L, NULL, 0L, &cbNeeded ); 1204 if (( rc != ERROR_MORE_DATA ) && ( rc != NERR_BufTooSmall )) 1205 { 1206 WriteErrorCode( rc, "SplQueryDevice"); 1207 MAKERXSTRING( *prsResult, "0", 1 ); 1208 return ( 0 ); 1209 } 1210 1211 // Now get the actual data 1212 pbuf = malloc( cbNeeded ); 1213 if ( !pbuf ) { 1214 WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc"); 1215 MAKERXSTRING( *prsResult, "0", 1 ); 1216 return ( 0 ); 1217 } 1218 cbBuf = cbNeeded; 1219 rc = SplQueryDevice( NULL, pszDeviceName, 3L, pbuf, cbBuf, &cbNeeded ); 1220 if ( rc == NO_ERROR ) { 1221 pInfo = (PPRDINFO3) pbuf; 1222 WriteCompoundVariable( szStem, "!name", pInfo->pszPrinterName ); 1223 WriteCompoundVariable( szStem, "!port", pInfo->pszLogAddr ); 1224 WriteCompoundVariable( szStem, "!description", pInfo->pszComment ); 1225 WriteCompoundVariable( szStem, "!drivers", pInfo->pszDrivers ); 1226 MAKERXSTRING( *prsResult, "1", 1 ); 1227 } 1228 else { 1229 WriteErrorCode( rc, "SplQueryDevice"); 1230 MAKERXSTRING( *prsResult, "0", 1 ); 1231 } 1232 1233 free( pbuf ); 1234 return ( 0 ); 1235 } 1236 1237 1238 /* ------------------------------------------------------------------------- * 1239 * RPUQueueDefault * 1240 * * 1241 * Sets the requested printer queue as the system default printer. * 1242 * * 1243 * REXX ARGUMENTS: * 1244 * 1. The name of the printer queue to set as default. (REQUIRED) * 1245 * * 1246 * REXX RETURN VALUE: * 1247 * 1 on success, or 0 if an error occurred. * 1248 * ------------------------------------------------------------------------- */ 1249 ULONG APIENTRY RPUQueueDefault( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 1250 { 1251 HOBJECT hObj; 1252 BOOL fRC; 1253 1254 // Reset the error indicator 1255 WriteErrorCode( 0, NULL ); 1256 1257 // Make sure we have at least one valid argument (the queue name) 1258 if ( argc != 1 || ( !RXVALIDSTRING(argv[0]) )) return ( 40 ); 1259 pszName = argv[0].strptr; 1260 1261 hObj = PrinterObjectHandle( pszName ); 1262 if ( !hObj ) return ( 40 ); 1263 1264 fRC = WinSetObjectData( hObj, "APPDEFAULT=YES;"); 1265 1266 MAKERXSTRING( *prsResult, fRC? "1": "0", 1 ); 1267 return ( 0 ); 1268 } 1269 1270 1271 /* ------------------------------------------------------------------------- * 1272 * RPUQueueHold * 1273 * * 1274 * Holds or releases the specified print queue. * 1275 * * 1276 * REXX ARGUMENTS: * 1277 * 1. The name of the printer queue to hold or release. (REQUIRED) * 1278 * 2. Action flag, one of: * 1279 * Y Hold printer (DEFAULT) * 1280 * N Release printer * 1281 * * 1282 * REXX RETURN VALUE: * 1283 * 1 on success, or 0 if an error occurred. * 1284 * ------------------------------------------------------------------------- */ 1285 ULONG APIENTRY RPUQueueHold( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 1286 { 1287 PSZ pszQueueName; // Print queue name 1288 BOOL fHold = TRUE; 1289 SPLERR rc; 1290 1291 1292 // Reset the error indicator 1293 WriteErrorCode( 0, NULL ); 1294 1295 // Make sure we have at least one valid argument (the queue name) 1296 if ( argc < 1 || argc > 2 || ( !RXVALIDSTRING(argv[0]) )) return ( 40 ); 1297 pszQueueName = argv[0].strptr; 1298 1299 // Second argument: view (optional, but must be correct if specified) 1300 if ( argc == 2 ) { 1301 if ( RXVALIDSTRING(argv[1]) ) { 1302 switch ( argv[1].strptr[0] ) { 1303 case 'y': 1304 case 'Y': fHold = TRUE; break; 1305 case 'n': 1306 case 'N': fHold = FALSE; break; 1307 default : return ( 40 ); 1308 } 1309 } 1310 else return ( 40 ); 1311 } 1312 1313 rc = fHold ? SplHoldQueue( NULL, pszQueueName ) : 1314 SplReleaseQueue( NULL, pszQueueName ); 1315 if ( rc != NO_ERROR ) { 1316 WriteErrorCode( rc, fHold ? "SplHoldQueue" : "SplReleaseQueue"); 1317 MAKERXSTRING( *prsResult, "0", 1 ); 1318 } 1319 else MAKERXSTRING( *prsResult, "1", 1 ); 1320 1321 return ( 0 ); 1322 } 1323 1324 1184 1325 /* ************************************************************************* * 1185 1326 * INTERNAL PRINTER-RELATED FUNCTIONS * -
rxprtutl/trunk/rxprtutl.def
r3 r5 1 1 LIBRARY RXPRTUTL INITINSTANCE TERMINSTANCE 2 2 DATA MULTIPLE NONSHARED 3 DESCRIPTION '@#Alex Taylor:0. 1.0#@##1## 11 Dec 2011 21:54:09 sigel::::::@@REXX Printer Management Utilities'3 DESCRIPTION '@#Alex Taylor:0.2.0#@##1## 4 Apr 2013 15:25:36 REINFORCE::::::@@REXX Printer Management Utilities' 4 4 5 5 EXPORTS RPULoadFuncs 6 6 RPUDropFuncs 7 7 RPUVersion 8 RPUEnum Devices8 RPUEnumModels 9 9 RPUEnumDrivers 10 10 RPUEnumPorts 11 11 RPUEnumPrinters 12 RPUHoldQueue13 12 RPUPortDialog 14 13 RPUPortInstall 15 14 RPUPortSet 16 RPU PrinterDefault17 RPUPrinter Open15 RPUOpenView 16 RPUPrinterCreate 18 17 RPUPrinterQuery 18 RPUQueueDefault 19 RPUQueueHold 20 -
rxprtutl/trunk/testlib.cmd
r3 r5 10 10 test_driver_file = SysBootDrive()'\os2\dll\'test_driver'\'test_driver'.DRV' 11 11 IF STREAM( test_driver_file, 'C', 'QUERY EXISTS') <> '' THEN DO 12 rc = RPUEnum Devices( test_driver_file, 'devs.')12 rc = RPUEnumModels( test_driver_file, 'devs.') 13 13 IF rc == 0 THEN SAY RPUERROR 14 14 ELSE DO … … 65 65 /* 66 66 IF printers.0 > 0 THEN DO 67 rc = RPU PrinterOpen( printers.1.!queue, 'O')67 rc = RPUOpenView( printers.1.!queue, 'O') 68 68 IF rc == 0 THEN SAY RPUERROR 69 69 END 70 70 71 rc = RPU HoldQueue('GenericP', 'N')71 rc = RPUQueueHold('GenericP', 'N') 72 72 IF rc == 0 THEN SAY RPUERROR 73 73 */
Note:
See TracChangeset
for help on using the changeset viewer.