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 <config.h>
#include "file-handle.h"
#include "filename.h"
#include "command.h"
#include "lexer.h"
-#include "getline.h"
+#include "getl.h"
#include "error.h"
#include "magic.h"
#include "var.h"
#include "linked-list.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
/* (headers) */
/* File handle. */
struct file_handle *iter;
for (iter = file_handles; iter != NULL; iter = iter->next)
- if (!strcmp (handle_name, iter->name))
+ if (!strcasecmp (handle_name, iter->name))
return iter;
return NULL;
}
int
cmd_file_handle (void)
{
- char handle_name[9];
+ char handle_name[LONG_NAME_LEN + 1];
struct cmd_file_handle cmd;
struct file_handle *handle;
if (!lex_force_id ())
return CMD_FAILURE;
- strcpy (handle_name, tokid);
+ str_copy_trunc (handle_name, sizeof handle_name, tokid);
handle = get_handle_with_name (handle_name);
if (handle != NULL)
{
- msg (SE, _("File handle %s already refers to "
- "file %s. File handle cannot be redefined within a "
- "session."),
- tokid, handle->filename);
+ msg (SE, _("File handle %s already refers to file %s. "
+ "File handles cannot be redefined within a session."),
+ handle_name, handle->filename);
return CMD_FAILURE;
}
else if (cmd.n_lrecl[0] < 1)
{
msg (SE, _("Record length (%ld) must be at least one byte. "
- "1-character records will be assumed."), cmd.n_lrecl);
+ "1-character records will be assumed."), cmd.n_lrecl[0]);
handle->length = 1;
}
else
}
-/* Tries to open FILE with the given TYPE and MODE.
+/* Tries to open handle H with the given TYPE and MODE.
TYPE is the sort of file, e.g. "system file". Only one given
type of access is allowed on a given file handle at once.
return handle->mode;
}
-/* Returns the width of a logical record on HANDLE. Applicable
- only to MODE_BINARY files. */
+/* Returns the width of a logical record on HANDLE. */
size_t
handle_get_record_width (const struct file_handle *handle)
{