[comp.sys.att] Putting an '=' in an environment variable

rdj@ttrde.UUCP (Robert D. Jackson) (05/22/87)

I am using a version of PC/VI, and have been trying for some time now
to get the EXINIT environment variable set to my liking.  On Unix, it is
set as such:

EXINIT="set ai sw=4 terse"
export EXINIT

On the PC, I am unable to get an '=' in an environment variable,
The best that I have been able to do so far is settle for:

set EXINIT=se ai terse

I would like to be able to do something like

set EXINIT="set ai sw=4 terse"
or
set EXINIT=set ai sw\=4 terse
...

but I have had no luck.  If anyone knows how to achieve this feat, please
post it, or respond via email.

BTW

set EXINIT=set ai sw 4 terse

doesn't work either.

rdj@ttrde.UUCP (Robert D. Jackson) (05/22/87)

I am using a version of PC/VI, and have been trying for some time now
to get the EXINIT environment variable set to my liking.  On Unix, it is
set as such:

EXINIT="set ai sw=4 terse"
export EXINIT

On the PC, I am unable to get an '=' in an environment variable,
The best that I have been able to do so far is settle for:

set EXINIT=se ai terse

I would like to be able to do something like

set EXINIT="set ai sw=4 terse"
or
set EXINIT=set ai sw\=4 terse
...

but I have had no luck.  If anyone knows how to achieve this feat, please
post it, or respond via email.

BTW

set EXINIT=set ai sw 4 terse

doesn't work either.

-- 
---------------------------------------------------------------------------
Bob Jackson
ihnp4!ttrdc!ttrde!rdj
---------------------------------------------------------------------------

wtm@neoucom.UUCP (05/25/87)

Hi,

If you`re using the MKS Toolkit's vi, you set the initial
environment for vi from a file named EX.RC in your $HOME directory
(if you're using the Korn shell).  If you are running in (MS) DOS,
the EX.RC should be in your ROOT directory.  Vi also requires you
to create a directory named \TMP on your default drive.

One restriction in EX.RC is that you only set one variable per
line.  For instance, my EX.RC file looks like this:

se wm=5
se noai
se nu

I know this doesn't answer using an equals sign in a (MS) DOS
environment variable, but it is a practical solution to the
problem.  I'm not sure if it's possible to put an = in an
environment variable.  There was recently a discussion of the = in
comp.sys.ibm.pc.

Bill Mayhew
Division of Basic Medical Sciences
Northeastern Ohio Universities College of Medicine
Rootstown, OH  44272  USA    phone:  216-325-2511
(wtm@neoucom.UUCP   ...!cbatt!neoucom!wtm)

jas@hou2d.UUCP (05/26/87)

limitations prevent using the =.  However, the same result may be 
obtained by placing the commands in the VI.INI file.
References: <209@ttrde.UUCP>

tel@cbstr1.att.com (T.E.Lester) (05/27/87)

In article <209@ttrde.UUCP> rdj@ttrde.UUCP () writes:
>I am using a version of PC/VI, and have been trying for some time now
>to get the EXINIT environment variable set to my liking.  ........
>.....  If anyone knows how to achieve this feat, please
>post it, or respond via email.
>
	If you are using Custom Software Systems PC/VI,  it
	will execute a file called vi.ini to get around all of these
	problems. To use this file EXINIT must NOT be set and the 
	file must reside in your HOME directory or root of the current
	drive. A second VI.INI file may reside in your current working 
	directory for additional commands. The manual states these are
	useful for different kinds of file editing ( text vs. program).
	This is equivelant to the UNIX vi file .exrc
	Try it and good luck.

		Tom Lester cb3D277 x3259

louis@drutx.UUCP (06/02/87)

In article <210@ttrde.UUCP>, rdj@ttrde.UUCP (Robert D. Jackson) writes:
> I am using a version of PC/VI, and have been trying for some time now
> to get the EXINIT environment variable set to my liking.

I had the identical problem with MKS Toolkit's vi.  Since I couldn't
put spaces or = in my EXINIT, I was using an ex.rc file in the root
directory of my hard disk.  When I made my current drive anything but
the hard disk, vi couldn't find ex.rc and would blow up.

I finally lost patience with the DOS SET command and rolled my own.

After writing the program, I discovered that by setting HOME=c:, vi
would have found ex.rc all of the time.  Oh well.  I like EXINIT
better, anyway.

What follows is the source and uuencoded binary for setenv.

Lou Warshawsky

-------- cut here for setenv.c --------
/*
 *	setenv - set environment variable
 *
 *	This program duplicates the function of SET, while avoiding
 *	arbitrary limitations on the characters that may be used in
 *	the variable's value.
 *
 *	To set a value containing spaces, enclose the value in
 *	quotation marks, as in:
 *
 *		setenv EXINIT "set ai dir=d:"
 *
 *	Compile this module using the large memory model.
 *
 *	Copyright (c) 1987 by Louis Warshawsky
 *	Permission is granted to reproduce for any purpose.
 *
 *	This program has been compiled using Microsoft C 3.0 and
 *	tested briefly under MS-DOS 2.11.
 */

#include <dos.h>
#include <stdlib.h>
#include <string.h>

#ifndef NULL
#define NULL	0L
#endif

#define ALTSYNTAX 1	/* use C-shell syntax (no =) */
#define START_SEG 0x60	/* start search after DOS communication area */

/*
 *	Locate command.com's environment table.
 *	The first occurrence on a 16-byte boundary of the string at
 *	envp[0] is probably it.  The redundant test of the first
 *	character speeds the search.
 */
char *
findenv(envp)
char *envp[];
{
	register int	c;
	char	*p;

	c = *envp[0];
	FP_OFF(p) = 0;
	for (FP_SEG(p) = START_SEG; FP_SEG(p) < _psp; FP_SEG(p)++)
		if (*p == c && strcmp(p, envp[0]) == 0)
			return p;
	return NULL;
}

/*
 *	Recreate command.com's environment table at (op).
 *	WARNING: Since command.com does not divulge the size of its
 *	environment table, we can not check for overflow.
 */
makenv(op)
register char *op;
{
	char	**ip, *cp;
	
	/* copy each string from our environment */
	for (ip = environ; cp = *ip++; )
		while (*op++ = *cp++)
			;
	/* add a final null */
	*op = '\0';
}

main(argc, argv, envp)
int argc;
char *argv[], *envp[];
{
	char	*ep;
#if ALTSYNTAX
	char	line[128];

	/* C-shell syntax */
	if (argc != 3)
		error("usage: setenv name value");
	if (strchr(argv[1], '=') != NULL)
		error("setenv: variable name must not contain '='.");
	strcat(strcat(strcpy(line, argv[1]), "="), argv[2]);
	if (putenv(line))
#else
	/* MS-DOS syntax */
	if (argc != 2)
		error("usage: setenv name=value");
	if (putenv(argv[1]))
#endif
		error("setenv: bad assignment.");
	if ((ep = findenv(envp)) == NULL)
		error("setenv: can't find environment.");
	makenv(ep);
	return 0;
}

error(s)
char *s;
{
	cputs(s);
	cputs("\r\n");
	exit(1);
}
-------- cut here --------
begin 644 setenv.exe
M35K:`0D`,P`@`($`___^```(&X%=`!P`'@````$`#@#\`$(````)````$`#\
M`,D!``"]`0``L`$``*4!``"2`0``A`$``&T!``!?`0``3@$``$`!```V`0``
M+`$```8!``#U````W@```,X```!U````5``<`)(`Y@!>`!P`/@$<`%H!'`!?
M`1P`A`$<`(L!'`"1`1P`ZP$<`!(`_``I`*8`%`#\`#4!J`#:`*@`M@"H`%T`
MJ`#/`AP`&`#\`!8`_`!&`,L`<0,<`(H#'`!(`-<`&0#7`#H%'`"^!1P`$`8<
M`+$&'`"=!QP`````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````!5B^RX!@":'P`<`%;$7@8FQ!\FB@>8B_#'1OH`
M`,=&_&``ZS+$7OHFB@>8.\9U),1>!B;_=P(F_S?_=OS_=OJ:6P(<`(/$"`O`
M=0B+1OJ+5OSK%/]&_(X&O@&+1OPF.08Z`7?`,\"97HOE7<M5B^RX"`":'P`<
M`(X&P`$FH4P!)HL63@&)1OB)5OK$7OB#1O@$)HL')HM7`HE&_(E6_@O"=!C$
M7OS_1OPFB@?$7@;_1@8FB`<*P'32Z^C$7@8FQ@<`B^5=RU6+[+B$`)H?`!P`
M@WX&`W0-N%``'E":G0$``(/$!+@]`%#$7@@F_W<&)O]W!)HP`AP`@\0&"\)T
M#;AI`!Y0FIT!``"#Q`3$7@@F_W<*)O]W"+B5`!Y0)O]W!B;_=P2-AGS_%E":
MD`(<`(/$"%)0FOL!'`"#Q`A24)K[`1P`@\0(C89\_Q90F@\`J`"#Q`0+P'0-
MN)<`'E":G0$``(/$!/]V#O]V#)H`````@\0$B4;\B5;^"\)U#;BO`!Y0FIT!
M``"#Q`3_=O[_=OR:;````(/$!#/`B^5=RU6+[#/`FA\`'`#_=@C_=@::00`<
M`(/$!+C/`!Y0FD$`'`"#Q`2X`0!0F@P`I@"+Y5W+````````````````````
M`%E:B]PKV'(+.Q[6`'(%B^-24<NAT@!`=0/IEP%24?\NT@!5B^Q6'L5V!C+D
MK`K`=`E0FN`#'`!8Z_(?7EW+O^$`BS8"`"OW@?X`$'(#O@`0^H[7@<3.`?MS
M`^E6`8'D_O\VB2;@`#:))MX`B\:Q!-/@2#:CW`"T,,TA-J-$`3P"<RH>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````````$,@3&EB<F%R>2`M("A#*4-O<'ER
M:6=H="!-:6-R;W-O9G0@0V]R<"`Q.3@U``%.=6QL('!O:6YT97(@87-S:6=N
M;65N=`T*`'5S86=E.B!S971E;G8@;F%M92!V86QU90!S971E;G8Z('9A<FEA
M8FQE(&YA;64@;75S="!N;W0@8V]N=&%I;B`G/2<N`#T`<V5T96YV.B!B860@
M87-S:6=N;65N="X`<V5T96YV.B!C86XG="!F:6YD(&5N=FER;VYM96YT+@`-
M"@#_____9@(`````````````X0``````````````````````````````````
M````````````````````````````````````````````````````````````
M````````X```````````````````````````````````````````````````
M````````````````````@8&!`0$`````````````````````````````````
M```[0U]&24Q%7TE.1D\``````````````````````"``````````````````
9`````````````````.$`X0#A`.$`X0#A````
`
end