# HG changeset patch # User nathan # Date 1274596242 -7200 # Node ID 6d3770b1a9e1427a1622bbed5214f768e127b927 # Parent 02236b87f6567ac42a5e4904ec13fc084a81db21 add option to specify cdrecord executable diff -r 02236b87f656 -r 6d3770b1a9e1 cdbackup.c --- a/cdbackup.c Tue May 11 11:37:18 2010 +0200 +++ b/cdbackup.c Sun May 23 08:30:42 2010 +0200 @@ -1,5 +1,5 @@ /* cdbackup.c -Copyright (c) 2000-2006 Craig Condit, Stefan Hülswitt. +Copyright (c) 2000-2010 Craig Condit, Stefan Hülswitt. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -67,6 +67,7 @@ char *virt_name=0; int virt_dump=0; int dvd =0; +char *exename ="cdrecord"; char **cdrec_opt=0; int cdrec_opt_count=0; @@ -94,14 +95,13 @@ void start_cdrecord(void) { - char **args, **p, *exname; + char **args, **p; int l; if(!(p=args=calloc(cdrec_opt_count+32,sizeof(char *)))) serror("No memory for cdrecord args\n"); - if(dvd) exname="dvdrecord"; else exname="cdrecord"; - *p++=exname; + *p++=exename; if(virt_dump || dvd) { *p++="-dao"; @@ -128,7 +128,7 @@ fprintf(stderr,"\n"); } - execvp(exname,args); + execvp(exename,args); error("Exec failed (cdrecord)"); } @@ -138,7 +138,7 @@ FILE *p; long size=-1; - asprintf(&cmd,"%srecord 2>&1 dev=%s -atip",dvd ? "dvd":"cd",cdr_dev); + asprintf(&cmd,"%s 2>&1 dev=%s -atip",exename,cdr_dev); DEBUG("%s: cdrecord atip command: %s\n",prg_name,cmd); p=popen(cmd,"r"); @@ -183,10 +183,10 @@ DEBUG("cdbackup: using speed %d from CDR_SPEED\n",cd_speed); } - while ((i=getopt(argc,argv,"d:r:l:s:p:a:c:mvVXDCi:wR"))>0) { + while ((i=getopt(argc,argv,"d:r:l:s:p:a:c:mvVXDCi:wRE:"))>0) { switch (i) { case 'V': fprintf(stderr,"cdbackup "VERSION" (compiled "__DATE__")\n" - "Copyright (C) 2000-2004\n" + "Copyright (C) 2000-2010\n" "This is free software; see the source for copying conditions.\n" "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n" "PARTICULAR PURPOSE.\n"); @@ -201,6 +201,7 @@ case 'C': crc=0; break; case 'i': virt_name=optarg; virtual=1; break; case 'w': virt_dump=1; break; + case 'E': exename=optarg; break; case 'R': dvd=1; DEBUG("cdbackup: DVD mode enabled\n"); break; @@ -231,6 +232,7 @@ " -i IMAGE use virtual image IMAGE for recording\n" " -w dump virtual image to media\n" " -R enables DVD mode\n" + " -E EXE set alternative cdrecord executable\n" " -v be verbose\n" " -D enable DEBUG output\n" " -V prints version & exits\n"