deal in a saner way with const strings.

This commit is contained in:
christos 2004-04-23 22:24:34 +00:00
parent 195f245afe
commit ecd199b9f5
2 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: remote.c,v 1.10 2004/04/23 22:11:44 christos Exp $ */
/* $NetBSD: remote.c,v 1.11 2004/04/23 22:24:34 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: remote.c,v 1.10 2004/04/23 22:11:44 christos Exp $");
__RCSID("$NetBSD: remote.c,v 1.11 2004/04/23 22:24:34 christos Exp $");
#endif /* not lint */
#include "pathnames.h"
@ -66,6 +66,9 @@ static const char *db_array[3] = { _PATH_REMOTE, 0, 0 };
static void getremcap __P((char *));
static char tiprecord[] = "tip.record";
static char wspace[] = "\t\n\b\f";
static void
getremcap(host)
char *host;
@ -175,9 +178,9 @@ getremcap(host)
if (cgetflag("dc"))
DC = 1;
if (RE == NULL)
RE = strdup("tip.record");
RE = tiprecord;
if (EX == NULL)
EX = strdup("\t\n\b\f");
EX = wspace;
if (ES != NULL)
vstring("es", ES);
if (FO != NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tip.c,v 1.25 2004/04/23 22:11:44 christos Exp $ */
/* $NetBSD: tip.c,v 1.26 2004/04/23 22:24:34 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: tip.c,v 1.25 2004/04/23 22:11:44 christos Exp $");
__RCSID("$NetBSD: tip.c,v 1.26 2004/04/23 22:24:34 christos Exp $");
#endif /* not lint */
/*
@ -66,6 +66,8 @@ void tipin __P((void));
char PNbuf[256]; /* This limits the size of a number */
static char path_phones[] = _PATH_PHONES;
int
main(argc, argv)
int argc;
@ -171,7 +173,7 @@ notnumber:
* in the right order, so force it here
*/
if ((PH = getenv("PHONES")) == NULL)
PH = strdup(_PATH_PHONES);
PH = path_phones;
vinit(); /* init variables */
setparity("even"); /* set the parity table */
if ((i = speed(number(value(BAUDRATE)))) == 0) {
@ -601,9 +603,13 @@ setparity(defparity)
{
int i, flip, clr, set;
const char *parity;
static char *curpar;
if (value(PARITY) == NULL || (value(PARITY))[0] == '\0')
value(PARITY) = strdup(defparity);
if (value(PARITY) == NULL || (value(PARITY))[0] == '\0') {
if (curpar != NULL)
free(curpar);
value(PARITY) = curpar = strdup(defparity);
}
parity = value(PARITY);
if (equal(parity, "none")) {
bits8 = 1;