Compare commits

..

No commits in common. "misc-fixes" and "mane" have entirely different histories.

35 changed files with 135 additions and 172 deletions

View file

@ -127,7 +127,7 @@ char *latin1_subst[128] = {
* NAME: charset->unicode() * NAME: charset->unicode()
* DESCRIPTION: return a Unicode string for MacOS Standard Roman * DESCRIPTION: return a Unicode string for MacOS Standard Roman
*/ */
UCS2 *cs_unicode(const char *mstr, int *lenptr) UCS2 *cs_unicode(char *mstr, int *lenptr)
{ {
int len, i; int len, i;
UCS2 *unicode, *ptr; UCS2 *unicode, *ptr;
@ -151,7 +151,7 @@ UCS2 *cs_unicode(const char *mstr, int *lenptr)
* NAME: charset->latin1() * NAME: charset->latin1()
* DESCRIPTION: return a Latin-1 (ISO 8859-1) string for MacOS Standard Roman * DESCRIPTION: return a Latin-1 (ISO 8859-1) string for MacOS Standard Roman
*/ */
char *cs_latin1(const char *mstr, int *lenptr) char *cs_latin1(char *mstr, int *lenptr)
{ {
int ilen, olen, i; int ilen, olen, i;
char *latin1, *ptr; char *latin1, *ptr;
@ -229,7 +229,7 @@ void mktable(void)
* NAME: charset->macroman() * NAME: charset->macroman()
* DESCRIPTION: return a MacOS Standard Roman string for Latin-1 (ISO 8859-1) * DESCRIPTION: return a MacOS Standard Roman string for Latin-1 (ISO 8859-1)
*/ */
char *cs_macroman(const char *lstr, int *lenptr) char *cs_macroman(char *lstr, int *lenptr)
{ {
int ilen, olen, i; int ilen, olen, i;
char *macroman, *ptr; char *macroman, *ptr;

View file

@ -21,7 +21,7 @@
typedef unsigned short UCS2; typedef unsigned short UCS2;
UCS2 *cs_unicode(const char *, int *); UCS2 *cs_unicode(char *, int *);
char *cs_latin1(const char *, int *); char *cs_latin1(char *, int *);
char *cs_macroman(const char *, int *); char *cs_macroman(char *, int *);

2
glob.c
View file

@ -336,7 +336,7 @@ int doglob(hfsvol *vol, dlist *list, const char *dir, const char *rem)
* NAME: hfs->glob() * NAME: hfs->glob()
* DESCRIPTION: perform glob pattern matching * DESCRIPTION: perform glob pattern matching
*/ */
char **hfs_glob(hfsvol *vol, int argc, const char *argv[], int *nelts) char **hfs_glob(hfsvol *vol, int argc, char *argv[], int *nelts)
{ {
dlist list; dlist list;
int i; int i;

2
glob.h
View file

@ -19,4 +19,4 @@
* $Id: glob.h,v 1.6 1998/04/11 08:26:55 rob Exp $ * $Id: glob.h,v 1.6 1998/04/11 08:26:55 rob Exp $
*/ */
char **hfs_glob(hfsvol *, int, const char *[], int *); char **hfs_glob(hfsvol *, int, char *[], int *);

View file

@ -51,7 +51,7 @@ int usage(void)
* NAME: hattrib->main() * NAME: hattrib->main()
* DESCRIPTION: implement hattrib command * DESCRIPTION: implement hattrib command
*/ */
int hattrib_main(int argc, const char *argv[]) int hattrib_main(int argc, char *argv[])
{ {
const char *type = 0, *crea = 0; const char *type = 0, *crea = 0;
int invis = 0, lock = 0, bless = 0; int invis = 0, lock = 0, bless = 0;

View file

@ -19,4 +19,4 @@
* $Id: hattrib.h,v 1.6 1998/04/11 08:26:56 rob Exp $ * $Id: hattrib.h,v 1.6 1998/04/11 08:26:56 rob Exp $
*/ */
int hattrib_main(int, const char *[]); int hattrib_main(int, char *[]);

2
hcd.c
View file

@ -36,7 +36,7 @@
* NAME: hcd->main() * NAME: hcd->main()
* DESCRIPTION: implement hcd command * DESCRIPTION: implement hcd command
*/ */
int hcd_main(int argc, const char *argv[]) int hcd_main(int argc, char *argv[])
{ {
mountent *ment; mountent *ment;
hfsvol *vol; hfsvol *vol;

2
hcd.h
View file

@ -19,4 +19,4 @@
* $Id: hcd.h,v 1.7 1998/04/11 08:26:56 rob Exp $ * $Id: hcd.h,v 1.7 1998/04/11 08:26:56 rob Exp $
*/ */
int hcd_main(int, const char *[]); int hcd_main(int, char *[]);

View file

@ -252,7 +252,7 @@ int usage(void)
* NAME: hcopy->main() * NAME: hcopy->main()
* DESCRIPTION: implement hcopy command * DESCRIPTION: implement hcopy command
*/ */
int hcopy_main(int argc, const char *argv[]) int hcopy_main(int argc, char *argv[])
{ {
int nargs, mode = 'a', result = 0; int nargs, mode = 'a', result = 0;
const char *target; const char *target;
@ -265,7 +265,7 @@ int hcopy_main(int argc, const char *argv[])
{ {
int opt; int opt;
opt = getopt(argc, (char**)argv, "mbtra"); opt = getopt(argc, argv, "mbtra");
if (opt == EOF) if (opt == EOF)
break; break;
@ -294,7 +294,7 @@ int hcopy_main(int argc, const char *argv[])
copy = do_copyin; copy = do_copyin;
fargc = nargs - 1; fargc = nargs - 1;
fargv = (char**)&argv[optind]; fargv = &argv[optind];
} }
else else
{ {
@ -311,7 +311,7 @@ int hcopy_main(int argc, const char *argv[])
hfsutil_unmount(vol, &result); hfsutil_unmount(vol, &result);
if (fargv && fargv != (char**)&argv[optind]) if (fargv && fargv != &argv[optind])
free(fargv); free(fargv);
return result; return result;

View file

@ -19,4 +19,4 @@
* $Id: hcopy.h,v 1.6 1998/04/11 08:26:56 rob Exp $ * $Id: hcopy.h,v 1.6 1998/04/11 08:26:56 rob Exp $
*/ */
int hcopy_main(int, const char *[]); int hcopy_main(int, char *[]);

2
hdel.c
View file

@ -35,7 +35,7 @@
* NAME: hdel->main() * NAME: hdel->main()
* DESCRIPTION: implement hdel command * DESCRIPTION: implement hdel command
*/ */
int hdel_main(int argc, const char *argv[]) int hdel_main(int argc, char *argv[])
{ {
hfsvol *vol; hfsvol *vol;
int fargc; int fargc;

2
hdel.h
View file

@ -19,4 +19,4 @@
* $Id: hdel.h,v 1.6 1998/04/11 08:26:57 rob Exp $ * $Id: hdel.h,v 1.6 1998/04/11 08:26:57 rob Exp $
*/ */
int hdel_main(int, const char *[]); int hdel_main(int, char *[]);

View file

@ -75,7 +75,7 @@ hfsvol *do_format(const char *path, int partno, int mode, const char *vname)
* NAME: hformat->main() * NAME: hformat->main()
* DESCRIPTION: implement hformat command * DESCRIPTION: implement hformat command
*/ */
int hformat_main(int argc, const char *argv[]) int hformat_main(int argc, char *argv[])
{ {
const char *vname; const char *vname;
char *path = 0; char *path = 0;
@ -89,7 +89,7 @@ int hformat_main(int argc, const char *argv[])
{ {
int opt; int opt;
opt = getopt(argc, (char**)argv, "fl:"); opt = getopt(argc, argv, "fl:");
if (opt == EOF) if (opt == EOF)
break; break;

View file

@ -19,4 +19,4 @@
* $Id: hformat.h,v 1.7 1998/04/11 08:26:57 rob Exp $ * $Id: hformat.h,v 1.7 1998/04/11 08:26:57 rob Exp $
*/ */
int hformat_main(int, const char *[]); int hformat_main(int, char *[]);

View file

@ -64,14 +64,14 @@ const char *argv0, *bargv0;
* NAME: main() * NAME: main()
* DESCRIPTION: program entry dispatch * DESCRIPTION: program entry dispatch
*/ */
int main(int argc, const char *argv[]) int main(int argc, char *argv[])
{ {
int i, len; int i, len;
const char *dot; const char *dot;
struct { struct {
const char *name; const char *name;
int (*func)(int, const char *[]); int (*func)(int, char *[]);
} list[] = { } list[] = {
{ "hattrib", hattrib_main }, { "hattrib", hattrib_main },
{ "hcd", hcd_main }, { "hcd", hcd_main },
@ -254,7 +254,7 @@ void hfsutil_pinfo(hfsvolent *ent)
* NAME: hfsutil->glob() * NAME: hfsutil->glob()
* DESCRIPTION: perform filename globbing * DESCRIPTION: perform filename globbing
*/ */
char **hfsutil_glob(hfsvol *vol, int argc, const char *argv[], char **hfsutil_glob(hfsvol *vol, int argc, char *argv[],
int *nelts, int *result) int *nelts, int *result)
{ {
char **fargv; char **fargv;
@ -276,7 +276,7 @@ char **hfsutil_glob(hfsvol *vol, int argc, const char *argv[],
char *hfsutil_getcwd(hfsvol *vol) char *hfsutil_getcwd(hfsvol *vol)
{ {
char *path, name[HFS_MAX_FLEN + 1 + 1]; char *path, name[HFS_MAX_FLEN + 1 + 1];
unsigned long cwd; long cwd;
int pathlen; int pathlen;
path = malloc(1); path = malloc(1);

View file

@ -32,7 +32,7 @@ hfsvol *hfsutil_remount(mountent *, int);
void hfsutil_unmount(hfsvol *, int *); void hfsutil_unmount(hfsvol *, int *);
void hfsutil_pinfo(hfsvolent *); void hfsutil_pinfo(hfsvolent *);
char **hfsutil_glob(hfsvol *, int, const char *[], int *, int *); char **hfsutil_glob(hfsvol *, int, char *[], int *, int *);
char *hfsutil_getcwd(hfsvol *); char *hfsutil_getcwd(hfsvol *);
int hfsutil_samepath(const char *, const char *); int hfsutil_samepath(const char *, const char *);

View file

@ -94,7 +94,7 @@ int Tcl_AppInit(Tcl_Interp *interp)
if (Tcl_Eval(interp, xhfs) == TCL_ERROR) if (Tcl_Eval(interp, xhfs) == TCL_ERROR)
{ {
fprintf(stderr, "Error: %s\n", Tcl_GetStringResult(interp)); fprintf(stderr, "Error: %s\n", interp->result);
exit(1); exit(1);
} }

4
hls.c
View file

@ -828,7 +828,7 @@ int queuepath(hfsvol *vol, char *path, darray *dirs, darray *files, int flags)
* NAME: hls->main() * NAME: hls->main()
* DESCRIPTION: implement hls command * DESCRIPTION: implement hls command
*/ */
int hls_main(int argc, const char *argv[]) int hls_main(int argc, char *argv[])
{ {
hfsvol *vol; hfsvol *vol;
int fargc, i; int fargc, i;
@ -871,7 +871,7 @@ int hls_main(int argc, const char *argv[])
{ {
int opt; int opt;
opt = getopt(argc, (char**)argv, "1abcdfilmqrstxw:CFNQRSU"); opt = getopt(argc, argv, "1abcdfilmqrstxw:CFNQRSU");
if (opt == EOF) if (opt == EOF)
break; break;

2
hls.h
View file

@ -19,4 +19,4 @@
* $Id: hls.h,v 1.6 1998/04/11 08:26:58 rob Exp $ * $Id: hls.h,v 1.6 1998/04/11 08:26:58 rob Exp $
*/ */
int hls_main(int, const char *[]); int hls_main(int, char *[]);

View file

@ -35,7 +35,7 @@
* NAME: hmkdir->main() * NAME: hmkdir->main()
* DESCRIPTION: implement hmkdir command * DESCRIPTION: implement hmkdir command
*/ */
int hmkdir_main(int argc, const char *argv[]) int hmkdir_main(int argc, char *argv[])
{ {
hfsvol *vol; hfsvol *vol;
char **fargv; char **fargv;

View file

@ -19,4 +19,4 @@
* $Id: hmkdir.h,v 1.6 1998/04/11 08:26:58 rob Exp $ * $Id: hmkdir.h,v 1.6 1998/04/11 08:26:58 rob Exp $
*/ */
int hmkdir_main(int, const char *[]); int hmkdir_main(int, char *[]);

View file

@ -36,7 +36,7 @@
* NAME: hmount->main() * NAME: hmount->main()
* DESCRIPTION: implement hmount command * DESCRIPTION: implement hmount command
*/ */
int hmount_main(int argc, const char *argv[]) int hmount_main(int argc, char *argv[])
{ {
char *path = 0; char *path = 0;
hfsvol *vol; hfsvol *vol;

View file

@ -19,4 +19,4 @@
* $Id: hmount.h,v 1.7 1998/04/11 08:26:59 rob Exp $ * $Id: hmount.h,v 1.7 1998/04/11 08:26:59 rob Exp $
*/ */
int hmount_main(int, const char *[]); int hmount_main(int, char *[]);

2
hpwd.c
View file

@ -35,7 +35,7 @@
* NAME: hpwd->main() * NAME: hpwd->main()
* DESCRIPTION: implement hpwd command * DESCRIPTION: implement hpwd command
*/ */
int hpwd_main(int argc, const char *argv[]) int hpwd_main(int argc, char *argv[])
{ {
mountent *ent; mountent *ent;

2
hpwd.h
View file

@ -19,4 +19,4 @@
* $Id: hpwd.h,v 1.7 1998/04/11 08:26:59 rob Exp $ * $Id: hpwd.h,v 1.7 1998/04/11 08:26:59 rob Exp $
*/ */
int hpwd_main(int, const char *[]); int hpwd_main(int, char *[]);

View file

@ -67,7 +67,7 @@ int do_rename(hfsvol *vol, int argc, char *argv[], const char *dest)
* NAME: hrename->main() * NAME: hrename->main()
* DESCRIPTION: implement hrename command * DESCRIPTION: implement hrename command
*/ */
int hrename_main(int argc, const char *argv[]) int hrename_main(int argc, char *argv[])
{ {
mountent *ment; mountent *ment;
hfsvol *vol; hfsvol *vol;

View file

@ -19,4 +19,4 @@
* $Id: hrename.h,v 1.6 1998/04/11 08:26:59 rob Exp $ * $Id: hrename.h,v 1.6 1998/04/11 08:26:59 rob Exp $
*/ */
int hrename_main(int, const char *[]); int hrename_main(int, char *[]);

View file

@ -35,7 +35,7 @@
* NAME: hrmdir->main() * NAME: hrmdir->main()
* DESCRIPTION: implement hrmdir command * DESCRIPTION: implement hrmdir command
*/ */
int hrmdir_main(int argc, const char *argv[]) int hrmdir_main(int argc, char *argv[])
{ {
hfsvol *vol; hfsvol *vol;
char **fargv; char **fargv;

View file

@ -19,4 +19,4 @@
* $Id: hrmdir.h,v 1.6 1998/04/11 08:26:59 rob Exp $ * $Id: hrmdir.h,v 1.6 1998/04/11 08:26:59 rob Exp $
*/ */
int hrmdir_main(int, const char *[]); int hrmdir_main(int, char *[]);

View file

@ -35,7 +35,7 @@
* NAME: humount->main() * NAME: humount->main()
* DESCRIPTION: implement humount command * DESCRIPTION: implement humount command
*/ */
int humount_main(int argc, const char *argv[]) int humount_main(int argc, char *argv[])
{ {
int vnum; int vnum;
mountent *ent; mountent *ent;

View file

@ -19,4 +19,4 @@
* $Id: humount.h,v 1.6 1998/04/11 08:26:59 rob Exp $ * $Id: humount.h,v 1.6 1998/04/11 08:26:59 rob Exp $
*/ */
int humount_main(int, const char *[]); int humount_main(int, char *[]);

2
hvol.c
View file

@ -64,7 +64,7 @@ int showvol(mountent *ment)
* NAME: hvol->main() * NAME: hvol->main()
* DESCRIPTION: implement hvol command * DESCRIPTION: implement hvol command
*/ */
int hvol_main(int argc, const char *argv[]) int hvol_main(int argc, char *argv[])
{ {
int vnum; int vnum;
mountent *ment; mountent *ment;

2
hvol.h
View file

@ -19,4 +19,4 @@
* $Id: hvol.h,v 1.7 1998/04/11 08:27:00 rob Exp $ * $Id: hvol.h,v 1.7 1998/04/11 08:27:00 rob Exp $
*/ */
int hvol_main(int, const char *[]); int hvol_main(int, char *[]);

View file

@ -88,7 +88,7 @@ int os_open(void **priv, const char *path, int mode)
(errno == EACCES || errno == EAGAIN)) (errno == EACCES || errno == EAGAIN))
ERROR(EAGAIN, "unable to obtain lock for medium"); ERROR(EAGAIN, "unable to obtain lock for medium");
*priv = (void *)(intptr_t) fd; *priv = (void *) fd;
return 0; return 0;
@ -105,7 +105,7 @@ fail:
*/ */
int os_close(void **priv) int os_close(void **priv)
{ {
int fd = (int)(intptr_t) *priv; int fd = (int) *priv;
*priv = (void *) -1; *priv = (void *) -1;
@ -124,7 +124,7 @@ fail:
*/ */
int os_same(void **priv, const char *path) int os_same(void **priv, const char *path)
{ {
int fd = (int)(intptr_t) *priv; int fd = (int) *priv;
struct stat fdev, dev; struct stat fdev, dev;
if (fstat(fd, &fdev) == -1 || if (fstat(fd, &fdev) == -1 ||
@ -144,7 +144,7 @@ fail:
*/ */
unsigned long os_seek(void **priv, unsigned long offset) unsigned long os_seek(void **priv, unsigned long offset)
{ {
int fd = (int)(intptr_t) *priv; int fd = (int) *priv;
off_t result; off_t result;
/* offset == -1 special; seek to last block of device */ /* offset == -1 special; seek to last block of device */
@ -169,7 +169,7 @@ fail:
*/ */
unsigned long os_read(void **priv, void *buf, unsigned long len) unsigned long os_read(void **priv, void *buf, unsigned long len)
{ {
int fd = (int)(intptr_t) *priv; int fd = (int) *priv;
ssize_t result; ssize_t result;
result = read(fd, buf, len << HFS_BLOCKSZ_BITS); result = read(fd, buf, len << HFS_BLOCKSZ_BITS);
@ -189,7 +189,7 @@ fail:
*/ */
unsigned long os_write(void **priv, const void *buf, unsigned long len) unsigned long os_write(void **priv, const void *buf, unsigned long len)
{ {
int fd = (int)(intptr_t) *priv; int fd = (int) *priv;
ssize_t result; ssize_t result;
result = write(fd, buf, len << HFS_BLOCKSZ_BITS); result = write(fd, buf, len << HFS_BLOCKSZ_BITS);

205
tclhfs.c
View file

@ -76,39 +76,6 @@ typedef struct {
Tcl_HashTable volumes; /* set containing mounted volumes (no values) */ Tcl_HashTable volumes; /* set containing mounted volumes (no values) */
Tcl_HashTable files; /* mapping of frefs -> vrefs */ Tcl_HashTable files; /* mapping of frefs -> vrefs */
/*
* NAME: resultf()
* DESCRIPTION: Fill the interpreter result using a printf-style format specifier
* NOTES: Requires a C99-conforming snprintf implemnetation
*/
#if __GNUC__
static
void resultf(Tcl_Interp *interp, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
#endif
static
void resultf(Tcl_Interp *interp, const char *fmt, ...)
{
char smallbuf[60];
int required;
va_list ap;
va_start(ap, fmt);
required = vsnprintf(smallbuf, sizeof(smallbuf), fmt, ap) + 1; // returned size does not include trailing NUL
va_end(ap);
if (required < sizeof(smallbuf)) {
Tcl_SetResult(interp, smallbuf, TCL_VOLATILE);
return;
}
char *buf = Tcl_Alloc(required);
va_start(ap, fmt);
vsnprintf(buf, required, fmt, ap);
va_end(ap);
Tcl_SetResult(interp, buf, TCL_DYNAMIC);
}
/* /*
* NAME: error() * NAME: error()
* DESCRIPTION: return a Tcl error for an HFS error * DESCRIPTION: return a Tcl error for an HFS error
@ -152,7 +119,7 @@ char *direntstr(hfsdirent *ent)
mddate[CHARLEN(long) + 1], mddate[CHARLEN(long) + 1],
bkdate[CHARLEN(long) + 1]; bkdate[CHARLEN(long) + 1];
register int argc; register int argc;
const char *argv[24]; char *argv[24];
int locked, invis; int locked, invis;
argc = 0; argc = 0;
@ -271,7 +238,7 @@ int getdir(Tcl_Interp *interp, volref *vref, const char *path)
str = direntstr(&ent); str = direntstr(&ent);
if (str == 0) if (str == 0)
{ {
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -308,7 +275,7 @@ void file_del(ClientData clientData)
*/ */
static static
int file_cmd(ClientData clientData, Tcl_Interp *interp, int file_cmd(ClientData clientData, Tcl_Interp *interp,
int argc, const char *argv[]) int argc, char *argv[])
{ {
fileref *fref = clientData; fileref *fref = clientData;
hfsfile *file = fref->file; hfsfile *file = fref->file;
@ -316,7 +283,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
switch (argc) switch (argc)
{ {
case 1: case 1:
Tcl_SetResult(interp, "missing command", TCL_STATIC); interp->result = "missing command";
return TCL_ERROR; return TCL_ERROR;
case 2: case 2:
@ -334,7 +301,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
if (offset == -1) if (offset == -1)
return error(interp, 0); return error(interp, 0);
resultf(interp, "%lu", offset); sprintf(interp->result, "%lu", offset);
} }
else if (strcmp(argv[1], "stat") == 0) else if (strcmp(argv[1], "stat") == 0)
{ {
@ -347,7 +314,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
str = direntstr(&ent); str = direntstr(&ent);
if (str == 0) if (str == 0)
{ {
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -355,7 +322,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
} }
else if (strcmp(argv[1], "getfork") == 0) else if (strcmp(argv[1], "getfork") == 0)
{ {
Tcl_SetResult(interp, (hfs_getfork(file) == 0) ? "data" : "rsrc", TCL_STATIC); interp->result = (hfs_getfork(file) == 0) ? "data" : "rsrc";
} }
else else
{ {
@ -378,7 +345,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
fork = 1; fork = 1;
else else
{ {
Tcl_SetResult(interp, "bad arg to setfork: must be data or rsrc", TCL_STATIC); interp->result = "bad arg to setfork: must be data or rsrc";
return TCL_ERROR; return TCL_ERROR;
} }
@ -395,7 +362,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
if (offset == -1) if (offset == -1)
return error(interp, 0); return error(interp, 0);
resultf(interp, "%lu", offset); sprintf(interp->result, "%lu", offset);
} }
else if (strcmp(argv[1], "read") == 0) else if (strcmp(argv[1], "read") == 0)
{ {
@ -407,7 +374,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
if (bytes < 0) if (bytes < 0)
{ {
Tcl_SetResult(interp, "size must be >= 0", TCL_STATIC); interp->result = "size must be >= 0";
return TCL_ERROR; return TCL_ERROR;
} }
@ -432,7 +399,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
if (bytes == -1) if (bytes == -1)
return error(interp, 0); return error(interp, 0);
resultf(interp, "%lu", bytes); sprintf(interp->result, "%lu", bytes);
} }
else else
{ {
@ -461,7 +428,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
whence = HFS_SEEK_END; whence = HFS_SEEK_END;
else else
{ {
Tcl_SetResult(interp, "bad arg 3: must be start, current, or end", TCL_STATIC); interp->result = "bad arg 3: must be start, current, or end";
return TCL_ERROR; return TCL_ERROR;
} }
@ -469,7 +436,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
if (offset == -1) if (offset == -1)
return error(interp, 0); return error(interp, 0);
resultf(interp, "%lu", offset); sprintf(interp->result, "%lu", offset);
} }
else else
{ {
@ -519,7 +486,6 @@ int fork_native(Tcl_Interp *interp, hfsfile *ifile, hfsfile *ofile)
/* /*
* NAME: file->ref() * NAME: file->ref()
* DESCRIPTION: called to initialize a new file reference * DESCRIPTION: called to initialize a new file reference
* NOTE: Sets interpreter result to the new command name
*/ */
static static
void file_ref(Tcl_Interp *interp, volref *vref, fileref *fref, hfsfile *file) void file_ref(Tcl_Interp *interp, volref *vref, fileref *fref, hfsfile *file)
@ -529,18 +495,17 @@ void file_ref(Tcl_Interp *interp, volref *vref, fileref *fref, hfsfile *file)
Tcl_HashEntry *entry; Tcl_HashEntry *entry;
int new; int new;
char buf[sizeof("hfsfile") + sizeof(int) * 3];
do do
snprintf(buf, sizeof(buf), "hfsfile%d", id++); sprintf(interp->result, "hfsfile%d", id++);
while (Tcl_GetCommandInfo(interp, buf, &info)); while (Tcl_GetCommandInfo(interp, interp->result, &info));
fref->file = file; fref->file = file;
fref->interp = interp; fref->interp = interp;
fref->cmd = Tcl_CreateCommand(interp, buf, file_cmd, fref, file_del); fref->cmd = Tcl_CreateCommand(interp, interp->result,
file_cmd, fref, file_del);
entry = Tcl_CreateHashEntry(&files, (char *) fref, &new); entry = Tcl_CreateHashEntry(&files, (char *) fref, &new);
Tcl_SetHashValue(entry, vref); Tcl_SetHashValue(entry, vref);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
} }
/* /*
@ -576,7 +541,7 @@ int do_copynative(Tcl_Interp *interp, hfsfile *ifile, hfsfile *ofile)
* DESCRIPTION: copy an HFS file to another HFS volume * DESCRIPTION: copy an HFS file to another HFS volume
*/ */
static static
int copynative(Tcl_Interp *interp, volref *srcvref, const char *argv[]) int copynative(Tcl_Interp *interp, volref *srcvref, char *argv[])
{ {
volref *dstvref; volref *dstvref;
Tcl_CmdInfo info; Tcl_CmdInfo info;
@ -647,7 +612,7 @@ int copynative(Tcl_Interp *interp, volref *srcvref, const char *argv[])
if (srcvref->vol == dstvref->vol && if (srcvref->vol == dstvref->vol &&
ent.cnid == cnid) ent.cnid == cnid)
{ {
Tcl_SetResult(interp, "source and destination files are the same", TCL_STATIC); interp->result = "source and destination files are the same";
hfs_close(ifile); hfs_close(ifile);
return TCL_ERROR; return TCL_ERROR;
} }
@ -684,7 +649,7 @@ int copynative(Tcl_Interp *interp, volref *srcvref, const char *argv[])
* DESCRIPTION: copy a UNIX file into an HFS volume * DESCRIPTION: copy a UNIX file into an HFS volume
*/ */
static static
int copyin(Tcl_Interp *interp, hfsvol *vol, const char *argv[]) int copyin(Tcl_Interp *interp, hfsvol *vol, char *argv[])
{ {
cpifunc copyfile; cpifunc copyfile;
@ -701,7 +666,7 @@ int copyin(Tcl_Interp *interp, hfsvol *vol, const char *argv[])
copyfile = cpi_raw; copyfile = cpi_raw;
else else
{ {
Tcl_SetResult(interp, "bad mode: must be macb, binh, text, or raw", TCL_STATIC); interp->result = "bad mode: must be macb, binh, text, or raw";
return TCL_ERROR; return TCL_ERROR;
} }
@ -719,7 +684,7 @@ int copyin(Tcl_Interp *interp, hfsvol *vol, const char *argv[])
* DESCRIPTION: copy an HFS file out to a UNIX file * DESCRIPTION: copy an HFS file out to a UNIX file
*/ */
static static
int copyout(Tcl_Interp *interp, hfsvol *vol, const char *argv[]) int copyout(Tcl_Interp *interp, hfsvol *vol, char *argv[])
{ {
cpofunc copyfile; cpofunc copyfile;
@ -736,7 +701,7 @@ int copyout(Tcl_Interp *interp, hfsvol *vol, const char *argv[])
copyfile = cpo_raw; copyfile = cpo_raw;
else else
{ {
Tcl_SetResult(interp, "bad mode: must be macb, binh, text, or raw", TCL_STATIC); interp->result = "bad mode: must be macb, binh, text, or raw";
return TCL_ERROR; return TCL_ERROR;
} }
@ -842,7 +807,7 @@ void vol_del(ClientData clientData)
*/ */
static static
int vol_cmd(ClientData clientData, Tcl_Interp *interp, int vol_cmd(ClientData clientData, Tcl_Interp *interp,
int argc, const char *argv[]) int argc, char *argv[])
{ {
volref *vref = clientData; volref *vref = clientData;
hfsvol *vol = vref->vol; hfsvol *vol = vref->vol;
@ -850,7 +815,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
switch (argc) switch (argc)
{ {
case 1: case 1:
Tcl_SetResult(interp, "missing command", TCL_STATIC); interp->result = "missing command";
return TCL_ERROR; return TCL_ERROR;
case 2: case 2:
@ -866,21 +831,21 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
hfsvolent ent; hfsvolent ent;
hfs_vstat(vol, &ent); hfs_vstat(vol, &ent);
resultf(interp, "%lu %lu", ent.totbytes, ent.freebytes); sprintf(interp->result, "%lu %lu", ent.totbytes, ent.freebytes);
} }
else if (strcmp(argv[1], "crdate") == 0) else if (strcmp(argv[1], "crdate") == 0)
{ {
hfsvolent ent; hfsvolent ent;
hfs_vstat(vol, &ent); hfs_vstat(vol, &ent);
resultf(interp, "%ld", (long) ent.crdate); sprintf(interp->result, "%ld", (long) ent.crdate);
} }
else if (strcmp(argv[1], "mddate") == 0) else if (strcmp(argv[1], "mddate") == 0)
{ {
hfsvolent ent; hfsvolent ent;
hfs_vstat(vol, &ent); hfs_vstat(vol, &ent);
resultf(interp, "%ld", (long) ent.mddate); sprintf(interp->result, "%ld", (long) ent.mddate);
} }
else if (strcmp(argv[1], "islocked") == 0) else if (strcmp(argv[1], "islocked") == 0)
{ {
@ -888,9 +853,9 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
hfs_vstat(vol, &ent); hfs_vstat(vol, &ent);
if (ent.flags & HFS_ISLOCKED) if (ent.flags & HFS_ISLOCKED)
Tcl_SetResult(interp, "1", TCL_STATIC); interp->result = "1";
else else
Tcl_SetResult(interp, "0", TCL_STATIC); interp->result = "0";
} }
else if (strcmp(argv[1], "umount") == 0) else if (strcmp(argv[1], "umount") == 0)
{ {
@ -899,13 +864,13 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
return error(interp, 0); return error(interp, 0);
} }
else if (strcmp(argv[1], "cwd") == 0) else if (strcmp(argv[1], "cwd") == 0)
resultf(interp, "%lu", vref->cwd); sprintf(interp->result, "%lu", vref->cwd);
else if (strcmp(argv[1], "path") == 0) else if (strcmp(argv[1], "path") == 0)
{ {
char name[HFS_MAX_FLEN + 1]; char name[HFS_MAX_FLEN + 1];
unsigned long id; long id;
int listc, i; int listc, i;
const char **listv; char **listv;
char *result; char *result;
id = vref->cwd; id = vref->cwd;
@ -919,12 +884,12 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
/* reverse the resulting list */ /* reverse the resulting list */
if (Tcl_SplitList(interp, Tcl_GetStringResult(interp), &listc, &listv) != TCL_OK) if (Tcl_SplitList(interp, interp->result, &listc, &listv) != TCL_OK)
return TCL_ERROR; return TCL_ERROR;
for (i = 0; i < listc / 2; ++i) for (i = 0; i < listc / 2; ++i)
{ {
const char *tmp; char *tmp;
tmp = listv[i]; tmp = listv[i];
listv[i] = listv[listc - 1 - i]; listv[i] = listv[listc - 1 - i];
@ -932,7 +897,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
} }
result = Tcl_Merge(listc, listv); result = Tcl_Merge(listc, listv);
Tcl_Free((char*)listv); Tcl_Free(listv);
Tcl_SetResult(interp, result, TCL_DYNAMIC); Tcl_SetResult(interp, result, TCL_DYNAMIC);
} }
@ -947,7 +912,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
return error(interp, 0); return error(interp, 0);
} }
else if (strcmp(argv[1], "sepchar") == 0) else if (strcmp(argv[1], "sepchar") == 0)
Tcl_SetResult(interp, ":", TCL_STATIC); interp->result = ":";
else else
{ {
Tcl_AppendResult(interp, "bad command \"", argv[1], Tcl_AppendResult(interp, "bad command \"", argv[1],
@ -968,7 +933,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
} }
else if (strcmp(argv[1], "dirinfo") == 0) else if (strcmp(argv[1], "dirinfo") == 0)
{ {
unsigned long id; long id;
char name[HFS_MAX_FLEN + 1], idstr[CHARLEN(unsigned long) + 1]; char name[HFS_MAX_FLEN + 1], idstr[CHARLEN(unsigned long) + 1];
if (Tcl_ExprLong(interp, argv[2], &id) != TCL_OK) if (Tcl_ExprLong(interp, argv[2], &id) != TCL_OK)
@ -994,7 +959,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
fref = ALLOC(fileref, 1); fref = ALLOC(fileref, 1);
if (fref == 0) if (fref == 0)
{ {
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1019,7 +984,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
str = direntstr(&ent); str = direntstr(&ent);
if (str == 0) if (str == 0)
{ {
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1059,8 +1024,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
else if (strcmp(argv[1], "glob") == 0) else if (strcmp(argv[1], "glob") == 0)
{ {
int listc, fargc; int listc, fargc;
const char **listv; char **listv, **fargv, *result;
char **fargv, *result;
if (hfs_setcwd(vol, vref->cwd) == -1) if (hfs_setcwd(vol, vref->cwd) == -1)
return error(interp, 0); return error(interp, 0);
@ -1069,16 +1033,16 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
return TCL_ERROR; return TCL_ERROR;
fargv = hfs_glob(vol, listc, listv, &fargc); fargv = hfs_glob(vol, listc, listv, &fargc);
Tcl_Free((void*)listv); free(listv);
if (fargv == 0) if (fargv == 0)
{ {
Tcl_SetResult(interp, "globbing error", TCL_STATIC); interp->result = "globbing error";
return TCL_ERROR; return TCL_ERROR;
} }
result = Tcl_Merge(fargc, (const char**)fargv); result = Tcl_Merge(fargc, fargv);
free(fargv); Tcl_Free(fargv);
Tcl_SetResult(interp, result, TCL_DYNAMIC); Tcl_SetResult(interp, result, TCL_DYNAMIC);
} }
@ -1129,14 +1093,14 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
if (strlen(argv[3]) != 4 || if (strlen(argv[3]) != 4 ||
strlen(argv[4]) != 4) strlen(argv[4]) != 4)
{ {
Tcl_SetResult(interp, "type and creator must be 4 character strings", TCL_STATIC); interp->result = "type and creator must be 4 character strings";
return TCL_ERROR; return TCL_ERROR;
} }
fref = ALLOC(fileref, 1); fref = ALLOC(fileref, 1);
if (fref == 0) if (fref == 0)
{ {
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1188,13 +1152,13 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
*/ */
static static
int cmd_hfs(ClientData clientData, Tcl_Interp *interp, int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
int argc, const char *argv[]) int argc, char *argv[])
{ {
static int id = 0; static int id = 0;
if (argc < 2) if (argc < 2)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1209,7 +1173,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (argc < 3 || argc > 4) if (argc < 3 || argc > 4)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1228,7 +1192,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (nparts > 1) if (nparts > 1)
{ {
resultf(interp, "must specify partition number " sprintf(interp->result, "must specify partition number "
"(%d available)", nparts); "(%d available)", nparts);
return TCL_ERROR; return TCL_ERROR;
} }
@ -1241,7 +1205,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
vref = ALLOC(volref, 1); vref = ALLOC(volref, 1);
if (vref == 0) if (vref == 0)
{ {
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1261,13 +1225,12 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
entry = Tcl_CreateHashEntry(&volumes, (char *) vref, &new); entry = Tcl_CreateHashEntry(&volumes, (char *) vref, &new);
char buf[sizeof("hfsvol") + sizeof(int) * 3];
do do
snprintf(buf, sizeof(buf), "hfsvol%d", id++); sprintf(interp->result, "hfsvol%d", id++);
while (Tcl_GetCommandInfo(interp, buf, &info)); while (Tcl_GetCommandInfo(interp, interp->result, &info));
Tcl_CreateCommand(interp, buf, vol_cmd, vref, vol_del); Tcl_CreateCommand(interp, interp->result,
Tcl_SetResult(interp, buf, TCL_VOLATILE); vol_cmd, vref, vol_del);
} }
else if (strcmp(argv[1], "zero") == 0) else if (strcmp(argv[1], "zero") == 0)
{ {
@ -1276,7 +1239,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (argc != 4) if (argc != 4)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1286,7 +1249,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (do_zero(argv[2], nparts, &len) == -1) if (do_zero(argv[2], nparts, &len) == -1)
return error(interp, 0); return error(interp, 0);
resultf(interp, "%lu", len); sprintf(interp->result, "%lu", len);
} }
else if (strcmp(argv[1], "mkpart") == 0) else if (strcmp(argv[1], "mkpart") == 0)
{ {
@ -1294,7 +1257,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (argc != 4) if (argc != 4)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1310,7 +1273,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (argc != 3) if (argc != 3)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1318,7 +1281,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
nparts = hfs_nparts(argv[2]); nparts = hfs_nparts(argv[2]);
suid_disable(); suid_disable();
resultf(interp, "%d", nparts); sprintf(interp->result, "%d", nparts);
} }
else if (strcmp(argv[1], "format") == 0) else if (strcmp(argv[1], "format") == 0)
{ {
@ -1326,7 +1289,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (argc < 5 || argc > 6) if (argc < 5 || argc > 6)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1336,7 +1299,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (argc == 6) if (argc == 6)
{ {
int listc, i; int listc, i;
const char **listv; char **listv;
unsigned long *badblocks; unsigned long *badblocks;
if (Tcl_SplitList(interp, argv[5], &listc, &listv) != TCL_OK) if (Tcl_SplitList(interp, argv[5], &listc, &listv) != TCL_OK)
@ -1345,9 +1308,9 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
badblocks = ALLOCX(unsigned long, listc); badblocks = ALLOCX(unsigned long, listc);
if (listc && badblocks == 0) if (listc && badblocks == 0)
{ {
Tcl_Free((void*)listv); Tcl_Free(listv);
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1356,13 +1319,13 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (Tcl_ExprLong(interp, listv[i], if (Tcl_ExprLong(interp, listv[i],
(long *) &badblocks[i]) != TCL_OK) (long *) &badblocks[i]) != TCL_OK)
{ {
Tcl_Free((void*)listv); Tcl_Free(listv);
FREE(badblocks); FREE(badblocks);
return TCL_ERROR; return TCL_ERROR;
} }
} }
Tcl_Free((void*)listv); Tcl_Free(listv);
if (do_format(argv[2], partno, 0, argv[4], listc, badblocks) == -1) if (do_format(argv[2], partno, 0, argv[4], listc, badblocks) == -1)
{ {
@ -1388,7 +1351,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
if (argc != 5) if (argc != 5)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1397,8 +1360,8 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
(strcmp(argv[3], "latin1") != 0 && (strcmp(argv[3], "latin1") != 0 &&
strcmp(argv[3], "macroman") != 0)) strcmp(argv[3], "macroman") != 0))
{ {
Tcl_SetResult(interp, "bad arg to chartrans: " interp->result = "bad arg to chartrans: "
"charsets must be one of latin1, macroman", TCL_STATIC); "charsets must be one of latin1, macroman";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1410,13 +1373,13 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
result = cs_latin1(argv[4], 0); result = cs_latin1(argv[4], 0);
else else
{ {
Tcl_SetObjResult(interp, Tcl_NewStringObj(argv[4], -1)); Tcl_SetResult(interp, argv[4], TCL_VOLATILE);
return TCL_OK; return TCL_OK;
} }
if (result == 0) if (result == 0)
{ {
Tcl_SetResult(interp, "out of memory", TCL_STATIC); interp->result = "out of memory";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1430,41 +1393,41 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
{ {
if (argc != 2) if (argc != 2)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_SetResult(interp, (char *)hfsutils_version, TCL_STATIC); interp->result = (char *) hfsutils_version;
} }
else if (strcmp(argv[1], "copyright") == 0) else if (strcmp(argv[1], "copyright") == 0)
{ {
if (argc != 2) if (argc != 2)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_SetResult(interp, (char *)hfsutils_copyright, TCL_STATIC); interp->result = (char *) hfsutils_copyright;
} }
else if (strcmp(argv[1], "author") == 0) else if (strcmp(argv[1], "author") == 0)
{ {
if (argc != 2) if (argc != 2)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_SetResult(interp, (char *)hfsutils_author, TCL_STATIC); interp->result = (char *) hfsutils_author;
} }
else if (strcmp(argv[1], "license") == 0) else if (strcmp(argv[1], "license") == 0)
{ {
if (argc != 2) if (argc != 2)
{ {
Tcl_SetResult(interp, "wrong # args", TCL_STATIC); interp->result = "wrong # args";
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_SetResult(interp, (char *)hfsutils_license, TCL_STATIC); interp->result = (char *) hfsutils_license;
} }
else else
{ {
@ -1485,13 +1448,13 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
*/ */
static static
int cmd_exit(ClientData clientData, Tcl_Interp *interp, int cmd_exit(ClientData clientData, Tcl_Interp *interp,
int argc, const char *argv[]) int argc, char *argv[])
{ {
int status = 0; int status = 0;
if (argc > 2) if (argc > 2)
{ {
Tcl_SetResult(interp, "wrong # args: should be \"exit ?returnCode?\"", TCL_STATIC); interp->result = "wrong # args: should be \"exit ?returnCode?\"";
return TCL_ERROR; return TCL_ERROR;
} }
@ -1514,8 +1477,8 @@ int Hfs_Init(Tcl_Interp *interp)
Tcl_InitHashTable(&volumes, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&volumes, TCL_ONE_WORD_KEYS);
Tcl_InitHashTable(&files, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&files, TCL_ONE_WORD_KEYS);
Tcl_CreateCommand(interp, "hfs", cmd_hfs, NULL, NULL); Tcl_CreateCommand(interp, "hfs", cmd_hfs, 0, 0);
Tcl_CreateCommand(interp, "exit", cmd_exit, NULL, NULL); Tcl_CreateCommand(interp, "exit", cmd_exit, 0, 0);
return TCL_OK; return TCL_OK;
} }