From: RUTGES_ASS@rugb38.bdk.rug.nl (ass. A.Rutges (I&O))
Subject: Summary + thanks + solution: VAX C makes all paramaters lowercase
Organization: Faculty of Management Studies, University of Groningen (NL)
Date: Mon, 05 Oct 1992 15:06:36 GMT
X-News-Reader: VMS NEWS 1.24

Hi all,

Thanks to all who replied to my request concerning passing of parameters
in VAX C. Unfortunately, it did not help me much, though, but I figured
out a way around my problem. I will eleborate on the original problem, 
for those interested:

I have this TEXT2PS program which converts ASCII texts to PostScript (tm)
files. For convenience of the users of the utilities I install (I am the
maintainer of installed PD VMS utilities here on our VAX) I decided to
program a command procedure that prompts users to provide options for
the TEXT2PS utility (file to be converted, output file, fontname, char's
per line etc.)

All parameters are preceded with a flag: "-" and then a switch to point to
a TEXT2PS option (e.g. -r directly followed by a number to represent the 
rotation of the text in degrees: -r90 for landscape)

I already THOUGHT (but was not sure, that's why I posted my request) I read 
somewhere (in the ZMODEM package by Omen Technology if I recall correctly) 
that parameters in VAX C are passed in lowercase.

There is only one option which needs a string for an answer: that is the
fontname to be applied to the output PS file. Even more irritant, it is also
in mixed lower and uppercase characters, and it can contain the flag
character ("-")! 

I wrote my .COM file in a way, that all parameters are being read in
PRESERVING case. I passed them to the program in a way that it became:
$ TEXT2PS "-fTimes-BoldOblique -r90"

, but the program did not take the parameters correctly, REGARDLESS of
the quotes! While examining the original .C file (a friend of mine was 
watching over my shoulder) he told me, that the argument handling was
done in a non-ANSI way. I think that things went wrong there. So I 
rewrote my .COM file to pass ALL paramaters as independent parameters,
and every individual parameter ALWAYS enclosed in quotes. Then the
problem was solved. For those interested (it is NOT state-of-the-art
DCL programming, so pro's should not even take a look) I have included
it under my .SIGNATURE.

Again, I would like to thank all ppl. who took the time to write a reply!

Greetings!

Tijs Coumans
Computer Simulation + VAX/VMS Expert
Faculty of Management Studies, University of Groningen (The Netherlands)
Mail: RUTGES_ASS @ RUGB38.BDK.RUG.NL
------------------------------------------------------------------------
Disclaimer: All I say, is on my own behalf, not that of my employer's.

Text2Ps.Com

$ set noverify
$ text2ps := $text2ps_dir:text2ps.exe
$ if f$type(commandline) .nes. "" 
$ then save_commandline = commandline
$ endif
$ commandline == "text2ps"
$ if p1 .eqs. "" then read sys$command/prompt= -
"File to prepare for Postscript?                              " p1
$ if p1 .eqs. "" .or. f$search(p1) .eqs. "" then exit
$ if p2 .eqs. "" then p2 = f$element(0, ".", p1 + ".") + ".ps"
$ if p3 .nes. "" 
$ then commandline == commandline + " ""''f$string(p3)'"""
$ goto do_it
$ endif
$ params == ""
$ read sys$command/prompt= -
"List all options, and quit? <Y/N, def. N>?                   " q 
$ if q 
$ then text2ps -?
$ exit
$ endif
$ read sys$command/prompt= -
"Print current version and quit? <Y/N, def. N>?               " v 
$ if v 
$ then text2ps -v
$ exit
$ endif
$ read sys$command/prompt= -
"Rotation <# degrees, def. 0>?                                " r
$ ask_font:
$ f = ""
$ read sys$command/prompt= -
"Font <fontname, def. Courier, ?>?                            " f
$ if f .eqs. "?" 
$ then type sys$input
       Courier             Times-Roman      Helvetica
       Courier-Bold        Times-Bold       Helvetica-Bold
       Courier-Oblique     Times-Italic     Helvetica-Oblique
       Courier-BoldOblique Times-BoldItalic Helvetica-BoldOblique
$ goto ask_font
$ endif
$ read sys$command/prompt= -
"Character height <# points, def. 10>?                        " s 
$ read sys$command/prompt= -
"Spacing betw. char.'s <fragm. of curr. pointsize, def. 0>?   " h
$ read sys$command/prompt= -
"Line-spacing <# points, def. curr. pointsize + 2>?           " p 
$ read sys$command/prompt="Left margin <# cm'w, def. 0>?      " o 
$ read sys$command/prompt= -
"Left margin even pages <# cm's, def. same as for odd pages>? " oe
$ read sys$command/prompt= -
"Top margin <# cm's, def. 0.5>?                               " m 
$ read sys$command/prompt= -
"No. of characters per line <# characters, def. 72>?          " w 
$ read sys$command/prompt= -
"No. of lines per page <# lines>?                             " l 
$ call add_params "r" "''f$string(r)'"
$ call add_params "f" "''f$string(f)'"
$ call add_params "s" "''f$string(s)'"
$ call add_params "h" "''f$string(h)'"
$ call add_params "p" "''f$string(p)'"
$ call add_params "o" "''f$string(o)'"
$ call add_params "oe" "''f$string(oe)'"
$ call add_params "m" "''f$string(m)'"
$ call add_params "w" "''f$string(w)'"
$ call add_params "l" "''f$string(l)'"
$ do_it:
$ write sys$command "File ''p1' to be converted to ''p2'"
$ write sys$command " with commandline ",commandline
$ define/user sys$input 'p1'
$ define/user sys$output 'p2'
$ 'commandline
$ file = f$search(p2)
$ copy text2ps_dir:appendix. 'p2'
$ convert/append 'file' 'p2'
$! previous stuff needed because of the behaviour of the ps-interpreter,
$!  which needs a %! at the beginning of the file
$ write sys$command "Transcript written to ''p2'"
$ delete/noconfi/nolog 'file'
$ if f$type(save_commandline) .nes. "" 
$ then commandline == save_commandline
$ else
$ delete/symbol/global commandline
$ endif
$ exit
$ add_params: subroutine
$ if p2 .eqs. "" then endsubroutine
$ commandline == commandline + " ""-''p1'''f$string(p2)'"""
$ endsubroutine

Newsgroups: comp.os.vms