diff options
Diffstat (limited to 'src/fstring.h')
-rw-r--r-- | src/fstring.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h index 63e1e1a..9de6a56 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | #include <string> | 5 | #include <string> |
6 | #include <memory> | 6 | #include <memory> |
7 | #include <wordexp.h> | ||
7 | #include "bu/archival.h" | 8 | #include "bu/archival.h" |
8 | #include "bu/archive.h" | 9 | #include "bu/archive.h" |
9 | #include "bu/hash.h" | 10 | #include "bu/hash.h" |
@@ -397,6 +398,31 @@ namespace Bu | |||
397 | append( pData, nSize ); | 398 | append( pData, nSize ); |
398 | } | 399 | } |
399 | 400 | ||
401 | void expand() | ||
402 | { | ||
403 | flatten(); | ||
404 | |||
405 | wordexp_t result; | ||
406 | |||
407 | /* Expand the string for the program to run. */ | ||
408 | switch (wordexp (pFirst->pData, &result, 0)) | ||
409 | { | ||
410 | case 0: /* Successful. */ | ||
411 | { | ||
412 | set( result.we_wordv[0] ); | ||
413 | wordfree( &result ); | ||
414 | return; | ||
415 | } | ||
416 | break; | ||
417 | case WRDE_NOSPACE: | ||
418 | /* If the error was `WRDE_NOSPACE', | ||
419 | then perhaps part of the result was allocated. */ | ||
420 | wordfree (&result); | ||
421 | default: /* Some other error. */ | ||
422 | return; | ||
423 | } | ||
424 | } | ||
425 | |||
400 | /** | 426 | /** |
401 | * Assignment operator. | 427 | * Assignment operator. |
402 | *@param rSrc (const MyType &) The FString to set your FString to. | 428 | *@param rSrc (const MyType &) The FString to set your FString to. |