Changeset 40652 for trunk/Ohana/src/opihi/lib.shell/string.c
- Timestamp:
- Mar 29, 2019, 5:05:27 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/string.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/string.c
r37049 r40652 114 114 } 115 115 116 /* take a pointer to the beginning of a variable (ie $foo) 117 and extract only the variable name (eg, foo) */ 118 119 char *thisref (char *string) { 120 121 int i, start; 122 char *word; 123 124 if (string == (char *) NULL) return ((char *) NULL); 125 if (string[0] != '$') return ((char *) NULL); 126 127 /* special case $?name : check that name is valid */ 128 start = 1; 129 if (string[1] == '?') start = 2; 130 131 for (i = start; ISREF(string[i]); i++); 132 if (i == start) return ((char *) NULL); 133 134 /* the ? is part of the variable */ 135 word = strncreate (&string[1], i - 1); 136 return (word); 137 138 } 116 139 117 140 /**********************************************************************/
Note:
See TracChangeset
for help on using the changeset viewer.
