"Complies with standard 1.0 of Graham Nelson's specification.\n"\r
"\n"\r
"Syntax: frotz [options] story-file\n"\r
-" -a watch attribute setting \t -o watch object movement\n"\r
-" -A watch attribute testing \t -O watch object locating\n"\r
-" -b # background colour \t -p alter piracy opcode\n"\r
-" -B # reverse background colour\t -r # right margin\n"\r
-" -c # context lines \t -s # random number seed value\n"\r
-" -d # display mode (see below) \t -S # transscript width\n"\r
-" -e # emphasis colour [mode 1] \t -t set Tandy bit\n"\r
-" -f # foreground colour \t -T bold typing [modes 2+4+5]\n"\r
-" -F # reverse foreground colour\t -u # slots for multiple undo\n"\r
-" -g # font [mode 5] (see below)\t -w # screen width\n"\r
-" -h # screen height \t -x expand abbreviations g/x/z\n"\r
-" -i ignore runtime errors \t -Z # error checking (see below)\n"\r
-" -l # left margin"\r
+" -a watch attribute setting \t -o watch object movement\n"\r
+" -A watch attribute testing \t -O watch object locating\n"\r
+" -b # background colour \t -p alter piracy opcode\n"\r
+" -B # reverse background colour \t -r # right margin\n"\r
+" -c # context lines \t -R <path> restricted read/write\n"\r
+" -d # display mode (see below) \t -s # random number seed value\n"\r
+" -e # emphasis colour [mode 1] \t -S # transscript width\n"\r
+" -f # foreground colour \t -t set Tandy bit\n"\r
+" -F # reverse foreground colour \t -T bold typing [modes 2+4+5]\n"\r
+" -g # font [mode 5] (see below) \t -u # slots for multiple undo\n"\r
+" -h # screen height \t -w # screen width\n"\r
+" -i ignore runtime errors \t -x expand abbreviations g/x/z\n"\r
+" -l # left margin \t -Z # error checking (see below)"\r
"\n"\r
"Fonts are 0 (fixed), 1 (sans serif), 2 (comic), 3 (times), 4 (serif).\n"\r
"Display modes are 0 (mono), 1 (text), 2 (CGA), 3 (MCGA), 4 (EGA), 5 (Amiga)."\r
\r
int num = 0;\r
\r
- c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpr:s:S:tTu:w:xZ:");\r
+ c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpr:R:s:S:tTu:w:xZ:");\r
\r
if (optarg != NULL)\r
num = dectoi (optarg);\r
f_setup.piracy = 1;\r
if (c == 'r')\r
f_setup.right_margin = num;\r
+ if (c == 'R')\r
+ f_setup.restricted_path = strdup(optarg);\r
if (c == 's')\r
user_random_seed = num;\r
if (c == 'S')\r
bool saved_replay = istream_replay;
bool saved_record = ostream_record;
+ int i;
+ char *tempname;
+
/* Turn off playback and recording temporarily */
istream_replay = FALSE;
if (strchr (file_name, '.') == NULL)
strcat (file_name, extension);
+ /* FIXME: UNTESTED Check if we're restricted to one directory. */
+
+ if (f_setup.restricted_path != NULL) {
+ for (i = strlen(file_name); i > 0; i--) {
+ if (file_name[i] == PATH_SEPARATOR) {
+ i++;
+ break;
+ }
+ }
+ tempname = strdup(file_name + i);
+ strcpy(file_name, f_setup.restricted_path);
+ if (file_name[strlen(file_name)-1] != PATH_SEPARATOR) {
+ strcat(file_name, "\\");
+ }
+ strcat(file_name, tempname);
+ }
+
/* Make sure it is safe to use this file name */
result = TRUE;