X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffile-type.c;h=ff97f8dbbfbfd868c7adcd72c10672fb3a32bf1b;hb=b9799cdd10b30ea96d9178b7a0d48504d052228c;hp=a4940c23f1631f347b5a90db3d7c573a12210719;hpb=7dc203206d3f3172474a4ec0f4dcab5364f4ce26;p=pspp-builds.git diff --git a/src/file-type.c b/src/file-type.c index a4940c23..ff97f8db 100644 --- a/src/file-type.c +++ b/src/file-type.c @@ -14,8 +14,8 @@ 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. */ #include #include @@ -33,6 +33,9 @@ #include "var.h" #include "vfm.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* Defines the three types of complex files read by FILE TYPE. */ enum { @@ -44,7 +47,7 @@ enum /* Limited variable column specifications. */ struct col_spec { - char name[9]; /* Variable name. */ + char name[LONG_NAME_LEN + 1]; /* Variable name. */ int fc, nc; /* First column (1-based), # of columns. */ int fmt; /* Format type. */ struct variable *v; /* Variable. */ @@ -71,8 +74,7 @@ struct record_type int ft, lt; /* First, last transformation index. */ }; /* record_type */ -/* Represents a FILE TYPE input program. Does not contain a - trns_header because it's never submitted as a transformation. */ +/* Represents a FILE TYPE input program. */ struct file_type_pgm { int type; /* One of the FTY_* constants. */ @@ -94,6 +96,8 @@ struct file_type_pgm static int parse_col_spec (struct col_spec *, const char *); static void create_col_var (struct col_spec *c); +int cmd_file_type (void); + /* Parses FILE TYPE command. */ int cmd_file_type (void) @@ -264,7 +268,7 @@ cmd_file_type (void) goto error; } - if (!strcmp (fty->case_sbc.name, fty->record.name)) + if (!strcasecmp (fty->case_sbc.name, fty->record.name)) { msg (SE, _("CASE and RECORD must specify different variable " "names.")); @@ -440,7 +444,7 @@ cmd_record_type (void) if (rct->nv >= mv) { mv += 16; - rct->v = xrealloc (rct->v, mv * sizeof *rct->v); + rct->v = xnrealloc (rct->v, mv, sizeof *rct->v); } if (formats[fty->record.fmt].cat & FCAT_STRING) @@ -448,8 +452,8 @@ cmd_record_type (void) if (!lex_force_string ()) goto error; rct->v[rct->nv].c = xmalloc (fty->record.nc + 1); - st_bare_pad_copy (rct->v[rct->nv].c, ds_c_str (&tokstr), - fty->record.nc + 1); + buf_copy_str_rpad (rct->v[rct->nv].c, fty->record.nc + 1, + ds_c_str (&tokstr)); } else { @@ -569,6 +573,7 @@ cmd_record_type (void) /* END FILE TYPE. */ +int cmd_end_file_type (void); int cmd_end_file_type (void) {