2017-04-11 21:13:36 +00:00
|
|
|
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software
|
|
|
|
* is freely granted, provided that this notice is preserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NO_WORDEXP
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <glob.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
2017-10-07 00:16:47 +00:00
|
|
|
#include <sys/queue.h>
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
#include <wordexp.h>
|
2017-10-07 00:16:47 +00:00
|
|
|
#include "wordexp2.h"
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
wordfree(wordexp_t *pwordexp)
|
|
|
|
{
|
2017-10-07 00:16:47 +00:00
|
|
|
ext_wordv_t *wordv;
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
if (pwordexp == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (pwordexp->we_wordv == NULL)
|
|
|
|
return;
|
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
wordv = WE_WORDV_TO_EXT_WORDV(pwordexp->we_wordv);
|
|
|
|
while (!SLIST_EMPTY(&wordv->list)) {
|
|
|
|
struct ewords_entry *entry = SLIST_FIRST(&wordv->list);
|
|
|
|
SLIST_REMOVE_HEAD(&wordv->list, next);
|
|
|
|
free(entry);
|
|
|
|
}
|
2017-04-11 21:13:36 +00:00
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
free(wordv);
|
2017-04-11 21:13:36 +00:00
|
|
|
pwordexp->we_wordv = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !_NO_WORDEXP */
|