src/cdrom/linux/SDL_syscdrom.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/cdrom/linux/SDL_syscdrom.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/cdrom/linux/SDL_syscdrom.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -96,16 +96,16 @@
     1.4  static dev_t SDL_cdmode[MAX_DRIVES];
     1.5  
     1.6  /* The system-dependent CD control functions */
     1.7 -static const char *SDL_SYS_CDName (int drive);
     1.8 -static int SDL_SYS_CDOpen (int drive);
     1.9 -static int SDL_SYS_CDGetTOC (SDL_CD * cdrom);
    1.10 -static CDstatus SDL_SYS_CDStatus (SDL_CD * cdrom, int *position);
    1.11 -static int SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length);
    1.12 -static int SDL_SYS_CDPause (SDL_CD * cdrom);
    1.13 -static int SDL_SYS_CDResume (SDL_CD * cdrom);
    1.14 -static int SDL_SYS_CDStop (SDL_CD * cdrom);
    1.15 -static int SDL_SYS_CDEject (SDL_CD * cdrom);
    1.16 -static void SDL_SYS_CDClose (SDL_CD * cdrom);
    1.17 +static const char *SDL_SYS_CDName(int drive);
    1.18 +static int SDL_SYS_CDOpen(int drive);
    1.19 +static int SDL_SYS_CDGetTOC(SDL_CD * cdrom);
    1.20 +static CDstatus SDL_SYS_CDStatus(SDL_CD * cdrom, int *position);
    1.21 +static int SDL_SYS_CDPlay(SDL_CD * cdrom, int start, int length);
    1.22 +static int SDL_SYS_CDPause(SDL_CD * cdrom);
    1.23 +static int SDL_SYS_CDResume(SDL_CD * cdrom);
    1.24 +static int SDL_SYS_CDStop(SDL_CD * cdrom);
    1.25 +static int SDL_SYS_CDEject(SDL_CD * cdrom);
    1.26 +static void SDL_SYS_CDClose(SDL_CD * cdrom);
    1.27  
    1.28  /* Some ioctl() errno values which occur when the tray is empty */
    1.29  #ifndef ENOMEDIUM
    1.30 @@ -117,33 +117,33 @@
    1.31  
    1.32  /* Check a drive to see if it is a CD-ROM */
    1.33  static int
    1.34 -CheckDrive (char *drive, char *mnttype, struct stat *stbuf)
    1.35 +CheckDrive(char *drive, char *mnttype, struct stat *stbuf)
    1.36  {
    1.37      int is_cd, cdfd;
    1.38      struct cdrom_subchnl info;
    1.39  
    1.40      /* If it doesn't exist, return -1 */
    1.41 -    if (stat (drive, stbuf) < 0) {
    1.42 +    if (stat(drive, stbuf) < 0) {
    1.43          return (-1);
    1.44      }
    1.45  
    1.46      /* If it does exist, verify that it's an available CD-ROM */
    1.47      is_cd = 0;
    1.48 -    if (S_ISCHR (stbuf->st_mode) || S_ISBLK (stbuf->st_mode)) {
    1.49 -        cdfd = open (drive, (O_RDONLY | O_NONBLOCK), 0);
    1.50 +    if (S_ISCHR(stbuf->st_mode) || S_ISBLK(stbuf->st_mode)) {
    1.51 +        cdfd = open(drive, (O_RDONLY | O_NONBLOCK), 0);
    1.52          if (cdfd >= 0) {
    1.53              info.cdsc_format = CDROM_MSF;
    1.54              /* Under Linux, EIO occurs when a disk is not present.
    1.55               */
    1.56 -            if ((ioctl (cdfd, CDROMSUBCHNL, &info) == 0) ||
    1.57 -                ERRNO_TRAYEMPTY (errno)) {
    1.58 +            if ((ioctl(cdfd, CDROMSUBCHNL, &info) == 0) ||
    1.59 +                ERRNO_TRAYEMPTY(errno)) {
    1.60                  is_cd = 1;
    1.61              }
    1.62 -            close (cdfd);
    1.63 +            close(cdfd);
    1.64          }
    1.65  #ifdef USE_MNTENT
    1.66          /* Even if we can't read it, it might be mounted */
    1.67 -        else if (mnttype && (SDL_strcmp (mnttype, MNTTYPE_CDROM) == 0)) {
    1.68 +        else if (mnttype && (SDL_strcmp(mnttype, MNTTYPE_CDROM) == 0)) {
    1.69              is_cd = 1;
    1.70          }
    1.71  #endif
    1.72 @@ -153,7 +153,7 @@
    1.73  
    1.74  /* Add a CD-ROM drive to our list of valid drives */
    1.75  static void
    1.76 -AddDrive (char *drive, struct stat *stbuf)
    1.77 +AddDrive(char *drive, struct stat *stbuf)
    1.78  {
    1.79      int i;
    1.80  
    1.81 @@ -164,8 +164,8 @@
    1.82          for (i = 0; i < SDL_numcds; ++i) {
    1.83              if (stbuf->st_rdev == SDL_cdmode[i]) {
    1.84  #ifdef DEBUG_CDROM
    1.85 -                fprintf (stderr, "Duplicate drive detected: %s == %s\n",
    1.86 -                         drive, SDL_cdlist[i]);
    1.87 +                fprintf(stderr, "Duplicate drive detected: %s == %s\n",
    1.88 +                        drive, SDL_cdlist[i]);
    1.89  #endif
    1.90                  return;
    1.91              }
    1.92 @@ -173,28 +173,28 @@
    1.93  
    1.94          /* Add this drive to our list */
    1.95          i = SDL_numcds;
    1.96 -        SDL_cdlist[i] = SDL_strdup (drive);
    1.97 +        SDL_cdlist[i] = SDL_strdup(drive);
    1.98          if (SDL_cdlist[i] == NULL) {
    1.99 -            SDL_OutOfMemory ();
   1.100 +            SDL_OutOfMemory();
   1.101              return;
   1.102          }
   1.103          SDL_cdmode[i] = stbuf->st_rdev;
   1.104          ++SDL_numcds;
   1.105  #ifdef DEBUG_CDROM
   1.106 -        fprintf (stderr, "Added CD-ROM drive: %s\n", drive);
   1.107 +        fprintf(stderr, "Added CD-ROM drive: %s\n", drive);
   1.108  #endif
   1.109      }
   1.110  }
   1.111  
   1.112  #ifdef USE_MNTENT
   1.113  static void
   1.114 -CheckMounts (const char *mtab)
   1.115 +CheckMounts(const char *mtab)
   1.116  {
   1.117      FILE *mntfp;
   1.118      struct mntent *mntent;
   1.119      struct stat stbuf;
   1.120  
   1.121 -    mntfp = setmntent (mtab, "r");
   1.122 +    mntfp = setmntent(mtab, "r");
   1.123      if (mntfp != NULL) {
   1.124          char *tmp;
   1.125          char *mnt_type;
   1.126 @@ -202,67 +202,67 @@
   1.127          char *mnt_dev;
   1.128          size_t mnt_dev_len;
   1.129  
   1.130 -        while ((mntent = getmntent (mntfp)) != NULL) {
   1.131 -            mnt_type_len = SDL_strlen (mntent->mnt_type) + 1;
   1.132 -            mnt_type = SDL_stack_alloc (char, mnt_type_len);
   1.133 +        while ((mntent = getmntent(mntfp)) != NULL) {
   1.134 +            mnt_type_len = SDL_strlen(mntent->mnt_type) + 1;
   1.135 +            mnt_type = SDL_stack_alloc(char, mnt_type_len);
   1.136              if (mnt_type == NULL)
   1.137                  continue;       /* maybe you'll get lucky next time. */
   1.138  
   1.139 -            mnt_dev_len = SDL_strlen (mntent->mnt_fsname) + 1;
   1.140 -            mnt_dev = SDL_stack_alloc (char, mnt_dev_len);
   1.141 +            mnt_dev_len = SDL_strlen(mntent->mnt_fsname) + 1;
   1.142 +            mnt_dev = SDL_stack_alloc(char, mnt_dev_len);
   1.143              if (mnt_dev == NULL) {
   1.144 -                SDL_stack_free (mnt_type);
   1.145 +                SDL_stack_free(mnt_type);
   1.146                  continue;
   1.147              }
   1.148  
   1.149 -            SDL_strlcpy (mnt_type, mntent->mnt_type, mnt_type_len);
   1.150 -            SDL_strlcpy (mnt_dev, mntent->mnt_fsname, mnt_dev_len);
   1.151 +            SDL_strlcpy(mnt_type, mntent->mnt_type, mnt_type_len);
   1.152 +            SDL_strlcpy(mnt_dev, mntent->mnt_fsname, mnt_dev_len);
   1.153  
   1.154              /* Handle "supermount" filesystem mounts */
   1.155 -            if (SDL_strcmp (mnt_type, MNTTYPE_SUPER) == 0) {
   1.156 -                tmp = SDL_strstr (mntent->mnt_opts, "fs=");
   1.157 +            if (SDL_strcmp(mnt_type, MNTTYPE_SUPER) == 0) {
   1.158 +                tmp = SDL_strstr(mntent->mnt_opts, "fs=");
   1.159                  if (tmp) {
   1.160 -                    SDL_free (mnt_type);
   1.161 -                    mnt_type = SDL_strdup (tmp + SDL_strlen ("fs="));
   1.162 +                    SDL_free(mnt_type);
   1.163 +                    mnt_type = SDL_strdup(tmp + SDL_strlen("fs="));
   1.164                      if (mnt_type) {
   1.165 -                        tmp = SDL_strchr (mnt_type, ',');
   1.166 +                        tmp = SDL_strchr(mnt_type, ',');
   1.167                          if (tmp) {
   1.168                              *tmp = '\0';
   1.169                          }
   1.170                      }
   1.171                  }
   1.172 -                tmp = SDL_strstr (mntent->mnt_opts, "dev=");
   1.173 +                tmp = SDL_strstr(mntent->mnt_opts, "dev=");
   1.174                  if (tmp) {
   1.175 -                    SDL_free (mnt_dev);
   1.176 -                    mnt_dev = SDL_strdup (tmp + SDL_strlen ("dev="));
   1.177 +                    SDL_free(mnt_dev);
   1.178 +                    mnt_dev = SDL_strdup(tmp + SDL_strlen("dev="));
   1.179                      if (mnt_dev) {
   1.180 -                        tmp = SDL_strchr (mnt_dev, ',');
   1.181 +                        tmp = SDL_strchr(mnt_dev, ',');
   1.182                          if (tmp) {
   1.183                              *tmp = '\0';
   1.184                          }
   1.185                      }
   1.186                  }
   1.187              }
   1.188 -            if (SDL_strcmp (mnt_type, MNTTYPE_CDROM) == 0) {
   1.189 +            if (SDL_strcmp(mnt_type, MNTTYPE_CDROM) == 0) {
   1.190  #ifdef DEBUG_CDROM
   1.191 -                fprintf (stderr,
   1.192 -                         "Checking mount path from %s: %s mounted on %s of %s\n",
   1.193 -                         mtab, mnt_dev, mntent->mnt_dir, mnt_type);
   1.194 +                fprintf(stderr,
   1.195 +                        "Checking mount path from %s: %s mounted on %s of %s\n",
   1.196 +                        mtab, mnt_dev, mntent->mnt_dir, mnt_type);
   1.197  #endif
   1.198 -                if (CheckDrive (mnt_dev, mnt_type, &stbuf) > 0) {
   1.199 -                    AddDrive (mnt_dev, &stbuf);
   1.200 +                if (CheckDrive(mnt_dev, mnt_type, &stbuf) > 0) {
   1.201 +                    AddDrive(mnt_dev, &stbuf);
   1.202                  }
   1.203              }
   1.204 -            SDL_stack_free (mnt_dev);
   1.205 -            SDL_stack_free (mnt_type);
   1.206 +            SDL_stack_free(mnt_dev);
   1.207 +            SDL_stack_free(mnt_type);
   1.208          }
   1.209 -        endmntent (mntfp);
   1.210 +        endmntent(mntfp);
   1.211      }
   1.212  }
   1.213  #endif /* USE_MNTENT */
   1.214  
   1.215  int
   1.216 -SDL_SYS_CDInit (void)
   1.217 +SDL_SYS_CDInit(void)
   1.218  {
   1.219      /* checklist: /dev/cdrom, /dev/hd?, /dev/scd? /dev/sr? */
   1.220      static char *checklist[] = {
   1.221 @@ -286,26 +286,26 @@
   1.222      SDL_CDcaps.Close = SDL_SYS_CDClose;
   1.223  
   1.224      /* Look in the environment for our CD-ROM drive list */
   1.225 -    SDLcdrom = SDL_getenv ("SDL_CDROM");        /* ':' separated list of devices */
   1.226 +    SDLcdrom = SDL_getenv("SDL_CDROM"); /* ':' separated list of devices */
   1.227      if (SDLcdrom != NULL) {
   1.228          char *cdpath, *delim;
   1.229 -        size_t len = SDL_strlen (SDLcdrom) + 1;
   1.230 -        cdpath = SDL_stack_alloc (char, len);
   1.231 +        size_t len = SDL_strlen(SDLcdrom) + 1;
   1.232 +        cdpath = SDL_stack_alloc(char, len);
   1.233          if (cdpath != NULL) {
   1.234 -            SDL_strlcpy (cdpath, SDLcdrom, len);
   1.235 +            SDL_strlcpy(cdpath, SDLcdrom, len);
   1.236              SDLcdrom = cdpath;
   1.237              do {
   1.238 -                delim = SDL_strchr (SDLcdrom, ':');
   1.239 +                delim = SDL_strchr(SDLcdrom, ':');
   1.240                  if (delim) {
   1.241                      *delim++ = '\0';
   1.242                  }
   1.243  #ifdef DEBUG_CDROM
   1.244 -                fprintf (stderr,
   1.245 -                         "Checking CD-ROM drive from SDL_CDROM: %s\n",
   1.246 -                         SDLcdrom);
   1.247 +                fprintf(stderr,
   1.248 +                        "Checking CD-ROM drive from SDL_CDROM: %s\n",
   1.249 +                        SDLcdrom);
   1.250  #endif
   1.251 -                if (CheckDrive (SDLcdrom, NULL, &stbuf) > 0) {
   1.252 -                    AddDrive (SDLcdrom, &stbuf);
   1.253 +                if (CheckDrive(SDLcdrom, NULL, &stbuf) > 0) {
   1.254 +                    AddDrive(SDLcdrom, &stbuf);
   1.255                  }
   1.256                  if (delim) {
   1.257                      SDLcdrom = delim;
   1.258 @@ -314,7 +314,7 @@
   1.259                  }
   1.260              }
   1.261              while (SDLcdrom);
   1.262 -            SDL_stack_free (cdpath);
   1.263 +            SDL_stack_free(cdpath);
   1.264          }
   1.265  
   1.266          /* If we found our drives, there's nothing left to do */
   1.267 @@ -324,15 +324,15 @@
   1.268      }
   1.269  #ifdef USE_MNTENT
   1.270      /* Check /dev/cdrom first :-) */
   1.271 -    if (CheckDrive ("/dev/cdrom", NULL, &stbuf) > 0) {
   1.272 -        AddDrive ("/dev/cdrom", &stbuf);
   1.273 +    if (CheckDrive("/dev/cdrom", NULL, &stbuf) > 0) {
   1.274 +        AddDrive("/dev/cdrom", &stbuf);
   1.275      }
   1.276  
   1.277      /* Now check the currently mounted CD drives */
   1.278 -    CheckMounts (_PATH_MOUNTED);
   1.279 +    CheckMounts(_PATH_MOUNTED);
   1.280  
   1.281      /* Finally check possible mountable drives in /etc/fstab */
   1.282 -    CheckMounts (_PATH_MNTTAB);
   1.283 +    CheckMounts(_PATH_MNTTAB);
   1.284  
   1.285      /* If we found our drives, there's nothing left to do */
   1.286      if (SDL_numcds > 0) {
   1.287 @@ -348,20 +348,20 @@
   1.288              char *insert;
   1.289              exists = 1;
   1.290              for (j = checklist[i][1]; exists; ++j) {
   1.291 -                SDL_snprintf (drive, SDL_arraysize (drive), "/dev/%s",
   1.292 -                              &checklist[i][3]);
   1.293 -                insert = SDL_strchr (drive, '?');
   1.294 +                SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s",
   1.295 +                             &checklist[i][3]);
   1.296 +                insert = SDL_strchr(drive, '?');
   1.297                  if (insert != NULL) {
   1.298                      *insert = j;
   1.299                  }
   1.300  #ifdef DEBUG_CDROM
   1.301 -                fprintf (stderr, "Checking possible CD-ROM drive: %s\n",
   1.302 -                         drive);
   1.303 +                fprintf(stderr, "Checking possible CD-ROM drive: %s\n",
   1.304 +                        drive);
   1.305  #endif
   1.306 -                switch (CheckDrive (drive, NULL, &stbuf)) {
   1.307 +                switch (CheckDrive(drive, NULL, &stbuf)) {
   1.308                      /* Drive exists and is a CD-ROM */
   1.309                  case 1:
   1.310 -                    AddDrive (drive, &stbuf);
   1.311 +                    AddDrive(drive, &stbuf);
   1.312                      break;
   1.313                      /* Drive exists, but isn't a CD-ROM */
   1.314                  case 0:
   1.315 @@ -373,13 +373,13 @@
   1.316                  }
   1.317              }
   1.318          } else {
   1.319 -            SDL_snprintf (drive, SDL_arraysize (drive), "/dev/%s",
   1.320 -                          checklist[i]);
   1.321 +            SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s",
   1.322 +                         checklist[i]);
   1.323  #ifdef DEBUG_CDROM
   1.324 -            fprintf (stderr, "Checking possible CD-ROM drive: %s\n", drive);
   1.325 +            fprintf(stderr, "Checking possible CD-ROM drive: %s\n", drive);
   1.326  #endif
   1.327 -            if (CheckDrive (drive, NULL, &stbuf) > 0) {
   1.328 -                AddDrive (drive, &stbuf);
   1.329 +            if (CheckDrive(drive, NULL, &stbuf) > 0) {
   1.330 +                AddDrive(drive, &stbuf);
   1.331              }
   1.332          }
   1.333      }
   1.334 @@ -388,38 +388,38 @@
   1.335  
   1.336  /* General ioctl() CD-ROM command function */
   1.337  static int
   1.338 -SDL_SYS_CDioctl (int id, int command, void *arg)
   1.339 +SDL_SYS_CDioctl(int id, int command, void *arg)
   1.340  {
   1.341      int retval;
   1.342  
   1.343 -    retval = ioctl (id, command, arg);
   1.344 +    retval = ioctl(id, command, arg);
   1.345      if (retval < 0) {
   1.346 -        SDL_SetError ("ioctl() error: %s", strerror (errno));
   1.347 +        SDL_SetError("ioctl() error: %s", strerror(errno));
   1.348      }
   1.349      return (retval);
   1.350  }
   1.351  
   1.352  static const char *
   1.353 -SDL_SYS_CDName (int drive)
   1.354 +SDL_SYS_CDName(int drive)
   1.355  {
   1.356      return (SDL_cdlist[drive]);
   1.357  }
   1.358  
   1.359  static int
   1.360 -SDL_SYS_CDOpen (int drive)
   1.361 +SDL_SYS_CDOpen(int drive)
   1.362  {
   1.363 -    return (open (SDL_cdlist[drive], (O_RDONLY | O_NONBLOCK), 0));
   1.364 +    return (open(SDL_cdlist[drive], (O_RDONLY | O_NONBLOCK), 0));
   1.365  }
   1.366  
   1.367  static int
   1.368 -SDL_SYS_CDGetTOC (SDL_CD * cdrom)
   1.369 +SDL_SYS_CDGetTOC(SDL_CD * cdrom)
   1.370  {
   1.371      struct cdrom_tochdr toc;
   1.372      int i, okay;
   1.373      struct cdrom_tocentry entry;
   1.374  
   1.375      okay = 0;
   1.376 -    if (SDL_SYS_CDioctl (cdrom->id, CDROMREADTOCHDR, &toc) == 0) {
   1.377 +    if (SDL_SYS_CDioctl(cdrom->id, CDROMREADTOCHDR, &toc) == 0) {
   1.378          cdrom->numtracks = toc.cdth_trk1 - toc.cdth_trk0 + 1;
   1.379          if (cdrom->numtracks > SDL_MAX_TRACKS) {
   1.380              cdrom->numtracks = SDL_MAX_TRACKS;
   1.381 @@ -433,7 +433,7 @@
   1.382              }
   1.383              entry.cdte_track = cdrom->track[i].id;
   1.384              entry.cdte_format = CDROM_MSF;
   1.385 -            if (SDL_SYS_CDioctl (cdrom->id, CDROMREADTOCENTRY, &entry) < 0) {
   1.386 +            if (SDL_SYS_CDioctl(cdrom->id, CDROMREADTOCENTRY, &entry) < 0) {
   1.387                  break;
   1.388              } else {
   1.389                  if (entry.cdte_ctrl & CDROM_DATA_TRACK) {
   1.390 @@ -442,9 +442,9 @@
   1.391                      cdrom->track[i].type = SDL_AUDIO_TRACK;
   1.392                  }
   1.393                  cdrom->track[i].offset =
   1.394 -                    MSF_TO_FRAMES (entry.cdte_addr.msf.minute,
   1.395 -                                   entry.cdte_addr.msf.second,
   1.396 -                                   entry.cdte_addr.msf.frame);
   1.397 +                    MSF_TO_FRAMES(entry.cdte_addr.msf.minute,
   1.398 +                                  entry.cdte_addr.msf.second,
   1.399 +                                  entry.cdte_addr.msf.frame);
   1.400                  cdrom->track[i].length = 0;
   1.401                  if (i > 0) {
   1.402                      cdrom->track[i - 1].length =
   1.403 @@ -461,15 +461,15 @@
   1.404  
   1.405  /* Get CD-ROM status */
   1.406  static CDstatus
   1.407 -SDL_SYS_CDStatus (SDL_CD * cdrom, int *position)
   1.408 +SDL_SYS_CDStatus(SDL_CD * cdrom, int *position)
   1.409  {
   1.410      CDstatus status;
   1.411      struct cdrom_tochdr toc;
   1.412      struct cdrom_subchnl info;
   1.413  
   1.414      info.cdsc_format = CDROM_MSF;
   1.415 -    if (ioctl (cdrom->id, CDROMSUBCHNL, &info) < 0) {
   1.416 -        if (ERRNO_TRAYEMPTY (errno)) {
   1.417 +    if (ioctl(cdrom->id, CDROMSUBCHNL, &info) < 0) {
   1.418 +        if (ERRNO_TRAYEMPTY(errno)) {
   1.419              status = CD_TRAYEMPTY;
   1.420          } else {
   1.421              status = CD_ERROR;
   1.422 @@ -479,7 +479,7 @@
   1.423          case CDROM_AUDIO_INVALID:
   1.424          case CDROM_AUDIO_NO_STATUS:
   1.425              /* Try to determine if there's a CD available */
   1.426 -            if (ioctl (cdrom->id, CDROMREADTOCHDR, &toc) == 0)
   1.427 +            if (ioctl(cdrom->id, CDROMREADTOCHDR, &toc) == 0)
   1.428                  status = CD_STOPPED;
   1.429              else
   1.430                  status = CD_TRAYEMPTY;
   1.431 @@ -505,9 +505,9 @@
   1.432      }
   1.433      if (position) {
   1.434          if (status == CD_PLAYING || (status == CD_PAUSED)) {
   1.435 -            *position = MSF_TO_FRAMES (info.cdsc_absaddr.msf.minute,
   1.436 -                                       info.cdsc_absaddr.msf.second,
   1.437 -                                       info.cdsc_absaddr.msf.frame);
   1.438 +            *position = MSF_TO_FRAMES(info.cdsc_absaddr.msf.minute,
   1.439 +                                      info.cdsc_absaddr.msf.second,
   1.440 +                                      info.cdsc_absaddr.msf.frame);
   1.441          } else {
   1.442              *position = 0;
   1.443          }
   1.444 @@ -517,66 +517,66 @@
   1.445  
   1.446  /* Start play */
   1.447  static int
   1.448 -SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length)
   1.449 +SDL_SYS_CDPlay(SDL_CD * cdrom, int start, int length)
   1.450  {
   1.451      struct cdrom_msf playtime;
   1.452  
   1.453 -    FRAMES_TO_MSF (start,
   1.454 -                   &playtime.cdmsf_min0, &playtime.cdmsf_sec0,
   1.455 -                   &playtime.cdmsf_frame0);
   1.456 -    FRAMES_TO_MSF (start + length, &playtime.cdmsf_min1, &playtime.cdmsf_sec1,
   1.457 -                   &playtime.cdmsf_frame1);
   1.458 +    FRAMES_TO_MSF(start,
   1.459 +                  &playtime.cdmsf_min0, &playtime.cdmsf_sec0,
   1.460 +                  &playtime.cdmsf_frame0);
   1.461 +    FRAMES_TO_MSF(start + length, &playtime.cdmsf_min1, &playtime.cdmsf_sec1,
   1.462 +                  &playtime.cdmsf_frame1);
   1.463  #ifdef DEBUG_CDROM
   1.464 -    fprintf (stderr, "Trying to play from %d:%d:%d to %d:%d:%d\n",
   1.465 -             playtime.cdmsf_min0, playtime.cdmsf_sec0, playtime.cdmsf_frame0,
   1.466 -             playtime.cdmsf_min1, playtime.cdmsf_sec1, playtime.cdmsf_frame1);
   1.467 +    fprintf(stderr, "Trying to play from %d:%d:%d to %d:%d:%d\n",
   1.468 +            playtime.cdmsf_min0, playtime.cdmsf_sec0, playtime.cdmsf_frame0,
   1.469 +            playtime.cdmsf_min1, playtime.cdmsf_sec1, playtime.cdmsf_frame1);
   1.470  #endif
   1.471 -    return (SDL_SYS_CDioctl (cdrom->id, CDROMPLAYMSF, &playtime));
   1.472 +    return (SDL_SYS_CDioctl(cdrom->id, CDROMPLAYMSF, &playtime));
   1.473  }
   1.474  
   1.475  /* Pause play */
   1.476  static int
   1.477 -SDL_SYS_CDPause (SDL_CD * cdrom)
   1.478 +SDL_SYS_CDPause(SDL_CD * cdrom)
   1.479  {
   1.480 -    return (SDL_SYS_CDioctl (cdrom->id, CDROMPAUSE, 0));
   1.481 +    return (SDL_SYS_CDioctl(cdrom->id, CDROMPAUSE, 0));
   1.482  }
   1.483  
   1.484  /* Resume play */
   1.485  static int
   1.486 -SDL_SYS_CDResume (SDL_CD * cdrom)
   1.487 +SDL_SYS_CDResume(SDL_CD * cdrom)
   1.488  {
   1.489 -    return (SDL_SYS_CDioctl (cdrom->id, CDROMRESUME, 0));
   1.490 +    return (SDL_SYS_CDioctl(cdrom->id, CDROMRESUME, 0));
   1.491  }
   1.492  
   1.493  /* Stop play */
   1.494  static int
   1.495 -SDL_SYS_CDStop (SDL_CD * cdrom)
   1.496 +SDL_SYS_CDStop(SDL_CD * cdrom)
   1.497  {
   1.498 -    return (SDL_SYS_CDioctl (cdrom->id, CDROMSTOP, 0));
   1.499 +    return (SDL_SYS_CDioctl(cdrom->id, CDROMSTOP, 0));
   1.500  }
   1.501  
   1.502  /* Eject the CD-ROM */
   1.503  static int
   1.504 -SDL_SYS_CDEject (SDL_CD * cdrom)
   1.505 +SDL_SYS_CDEject(SDL_CD * cdrom)
   1.506  {
   1.507 -    return (SDL_SYS_CDioctl (cdrom->id, CDROMEJECT, 0));
   1.508 +    return (SDL_SYS_CDioctl(cdrom->id, CDROMEJECT, 0));
   1.509  }
   1.510  
   1.511  /* Close the CD-ROM handle */
   1.512  static void
   1.513 -SDL_SYS_CDClose (SDL_CD * cdrom)
   1.514 +SDL_SYS_CDClose(SDL_CD * cdrom)
   1.515  {
   1.516 -    close (cdrom->id);
   1.517 +    close(cdrom->id);
   1.518  }
   1.519  
   1.520  void
   1.521 -SDL_SYS_CDQuit (void)
   1.522 +SDL_SYS_CDQuit(void)
   1.523  {
   1.524      int i;
   1.525  
   1.526      if (SDL_numcds > 0) {
   1.527          for (i = 0; i < SDL_numcds; ++i) {
   1.528 -            SDL_free (SDL_cdlist[i]);
   1.529 +            SDL_free(SDL_cdlist[i]);
   1.530          }
   1.531          SDL_numcds = 0;
   1.532      }