Everhart, Glenn From: sreece@qred.quintiles.com Sent: Friday, July 31, 1998 11:09 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: Problem with VAX C system RTL function Ed James (ed dot james at jhuapl dot edu) commented/quoted: >> From then on I've used the C routine and will often use it from >the command >> line too > >Will you please publish these on INFO-VAX or make them available via >ftp or www site? Sounds like it would be very useful. In response to Ed. and anyone else out there, the file (in DEC C) that I use is appended below my .sig. As usual, it is provided un-supported but does work under VMS on VAX and Alpha using V5.5-2, V6.1 on VAX and 6.2 on Alpha. (I just hope it comes out ok.... :-)) Steve Reece, sreece@qred.quintiles.com QRED IT Operations. Tel. 01344 708 631 "Digital's Had it Now". "In the desert, things find a way to survive. Secrets are like this too. They push their way up through the sands of deception so men can know them." /*C_PRINT.C*/ /* Steve Reece, 1997/1998 */ /* Distribute freely (preferably with acknowledgement but without warranty)*/ /* Usage: $ C_PRINT:=="$C_PRINT" $ C_PRINT If filename is included but queue isn't then output goes to queue SYS$LASER. If neither filename nor queue are included then program will prompt for both (but queue prompt will be for either SYS$LASER (L) or SYS$PRINT (P) If filename and queuename are included then output will go to the queue stated - even if this is a full queue name rather than just the P or L Eg : C_PRINT SYS$LOGIN:LOGIN.COM F2_LASER outputs to f2_laser queue or C_PRINT SYS$LOGIN:LOGIN.COM outputs to sys$laser queue Confirmation of entry number and queue submitted to are provided. */ #include #include #include #include #include #include #include #include #include typedef struct { short buflen, itmcode; void *bufadr; unsigned short *retlenadr; } ITMLST; ITMLST itemlist[8]; typedef struct { int condval, rest; } IOSBBLK; IOSBBLK submit_iosb; main (int argc, char *argv[]) { unsigned int status, entry_number; unsigned int i=0; char filename[255]; char quename[31]; char que; char note[255]; strcpy(note,"Job processed by DEC C Print module C_PRINT"); switch (argc) { case 1: printf ("Enter filename to print (255 characters) :"),scanf("%s",&filename); printf ("Queue to print to SYS$LASER (L) or SYS$PRINT (P) [P]:"),scanf("%s",&que ); break; case 2: strcpy(&que,"l"); strcpy(filename,argv[1]); break; case 3: strcpy (&que,argv[2]); strcpy (filename,argv[1]); break; default: break; } /* printf ("Enter formname(31 characters):"),scanf("%s",&formname);*/ que = _tolower(que); switch (que) { case 'p': strcpy(quename,"SYS$PRINT"); break; case 'l': strcpy(quename,"SYS$LASER"); break; default: strcpy(quename,argv[2]); break; } printf ("Queue : %s\n",quename); printf ("File : %s\n",&filename); itemlist[0].buflen = strlen(quename); itemlist[0].itmcode = SJC$_QUEUE; itemlist[0].bufadr = quename; itemlist[0].retlenadr = 0; itemlist[1].buflen = strlen(filename); itemlist[1].itmcode = SJC$_FILE_SPECIFICATION; itemlist[1].bufadr = filename; itemlist[1].retlenadr = 0; itemlist[2].buflen = 4; itemlist[2].itmcode = SJC$_ENTRY_NUMBER_OUTPUT; itemlist[2].bufadr = &entry_number; itemlist[2].retlenadr = 0; itemlist[3].buflen = 0; itemlist[3].itmcode = SJC$_FILE_BURST; itemlist[3].bufadr = 0; itemlist[3].retlenadr = 0; /*This will provide a trailer if you want to un-comment it*/ /*itemlist[4].buflen = 0; itemlist[4].itmcode = SJC$_FILE_TRAILER; itemlist[4].bufadr = 0; itemlist[4].retlenadr = 0;*/ itemlist[4].buflen = 0; itemlist[4].itmcode = SJC$_NO_FILE_FLAG; itemlist[4].bufadr = 0; itemlist[4].retlenadr = 0; /*This will retain the job on the queue if un-commented*/ /*itemlist[6].buflen = 0; itemlist[6].itmcode = SJC$_JOB_RETAIN; itemlist[6].bufadr = 0; itemlist[6].retlenadr = 0;*/ itemlist[5].buflen = strlen(note); itemlist[5].itmcode = SJC$_NOTE; itemlist[5].bufadr = note; itemlist[5].retlenadr = 0; itemlist[6].buflen = 0; /* Terminate with zeroes */ itemlist[6].itmcode = 0; status = sys$sndjbcw(0,SJC$_ENTER_FILE,0,&itemlist,&submit_iosb,0,0); if ((status & 1)!= 1) lib$stop(status); if ((submit_iosb.condval & 1) != 1) lib$stop(submit_iosb.condval); printf("Print job %s has been submitted to queue %s\n",filename,quename); printf("as entry number %d\n",entry_number); exit(1); }