You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
/* FIXME: Many possible optimizations. */
#include "case.h"
#include "casefile.h"
#include "command.h"
+#include "dictionary.h"
#include "lexer.h"
#include "error.h"
#include "magic.h"
struct dsc_var
{
struct variable *v; /* Variable to calculate on. */
- char z_name[9]; /* Name for z-score variable. */
+ char z_name[LONG_NAME_LEN + 1]; /* Name for z-score variable. */
double valid, missing; /* Valid, missing counts. */
struct moments *moments; /* Moments. */
double min, max; /* Maximum and mimimum values. */
else if (lex_match_id ("DEFAULT"))
dsc->show_stats |= DEFAULT_STATS;
else
- {
- dsc->show_stats |= 1ul << (match_statistic ());
- if (dsc->show_stats == DSC_NONE)
- dsc->show_stats = DEFAULT_STATS;
- }
+ dsc->show_stats |= 1ul << (match_statistic ());
lex_match (',');
}
if (dsc->show_stats == 0)
if (dict_lookup_var (default_dict, name) != NULL)
return 0;
for (i = 0; i < dsc->var_cnt; i++)
- if (!strcmp (dsc->vars[i].z_name, name))
+ if (!strcasecmp (dsc->vars[i].z_name, name))
return 0;
return 1;
}
generate_z_varname (struct dsc_proc *dsc, char *z_name,
const char *var_name, int *z_cnt)
{
- char name[10];
+ char name[LONG_NAME_LEN + 1];
/* Try a name based on the original variable name. */
name[0] = 'Z';
- strcpy (name + 1, var_name);
- name[8] = '\0';
+ st_trim_copy (name + 1, var_name, sizeof name - 1);
if (try_name (dsc, name))
{
strcpy (z_name, name);
int result;
if (dsc->sort_by_stat == DSC_NAME)
- result = strcmp (a->v->name, b->v->name);
+ result = strcasecmp (a->v->name, b->v->name);
else
{
double as = a->stats[dsc->sort_by_stat];