~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/cdrom/lincd.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{
2
 
    $Id: lincd.pp,v 1.4 2003/09/27 12:49:50 peter Exp $
3
2
    Copyright (c) 1999-2000 by Michael Van Canneyt
4
3
 
5
4
    Unit containing definitions from the Linux CDROM kernel interface.
19
18
interface
20
19
 
21
20
uses
22
 
{$ifdef ver1_0}
23
 
  linux
24
 
{$else}
25
21
  baseunix,
26
 
  unix
27
 
{$endif}
28
 
  ;
 
22
  unix;
29
23
 
30
24
{ ---------------------------------------------------------------------
31
25
    cdrom.h header translation.
48
42
{$PACKRECORDS C}
49
43
 
50
44
const
51
 
   EDRIVE_CANT_DO_THIS = {$ifdef ver1_0}Sys_EOPNOTSUPP{$else}ESysEOPNOTSUPP{$endif}; // = 95
 
45
   EDRIVE_CANT_DO_THIS = ESysEOPNOTSUPP; // = 95
52
46
   CDROMPAUSE = $5301;
53
47
   CDROMRESUME = $5302;
54
48
   CDROMPLAYMSF = $5303;
1156
1150
  Writeln('Testing device : ',Device);
1157
1151
{$endif}
1158
1152
  Result:=False;
1159
 
{$ifdef ver1_0}
1160
 
  If not fstat(device,info) then
1161
 
{$else}
1162
1153
  If fpstat(device,info)<>0 then
1163
 
{$endif}
1164
 
    exit;
1165
 
  if not ({$ifdef ver1_0}S_ISCHR{$else}fpS_ISCHR{$endif}(info.mode) or
1166
 
     {$Ifdef ver1_0}S_ISBLK{$else}fpS_ISBLK{$endif}(info.mode)) then
1167
 
    exit;
1168
 
  S:={$ifdef ver1_0}ReadLink{$else}fpReadLink{$endif}(Device);
 
1154
    exit;
 
1155
  if not (fpS_ISCHR(info.mode) or
 
1156
     fpS_ISBLK(info.mode)) then
 
1157
    exit;
 
1158
  S:=fpReadLink(Device);
1169
1159
  If (S<>'') then
1170
1160
    Device:=S;
1171
 
{$ifdef ver1_0}
1172
 
  If Not FStat(Device,info) then
1173
 
{$else}
1174
1161
  If fpStat(Device,info)<>0 then
1175
 
{$endif}
1176
1162
    exit;
1177
1163
  DeviceMajor:=info.rdev shr 8;
1178
1164
  If DeviceMajor in [IDE0_MAJOR,IDE1_MAJOR,IDE2_MAJOR,IDE3_MAJOR] then
1186
1172
      end
1187
1173
    else
1188
1174
      begin
1189
 
      F:={$ifdef ver1_0}fdOpen{$else}fpOpen{$endif}(Device,OPEN_RDONLY or OPEN_NONBLOCK);
 
1175
      F:=fpOpen(Device,OPEN_RDONLY or OPEN_NONBLOCK);
1190
1176
      Result:=(F>=0);
1191
1177
      If Result then
1192
 
        {$ifdef ver1_0}fdClose{$else}fpClose{$endif}(F);
 
1178
        fpClose(F);
1193
1179
      end;
1194
1180
    end;
1195
1181
end;
1205
1191
  Writeln('Testing for ATAPI');
1206
1192
{$endif}
1207
1193
  Result:=False;
1208
 
  f:={$ifdef ver1_0}fdOpen{$else}fpOpen{$endif}(device,OPEN_RDONLY or OPEN_NONBLOCK);
 
1194
  f:=fpOpen(device,OPEN_RDONLY or OPEN_NONBLOCK);
1209
1195
  If (f<0) then
1210
1196
    exit;
1211
 
{$ifdef ver1_0}
1212
 
  Result:=ioctl(f,CDROMVOLREAD,@info);
1213
 
{$else}
1214
1197
  Result:=(fpIOCtl(f,CDROMVOLREAD,@info)=0);
1215
 
{$endif}
1216
 
  {$ifdef ver1_0}fdClose{$else}fpClose{$endif}(f);
 
1198
  fpClose(f);
1217
1199
end;
1218
1200
 
1219
1201
end.