cdbackup.c
branchtrunk
changeset 12 6d3770b1a9e1
parent 10 79f97a86b31a
child 13 6ef9b2adca64
     1.1 --- a/cdbackup.c	Tue May 11 11:37:18 2010 +0200
     1.2 +++ b/cdbackup.c	Sun May 23 08:30:42 2010 +0200
     1.3 @@ -1,5 +1,5 @@
     1.4  /* cdbackup.c
     1.5 -Copyright (c) 2000-2006 Craig Condit, Stefan Hülswitt.
     1.6 +Copyright (c) 2000-2010 Craig Condit, Stefan Hülswitt.
     1.7  
     1.8  Redistribution and use in source and binary forms, with or without
     1.9  modification, are permitted provided that the following conditions are met: 
    1.10 @@ -67,6 +67,7 @@
    1.11  char *virt_name=0;
    1.12  int   virt_dump=0;
    1.13  int   dvd      =0;
    1.14 +char *exename  ="cdrecord";
    1.15  
    1.16  char **cdrec_opt=0;
    1.17  int    cdrec_opt_count=0;
    1.18 @@ -94,14 +95,13 @@
    1.19  
    1.20  void start_cdrecord(void)
    1.21  {
    1.22 -  char **args, **p, *exname;
    1.23 +  char **args, **p;
    1.24    int l;
    1.25    
    1.26    if(!(p=args=calloc(cdrec_opt_count+32,sizeof(char *))))
    1.27      serror("No memory for cdrecord args\n");
    1.28  
    1.29 -  if(dvd) exname="dvdrecord"; else exname="cdrecord";
    1.30 -  *p++=exname;
    1.31 +  *p++=exename;
    1.32  
    1.33    if(virt_dump || dvd) {
    1.34      *p++="-dao";
    1.35 @@ -128,7 +128,7 @@
    1.36      fprintf(stderr,"\n");
    1.37      }
    1.38  
    1.39 -  execvp(exname,args);
    1.40 +  execvp(exename,args);
    1.41    error("Exec failed (cdrecord)");
    1.42  }
    1.43  
    1.44 @@ -138,7 +138,7 @@
    1.45    FILE *p;
    1.46    long size=-1;
    1.47    
    1.48 -  asprintf(&cmd,"%srecord 2>&1 dev=%s -atip",dvd ? "dvd":"cd",cdr_dev);
    1.49 +  asprintf(&cmd,"%s 2>&1 dev=%s -atip",exename,cdr_dev);
    1.50    DEBUG("%s: cdrecord atip command: %s\n",prg_name,cmd);
    1.51  
    1.52    p=popen(cmd,"r");
    1.53 @@ -183,10 +183,10 @@
    1.54      DEBUG("cdbackup: using speed %d from CDR_SPEED\n",cd_speed);
    1.55      }
    1.56    
    1.57 -  while ((i=getopt(argc,argv,"d:r:l:s:p:a:c:mvVXDCi:wR"))>0) {
    1.58 +  while ((i=getopt(argc,argv,"d:r:l:s:p:a:c:mvVXDCi:wRE:"))>0) {
    1.59      switch (i) {
    1.60         case 'V': fprintf(stderr,"cdbackup "VERSION" (compiled "__DATE__")\n"
    1.61 -	                        "Copyright (C) 2000-2004\n"
    1.62 +	                        "Copyright (C) 2000-2010\n"
    1.63  			        "This is free software; see the source for copying conditions.\n"
    1.64  			        "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n"
    1.65  			        "PARTICULAR PURPOSE.\n");
    1.66 @@ -201,6 +201,7 @@
    1.67         case 'C': crc=0; break;
    1.68         case 'i': virt_name=optarg; virtual=1; break;
    1.69         case 'w': virt_dump=1; break;
    1.70 +       case 'E': exename=optarg; break;
    1.71         case 'R': dvd=1;
    1.72                   DEBUG("cdbackup: DVD mode enabled\n");
    1.73                   break;
    1.74 @@ -231,6 +232,7 @@
    1.75                           "  -i IMAGE       use virtual image IMAGE for recording\n"
    1.76                           "  -w             dump virtual image to media\n"
    1.77                           "  -R             enables DVD mode\n"
    1.78 +                         "  -E EXE         set alternative cdrecord executable\n"
    1.79                           "  -v             be verbose\n"
    1.80                           "  -D             enable DEBUG output\n"
    1.81                           "  -V             prints version & exits\n"