Codebase list daisy-player / c485b70
Imported Upstream version 3.1.1 Paul Gevers 13 years ago
6 changed file(s) with 352 addition(s) and 94 deletion(s). Raw diff Collapse all Expand all
0 Author: J. Lemmens <jos@jlemmens.nl>
1 Download: http://www.jlemmens.nl
2
3 Copyright:
4 (C)2003-2010 J. Lemmens
5
6 License: GPL-2+
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11 .
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 .
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1818
1919 # daisy_player /dev/cdrom2
2020
21 To "mount" and read a daisy_cd, daisy_player needs super-user previlages.
22 start daisy_player with sudo:
23
24 # sudo daisy_player
21 To read a Daisy_CD, the daisy_player calling user has to be a member
22 of the group "cdrom". See the man-page of usermod for more information
23 about how to get a user of the group "cdrom".
2524
2625 Instead of a drive name one could also give a map with a daisy structure
2726 as argument to daisy_player:
2827
2928 # daisy_player /home/jos/daisy_map
3029
31 A list of items on the daisy-cd will appear. Press <ENTER>
30 A list of items on the Daisy-CD will appear. Press <ENTER>
3231 to start playing. When reading of an item has finished, daisy_player will
3332 play the next item and the cursor will automatically skip
3433 to that item, so that your braille-terminal will display the name
+0
-20
copyright less more
0 Author: J. Lemmens <jos@jlemmens.nl>
1 Download: http://www.jlemmens.nl
2
3 Copyright:
4 (C)2003-2010 J. Lemmens
5
6 License: GPL-2+
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11 .
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 .
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Binary diff not shown
0 daisy_player(1) Unix user 's manual daisy_player(1)
1
2
3
4 NNAAMMEE
5 ddaaiissyy__ppllaayyeerr - A parser to play Daisy-CD's with Linux
6
7 SSYYNNOOPPSSIISS
8 ddaaiissyy__ppllaayyeerr [[_m_a_p _w_i_t_h _a _D_a_i_s_y_-_s_t_r_u_c_t_u_r_e] | [_d_e_v_i_c_e _n_a_m_e _w_i_t_h _a _D_a_i_s_y_-_C_D]]
9
10 DDEESSCCRRIIPPTTIIOONN
11 Daisy_player reads _a _D_a_i_s_y_-_C_D and plays the audio-files using mmaadd--
12 ppllaayy(1). Daisy_player uses /dev/cdrom by default. An alternative CD-ROM
13 drive can be given as an argument to ddaaiissyy__ppllaayyeerr. To read _a Daisy_CD,
14 the ddaaiissyy__ppllaayyeerr calling user need to be _a member of the group "cdrom".
15 To make _a user _a member of the group "cdrom", one can give the follow-
16 ing command:
17
18 usermod -a -G cdrom <logname>
19
20 See the documentation of uusseerrmmoodd(8) for more information.
21
22 Instead of _a drive _n_a_m_e one could also give _a _m_a_p _w_i_t_h _a daisy struc-
23 ture as argument to ddaaiissyy__ppllaayyeerr.
24
25 A list of items on the _D_a_i_s_y_-_C_D will appear. Press <ENTER> to start
26 playing. When reading of an item has finished, ddaaiissyy__ppllaayyeerr will play
27 the next item and the cursor will automatically skip to that item, so
28 that an attached braille-terminal will display the _n_a_m_e of that item.
29
30 SSCCRREEEENN
31 The _n_a_m_e and version of this program and the _n_a_m_e of the author will be
32 displayed left aligned at the top of the screen. The _n_a_m_e of the cur-
33 rent loaded book will be displayed right aligned.
34
35 The second row of the screen will display the number of pages of the
36 current loaded book (if any), the current selected level and the total
37 number of levels, the total playing time, the current displayed screen
38 and the total number of screens.
39
40 The next rows will display the title of the item, the first and last
41 page of the item within brackets (if there are pages) and the playing
42 time. Items in higher levels will be indented. (Three spaces each
43 level.) When "just playing this item" is active, _a "J" will be viewed
44 at the first column of that item.
45
46 KKEEYYBBOOAARRDD CCOOMMMMAANNDDSS
47 Daisy_player recognizes the following keyboard-commands:
48
49 -- ccuurrssoorr ddoowwnn
50 move cursor to the next item
51
52 -- ccuurrssoorr uupp
53 move cursor to the previous item
54
55 -- ccuurrssoorr rriigghhtt
56 skip to next phrase
57
58 -- ccuurrssoorr lleefftt
59 skip to previous phrase
60
61 -- ppaaggee--ddoowwnn
62 view next screen
63
64 -- ppaaggee--uupp
65 view previous screen
66
67 -- eenntteerr
68 Start playing
69
70 -- ssppaaccee
71 pause/resume playing
72
73 -- // search for _a label
74
75 -- dd store current item to disk
76
77 -- ee stop playing and eject
78
79 -- ff find the currently playing item and place the cursor there
80
81 -- gg go to page number (if any)
82
83 -- hh oorr ??
84 give this help
85
86 -- jj just play current item and place _a "J" at the first column.
87
88 -- ll switch to next level
89
90 -- LL switch to previous level
91
92 -- nn search next
93
94 -- NN search backwards
95
96 -- qq quit daisy-player
97
98 -- ss stop playing
99
100 SSEEEE AALLSSOO
101 mmaaddppllaayy(1), uusseerrmmoodd(8)
102
103 AAUUTTHHOORR
104 Jos Lemmens <jos@jlemmens.nl>
105
106 CCOOPPYYRRIIGGHHTT
107 Copyright (C)2003-2010 Jos Lemmens <jos@jlemmens.nl>
108
109 This program is free software; you can redistribute it and/or modify it
110 under the terms of the GNU General Public License as published by the
111 Free Software Foundation; either version 2, or (at your option) any
112 later version. This program is distributed in the hope that it will be
113 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
114 MER- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
115 General Public License for more details. You should have received _a
116 copy of the GNU General Public License along _w_i_t_h this program (see the
117 file COPYING); if not, write to the Free Software Foundation, Inc., 59
118 Temple Place - Suite 330, Boston, MA 02111-1307, USA
119
120
121
122 25 July 2010 daisy_player(1)
2828 #include <curses.h>
2929 #include <sys/ioctl.h>
3030 #include <fcntl.h>
31 #include <sys/mount.h>
3231 #include <sys/soundcard.h>
3332 #include <libgen.h>
3433 #include <time.h>
3736 #include <cdio/cdio.h>
3837 #include <cdio/iso9660.h>
3938
40 #define VERSION "3.0"
39 #define VERSION "3.1.1"
4140 #define BUF_SIZE 2048
4241 #define FACTOR (44100 * 2 * 2)
4342
4443 WINDOW *scherm, *titlewin;
4544 int html_fp, smil_file_fd, discinfo_fp, discinfo = 00, multi = 0;
46 int playing, playing_y, playing_page, just_this_item;
45 int playing, playing_y, playing_page, just_this_item, read_from_device_flag;
4746 char from_page[10], to_page[10], current_book_page[100];
4847 int bytes_read, ncc_maxPageNormal;
4948 char ncc_timeInThisSmil[10], page_number[15], label[255];
106105 } // if
107106 } // while
108107 closedir (dir);
109 return NULL;
108 return name;
110109 } // realname
110
111 void get_from_iso9660 (char *file)
112 {
113 #define CEILING(x, y) ((x+(y-1))/y)
114
115 #define my_exit(rc) \
116 fclose (w); \
117 free (p_statbuf); \
118 iso9660_close (p_iso); \
119 exit (1);
120
121 iso9660_stat_t *p_statbuf;
122 FILE *w;
123 int i;
124 iso9660_t *p_iso;
125
126 for (i = 0; i < 10; i++)
127 {
128 if ((p_iso = iso9660_open (daisy_dev)) == NULL)
129 {
130 switch (errno)
131 {
132 case EPERM:
133 beep ();
134 endwin ();
135 fprintf (stderr, "\nSorry, couldn't open ISO 9660 image %s\n",
136 daisy_dev);
137 perror (daisy_dev);
138 exit (1);
139 case ENOMEDIUM:
140 sleep (5);
141 continue;
142 case EBUSY:
143 break;
144 } // switch
145 } // if
146 } // for
147 if ((p_statbuf = iso9660_ifs_stat_translate (p_iso, file)) == NULL)
148 {
149 endwin ();
150 fprintf (stderr,
151 "\nCould not get ISO-9660 file information for file %s\n", file);
152 perror (file);
153 fprintf (stderr, "\
154 You ar not permitted to read from this device.\n\
155 To get read permission, make yourself a member of the group cdrom.\n\
156 To do this type:\n\n\
157 sudo usermod -a -G cdrom %s\n\n\
158 or ask the system maintainer to do this for you.\n\
159 (You need to logout and login again to let the change get effect.)\n",
160 getenv ("LOGNAME"));
161 beep ();
162 iso9660_close (p_iso);
163 exit (1);
164 } // if
165 if (! (w = fopen (file, "wb")))
166 {
167 endwin ();
168 perror (file);
169 free (p_statbuf);
170 iso9660_close (p_iso);
171 exit (1);
172 } // if
173 {
174 const unsigned int i_blocks = CEILING (p_statbuf->size, ISO_BLOCKSIZE);
175 for (i = 0; i < i_blocks; i++)
176 {
177 char buf[ISO_BLOCKSIZE];
178 const lsn_t lsn = p_statbuf->lsn + i;
179
180 memset (buf, 0, ISO_BLOCKSIZE);
181 if (ISO_BLOCKSIZE != iso9660_iso_seek_read (p_iso, buf, lsn, 1))
182 {
183 endwin ();
184 fprintf (stderr, "Error reading ISO 9660 file %s at LSN %lu\n",
185 file, (long unsigned int) lsn);
186 my_exit (4);
187 } // if
188 fwrite (buf, ISO_BLOCKSIZE, 1, w);
189 if (ferror (w))
190 {
191 endwin ();
192 perror (file);
193 my_exit (5);
194 } // if
195 } // for
196 }
197 fflush (w);
198 if (ftruncate (fileno (w), p_statbuf->size))
199 {
200 endwin ();
201 perror ("ftruncate()");
202 exit (1);
203 } // if
204 } // get_from_iso9660
111205
112206 void put_bookmark ()
113207 {
160254 {
161255 if (get_next_clips (smil_file_fd) == EOF)
162256 {
163 sprintf (str, "%s/%s", daisy_mp, realname (daisy[current].smil_file));
164 if ((smil_file_fd = open (str, O_RDONLY)) == -1)
257 if (read_from_device_flag)
258 get_from_iso9660 (daisy[current].smil_file);
259 if ((smil_file_fd =
260 open (realname (daisy[current].smil_file), O_RDONLY)) == -1)
165261 {
166262 endwin ();
167 perror (str);
263 perror (realname (daisy[current].smil_file));
168264 exit (1);
169265 } // if
170266 return;
527623 strcpy (orig, new);
528624 } // convert_html_entities
529625
530
531
532626 int get_element_or_label (int r)
533627 {
534628 char *p;
606700 void get_book_page ()
607701 {
608702 int fd;
609 char *p, file[100], anchor[100], str[255];
703 char *p, file[100], anchor[100];
610704
611705 p = strcasestr (element, "src");
612706 while (*++p != '=');
617711 while (*p != '"' && *p != '\'' && *p != '>' && *p != '#')
618712 p++;
619713 *p++ = 0;
620 strcpy (anchor, p);
714 strcpy (anchor, p);
621715 p = anchor;
622716 while (*p != '"' && *p != '\'' && *p != '>' && *p != '#')
623717 p++;
624718 *p = 0;
625 sprintf (str, "%s/%s", daisy_mp, realname (file));
626 if ((fd = open (str, O_RDONLY)) == -1)
719 if (read_from_device_flag)
720 get_from_iso9660 (file);
721 if ((fd = open (realname (file), O_RDONLY)) == -1)
627722 {
628723 endwin ();
629 perror (str);
724 perror (realname (file));
630725 exit (1);
631726 } // if
632727 while (1)
634729 if (get_element_or_label (fd) == EOF)
635730 {
636731 close (fd);
732 if (read_from_device_flag)
733 remove (file);
637734 return;
638735 } // if
639736 if (strcasestr (element, anchor))
644741 if (get_element_or_label (fd) == EOF)
645742 {
646743 close (fd);
744 if (read_from_device_flag)
745 remove (file);
647746 return;
648747 } // if
649748 strcpy (tag, element + 1);
651750 if ((tag[0] == 'h' || tag[0] == 'H') && isdigit (tag[1]))
652751 {
653752 close (fd);
753 if (read_from_device_flag)
754 remove (file);
654755 return;
655756 } // if
656757 if (strcasecmp (tag, "span") == 0)
661762 if (get_element_or_label (fd) == EOF)
662763 {
663764 close (fd);
765 if (read_from_device_flag)
766 remove (file);
664767 return;
665768 } // if
666769 if (*label)
667770 {
668771 strcpy (current_book_page, label);
669772 close (fd);
773 if (read_from_device_flag)
774 remove (file);
670775 return;
671776 } // if
672777 } // while
673778 close (fd);
779 if (read_from_device_flag)
780 remove (file);
674781 } // get_book_page
675782
676783 int get_next_clips (int fd)
721828 } // while
722829 strcpy (f, strcasestr (element, "src=\"") + 5);
723830 *strchr (f, '"') = 0;
724 sprintf (daisy[current].audio_file, "%s/%s", daisy_mp, realname (f));
831 strcpy (daisy[current].audio_file, realname (f));
725832
726833 // fill begin
727834 p = strcasestr (element, "clip-begin");
745852
746853 void parse_smil (char *smil_file)
747854 {
748 char str[255], *s;
855 char *s;
749856 int r;
750857
751 sprintf (str, "%s/%s", daisy_mp, realname (smil_file));
752 if ((r = open (str, O_RDONLY)) == -1)
858 if (read_from_device_flag)
859 get_from_iso9660 (smil_file);
860 if ((r = open (realname (smil_file), O_RDONLY)) == -1)
753861 {
754862 endwin ();
755 perror (str);
863 perror (realname (smil_file));
756864 exit (1);
757865 } // if
758866 while (get_element_or_label (r) != EOF)
781889 } // while
782890 compose_audio_file (r);
783891 close (r);
892 if (read_from_device_flag)
893 remove (smil_file);
784894 } // parse_smil
785895
786896 void view_page (int page)
851961 char *p, *str;
852962 int r;
853963
964 if (read_from_device_flag)
965 get_from_iso9660 (html_file);
854966 if ((r = open (html_file, O_RDONLY)) == -1)
855967 {
856968 endwin ();
857969 perror (html_file);
858 putchar ('\7');
970 beep ();
859971 exit (-1);
860972 } // if
861973
8891001 do
8901002 {
8911003 if (get_element_or_label (r) == EOF)
1004 {
1005 if (read_from_device_flag)
1006 remove (html_file);
8921007 return;
1008 } // if
8931009 strcpy (tag, element + 1);
8941010 get_tag ();
8951011 if (*label)
9791095 } // while
9801096 max_items = current - 1;
9811097 close (r);
1098 if (read_from_device_flag)
1099 remove (html_file);
9821100
9831101 int w;
9841102
10211139 break;
10221140 default:
10231141 return;
1024 } // switch
1142 } // switch
10251143 sprintf (str, "%f", clip_duration);
1144 if (read_from_device_flag)
1145 get_from_iso9660 (daisy[playing].audio_file);
10261146 execlp ("madplay", "madplay", "-Q", daisy[playing].audio_file,
1027 "-s", clip_begin, "-t", str, "-o", sound_dev, NULL);
1147 "-s", clip_begin, "-t", str, NULL); // "-o", sound_dev, NULL);
10281148 } // madplay
10291149
10301150 void start_playing (char *smil_file, char *anchor)
10311151 {
1032 char str[100];
1033
10341152 if (smil_file_fd > -1)
10351153 close (smil_file_fd);
1036 sprintf (str, "%s/%s", daisy_mp, realname (smil_file));
1037 if ((smil_file_fd = open (str, O_RDONLY)) == -1)
1154 if (read_from_device_flag)
1155 get_from_iso9660 (smil_file);
1156 if ((smil_file_fd = open (realname (smil_file), O_RDONLY)) == -1)
10381157 {
10391158 endwin ();
1040 perror (smil_file);
1159 perror (realname (smil_file));
10411160 exit (1);
10421161 } // if
10431162 *current_book_page = 0;
10461165 if (get_element_or_label (smil_file_fd) == EOF)
10471166 {
10481167 close (smil_file_fd);
1168 if (read_from_device_flag)
1169 remove (smil_file);
10491170 return;
10501171 } // if
10511172 strcpy (tag, element + 1);
10911212 case 13:
10921213 mvwaddstr (scherm, 8, 0, "Please wait...");
10931214 wrefresh (scherm);
1094 sprintf (str, "madplay -Q %s -o %s:\"%s.%s\" -s %s",
1095 daisy[current].audio_file, format, daisy[current].label,
1096 ext, clip_begin);
1215 sprintf (str, "madplay -Q %s -o %s:%s/\"%s.%s\" -s %s",
1216 daisy[current].audio_file, format, getenv ("HOME"),
1217 daisy[current].label, ext, clip_begin);
10971218 system (str);
10981219 view_page (cur_page);
10991220 wmove (scherm, by, bx);
11001221 return;
1101 case 'q':
1222 case 'q':
11021223 view_page (cur_page);
11031224 wmove (scherm, by, bx);
11041225 return;
12651386
12661387 void skip_left ()
12671388 {
1268 char str[100], last_clip[255];
1389 char last_clip[255];
12691390
12701391 if (1)
12711392 {
12811402 } // if
12821403 kill_madplay (SIGTERM);
12831404 close (smil_file_fd);
1405 if (read_from_device_flag)
1406 remove (daisy[current].smil_file);
12841407 current = playing;
12851408 while (daisy[--current].level > level);
12861409 playing = current;
1287 sprintf (str, "%s/%s", daisy_mp, daisy[current].smil_file);
1288 if ((smil_file_fd = open (str, O_RDONLY)) == -1)
1410 if (read_from_device_flag)
1411 get_from_iso9660 (daisy[current].smil_file);
1412 if ((smil_file_fd = open (daisy[current].smil_file, O_RDONLY)) == -1)
12891413 {
12901414 endwin ();
1291 perror (str);
1415 perror (daisy[current].smil_file);
12921416 exit (-1);
12931417 } // if
12941418 while (get_element_or_label (smil_file_fd) != EOF)
13821506 remove (template);
13831507 kill_madplay (SIGTERM);
13841508 put_bookmark ();
1385 umount (daisy_dev);
1509 if (read_from_device_flag)
1510 remove (daisy_mp);
13861511 } // quit_daisy_player
13871512
13881513 void search (int start, char mode)
14571582 beep ();
14581583 return;
14591584 } // if
1585 if (read_from_device_flag)
1586 get_from_iso9660 (NCC_HTML);
14601587 if ((fd = open (NCC_HTML, O_RDONLY)) == -1)
14611588 {
14621589 endwin ();
15001627 *p = 0;
15011628 } while (strcmp (label, page_number) != 0);
15021629 close (fd);
1630 if (read_from_device_flag)
1631 remove (NCC_HTML);
15031632
15041633 for (current = 0; current <= max_items; current++)
15051634 {
15181647
15191648 void cd_eject (const char *dev)
15201649 {
1521 cdio_eject_media_drive (daisy_dev);
1650 endwin ();
1651 switch (cdio_eject_media_drive (daisy_dev))
1652 {
1653 case DRIVER_OP_UNSUPPORTED:
1654 fprintf (stderr, "\nEject not supported for %s.\n", daisy_dev);
1655 break;
1656 default:
1657 // fprintf (stderr, "\nEject of CD-ROM drive %s failed.\n", daisy_dev);
1658 break;
1659 } // switch
15221660 } // cd_eject
15231661
15241662 void browse ()
15461684 view_page (cur_page);
15471685 if (discinfo)
15481686 {
1549 sprintf (str, "%s -m %s/%s -d %s", prog_name, daisy_mp,
1687 sprintf (str, "%s -m %s -d %s", prog_name,
15501688 dirname (daisy[current].smil_file), sound_dev);
15511689 system (str);
15521690 view_page (cur_page);
17261864 {
17271865 // get list of files in a directory of an ISO-9660 image
17281866
1729 CdioList_t *p_entlist;
1867 CdioList_t *p_entlist;
17301868 CdioListNode_t *p_entnode;
17311869 iso9660_t *p_iso;
17321870 const char *psz_path = "/";
17351873 {
17361874 beep ();
17371875 endwin ();
1738 fprintf (stderr, "Sorry, couldn't open %s as an ISO-9660 image\n",
1876 fprintf (stderr, "\nSorry, couldn't open %s as an ISO-9660 image\n",
17391877 daisy_dev);
17401878 exit (1);
17411879 } // if
17571895
17581896 int main (int argc, char *argv[])
17591897 {
1760 int x, mount_it = 1, ret;
1898 int x;
17611899 char str[255];
17621900 driver_id_t driver_id = DRIVER_DEVICE;
17631901
17711909 if (strcmp (argv[1], "-m") == 0)
17721910 multi = 1;
17731911 strcpy ((char *) daisy_dev, "/dev/cdrom");
1912 read_from_device_flag = 1;
17741913 switch (argc - multi)
17751914 {
17761915 case 2:
17791918 if (chdir (argv[multi + 1]) == 0)
17801919 {
17811920 strcpy ((char *) daisy_mp, argv[multi + 1]);
1782 mount_it = 0;
1921 read_from_device_flag = 0;
17831922 }
17841923 else
17851924 strcpy ((char *) daisy_dev, argv[multi + 1]);
17951934 {
17961935 sound_dev = argv[multi + 2];
17971936 strcpy ((char *) daisy_mp, argv[multi + 3]);
1798 mount_it = 0;
1937 read_from_device_flag = 0;
17991938 }
18001939 else
18011940 if (! strcmp (argv[multi + 2], "-d"))
18021941 {
18031942 strcpy ((char *) daisy_mp, argv[multi + 1]);
1804 mount_it = 0;
1943 read_from_device_flag = 0;
18051944 sound_dev = argv[multi + 3];
18061945 }
18071946 else
18131952 usage (prog_name);
18141953 } // switch
18151954 printf ("Reading daisy structure...");
1816 if (cdio_close_tray (NULL, &driver_id) != DRIVER_OP_SUCCESS)
1817 {
1818 perror (prog_name);
1819 exit (1);
1820 } // if
1955 cdio_close_tray (NULL, &driver_id);
18211956 initscr ();
18221957 titlewin = newwin (2, 80, 0, 0);
18231958 scherm = newwin (23, 80, 2, 0);
18281963 nonl ();
18291964 noecho ();
18301965 madplay_pid = -2;
1831 if (mount_it)
1966 if (read_from_device_flag)
18321967 {
18331968 sprintf ((char *) daisy_mp, "/tmp/%s.XXXXXX", prog_name);
18341969 if (mkdtemp ((char *) daisy_mp) == NULL)
18351970 {
18361971 endwin ();
1972 fprintf (stderr, "\nCannot create temporary directory %s\n",
1973 daisy_mp);
18371974 perror ("mkdtemp");
18381975 exit (1);
18391976 } // if
1840 ret = mount (daisy_dev, daisy_mp, "iso9660",
1841 MS_RDONLY | MS_SILENT | MS_NOATIME | S_WRITE | MS_NODIRATIME, "");
1842 switch (ret)
1843 {
1844 case 0:
1845 break;
1846 default:
1847 beep ();
1848 endwin ();
1849 fprintf (stderr, "\n%s\n", strerror (errno));
1850 fprintf (stderr, "(Try with \"sudo %s\")\n", *argv);
1851 exit (1);
1852 } // switch
1853 } // if
1854 sprintf (NCC_HTML, "%s/%s", daisy_mp, realname ("ncc.html"));
1855 if (access (NCC_HTML, R_OK))
1977 } // if
1978 if (chdir (daisy_mp) == -1)
18561979 {
18571980 beep ();
18581981 endwin ();
1859 perror (NCC_HTML);
1982 perror (daisy_mp);
18601983 exit (1);
18611984 } // if
1985 strcpy (NCC_HTML, realname ("ncc.html"));
1986 if (read_from_device_flag)
1987 get_from_iso9660 (NCC_HTML);
18621988 if ((html_fp = open (NCC_HTML, O_RDONLY)) == -1)
18631989 {
1864 sprintf (discinfo_html, "%s/discinfo.html", daisy_mp);
1990 strcpy (discinfo_html, "discinfo.html");
18651991 if ((discinfo_fp = open (discinfo_html, O_RDONLY)) >= 0)
18661992 {
18671993 discinfo = 1;
18691995 browse ();
18701996 close (discinfo_fp);
18711997 exit (0);
1998 }
1999 else
2000 {
2001 endwin ();
2002 perror (NCC_HTML);
2003 fputs ("Can't find a Daisy structure!\n", stderr);
2004 beep ();
2005 exit (1);
18722006 } // if
18732007 } // if
18742008 wattron (titlewin, A_BOLD);
19022036 remake_structure (level);
19032037 *search_str = 0;
19042038 browse ();
2039 if (read_from_device_flag)
2040 remove (daisy_mp);
19052041 return 0;
1906 } // main
2042 } // main