"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/text_io.c" between
libisoburn-1.5.0.tar.gz and libisoburn-1.5.2.tar.gz

About: libisoburn is a frontend for the libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all media and file types supported by libburn. It implements the API and command interpreter of program xorriso, and installs this program as small dynamically linked binary. xorriso is suitable for incremental data backup and for production of bootable ISO 9660 images. A statically linked version is available as GNU xorriso.

text_io.c  (libisoburn-1.5.0):text_io.c  (libisoburn-1.5.2)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains the implementation of text i/o functions. This file contains the implementation of text i/o functions.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 715 skipping to change at line 715
else else
sprintf(xorriso->info_text + strlen(xorriso->info_text), sprintf(xorriso->info_text + strlen(xorriso->info_text),
"line %d", mem_linecount + 1); "line %d", mem_linecount + 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
} }
} else { } else {
(*argv)= Smem_malloC(sizeof(char *)); (*argv)= Smem_malloC(sizeof(char *));
if(*argv == NULL) if(*argv == NULL)
{ret= -1; goto ex;} {ret= -1; goto ex;}
(*argv)[0]= strdup(line); (*argv)[0]= strdup(line);
if((*argv)[0] == NULL) if((*argv)[0] == NULL) {
free(*argv);
(*argv)= NULL;
{ret= -1; goto ex;} {ret= -1; goto ex;}
}
*argc= 1; *argc= 1;
} }
ret= 1; ret= 1;
ex:; ex:;
Xorriso_free_meM(line); Xorriso_free_meM(line);
return(ret); return(ret);
} }
int Xorriso_predict_linecount(struct XorrisO *xorriso, char *line, int Xorriso_predict_linecount(struct XorrisO *xorriso, char *line,
int *linecount, int flag) int *linecount, int flag)
skipping to change at line 2014 skipping to change at line 2017
{"Biblio File :", 3, "Biblio File : ", "", 1, { 0, -1, -1, -1, -1, -1}, {"Biblio File :", 3, "Biblio File : ", "", 1, { 0, -1, -1, -1, -1, -1},
1, 1}, 1, 1},
{"Build timestamp :", 3, "Build timestamp : ", "", 1, {"Build timestamp :", 3, "Build timestamp : ", "", 1,
{ 0, -1, -1, -1, -1, -1}, 1, 1}, { 0, -1, -1, -1, -1, -1}, 1, 1},
{"CopyrightFile:", 3, "CopyrightFile: ", "", 1, { 0, -1, -1, -1, -1, -1}, {"CopyrightFile:", 3, "CopyrightFile: ", "", 1, { 0, -1, -1, -1, -1, -1},
1, 1}, 1, 1},
{"Creation Time:", 3, "Creation Time: ", "", 1, { 0, -1, -1, -1, -1, -1}, {"Creation Time:", 3, "Creation Time: ", "", 1, { 0, -1, -1, -1, -1, -1},
1, 1}, 1, 1},
{"DVD obs 64 kB:", 3, "DVD obs 64 kB:", "", 1, { 0, -1, -1, -1, -1, -1}, {"DVD obs 64 kB:", 3, "DVD obs 64 kB:", "", 1, { 0, -1, -1, -1, -1, -1},
1, 0}, 1, 0},
{"Drive access :", 3, "Drive access : ", ": ", 2, { 0, 1, -1, -1, -1, -1},
2, 0},
{"Drive current:", 3, "Drive current:", "", 2, { 0, 1, -1, -1, -1, -1}, {"Drive current:", 3, "Drive current:", "", 2, { 0, 1, -1, -1, -1, -1},
2, 0}, 2, 0},
{"Drive id :", 3, "Drive id :", "", 1, { 0, -1, -1, -1, -1, -1}, {"Drive id :", 3, "Drive id :", "", 1, { 0, -1, -1, -1, -1, -1},
2, 0}, 2, 0},
{"Drive type :", 3, "Drive type :", "", 3, { 1, 3, 5, -1, -1, -1}, {"Drive type :", 3, "Drive type :", "", 3, { 1, 3, 5, -1, -1, -1},
2, 0}, 2, 0},
{"Eff. Time :", 3, "Eff. Time : ", "", 1, { 0, -1, -1, -1, -1, -1}, {"Eff. Time :", 3, "Eff. Time : ", "", 1, { 0, -1, -1, -1, -1, -1},
1, 1}, 1, 1},
{"Expir. Time :", 3, "Expir. Time : ", "", 1, { 0, -1, -1, -1, -1, -1}, {"Expir. Time :", 3, "Expir. Time : ", "", 1, { 0, -1, -1, -1, -1, -1},
1, 1}, 1, 1},
skipping to change at line 2711 skipping to change at line 2716
bit0= do only report non-default settings bit0= do only report non-default settings
bit1= do only report to fp bit1= do only report to fp
bit2= report current -resume status even if bit0 is set, but only if valid bit2= report current -resume status even if bit0 is set, but only if valid
bit3= report readline history bit3= report readline history
bit4= report -resume options indirectly as bit4= report -resume options indirectly as
-options_from_file:${resume_state_file}_pos -options_from_file:${resume_state_file}_pos
*/ */
{ {
int is_default, no_defaults, i, ret, adr_mode, do_single, behavior; int is_default, no_defaults, i, ret, adr_mode, do_single, behavior;
int show_indev= 1, show_outdev= 1, show_dev= 0; int show_indev= 1, show_outdev= 1, show_dev= 0;
int do_drive_access, did_drive_access;
int part_table_implicit= 0; int part_table_implicit= 0;
char *line, *sfe= NULL, mode[80], *form, *treatment; char *line, *sfe= NULL, mode[80], *form, *treatment;
char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt; char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt;
char *dev_filter= NULL, *xorriso_id= NULL; char *dev_filter= NULL, *xorriso_id= NULL;
static char channel_prefixes[4][4]= {".","R","I","M"}; static char channel_prefixes[4][4]= {".","R","I","M"};
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"}; static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
static int max_load_mode= 4; static int max_load_mode= 4;
static char scsi_family[8][8]= static char scsi_family[8][8]=
{"default", "sr", "scd", "st", "sg", "", "", ""}; {"default", "sr", "scd", "st", "sg", "", "", ""};
struct Xorriso_lsT *paths, *leafs, *s, *plst, *vlst; struct Xorriso_lsT *paths, *leafs, *s, *plst, *vlst;
skipping to change at line 3009 skipping to change at line 3015
} }
is_default= (xorriso->part_like_isohybrid == 0); is_default= (xorriso->part_like_isohybrid == 0);
sprintf(line, "-boot_image any part_like_isohybrid=%s\n", sprintf(line, "-boot_image any part_like_isohybrid=%s\n",
xorriso->part_like_isohybrid ? "on" : "off"); xorriso->part_like_isohybrid ? "on" : "off");
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->iso_mbr_part_type == -1); is_default= (xorriso->iso_mbr_part_type == -1);
sprintf(line, "-boot_image any iso_mbr_part_type="); sprintf(line, "-boot_image any iso_mbr_part_type=");
if(xorriso->iso_mbr_part_type == -1) if(xorriso->iso_mbr_part_flag & 1) {
Xorriso__format_guid(xorriso->iso_gpt_type_guid, line + strlen(line), 0);
strcat(line, "\n");
} else if(xorriso->iso_mbr_part_type == -1) {
sprintf(line + strlen(line), "default\n"); sprintf(line + strlen(line), "default\n");
else } else {
sprintf(line + strlen(line), "0x%-2.2x\n", sprintf(line + strlen(line), "0x%-2.2x\n",
(unsigned int) xorriso->iso_mbr_part_type); (unsigned int) xorriso->iso_mbr_part_type);
}
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->gpt_guid_mode == 0); is_default= (xorriso->gpt_guid_mode == 0);
sprintf(line, "-boot_image any gpt_disk_guid=%s", sprintf(line, "-boot_image any gpt_disk_guid=%s",
xorriso->gpt_guid_mode == 0 ? "random" : xorriso->gpt_guid_mode == 0 ? "random" :
xorriso->gpt_guid_mode == 2 ? "volume_date_uuid" : ""); xorriso->gpt_guid_mode == 2 ? "volume_date_uuid" : "");
if(xorriso->gpt_guid_mode == 1) if(xorriso->gpt_guid_mode == 1)
for(i= 0; i < 16; i++) for(i= 0; i < 16; i++)
sprintf(line + strlen(line), "%-2.2x", sprintf(line + strlen(line), "%-2.2x",
skipping to change at line 3151 skipping to change at line 3161
is_default= (xorriso->disk_excl_mode==1); is_default= (xorriso->disk_excl_mode==1);
sprintf(line, "-not_mgt %s:%s:%s:%s\n", sprintf(line, "-not_mgt %s:%s:%s:%s\n",
(xorriso->disk_excl_mode&1 ? "on" : "off"), (xorriso->disk_excl_mode&1 ? "on" : "off"),
(xorriso->disk_excl_mode&2 ? "param_on" : "param_off"), (xorriso->disk_excl_mode&2 ? "param_on" : "param_off"),
(xorriso->disk_excl_mode&4 ? "subtree_on" : "subtree_off"), (xorriso->disk_excl_mode&4 ? "subtree_on" : "subtree_off"),
(xorriso->disk_excl_mode&8 ? "ignore_on" : "ignore_off")); (xorriso->disk_excl_mode&8 ? "ignore_on" : "ignore_off"));
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->do_override_now_time == 0);
if(xorriso->do_override_now_time)
sprintf(line, "-iso_nowtime =%.f\n", (double) xorriso->now_time_override);
else
sprintf(line, "-iso_nowtime dynamic\n");
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso, filter, fp, flag & 2);
is_default= (xorriso->do_iso_rr_pattern==1); is_default= (xorriso->do_iso_rr_pattern==1);
sprintf(line,"-iso_rr_pattern %s\n", sprintf(line,"-iso_rr_pattern %s\n",
(xorriso->do_iso_rr_pattern == 1 ? "on" : (xorriso->do_iso_rr_pattern == 1 ? "on" :
(xorriso->do_iso_rr_pattern == 2 ? "ls" : "off"))); (xorriso->do_iso_rr_pattern == 2 ? "ls" : "off")));
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->do_disk_pattern==2); is_default= (xorriso->do_disk_pattern==2);
sprintf(line,"-disk_pattern %s\n", sprintf(line,"-disk_pattern %s\n",
(xorriso->do_disk_pattern == 1 ? "on" : (xorriso->do_disk_pattern == 1 ? "on" :
skipping to change at line 3741 skipping to change at line 3759
Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0)); Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0));
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
} }
for(s= xorriso->drive_whitelist; s != NULL; s= Xorriso_lst_get_next(s, 0)) { for(s= xorriso->drive_whitelist; s != NULL; s= Xorriso_lst_get_next(s, 0)) {
sprintf(line, "-drive_class 'harmless' %s\n", sprintf(line, "-drive_class 'harmless' %s\n",
Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0)); Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0));
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
} }
} }
is_default= (xorriso->drives_exclusive == 1 && xorriso->drives_access == 1);
sprintf(line, "-drive_access %s:%s\n",
xorriso->drives_exclusive ? "exclusive" : "shared",
xorriso->drives_access == 0 ? "readonly" : "unrestricted");
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso, filter, fp, flag & 2);
is_default= (xorriso->linux_scsi_dev_family == 0); is_default= (xorriso->linux_scsi_dev_family == 0);
sprintf(line, "-scsi_dev_family %s\n", sprintf(line, "-scsi_dev_family %s\n",
scsi_family[xorriso->linux_scsi_dev_family & 7]); scsi_family[xorriso->linux_scsi_dev_family & 7]);
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
do_single= 0; do_single= do_drive_access= 0;
dev_filter= filter; dev_filter= filter;
if(dev_filter != NULL) { if(dev_filter != NULL) {
show_dev= Xorriso_status_filter(xorriso, filter, "-dev", 0); show_dev= Xorriso_status_filter(xorriso, filter, "-dev", 0);
if(show_dev > 0) if(show_dev > 0)
dev_filter= NULL; dev_filter= NULL;
} }
if(dev_filter != NULL) { if(dev_filter != NULL) {
show_indev= Xorriso_status_filter(xorriso, filter, "-indev", 0); show_indev= Xorriso_status_filter(xorriso, filter, "-indev", 0);
show_outdev= Xorriso_status_filter(xorriso, filter, "-outdev", 0); show_outdev= Xorriso_status_filter(xorriso, filter, "-outdev", 0);
if(show_outdev > 0 || show_indev > 0) if(show_outdev > 0 || show_indev > 0)
do_single= 1; do_single= 1;
} }
if(xorriso->drives_exclusive != xorriso->indev_is_exclusive && if((xorriso->drives_exclusive != xorriso->indev_is_exclusive ||
xorriso->indev[0]) xorriso->drives_access != xorriso->indev_access) && xorriso->indev[0]) {
do_single= 1; do_single= 1;
else if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive && do_drive_access|= 1;
xorriso->outdev[0]) }
if((xorriso->drives_exclusive != xorriso->outdev_is_exclusive ||
xorriso->drives_access != xorriso->outdev_access) &&
xorriso->outdev[0]) {
do_single= 1; do_single= 1;
do_drive_access|= 2;
}
if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) { if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) {
sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0)); sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
Xorriso_status_result(xorriso, dev_filter, fp, flag & 2); Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
} else { } else {
if(xorriso->drives_exclusive != xorriso->indev_is_exclusive && did_drive_access= 0;
xorriso->indev[0] && show_indev) { if((do_drive_access & 1) && xorriso->indev[0] && show_indev) {
sprintf(line,"-osirrox o_excl_%s\n", sprintf(line,"-drive_access %s:%s\n",
xorriso->indev_is_exclusive ? "on" : "off"); xorriso->indev_is_exclusive ? "exclusive" : "shared",
xorriso->indev_access == 0 ? "readonly" : "unrestricted");
Xorriso_status_result(xorriso, NULL, fp, flag & 2); Xorriso_status_result(xorriso, NULL, fp, flag & 2);
did_drive_access= 1;
} }
sprintf(line,"-indev %s\n", Text_shellsafe(xorriso->indev,sfe,0)); sprintf(line,"-indev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
Xorriso_status_result(xorriso, dev_filter, fp, flag & 2); Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
if(xorriso->drives_exclusive != xorriso->indev_is_exclusive && if(did_drive_access) {
xorriso->indev[0] && show_indev) { sprintf(line,"-drive_access %s:%s\n",
sprintf(line,"-osirrox o_excl_%s\n", xorriso->drives_exclusive ? "exclusive" : "shared",
xorriso->drives_exclusive ? "on" : "off"); xorriso->drives_access == 0 ? "readonly" : "unrestricted");
Xorriso_status_result(xorriso, NULL, fp, flag & 2); Xorriso_status_result(xorriso, NULL, fp, flag & 2);
} }
if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive && did_drive_access= 0;
xorriso->outdev[0] && show_outdev) { if((do_drive_access & 2) && xorriso->outdev[0] && show_outdev) {
sprintf(line,"-osirrox o_excl_%s\n", sprintf(line,"-drive_access %s:%s\n",
xorriso->outdev_is_exclusive ? "on" : "off"); xorriso->outdev_is_exclusive ? "exclusive" : "shared",
xorriso->outdev_access == 0 ? "readonly" : "unrestricted");
Xorriso_status_result(xorriso, NULL, fp, flag & 2); Xorriso_status_result(xorriso, NULL, fp, flag & 2);
did_drive_access= 1;
} }
sprintf(line,"-outdev %s\n", Text_shellsafe(xorriso->outdev,sfe,0)); sprintf(line,"-outdev %s\n", Text_shellsafe(xorriso->outdev,sfe,0));
Xorriso_status_result(xorriso, dev_filter, fp, flag & 2); Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive && if(did_drive_access) {
xorriso->outdev[0] && show_outdev) { sprintf(line,"-drive_access %s:%s\n",
sprintf(line,"-osirrox o_excl_%s\n", xorriso->drives_exclusive ? "exclusive" : "shared",
xorriso->drives_exclusive ? "on" : "off"); xorriso->drives_access == 0 ? "readonly" : "unrestricted");
Xorriso_status_result(xorriso, NULL, fp, flag & 2); Xorriso_status_result(xorriso, NULL, fp, flag & 2);
} }
} }
ret= 1; ret= 1;
ex:; ex:;
Xorriso_free_meM(sfe); Xorriso_free_meM(sfe);
Xorriso_free_meM(xorriso_id); Xorriso_free_meM(xorriso_id);
return(ret); return(ret);
} }
skipping to change at line 3968 skipping to change at line 4002
} else } else
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "ABORT", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "ABORT", 0);
return(1); return(1);
} }
/* @param flag bit0=path is in source filesystem , bit1= unconditionally */ /* @param flag bit0=path is in source filesystem , bit1= unconditionally */
int Xorriso_much_too_long(struct XorrisO *xorriso, int len, int flag) int Xorriso_much_too_long(struct XorrisO *xorriso, int len, int flag)
{ {
if(len>=SfileadrL || (flag&2)) { if(len>=SfileadrL || (flag&2)) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Path given for %s is much too long (%d)", "Path given for file in %s is much too long (%d)",
((flag&1) ? "local filesystem" : "ISO image"), len); ((flag&1) ? "local filesystem" : "ISO image"), len);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0); return(0);
} }
return(1); return(1);
} }
int Xorriso_no_findjob(struct XorrisO *xorriso, char *cmd, int flag) int Xorriso_no_findjob(struct XorrisO *xorriso, char *cmd, int flag)
{ {
sprintf(xorriso->info_text, "%s: cannot create find job object", cmd); sprintf(xorriso->info_text, "%s: cannot create find job object", cmd);
skipping to change at line 4622 skipping to change at line 4656
if(flag & 2) if(flag & 2)
limit= 10 * SfileadrL; limit= 10 * SfileadrL;
l= strlen(in_text); l= strlen(in_text);
if(w + l >= limit) { if(w + l >= limit) {
strcpy(out_text, "'xorriso: TEXT MUCH TOO LONG ... "); strcpy(out_text, "'xorriso: TEXT MUCH TOO LONG ... ");
return(out_text); return(out_text);
} }
strcpy(out_text + w, in_text); strcpy(out_text + w, in_text);
return(out_text); return(out_text);
} }
/* @param flag bit=add to existing info_text
*/
int Xorriso_set_info_text(struct XorrisO *xorriso, char *text,
size_t trunc_len, int flag)
{
size_t offst= 0, maxl;
maxl= sizeof(xorriso->info_text) - 1;
if(flag & 1)
offst= strlen(xorriso->info_text);
if(offst >= maxl)
return(0);
maxl-= offst;
if(maxl > trunc_len)
maxl= trunc_len;
strncpy(xorriso->info_text + offst, text, maxl + 1);
if(strlen(text) > maxl) {
strcpy(xorriso->info_text + offst + maxl - 12, "#[truncated]");
return(2);
}
return(1);
}
 End of changes. 22 change blocks. 
26 lines changed or deleted 60 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)