Deleted Added
full compact
variable.c (16326) variable.c (20247)
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
7 * $Id: variable.c,v 1.10 1996/04/29 06:47:10 jkh Exp $
7 * $Id: variable.c,v 1.11 1996/06/12 14:02:13 jkh Exp $
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 30 unchanged lines hidden (view full) ---

46 /* Put it in the environment in any case */
47 setenv(var, value, 1);
48
49 /* Now search to see if it's already in the list */
50 for (newvar = VarHead; newvar; newvar = newvar->next) {
51 if (!strcmp(newvar->name, var)) {
52 if (isDebug())
53 msgDebug("variable %s was %s, now %s\n", newvar->name, newvar->value, value);
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 30 unchanged lines hidden (view full) ---

46 /* Put it in the environment in any case */
47 setenv(var, value, 1);
48
49 /* Now search to see if it's already in the list */
50 for (newvar = VarHead; newvar; newvar = newvar->next) {
51 if (!strcmp(newvar->name, var)) {
52 if (isDebug())
53 msgDebug("variable %s was %s, now %s\n", newvar->name, newvar->value, value);
54 strncpy(newvar->value, value, VAR_VALUE_MAX);
54 SAFE_STRCPY(newvar->value, value);
55 return;
56 }
57 }
58
59 /* No? Create a new one */
60 newvar = (Variable *)safe_malloc(sizeof(Variable));
55 return;
56 }
57 }
58
59 /* No? Create a new one */
60 newvar = (Variable *)safe_malloc(sizeof(Variable));
61 strncpy(newvar->name, var, VAR_NAME_MAX);
62 strncpy(newvar->value, value, VAR_VALUE_MAX);
61 SAFE_STRCPY(newvar->name, var);
62 SAFE_STRCPY(newvar->value, value);
63 newvar->next = VarHead;
64 VarHead = newvar;
65 if (isDebug())
66 msgDebug("Setting variable %s to %s\n", newvar->name, newvar->value);
67}
68
69void
70variable_set(char *var)
71{
72 char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
73
74 if (!var)
75 msgFatal("NULL variable name & value passed.");
76 else if (!*var)
77 msgDebug("Warning: Zero length name & value passed to variable_set()\n");
63 newvar->next = VarHead;
64 VarHead = newvar;
65 if (isDebug())
66 msgDebug("Setting variable %s to %s\n", newvar->name, newvar->value);
67}
68
69void
70variable_set(char *var)
71{
72 char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
73
74 if (!var)
75 msgFatal("NULL variable name & value passed.");
76 else if (!*var)
77 msgDebug("Warning: Zero length name & value passed to variable_set()\n");
78 strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
78 SAFE_STRCPY(tmp, var);
79 if ((cp = index(tmp, '=')) == NULL)
80 msgFatal("Invalid variable format: %s", var);
81 *(cp++) = '\0';
82 make_variable(tmp, cp);
83}
84
85void
86variable_set2(char *var, char *value)

--- 59 unchanged lines hidden ---
79 if ((cp = index(tmp, '=')) == NULL)
80 msgFatal("Invalid variable format: %s", var);
81 *(cp++) = '\0';
82 make_variable(tmp, cp);
83}
84
85void
86variable_set2(char *var, char *value)

--- 59 unchanged lines hidden ---