cdw-0.7.1/0000755000175000017500000000000011736031301007270 500000000000000cdw-0.7.1/cdw.conf0000644000175000017500000000160411735415054010647 00000000000000#################################### # cdw 0.7.1 configuration file #################################### ### "Writing" options pad=1 pad_size=150 # fast / all blank=fast eject=0 burnproof=1 other_cdrecord_options= other_growisofs_options= other_xorriso_burn_options= ### "Hardware" options # string indicating drive to be used by cdw selected_drive=default # manually entered path to a drive custom_drive= # SCSI device descriptor, used by cdrecord scsi= ### "Audio" options audiodir= ### "ISO9660 file system" options # allowed values for iso_level are 1, 2, 3, 4 iso_level=3 joliet=1 rock_ridge=1 joliet_long=0 follow_symlinks=0 iso_image_full_path=/tmp/image.iso # well, in fact this field stores all options related to boot disc boot_image_path= other_mkisofs_options= other_xorriso_iso_options= ### "Log and other" options showlog=1 logfile= cdsize=cd74 cdsize=650 user_cdsize=0 cdw-0.7.1/configure0000755000175000017500000071571611722443566011157 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for cdw 0.7.1. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and acerion@wp.pl $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cdw' PACKAGE_TARNAME='cdw' PACKAGE_VERSION='0.7.1' PACKAGE_STRING='cdw 0.7.1' PACKAGE_BUGREPORT='acerion@wp.pl' PACKAGE_URL='' ac_unique_file="src/main.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS ALLOCA EGREP GREP CPP TXT2TAGS CDW_BUILD_DEBUG_ENABLED_FALSE CDW_BUILD_DEBUG_ENABLED_TRUE YFLAGS YACC RANLIB LN_S am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_debug ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures cdw 0.7.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cdw] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of cdw 0.7.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-debug enable debug messages printed to stderr, include debug info for gdb Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF cdw configure 0.7.1 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ---------------------------- ## ## Report this to acerion@wp.pl ## ## ---------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by cdw $as_me 0.7.1, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=cdw VERSION=0.7.1 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # part of checking (autoconf) and building (automake) systems ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # needed since adding convenience library in gnulib/lib dir for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" # enabe usage of per-target preprocessor flags if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi # Checks for libraries. Succesfull AC_CHECK_LIB will append "-l" # to compiler flags (to LIBS?), unless third argument to the macro defines # some other "action-if-found" is defined; we define empty (dummy) # "action-if-found" with bash built in null command ":" # reference: # http://www.gnu.org/software/autoconf/manual/autoconf.html#Libraries # http://tldp.org/LDP/abs/html/special-chars.html { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cdio_open in -lcdio" >&5 $as_echo_n "checking for cdio_open in -lcdio... " >&6; } if ${ac_cv_lib_cdio_cdio_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcdio $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cdio_open (); int main () { return cdio_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_cdio_cdio_open=yes else ac_cv_lib_cdio_cdio_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cdio_cdio_open" >&5 $as_echo "$ac_cv_lib_cdio_cdio_open" >&6; } if test "x$ac_cv_lib_cdio_cdio_open" = xyes; then : : else echo -e "\nError! Can't find cdio library (part of cdio project).\n" exit -1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iso9660_open in -liso9660" >&5 $as_echo_n "checking for iso9660_open in -liso9660... " >&6; } if ${ac_cv_lib_iso9660_iso9660_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liso9660 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char iso9660_open (); int main () { return iso9660_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iso9660_iso9660_open=yes else ac_cv_lib_iso9660_iso9660_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iso9660_iso9660_open" >&5 $as_echo "$ac_cv_lib_iso9660_iso9660_open" >&6; } if test "x$ac_cv_lib_iso9660_iso9660_open" = xyes; then : : else echo -e "\nError! Can't find iso9660 library (part of cdio project).\n" exit -1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new_form in -lformw" >&5 $as_echo_n "checking for new_form in -lformw... " >&6; } if ${ac_cv_lib_formw_new_form+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lformw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char new_form (); int main () { return new_form (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_formw_new_form=yes else ac_cv_lib_formw_new_form=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_formw_new_form" >&5 $as_echo "$ac_cv_lib_formw_new_form" >&6; } if test "x$ac_cv_lib_formw_new_form" = xyes; then : : else echo -e "\nError! Can't find formw library (part of ncurses project).\n" exit -1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new_menu in -lmenuw" >&5 $as_echo_n "checking for new_menu in -lmenuw... " >&6; } if ${ac_cv_lib_menuw_new_menu+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmenuw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char new_menu (); int main () { return new_menu (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_menuw_new_menu=yes else ac_cv_lib_menuw_new_menu=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_menuw_new_menu" >&5 $as_echo "$ac_cv_lib_menuw_new_menu" >&6; } if test "x$ac_cv_lib_menuw_new_menu" = xyes; then : : else echo -e "\nError! Can't find menuw library (part of ncurses project).\n" exit -1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for newwin in -lncursesw" >&5 $as_echo_n "checking for newwin in -lncursesw... " >&6; } if ${ac_cv_lib_ncursesw_newwin+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncursesw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char newwin (); int main () { return newwin (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncursesw_newwin=yes else ac_cv_lib_ncursesw_newwin=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_newwin" >&5 $as_echo "$ac_cv_lib_ncursesw_newwin" >&6; } if test "x$ac_cv_lib_ncursesw_newwin" = xyes; then : : else echo -e "\nError! Can't find ncursesw library (part of ncurses project).\n" exit -1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new_panel in -lpanelw" >&5 $as_echo_n "checking for new_panel in -lpanelw... " >&6; } if ${ac_cv_lib_panelw_new_panel+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpanelw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char new_panel (); int main () { return new_panel (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_panelw_new_panel=yes else ac_cv_lib_panelw_new_panel=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panelw_new_panel" >&5 $as_echo "$ac_cv_lib_panelw_new_panel" >&6; } if test "x$ac_cv_lib_panelw_new_panel" = xyes; then : : else echo -e "\nError! Can't find panelw library (part of ncurses project).\n" exit -1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : : else echo -e "\nError! Can't find pthread library.\n" exit -1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for burn_initialize in -lburn" >&5 $as_echo_n "checking for burn_initialize in -lburn... " >&6; } if ${ac_cv_lib_burn_burn_initialize+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lburn $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char burn_initialize (); int main () { return burn_initialize (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_burn_burn_initialize=yes else ac_cv_lib_burn_burn_initialize=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_burn_burn_initialize" >&5 $as_echo "$ac_cv_lib_burn_burn_initialize" >&6; } if test "x$ac_cv_lib_burn_burn_initialize" = xyes; then : : else echo -e "\nError! Can't find burn library.\n" exit -1 fi #enable_debug=no # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; enable_debug=yes else enable_debug=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debugging" >&5 $as_echo_n "checking whether to enable debugging... " >&6; } if test "x$enable_debug" = "xyes" then CFLAGS= # cure annoying default arguments for CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # conditionals: http://sources.redhat.com/autobook/autobook/autobook_179.html if test "$enable_debug" = yes; then CDW_BUILD_DEBUG_ENABLED_TRUE= CDW_BUILD_DEBUG_ENABLED_FALSE='#' else CDW_BUILD_DEBUG_ENABLED_TRUE='#' CDW_BUILD_DEBUG_ENABLED_FALSE= fi # info about "x$var_name" thing: # http://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyes # program used to generate man page # Extract the first word of "txt2tags", so it can be a program name with args. set dummy txt2tags; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_TXT2TAGS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$TXT2TAGS"; then ac_cv_prog_TXT2TAGS="$TXT2TAGS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_TXT2TAGS="txt2tags" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_TXT2TAGS" && ac_cv_prog_TXT2TAGS="""" fi fi TXT2TAGS=$ac_cv_prog_TXT2TAGS if test -n "$TXT2TAGS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TXT2TAGS" >&5 $as_echo "$TXT2TAGS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$TXT2TAGS" = "x" then { $as_echo "$as_me:${as_lineno-$LINENO}: Can't find txt2tags program. cdw man page won't be built locally, cdw.1 file from distribution package will be used instead." >&5 $as_echo "$as_me: Can't find txt2tags program. cdw man page won't be built locally, cdw.1 file from distribution package will be used instead." >&6;} fi if test "x$prefix" = xNONE; then prefix="${ac_default_prefix}" fi $as_echo "#define GNULIB_CANONICALIZE 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define LOCALEDIR "${prefix}/share/locale/" _ACEOF cat >>confdefs.h <<_ACEOF #define DOCDIR "${prefix}/share/doc/${PACKAGE}/" _ACEOF cat >>confdefs.h <<_ACEOF #define CDWDIR "${prefix}/share/${PACKAGE}/" _ACEOF cat >>confdefs.h <<_ACEOF #define COMMON "/usr/share/common-licenses/" _ACEOF # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi for ac_header in fcntl.h libintl.h locale.h limits.h malloc.h nl_types.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h unistd.h cdio/cdio.h cdio/mmc.h cdio/iso9660.h mntent.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in ncursesw/form.h ncursesw/menu.h ncursesw/ncurses.h ncursesw/panel.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in form.h menu.h ncurses.h panel.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 _ACEOF fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 _ACEOF $as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h else case " $LIBOBJS " in *" fileblocks.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext" ;; esac fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTRDIFF_T 1 _ACEOF fi # Checks for library functions. # AM_GNU_GETTEXT ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi # getmntent is in the standard C library on UNICOS, in -lsun on Irix 4, # -lseq on Dynix/PTX, -lgen on Unixware. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getmntent" >&5 $as_echo_n "checking for library containing getmntent... " >&6; } if ${ac_cv_search_getmntent+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getmntent (); int main () { return getmntent (); ; return 0; } _ACEOF for ac_lib in '' sun seq gen; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_getmntent=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_getmntent+:} false; then : break fi done if ${ac_cv_search_getmntent+:} false; then : else ac_cv_search_getmntent=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getmntent" >&5 $as_echo "$ac_cv_search_getmntent" >&6; } ac_res=$ac_cv_search_getmntent if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ac_cv_func_getmntent=yes $as_echo "#define HAVE_GETMNTENT 1" >>confdefs.h else ac_cv_func_getmntent=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi # AC_FUNC_CLOSEDIR_VOID for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat accepts an empty string" >&5 $as_echo_n "checking whether lstat accepts an empty string... " >&6; } if ${ac_cv_func_lstat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_lstat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return lstat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_empty_string_bug=no else ac_cv_func_lstat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_empty_string_bug" >&5 $as_echo "$ac_cv_func_lstat_empty_string_bug" >&6; } if test $ac_cv_func_lstat_empty_string_bug = yes; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_LSTAT_EMPTY_STRING_BUG 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi # AC_FUNC_STRFTIME for ac_func in getpass mempcpy memset mkdir regcomp setlocale \ strncasecmp strrchr strspn strdup asprintf \ canonicalize_file_name floor getmntent memmove \ pathconf realpath resolvepath setenv strerror \ strndup strpbrk strtol do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Checks for system services. # let autoconf generate a configure script that will # output Makefiles for some directories: ac_config_files="$ac_config_files Makefile src/Makefile gnulib/Makefile gnulib/lib/Makefile man/Makefile src/external_tools/Makefile src/tasks/Makefile src/user_interface/widgets/Makefile src/user_interface/Makefile src/disc_and_drive/Makefile src/native_file_system/Makefile src/optical_file_systems/Makefile src/configuration/Makefile src/utilities/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${CDW_BUILD_DEBUG_ENABLED_TRUE}" && test -z "${CDW_BUILD_DEBUG_ENABLED_FALSE}"; then as_fn_error $? "conditional \"CDW_BUILD_DEBUG_ENABLED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by cdw $as_me 0.7.1, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ cdw config.status 0.7.1 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "gnulib/Makefile") CONFIG_FILES="$CONFIG_FILES gnulib/Makefile" ;; "gnulib/lib/Makefile") CONFIG_FILES="$CONFIG_FILES gnulib/lib/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "src/external_tools/Makefile") CONFIG_FILES="$CONFIG_FILES src/external_tools/Makefile" ;; "src/tasks/Makefile") CONFIG_FILES="$CONFIG_FILES src/tasks/Makefile" ;; "src/user_interface/widgets/Makefile") CONFIG_FILES="$CONFIG_FILES src/user_interface/widgets/Makefile" ;; "src/user_interface/Makefile") CONFIG_FILES="$CONFIG_FILES src/user_interface/Makefile" ;; "src/disc_and_drive/Makefile") CONFIG_FILES="$CONFIG_FILES src/disc_and_drive/Makefile" ;; "src/native_file_system/Makefile") CONFIG_FILES="$CONFIG_FILES src/native_file_system/Makefile" ;; "src/optical_file_systems/Makefile") CONFIG_FILES="$CONFIG_FILES src/optical_file_systems/Makefile" ;; "src/configuration/Makefile") CONFIG_FILES="$CONFIG_FILES src/configuration/Makefile" ;; "src/utilities/Makefile") CONFIG_FILES="$CONFIG_FILES src/utilities/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cdw-0.7.1/INSTALL0000644000175000017500000001722707475402071010265 00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. cdw-0.7.1/Makefile.in0000644000175000017500000005525211722443565011304 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # hand-made Makefile.am (work includes CTRL+C SHIFT+Ins) # # references, sources, acknowledgements: # http://inti.sourceforge.net/tutorial/libinti/autotoolsproject.html#AP03 # http://mij.oltrelinux.com/devel/autoconf-automake/ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \ INSTALL NEWS THANKS TODO compile config.rpath depcomp \ install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # The SUBDIRS variable is used to list the subdirectories that must be built. SUBDIRS = gnulib src man # tools # http://www.gnu.org/software/hello/manual/automake/Basics-of-Distribution.html # "Still, sometimes there are files that must be distributed, but which # are not covered in the automatic rules. These files should be listed # in the EXTRA_DIST variable." EXTRA_DIST = $(top_srcdir)/Makefile.cdw.am \ $(top_srcdir)/cdw.conf \ $(top_srcdir)/cdw.colors \ $(top_srcdir)/TODO all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/THANKS0000644000175000017500000000043711604702036010133 00000000000000 Special thanks for reporting bugs and testing fixes for various versions of cdw go to robwoj44 and rogerx. Thanks to Krzysztof Grygiencz for some suggestions about cdw 0.6.0. --- Changes on hungarian translation: Gabor Sari Thanks for the Hungarian UHU-Linux Team! cdw-0.7.1/compile0000755000175000017500000000727111420346105010576 00000000000000#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2009-10-06.20; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software # Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use `[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cdw-0.7.1/AUTHORS0000644000175000017500000000062711735412577010306 00000000000000Kamil Ignacak (acerion) Balazs Varkonyi (vbali) Csaba Feher (linuxfan) Special thanks to: Laszlo Boszormenyi Sebastian Henschel (schenche) Marcel Hilzinger Jesus Espino Changes on hungarian translation: Gabor Sari Thanks for the Hungarian UHU-Linux Team! cdw-0.7.1/NEWS0000644000175000017500000005511111735546344007733 00000000000000cdw -- History of visible changes. Copyright (C) 2007 - 2012 Kamil Ignacak Copyright (C) 2005, Balazs Varkonyi Modified by Csaba Feher Please send bug reports to acerion@wp.pl Version 0.7.1 1-04-2012 NEWS: * new release: 0.7.1, changes between 0.7.1 and 0.7.0 are listed below: * fixing Sourceforge defect #3487958 (cdw was unable to detect installed wodim and genisoimage if they weren't symlinked as cdrecord and mkisofs); * dropdowns, button dialogs and few more places, like log window, recognize 'q' and 'Q' keys as cancel/escape keys; this change has been suggested by rogerx; * when burning second or following session to a disc, cdw now tries to check which tool has been used to create ISO file system already existing on a disc, and select the same tool for creating appended file system; user is warned if cdw can't recognize a tool used to create ISO file system existing on the disc; The change should decrease possibility of problems when burning files to a disc; see this post for related information: http://sourceforge.net/mailarchive/forum.php?thread_name=4EA08379.7090302%40wp.pl&forum_name=cdw-user * code handling signals has been improved: more signals are being handled, and code has been modified to make sure that final debug message is printed correctly, and that exit() is called properly; * there has been made small change that should help to resolve problems with saving data in configuration window or in wizards with F10 key, when user runs cdw in terminal emulators that use F10 for their own purposes; see also http://sourceforge.net/tracker/index.php?func=detail&aid=3424993&group_id=124080&atid=698428 * fixing problem with ejecting drive tray; after a bit of googling it turned out that this may be caused by the drive being locked; * fixing usage of meta information fields - they are used only when they are accessible during task creation, i.e. preparer/publisher/copyright fields are only used during creation of standalone ISO9660 file system (because there is this "meta" tab in ISO9660 wizard), but not during creation of ISO9660 file system on the fly, because the "meta" tab is currently missing in write wizard; * cdw now can recognize "not a known option" error message printed by xorriso to stderr, and inform user about the fact; * code implementing new ncurses widgets, used by cdw, has been extracted into separate files in src/user_interface/widgets/*.[ch]. I hope that someone will find them useful. * updating COPYING file (nothing harmless, just using corrected file with new snail mail address of Free Software Foundation and updated full name of LGPL license); --------------------------------------- Version 0.7.0 13-08-2011 NEWS: * new release: 0.7.0, changes between 0.7.0 and 0.6.0 are listed below: * adding support for xorriso (http://libburnia-project.org/wiki/Xorriso): cdw can employ xorriso to burn files and ISO images to CD-R, CD-RW, DVD+/-R disc, and to erase CD-RW discs; the support is limited and imperfect, but it's there; * adding new compile-time and run-time dependency: libburn from libburnia project (http://libburnia-project.org); * adding support for more digest (checksum) tools: sha1sum, sha224sum, sha256sum, sha384sum, sha512sum; a digest tool can be selected in Configuration -> Tools page; md5sum was already supported in 0.6.0; * fixing Sourceforge defect #3111089 ("verification of ISO images fails", http://sourceforge.net/tracker/?func=detail&aid=3111089&group_id=47851&atid=451091); * fixing Sourceforge defect #3149329 raised by user rogerx ("Using "dummy" option fails"), http://sourceforge.net/tracker/?func=detail&aid=3149329&group_id=47851&atid=451091; * fixing small annoyance with tray: it is reloaded less often during burning/verification (problem raised by user rogerx); * adding missing -lm library in src/Makefile.am (see Gentoo bug #344315, https://bugs.gentoo.org/show_bug.cgi?id=344315); * moving configuration file and log file from their original default locations (in $HOME dir) into their new location (in $HOME/.cdw/ dir); this is related to Sourceforge bug #3168259, "move the configuration files into a separate directory", http://sourceforge.net/tracker/?func=detail&aid=3168259&group_id=47851&atid=451091; * responding to feature request #3249439 on SourceForge: "ncurses header files" (http://sourceforge.net/tracker/?func=detail&aid=3249439&group_id=47851&atid=451094); this should ease compilation of cdw on Arch Linux; * improving recognition of track formats (TAO/DAO/SAO) supported by disc/drive when burning with cdrecord; * adding (partial) recognition of capacity of CD/DVD discs; the capacity is displayed in main window if Configuration -> Log and misc -> ISO volume size -> Get sizes from disc is selected; this functionality doesn't work too well when using wodim; * improving response to Esc key; in previous versions the delay between pressing Esc key and reaction to the key was considerable; now it is 50ms by default, and can be changed by command-line option; * adding command-line option "--escdelay=X", where X is time in milliseconds; * key 'q'/'Q' is now treated by some parts of user interface as 'Esc' key; fingers don't have to move that far anymore :) * adding "verify data" button in main menu, the button invokes wizard that configures new functionality of cdw: calculating digest of arbitrary disc file, or comparing digests of selected file and first track of optical disc; * simplifying main window - removing unnecessary double borders; * adding hiding/showing hidden files in file system browser widget - user can toggle the hiding using '.' (dot) character; * adding a wizard dialog for creating stand-alone ISO9660 image files; * some options related to burning and to ISO9660 file system have been moved to wizard dialog windows; * adding option fields for mkisofs and xorriso options, that allow editing Publisher, System ID, Volume Set ID and (in case of mkisofs) Preparer, Copyright and Abstract meta data; the data can be read from ~/.mkisofsrc or ~/.xorrisorc files; the fields are accessible through ISO9660 stand-alone file wizards only; they are not available through wizard that prepares "burn from files" process; * "Tools" page in Configuration window has been updated: dropdowns for growisofs, dvd+rw-mediainfo and dvd+rw-format have been removed: the tools aren't as "controversial" as cdrecord/wodim and mkisofs/genisoimage are - dropdowns for the two tools have been left intact; new dropdowns: "Tools for handling CDs" "Tool for creating stand alone ISO9660 file" have been added; * cdw now displays progress information during calculating digest of source ISO file; Version 0.6.0 24-10-2010 NEWS: * new release: 0.6.0 * added dependency on libiso9660 library; the library comes from cdio project (http://www.gnu.org/software/libcdio/), and if there is a libcdio in your packages repository, there should be a package for libiso9660 as well. libiso9660 may be a part libcdio package itself. * added verification of burning ISO9660 image to DVDs - it is done in similar fashion as verification of burning ISO9660 image to CD * added reading DVDs with ISO9660 file system (i.e. for copying content of their first session to file on hard disc); * cdw now can detect optical drives available on user's machine; it's not perfect, but basics are there; user can still enter and select his own, custom path to a drive; this function uses functionality of libcdio library; * fixed sourceforge defect #3088902: the defect resulted in crash whenever there were no programs for handling DVDs installed, but user wanted to configure them in Configuration window anyway; it seems that this defect was introduced in cdw 0.5.0, perhaps even earlier; * user is now warned when he attempts to burn image larger than 4GB with wodim - such operation may fail; * cdw gives more visual feedback to user about activities performed by the program: a dialog window informs user about things like waiting for drive, checking disc in drive, opening and closing drive tray - all these activities that may take a long time are now explicitly presented to user. User doesn't have to worry that cdw doesn't respond without any apparent reason; * cdw can now correctly recognize if DVD+RW or DVD-RW Restricted Overwrite is empty or not; * information about current burning speed is displayed in dialog window during process of burning; * until now cdw always attempted, but was never able to correctly read second and following sessions from a disc, now it doesn't attempt to do such reading; * added "Long Joliet names" ("-joliet-long") checkbox in mkisofs options panel in Configuration window; * options field for creating bootable CD has been dumbed down: user has to enter all correct and appropriate options by hand; reason: I had never tested this functionality myself, so I'm simplifying it in order to avoid implementing it completely wrong; * cdw now displays full text of GPL license, but only if it is in Debian's default location; if cdw can't find the file, it displays only small dialog box with basic information about licensing; * added "wrapping" in main menu: when focus is on last position of the menu and user presses down arrow, focus is moved to first item; similarly for topmost item; * fixed some small memory leaks * other small fixes and improvements; --------------------------------------- Version 0.5.0 17-07-2010 NEWS: * new release: 0.5.0 * fixed some small memory leaks * fixed sourceforge defect #2996770: "Problems with F1-F4 keys in Configuration window" * fixed sourceforge defect #2998671: "cdw hangs when getting media information on laptops" * fixed sourceforge defect #2996758: "cdw can't find any tools" * fixed sourceforge defect #2999633: "cdw can't create config file at startup, and exits" * small fix in process window (window that shows progress of current task, or informs about type/state of current task): sometimes the window displays message "press any key", but in previous versions on some occasions it closed itself without waiting for user's key; this has been (at least partially) fixed in 0.5.0 * when verifying burned image, cdw checks if optical disc is mounted or not; in previous versions disc mounted e.g. by auto mounter may have caused aborting the verification, now cdw asks user to unmount the disc and then correctly continues verification * added file picker, a dialog window allowing user to select single file or directory easily, without a need to type full path in input field * improved displaying files with characters in their names that appear to be corrupted when viewed in some file managers; in previous versions of cdw such file names might not be displayed at all * cdw 0.5.0 now includes few files from gnulib package to avoid reimplementing "canonicalize" function * removed separate dialog window for editing cdrecord parameters, it was available via F3 hotkey; cdrecord parameters can be now edited only in configuration window; * removed separate dialog window for editing volume size (target disc size), it was available via F4 hotkey; this functionality has been moved to Configuration window (tab "Log and other"); * removed separate dialog window for editing volume label, it was available via F2 hotkey; volume label can be now edited only in configuration window; * added file picker widget: a dialog window that simplifies selecting single file, e.g. ISO image file for burning. The widget is used in few panels of configuration window, and is also displayed when user wants to create new ISO image file or wants to burn ISO image file to optical disc; * updated build scripts: created separate Makefile.cdw.am file with common options; added explicit main build target and "check" build target; "configure" now accepts "--enable-debug" flag, which controls whether debug facilities (debug info for gdb, debug messages printed to stderr) are included in the build or not, and whether or not additional set of compiler warnings are enabled - this removes necessity of editing Makefile.cdw.am file to enable or disable debug build; "distcheck" target of build system now works; "configure" script makes more checks than in version 0.4.0; * default burning mode for burning files to empty disc is now "make single session" instead of "start multisession"; --------------------------------------- Version 0.4.0 31-03-2010 NEWS: * new release: 0.4.0 * when burning files with growisofs, cdw checks which implementation of mkisofs/genisoimage is selected in Configuration, and passes this information to growisofs * there is more feedback to user when some files can't be selected for burning or for creating image (e.g. when some directories in selected files can't be visited); * dialogs where user can enter a string (e.g. path to ISO image files) now don't accept insecure characters, like '|', '&' or ';' (sourceforge defect #2965153) * paths to ISO images with space characters are now correctly handled; (sourceforge defect #2965149) * user is warned when creating ISO file system fails because of some file being larger than 4GB, while ISO level is less than 3; * cdw can now detect other errors reported by tools, and report these errors to user; * there is now partial support for DVD+R DL discs, but user has to explicitly enable it by passing "--enable-dvd-rp-dl" command line argument to cdw; cdw can handle DVD+R DL discs only using dvd+rw-tools; this feature is very incomplete and possibly buggy; --------------------------------------- Version 0.3.95 17-01-2010 NEWS: * new release: 0.3.95 * tools (cdrecord, mkisofs etc.) are now configured automatically, unless user checks "Configure tools manually" checkbox in Configuration panel; this allows user to select tool implementations (as it was available since 0.3.93), but can also select which tools "family" (dvd+rw-tools / cdrtools) should be used for handling DVDs, which is related to next change: * added *basic* support for burning files and ISO images to DVDs with cdrecord / wodim: DVD-R, DVD+R, DVD+RW are supported (both burning files and ISO image); selection of tool family is made in Configuration -> Tools -> Tools family for handling DVDs; this is still bit buggy (but not fatally buggy ;)) * fixed sourceforge defects: - 2890402 ("cdw fails to build, problems with linux/cdrom.h"), - 2890403 ("problems with burning second session on 32-bit machine"), - 2890399 ("cdw freezes after writing to disc or creating image"), - 2545568 ("File > 4GB") * opened sourceforge defects: - 2909705 ("Problem with handling symlinks in selected files" * cdw now can recognize when external tools (growisofs and cdrecord) report insufficient space on target disc to perform burning; appropriate dialog messages are displayed to user; * a dialog message is displayed when user selects file larger than 4GB, since some versions of genisoimage can't handle file this large without additional arguments; * I did some very basic testing in i386 machine, if you had any problems with running cdw on i386 then the situation may have improved; * reduced consumption of CPU time during burning files or image to disc or creating image; this should be more visible on older machines; * "Copy data CD" and "Copy audio CD" menu options are now merged into single "Copy CD" option * other minor fixes and improvements; some more vague news and announcements: * I will fix most urgent problems, test cdw and release new version 0.4.0 soon, perhaps in March 2010; * there are now some solid foundations for adding support for new tools (e.g. xorriso) in cdw; * support for DVD+R DL is almost ready, I need to spend some time (and money) on testing and improving it version 0.3.95 was tested with Cdrecord-ProDVD-ProBD-Clone 2.01.01a37, Wodim 1.1.10, mkisofs 2.01.01a37, genisoimage 1.1.10, growisofs 7.1 on x86_64 GNU/Linux, Debian 5.0 with 2.6.32 kernel --------------------------------------- Version 0.3.94 27-10-2009 NEWS: * new release: 0.3.94 * There is only one change. Some time after releasing version 0.3.93 I have noticed that cdw can't handle some special case when using libcdio calls. Because of this issue on some systems user was unable to do anything involving optical disc. Small fix in source tree of cdw 0.3.93 fixes this problem. This is the one and only new change between previous and current version. --------------------------------------- Version 0.3.93 12-08-2009 NEWS: * new release: 0.3.93 * external tools (cdrecord, mkisofs, growisofs etc.) are no longer a compile time requirement * there is a basic support for managing external tools in cdw configuration module: user can select one of implementations of given tool if he has more than one available on his machine * configuration panel was redesigned, division of options among categories is now more reasonable * DAO option is moved from configuration panel to write wizard, this option (and TAO option) is available only when suitable (e.g. when disc state and type allows this) * added "Follow symbolic links" option checkbox to mkisofs options panel * added support for padding options in cdrecord options panel * cdw now can recognize few more error messages coming from cdrecord, mkisofs and growisofs, and present user with dialog window with some basic information about problem. There are still situations when cdw will silently ignore errors reported by external tools, but now behavior of cdw is at least a bit better than in previous version. * other minor improvements * there was a problem with correctness of list of CD writing speeds in write wizard, this is now fixed with new method of getting CD metainformation * other minor bugfixes --------------------------------------- Version 0.3.92 1-01-2009 NEWS: * new release: 0.3.92 * improved support of DVD-RW discs: cdw can recognize and handle properly discs in Sequential and Restricted mode - this includes reformatting DVD-RW discs * added verification of md5sum of iso image written to CD (but not DVD) * other minor improvements * minor bugfixes * information for people building cdw from sources: I added 'check' target in Makefile, so you can now run 'make check' to run some unit tests on few basic functions implemented and used by cdw --------------------------------------- Version 0.3.91 8-05-2008 NEWS: * new release: 0.3.91 * added support for dvd+rw-tools, which brings: * added writing files or ISO image to DVD-R, DVD+R, DVD-RW, DVD+RW discs; no double-layer media are supported * added blanking of DVD-RW and DVD+RW also: * simplified hardware configuration - now you need to enter no more than 2 device descriptors :) * wizard dialog windows ---------------------------------------------------------- Version 0.3.3 13-12-2007 NEWS: * new release: 0.3.3 * gtk-related files are removed, gtk interface is no longer an option * restored functionality: ripping audio CDs, but only to raw audio tracks. User have to use following command: 'sox -c 2 -r 44100 -L -2 -s track_name.raw -t wav track_name.wav' to recode the files to wav audio files. * restored functionality: copying data CDs to iso image on hdd. This works only for single-session CDs only for now. * new dependency: cdw now requires libcdio, a library for accessing CD device * dependency on wncurses (ncurses with wide chars support) is now mentioned in README file * some changes in main application window layout, so now cdw uses all lines and columns of console * updated man page, updated README file * new autotools files, configure.ac is now used instead of configure.in; 'bootstrap' file is removed, if you want to regenerate build files you should use autoreconf(1) now; * added some comments for translators of UI elements * removed dependency on external cdda2wav tool, currently cdw provides a subset of cdda2wav's functionality and don't require the tool * fixed bug: moving through fields in options forms using TAB key was impossible - this is now fixed * fixed bug: too wide fields in second page of options caused cdw to crash when switching options pages - this is now fixed * fixed bug: removed one source of memory leak in options module code * fixed bug: it was impossible to write second and following sessions to multisession CD disc - it is now fixed * fixed bug: bug 1841923 from SourceForge bug tracking system is now fixed (build error with lame-support: 'msg' undeclared) * fixed bug: space usage indicator (bar) in main application window works again (now with colors) * fixed bug: method of blanking is now properly saved when changed in method selection window (but only if user decides to perform blanking; until now change of method was saved even if user abandoned blanking after changing method). ---------------------------------------------------------- Version 0.3.2 August 26 2007 NEWS: * new release: 0.3.2 * changes mainly in options module: some sanity checks and reorganization of options window * additionaly small fixes in other files * new pot file ---------------------------------------------------------- Version 0.3.0 April 29 2007 NEWS: * part of functionality of previous version (0.2.4) was removed - all that was left was writing to image and writing to CD ---------------------------------------------------------- Version 0.1.5 May 12 2003 NEWS: * Added new mysql based disk catalog ---------------------------------------------------------- Version 0.1.5 Nov 05 2002 NEWS: * Quality related encoder options added ---------------------------------------------------------- Version 0.1.5 Oct 24 2002 NEWS: * Audio grab function * Ogg encoder support * Mp3 encoder support ---------------------------------------------------------- Version 0.1.4 Jul 15 2002 NEWS: * 'F1' shows README * 'F10' shows GPL * 'i' shows information about CD (cdrecord -atip) * 'v' shows and edits volume ID and autoshow before writing * 'o' shows and edits hidden parameters to cdrecord (such as '-overburn') * 'l' shows "Last log" window * Auto show log window after writing ---------------------------------------------------------- Version 0.1.3 Mar 01 2002 NEWS: * Data CD copy * CD image copy * Write CD directly * Dummy write ---------------------------------------------------------- Version 0.1.2 Feb 24 2002 NEWS: * Added language support. (All in one :-) ) cdw-0.7.1/Makefile.cdw.am0000644000175000017500000000657611673716156012060 00000000000000# _FILE_OFFSET_BITS=64 - large file support (>2GB on 32-bit systems); # this is unnecessary on 64-bit systems, but I had to add this # after doing some basic tests on i386 machine; see sourceforge # #2545568 defect for details; # # This is aso required by libburn - see information on top of # /usr/include/libburn/libburn.h CDW_BUILD_CPPFLAGS = -D _FILE_OFFSET_BITS=64 # "include" files of convenience libraries # don't use $(top_builddir), it fails during "make distcheck" CDW_BUILD_CPPFLAGS += -I$(top_srcdir)/src/ \ -I$(top_srcdir)/src/external_tools/ \ -I$(top_srcdir)/src/tasks/ \ -I$(top_srcdir)/src/utilities/ \ -I$(top_srcdir)/src/user_interface/widgets/ \ -I$(top_srcdir)/src/user_interface/ \ -I$(top_srcdir)/src/configuration/ \ -I$(top_srcdir)/src/native_file_system/ \ -I$(top_srcdir)/src/optical_file_systems/ \ -I$(top_srcdir)/src/disc_and_drive/ \ -I$(top_srcdir)/gnulib/lib/ # quoted descriptions of flags come from # http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html # using C99 standard + gnu extensions; I don't use pure c99, because # it may trigger problems caused by asm/byteorder.h, which is included # by linux/cdrom.h header, which in turn is included by cdw_drive.h CDW_BUILD_CFLAGS_C_STD = -std=gnu99 CDW_BUILD_CFLAGS_PEDANTIC = -pedantic # "Check calls to printf and scanf, etc., to make sure that the arguments # supplied have types appropriate to the format string specified..." CDW_BUILD_CFLAGS_WARNINGS = -Wformat # "If -Wformat is specified, also warn about uses of format functions that # represent possible security problems..." CDW_BUILD_CFLAGS_WARNINGS += -Wformat-security # "If -Wformat is specified, also warn if the format string is not # a string literal..." CDW_BUILD_CFLAGS_WARNINGS += -Wformat-nonliteral # "These warnings will help you find at compile time code that can try # to write into a string constant..." CDW_BUILD_CFLAGS_WARNINGS += -Wwrite-strings # "Warn about anything that depends on the “size of” a function type or # of void...." CDW_BUILD_CFLAGS_WARNINGS += -Wpointer-arith # "Warn whenever a switch statement does not have a default case" CDW_BUILD_CFLAGS_WARNINGS += -Wswitch-default # sometimes gcc can complain about unreachable code when using constant # strings like that: strcmp(some_string, "some string"); CDW_BUILD_CFLAGS_WARNINGS += -Wunreachable-code # "Warn whenever a pointer is cast such that the required alignment of # the target is increased..." CDW_BUILD_CFLAGS_WARNINGS += -Wcast-align # "Warn whenever a pointer is cast so as to remove a type qualifier from # the target type..." CDW_BUILD_CFLAGS_WARNINGS += -Wcast-qual # "Warn whenever a function call is cast to a non-matching type..." CDW_BUILD_CFLAGS_WARNINGS += -Wbad-function-cast CDW_BUILD_CFLAGS_WARNINGS += -Wall -Wshadow -Wextra -Wswitch-enum \ -Wfloat-equal -Wchar-subscripts -Winline -Wsign-compare \ -Wnested-externs -Wredundant-decls -Wconversion -Wlogical-op \ -Wno-declaration-after-statement -Wmissing-prototypes \ -Wmissing-declarations -Wstrict-prototypes if CDW_BUILD_DEBUG_ENABLED AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -g -O0 $(CDW_BUILD_CFLAGS_WARNINGS) $(CDW_BUILD_CFLAGS_PEDANTIC) else AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) -DNDEBUG AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -O2 endif # used by flymake check-syntax: $(CC) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(AM_CFLAGS) -fsyntax-only $(CHK_SOURCES) .PHONY: check-syntaxcdw-0.7.1/README0000644000175000017500000001213011735413042010072 00000000000000cdw is a front-end for some command-line tools used for burning data CD and DVD discs and for related tasks. The tools are: cdrecord/wodim, mkisofs/genisoimage, growisofs, dvd+rw-mediainfo, dvd+rw-format, xorriso. You can also use cdw to rip tracks from your audio CD to raw audio files. Limited support for copying content of data CD and DVD discs to image files is also provided. cdw can verify correctness of writing ISO9660 image to CD or DVD disc using md5sum or some of shaXsum programs (if installed on target machine). cdw uses ncurses library to build user interface and it can be used in UNIX terminal window and in terminal emulator (like konsole, xterm, rxvt or gnome-console) in X Window environment. cdw is developed and tested on my Debian GNU/Linux x64 machine. Basic tests on i386 machine (Debian) are also performed. The program automatically creates ~/.cdw/cdw.conf in your home directory. This distribution package contains a sample configuration file: cdw.conf. cdw also creates log file, default location is in ~/.cdw/ directory, but you can change this in cdw configuration window. Web pages --------- http://cdw.sourceforge.net/ http://sourceforge.net/projects/cdw/ Requirements --------------------- cdw 0.7.1 was tested on machines running Debian: 64-bit Debian GNU/Linux wheezy/sid with following software/hardware: - UNIX terminal, at least 80x24 chars - libc library: eglibc (Embedded GNU C Library), 2.13-27 - ncurses library with support for wide characters: ncursesw5, 5.9-4 - cdio library: multi platform library for accessing your CD hardware, libcdio10, 0.81-5 - iso9660 library from cdio project: libiso9660-7, 0.81-5 - burn library from libburnia project: libburn4, 1.2.0-1 - recent versions of mkisofs/genisoimage, cdrecord/wodim, dvd+rw-tools, xorriso (the tools aren't absolutely required in order to run cdw, but are needed to do anything useful with cdw) - md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum: used to verify ISO images written to CD and DVD - properly configured cd/dvd writer - linux kernel 3.1.8 32-bit Debian GNU/Linux wheezy/sid with following software/hardware: - UNIX terminal, at least 80x24 chars - libc library: eglibc (Embedded GNU C Library), 2.13-27 - ncurses library with support for wide characters: ncursesw5, 5.9-5 - cdio library: multi platform library for accessing your CD hardware, libcdio10, 0.81-5 - iso9660 library from cdio project: libiso9660-7, 0.81-5 - burn library from libburnia project: libburn4, 1.2.0-1 - recent versions of mkisofs/genisoimage, cdrecord/wodim, dvd+rw-tools, xorriso (the tools aren't absolutely required in order to run cdw, but are needed to do anything useful with cdw) - md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum: used to verify ISO images written to CD and DVD - properly configured cd/dvd writer - linux kernel 3.2.0 Install ------- Copy cdw-0.7.1.tar.gz to your source directory, such as /usr/local/src and 'untar' the archive. Compile and install. It goes like this: tar -xzf cdw-0.7.1.tar.gz cd ./cdw-0.7.1 ./configure make make install "./configure" script accepts "--enable-debug" flag, which enables debug messages printing some debug information (INFOs, WARNINGs and ERRORs) to stderr. You want to use this flag only if you want to hack cdw. "make" recognizes "check" target - this executes some unit tests for basic functions used by cdw. For generic information on installation see INSTALL file in main directory of this package. Program parameters ------------------ cdw accept the following parameters: -v | --version : display the version number of cdw -h | --help : display help --enable-dvd-rp-dl : enable support for DVD+R DL (buggy, with dvd+rw-tools only) --escdelay=X : modify ESC key delay period; 'X' is non-negative time in milliseconds Usage ----- Please refer to cdw man page for usage instructions. You can find man page in man directory. If cdw is already installed on your system, just type man cdw in your command line. Credits ------- Check AUTHORS file in main directory of this package for list of people who are or were authors of this software. Check THANKS file in main directory of this package for list of people who have contributed to this software in other ways. This project uses files from gnulib package (from version licensed under "GPL2 or later"). See cdw/gnulib dir for list of files. src/optical_file_systems/iso9660.h: J. Schilling (cdrecord) src/optical_file_systems/isosize.c: J. Schilling & Jonas Munsin (cdrecord) Original thread code (now found in src/external_tools/cdw_thread.c): Sharad Mittal (CDrecorder) News ---- Check NEWS file in main directory of this package for most recent news. GTK GUI ------- Older versions of cdw had GTK interface, that could be enabled on compile time. cdw no longer provides this option. ncurses interface is the only user interface available. Hacking ------- If you are interested in hacking cdw you may want to start with these files: TO BE DONE Contact, bug reports -------------------- Kamil Ignacak, acerion@wp.pl http://cdw.sourceforge.net 1.04.2012 cdw-0.7.1/gnulib/0000755000175000017500000000000011736031301010550 500000000000000cdw-0.7.1/gnulib/Makefile.in0000644000175000017500000003741711722443564012566 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = gnulib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = lib all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gnulib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gnulib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic ctags \ ctags-recursive distclean distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/gnulib/lib/0000755000175000017500000000000011736031301011316 500000000000000cdw-0.7.1/gnulib/lib/Makefile.in0000644000175000017500000004047511722443564013332 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.cdw.am subdir = gnulib/lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libgnulib_a_AR = $(AR) $(ARFLAGS) libgnulib_a_LIBADD = am_libgnulib_a_OBJECTS = canonicalize.$(OBJEXT) cycle-check.$(OBJEXT) \ filenamecat.$(OBJEXT) xreadlink.$(OBJEXT) libgnulib_a_OBJECTS = $(am_libgnulib_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libgnulib_a_SOURCES) DIST_SOURCES = $(libgnulib_a_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ METASOURCES = AUTO # _FILE_OFFSET_BITS=64 - large file support (>2GB on 32-bit systems); # this is unnecessary on 64-bit systems, but I had to add this # after doing some basic tests on i386 machine; see sourceforge # #2545568 defect for details; # # This is aso required by libburn - see information on top of # /usr/include/libburn/libburn.h # "include" files of convenience libraries # don't use $(top_builddir), it fails during "make distcheck" CDW_BUILD_CPPFLAGS = -D _FILE_OFFSET_BITS=64 -I$(top_srcdir)/src/ \ -I$(top_srcdir)/src/external_tools/ -I$(top_srcdir)/src/tasks/ \ -I$(top_srcdir)/src/utilities/ \ -I$(top_srcdir)/src/user_interface/widgets/ \ -I$(top_srcdir)/src/user_interface/ \ -I$(top_srcdir)/src/configuration/ \ -I$(top_srcdir)/src/native_file_system/ \ -I$(top_srcdir)/src/optical_file_systems/ \ -I$(top_srcdir)/src/disc_and_drive/ \ -I$(top_srcdir)/gnulib/lib/ # quoted descriptions of flags come from # http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html # using C99 standard + gnu extensions; I don't use pure c99, because # it may trigger problems caused by asm/byteorder.h, which is included # by linux/cdrom.h header, which in turn is included by cdw_drive.h CDW_BUILD_CFLAGS_C_STD = -std=gnu99 CDW_BUILD_CFLAGS_PEDANTIC = -pedantic # "Check calls to printf and scanf, etc., to make sure that the arguments # supplied have types appropriate to the format string specified..." # "If -Wformat is specified, also warn about uses of format functions that # represent possible security problems..." # "If -Wformat is specified, also warn if the format string is not # a string literal..." # "These warnings will help you find at compile time code that can try # to write into a string constant..." # "Warn about anything that depends on the “size of” a function type or # of void...." # "Warn whenever a switch statement does not have a default case" # sometimes gcc can complain about unreachable code when using constant # strings like that: strcmp(some_string, "some string"); # "Warn whenever a pointer is cast such that the required alignment of # the target is increased..." # "Warn whenever a pointer is cast so as to remove a type qualifier from # the target type..." # "Warn whenever a function call is cast to a non-matching type..." CDW_BUILD_CFLAGS_WARNINGS = -Wformat -Wformat-security \ -Wformat-nonliteral -Wwrite-strings -Wpointer-arith \ -Wswitch-default -Wunreachable-code -Wcast-align -Wcast-qual \ -Wbad-function-cast -Wall -Wshadow -Wextra -Wswitch-enum \ -Wfloat-equal -Wchar-subscripts -Winline -Wsign-compare \ -Wnested-externs -Wredundant-decls -Wconversion -Wlogical-op \ -Wno-declaration-after-statement -Wmissing-prototypes \ -Wmissing-declarations -Wstrict-prototypes @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) -DNDEBUG @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -O2 @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -g -O0 $(CDW_BUILD_CFLAGS_WARNINGS) $(CDW_BUILD_CFLAGS_PEDANTIC) # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake; # don't use $(top_builddir), it fails during "make distcheck" # static convenience library noinst_LIBRARIES = libgnulib.a libgnulib_a_SOURCES = canonicalize.c cycle-check.c filenamecat.c xreadlink.c \ canonicalize.h cycle-check.h dev-ino.h filenamecat.h pathmax.h \ same-inode.h xreadlink.h dirname.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.cdw.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gnulib/lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gnulib/lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.cdw.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libgnulib.a: $(libgnulib_a_OBJECTS) $(libgnulib_a_DEPENDENCIES) $(EXTRA_libgnulib_a_DEPENDENCIES) -rm -f libgnulib.a $(libgnulib_a_AR) libgnulib.a $(libgnulib_a_OBJECTS) $(libgnulib_a_LIBADD) $(RANLIB) libgnulib.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cycle-check.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filenamecat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xreadlink.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am # used by flymake check-syntax: $(CC) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(AM_CFLAGS) -fsyntax-only $(CHK_SOURCES) .PHONY: check-syntax # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/gnulib/lib/dev-ino.h0000644000175000017500000000022411370334335012755 00000000000000#ifndef DEV_INO_H # define DEV_INO_H 1 # include # include struct dev_ino { ino_t st_ino; dev_t st_dev; }; #endif cdw-0.7.1/gnulib/lib/canonicalize.h0000644000175000017500000000372411370334335014063 00000000000000/* Return the canonical absolute name of a given file. Copyright (C) 1996-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CANONICALIZE_H_ # define CANONICALIZE_H_ #include "config.h" # if GNULIB_CANONICALIZE enum canonicalize_mode_t { /* All components must exist. */ CAN_EXISTING = 0, /* All components excluding last one must exist. */ CAN_ALL_BUT_LAST = 1, /* No requirements on components existence. */ CAN_MISSING = 2 }; typedef enum canonicalize_mode_t canonicalize_mode_t; /* Return a malloc'd string containing the canonical absolute name of the named file. This acts like canonicalize_file_name, except that whether components must exist depends on the canonicalize_mode_t argument. */ char *canonicalize_filename_mode (const char *, canonicalize_mode_t); # endif # if HAVE_CANONICALIZE_FILE_NAME # include # else /* Return a malloc'd string containing the canonical absolute name of the named file. If any file name component does not exist or is a symlink to a nonexistent file, return NULL. A canonical name does not contain any `.', `..' components nor any repeated file name separators ('/') or symlinks. */ char *canonicalize_file_name (const char *); # endif #endif /* !CANONICALIZE_H_ */ cdw-0.7.1/gnulib/lib/pathmax.h0000644000175000017500000000270011370334335013057 00000000000000/* Define PATH_MAX somehow. Requires sys/types.h. Copyright (C) 1992, 1999, 2001, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _PATHMAX_H # define _PATHMAX_H # include # include # ifndef _POSIX_PATH_MAX # define _POSIX_PATH_MAX 256 # endif # if !defined PATH_MAX && defined _PC_PATH_MAX # define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \ : pathconf ("/", _PC_PATH_MAX)) # endif /* Don't include sys/param.h if it already has been. */ # if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN # include # endif # if !defined PATH_MAX && defined MAXPATHLEN # define PATH_MAX MAXPATHLEN # endif # ifndef PATH_MAX # define PATH_MAX _POSIX_PATH_MAX # endif #endif /* _PATHMAX_H */ cdw-0.7.1/gnulib/lib/xreadlink.h0000644000175000017500000000170511370334335013402 00000000000000/* readlink wrapper to return the link name in malloc'd storage Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #include char *xreadlink (char const *, size_t); cdw-0.7.1/gnulib/lib/cycle-check.h0000644000175000017500000000323011370334335013566 00000000000000/* help detect directory cycles efficiently Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #ifndef CYCLE_CHECK_H # define CYCLE_CHECK_H 1 # include # include # include "dev-ino.h" # include "same-inode.h" struct cycle_check_state { struct dev_ino dev_ino; uintmax_t chdir_counter; int magic; }; void cycle_check_init (struct cycle_check_state *state); bool cycle_check (struct cycle_check_state *state, struct stat const *sb); # define CYCLE_CHECK_REFLECT_CHDIR_UP(State, SB_dir, SB_subdir) \ do \ { \ /* You must call cycle_check at least once before using this macro. */ \ if ((State)->chdir_counter == 0) \ abort (); \ if (SAME_INODE ((State)->dev_ino, SB_subdir)) \ { \ (State)->dev_ino.st_dev = (SB_dir).st_dev; \ (State)->dev_ino.st_ino = (SB_dir).st_ino; \ } \ } \ while (0) #endif cdw-0.7.1/gnulib/lib/cycle-check.c0000644000175000017500000000526211370334335013570 00000000000000/* help detect directory cycles efficiently Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #include #include #include #include #include #include #include #include "cycle-check.h" #define CC_MAGIC 9827862 /* Return true if I is a power of 2, or is zero. */ static inline bool is_zero_or_power_of_two (uintmax_t i) { return (i & (i - 1)) == 0; } void cycle_check_init (struct cycle_check_state *state) { state->chdir_counter = 0; state->magic = CC_MAGIC; } /* In traversing a directory hierarchy, call this function once for each descending chdir call, with SB corresponding to the chdir operand. If SB corresponds to a directory that has already been seen, return true to indicate that there is a directory cycle. Note that this is done `lazily', which means that some of the directories in the cycle may be processed twice before the cycle is detected. */ bool cycle_check (struct cycle_check_state *state, struct stat const *sb) { assert (state->magic == CC_MAGIC); /* If the current directory ever happens to be the same as the one we last recorded for the cycle detection, then it's obviously part of a cycle. */ if (state->chdir_counter && SAME_INODE (*sb, state->dev_ino)) return true; /* If the number of `descending' chdir calls is a power of two, record the dev/ino of the current directory. */ if (is_zero_or_power_of_two (++(state->chdir_counter))) { /* On all architectures that we know about, if the counter overflows then there is a directory cycle here somewhere, even if we haven't detected it yet. Typically this happens only after the counter is incremented 2**64 times, so it's a fairly theoretical point. */ if (state->chdir_counter == 0) return true; state->dev_ino.st_dev = sb->st_dev; state->dev_ino.st_ino = sb->st_ino; } return false; } cdw-0.7.1/gnulib/lib/dirname.h0000644000175000017500000000437111370334335013042 00000000000000/* Take file names apart into directory and base names. Copyright (C) 1998, 2001, 2003-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 # include # include # ifndef DIRECTORY_SEPARATOR # define DIRECTORY_SEPARATOR '/' # endif # ifndef ISSLASH # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) # endif # ifndef FILE_SYSTEM_PREFIX_LEN # if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX /* This internal macro assumes ASCII, but all hosts that support drive letters use ASCII. */ # define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \ <= 'z' - 'a') # define FILE_SYSTEM_PREFIX_LEN(Filename) \ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) # else # define FILE_SYSTEM_PREFIX_LEN(Filename) 0 # endif # endif # ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 # endif # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 # endif # if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE # define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) # else # define IS_ABSOLUTE_FILE_NAME(F) \ (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F)) # endif # define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) char *base_name (char const *file); char *dir_name (char const *file); size_t base_len (char const *file); size_t dir_len (char const *file); char *last_component (char const *file); bool strip_trailing_slashes (char *file); #endif /* not DIRNAME_H_ */ cdw-0.7.1/gnulib/lib/same-inode.h0000644000175000017500000000177511370334335013451 00000000000000/* Determine whether two stat buffers refer to the same file. Copyright (C) 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SAME_INODE_H # define SAME_INODE_H 1 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \ ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \ && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev) #endif cdw-0.7.1/gnulib/lib/filenamecat.h0000644000175000017500000000165111370334335013671 00000000000000/* Concatenate two arbitrary file names. Copyright (C) 1996, 1997, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering. */ char *file_name_concat (char const *dir, char const *base, char **base_in_result); cdw-0.7.1/gnulib/lib/Makefile.am0000644000175000017500000000067711374603102013306 00000000000000METASOURCES = AUTO # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake; # don't use $(top_builddir), it fails during "make distcheck" include $(top_srcdir)/Makefile.cdw.am # static convenience library noinst_LIBRARIES = libgnulib.a libgnulib_a_SOURCES = canonicalize.c cycle-check.c filenamecat.c xreadlink.c \ canonicalize.h cycle-check.h dev-ino.h filenamecat.h pathmax.h \ same-inode.h xreadlink.h dirname.h cdw-0.7.1/gnulib/lib/canonicalize.c0000644000175000017500000001713511370334335014057 00000000000000/* Return the canonical absolute name of a given file. Copyright (C) 1996-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #define _GNU_SOURCE #include #include "canonicalize.h" #include #include #include #if HAVE_SYS_PARAM_H # include #endif #include #include #include #include #include "cycle-check.h" #include "filenamecat.h" #ifndef ELOOP # define ELOOP 0 #endif #ifndef __set_errno # define __set_errno(Val) errno = (Val) #endif #include "pathmax.h" #include "xreadlink.h" #if !HAVE_CANONICALIZE_FILE_NAME /* Return the canonical absolute name of file NAME. A canonical name does not contain any `.', `..' components nor any repeated file name separators ('/') or symlinks. All components must exist. The result is malloc'd. */ char * canonicalize_file_name (const char *name) { # if HAVE_RESOLVEPATH char *resolved, *extra_buf = NULL; size_t resolved_size; ssize_t resolved_len; if (name == NULL) { __set_errno (EINVAL); return NULL; } if (name[0] == '\0') { __set_errno (ENOENT); return NULL; } /* All known hosts with resolvepath (e.g. Solaris 7) don't turn relative names into absolute ones, so prepend the working directory if the file name is not absolute. */ if (name[0] != '/') { char *wd; if (!(wd = get_current_dir_name ())) return NULL; extra_buf = file_name_concat (wd, name, NULL); name = extra_buf; free (wd); } resolved_size = strlen (name); while (1) { resolved_size = 2 * resolved_size + 1; resolved = malloc (resolved_size); if (resolved == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to allocate \"resolved\"\n", __FUNCTION__); free (resolved); free (extra_buf); return NULL; } resolved_len = resolvepath (name, resolved, resolved_size); if (resolved_len < 0) { free (resolved); free (extra_buf); return NULL; } if (resolved_len < resolved_size) break; free (resolved); } free (extra_buf); /* NUL-terminate the resulting name. */ resolved[resolved_len] = '\0'; return resolved; # else return canonicalize_filename_mode (name, CAN_EXISTING); # endif /* !HAVE_RESOLVEPATH */ } #endif /* !HAVE_CANONICALIZE_FILE_NAME */ /* Return the canonical absolute name of file NAME. A canonical name does not contain any `.', `..' components nor any repeated file name separators ('/') or symlinks. Whether components must exist or not depends on canonicalize mode. The result is malloc'd. */ char * canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode) { char *rname, *dest, *extra_buf = NULL; char const *start; char const *end; char const *rname_limit; size_t extra_len = 0; struct cycle_check_state cycle_state; if (name == NULL) { __set_errno (EINVAL); return NULL; } if (name[0] == '\0') { __set_errno (ENOENT); return NULL; } if (name[0] != '/') { rname = get_current_dir_name (); if (!rname) return NULL; dest = strchr (rname, '\0'); if (dest - rname < PATH_MAX) { char *p = realloc (rname, PATH_MAX); if (p == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to reallocate \"rname\"\n", __FUNCTION__); goto error; } dest = p + (dest - rname); rname = p; rname_limit = rname + PATH_MAX; } else { rname_limit = dest; } } else { rname = malloc (PATH_MAX); if (rname == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to allocate \"rname\"\n", __FUNCTION__); goto error; } rname_limit = rname + PATH_MAX; rname[0] = '/'; dest = rname + 1; } cycle_check_init (&cycle_state); for (start = end = name; *start; start = end) { /* Skip sequence of multiple file name separators. */ while (*start == '/') ++start; /* Find end of component. */ for (end = start; *end && *end != '/'; ++end) /* Nothing. */; if (end - start == 0) break; else if (end - start == 1 && start[0] == '.') /* nothing */; else if (end - start == 2 && start[0] == '.' && start[1] == '.') { /* Back up to previous component, ignore if at root already. */ if (dest > rname + 1) while ((--dest)[-1] != '/'); } else { struct stat st; if (dest[-1] != '/') *dest++ = '/'; if (dest + (end - start) >= rname_limit) { ptrdiff_t dest_offset = dest - rname; size_t new_size = rname_limit - rname; if (end - start + 1 > PATH_MAX) new_size += end - start + 1; else new_size += PATH_MAX; rname = realloc (rname, new_size); if (rname == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to reallocate \"rname\"\n", __FUNCTION__); goto error; } rname_limit = rname + new_size; dest = rname + dest_offset; } dest = memcpy (dest, start, end - start); dest += end - start; *dest = '\0'; if (lstat (rname, &st) != 0) { if (can_mode == CAN_EXISTING) goto error; if (can_mode == CAN_ALL_BUT_LAST && *end) goto error; st.st_mode = 0; } if (S_ISLNK (st.st_mode)) { char *buf; size_t n, len; if (cycle_check (&cycle_state, &st)) { __set_errno (ELOOP); if (can_mode == CAN_MISSING) continue; else goto error; } buf = xreadlink (rname, st.st_size); if (!buf) { if (can_mode == CAN_MISSING) continue; else goto error; } n = strlen (buf); len = strlen (end); if (!extra_len) { extra_len = ((n + len + 1) > PATH_MAX) ? (n + len + 1) : PATH_MAX; extra_buf = malloc (extra_len); if (extra_buf == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to allocate \"extra_buf\"\n", __FUNCTION__); goto error; } } else if ((n + len + 1) > extra_len) { extra_len = n + len + 1; extra_buf = realloc (extra_buf, extra_len); if (extra_buf == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to reallocate \"extra_buf\"\n", __FUNCTION__); goto error; } } /* Careful here, end may be a pointer into extra_buf... */ memmove (&extra_buf[n], end, len + 1); name = end = memcpy (extra_buf, buf, n); if (buf[0] == '/') dest = rname + 1; /* It's an absolute symlink */ else /* Back up to previous component, ignore if at root already: */ if (dest > rname + 1) while ((--dest)[-1] != '/'); free (buf); } else { if (!S_ISDIR (st.st_mode) && *end && (can_mode != CAN_MISSING)) { errno = ENOTDIR; goto error; } } } } if (dest > rname + 1 && dest[-1] == '/') --dest; *dest = '\0'; free (extra_buf); return rname; error: free (extra_buf); free (rname); return NULL; } cdw-0.7.1/gnulib/lib/xreadlink.c0000644000175000017500000000632711370334335013402 00000000000000/* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering */ #include #include "xreadlink.h" #include #include #include #include #include #include #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif #ifndef SSIZE_MAX # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif /* SYMLINK_MAX is used only for an initial memory-allocation sanity check, so it's OK to guess too small on hosts where there is no arbitrary limit to symbolic link length. */ #ifndef SYMLINK_MAX # define SYMLINK_MAX 1024 #endif #define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX) /* Call readlink to get the symbolic link value of FILE. SIZE is a hint as to how long the link is expected to be; typically it is taken from st_size. It need not be correct. Return a pointer to that NUL-terminated string in malloc'd storage. If readlink fails, return NULL (caller may use errno to diagnose). If malloc fails, or if the link value is longer than SSIZE_MAX :-), give a diagnostic and exit. */ char * xreadlink (char const *file, size_t size) { /* Some buggy file systems report garbage in st_size. Defend against them by ignoring outlandish st_size values in the initial memory allocation. */ size_t symlink_max = SYMLINK_MAX; size_t INITIAL_LIMIT_BOUND = 8 * 1024; size_t initial_limit = (symlink_max < INITIAL_LIMIT_BOUND ? symlink_max + 1 : INITIAL_LIMIT_BOUND); /* The initial buffer size for the link value. */ size_t buf_size = size < initial_limit ? size + 1 : initial_limit; while (1) { char *buffer = malloc (buf_size); if (buffer == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to allocate \"buffer\"\n", __FUNCTION__); return NULL; } ssize_t r = readlink (file, buffer, buf_size); size_t link_length = r; /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 with errno == ERANGE if the buffer is too small. */ if (r < 0 && errno != ERANGE) { int saved_errno = errno; free (buffer); errno = saved_errno; return NULL; } if (link_length < buf_size) { buffer[link_length] = 0; return buffer; } free (buffer); if (buf_size <= MAXSIZE / 2) buf_size *= 2; else if (buf_size < MAXSIZE) buf_size = MAXSIZE; else return NULL; } } cdw-0.7.1/gnulib/lib/filenamecat.c0000644000175000017500000000760011370334335013664 00000000000000/* Concatenate two arbitrary file names. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Jim Meyering. */ #define _GNU_SOURCE /* mempcpy() */ #include #include #include /* Specification. */ #include "filenamecat.h" #include #include "dirname.h" #if ! HAVE_MEMPCPY && ! defined mempcpy # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N))) #endif /* Return the longest suffix of F that is a relative file name. If it has no such suffix, return the empty string. */ static char const * longest_relative_suffix (char const *f) { for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++) continue; return f; } /* Concatenate two file name components, DIR and ABASE, in newly-allocated storage and return the result. The resulting file name F is such that the commands "ls F" and "(cd DIR; ls BASE)" refer to the same file, where BASE is ABASE with any file system prefixes and leading separators removed. Arrange for a directory separator if necessary between DIR and BASE in the result, removing any redundant separators. In any case, if BASE_IN_RESULT is non-NULL, set *BASE_IN_RESULT to point to the copy of ABASE in the returned concatenation. However, if ABASE begins with more than one slash, set *BASE_IN_RESULT to point to the sole corresponding slash that is copied into the result buffer. Report an error if memory is exhausted. */ char * file_name_concat (char const *dir, char const *abase, char **base_in_result) { char const *dirbase = last_component (dir); size_t dirbaselen = base_len (dirbase); size_t dirlen = dirbase - dir + dirbaselen; size_t needs_separator = (dirbaselen && ! ISSLASH (dirbase[dirbaselen - 1])); char const *base = longest_relative_suffix (abase); size_t baselen = strlen (base); char *p_concat = malloc (dirlen + needs_separator + baselen + 1); if (p_concat == (char *) NULL) { fprintf(stderr, "ERROR: %s(): failed to allocate \"p_concat\"\n", __FUNCTION__); return NULL; } char *p; p = mempcpy (p_concat, dir, dirlen); *p = DIRECTORY_SEPARATOR; p += needs_separator; if (base_in_result) *base_in_result = p - IS_ABSOLUTE_FILE_NAME (abase); p = mempcpy (p, base, baselen); *p = '\0'; return p_concat; } #ifdef TEST_FILE_NAME_CONCAT # include # include int main () { static char const *const tests[][3] = { {"a", "b", "a/b"}, {"a/", "b", "a/b"}, {"a/", "/b", "a/b"}, {"a", "/b", "a/b"}, {"/", "b", "/b"}, {"/", "/b", "/b"}, {"/", "/", "/"}, {"a", "/", "a/"}, /* this might deserve a diagnostic */ {"/a", "/", "/a/"}, /* this might deserve a diagnostic */ {"a", "//b", "a/b"}, }; size_t i; bool fail = false; for (i = 0; i < sizeof tests / sizeof tests[0]; i++) { char *base_in_result; char const *const *t = tests[i]; char *res = file_name_concat (t[0], t[1], &base_in_result); if (strcmp (res, t[2]) != 0) { printf ("got %s, expected %s\n", res, t[2]); fail = true; } } exit (fail ? EXIT_FAILURE : EXIT_SUCCESS); } #endif cdw-0.7.1/gnulib/Makefile.am0000644000175000017500000000001611370334177012534 00000000000000SUBDIRS = lib cdw-0.7.1/cdw.colors0000644000175000017500000000125711727155100011221 00000000000000# Main window Color1_fore = WHITE Color1_bg = BLACK # Dialog Color2_fore = WHITE Color2_bg = BLUE # Title Color3_fore = RED Color3_bg = BLACK # Menu Color4_fore = WHITE Color4_bg = BLACK # Progress bar Color5_fore = YELLOW Color5_bg = BLACK # input field Color6_fore = WHITE Color6_bg = BLACK # Warning Color7_fore = BLACK Color7_bg = YELLOW # was: size info Color8_fore = YELLOW Color8_bg = WHITE # Disables Color9_fore = BLACK Color9_bg = WHITE # Not used Color10_fore = YELLOW Color10_bg = WHITE # Tooltips Color11_fore = YELLOW Color11_bg = BLACK # Text area Color12_fore = WHITE Color12_bg = BLACK # Error Color13_fore = BLACK Color13_bg = RED cdw-0.7.1/aclocal.m40000644000175000017500000010653711722443563011100 00000000000000# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR cdw-0.7.1/man/0000755000175000017500000000000011736031303010045 500000000000000cdw-0.7.1/man/Makefile.in0000644000175000017500000003175011722443564012053 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ src_MANS = cdw.t2t man_MANS = cdw.1 # cdw.1 file may not get built (e.g. because there is no txt2tags # installed), but it needs to be distributed EXTRA_DIST = $(man_MANS) $(src_MANS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-man uninstall-man1 # each line of shell script in Makefile will be treated as separate # shell command; a workaround for this is either put whole "if/then/fi" # in one line, or add ";" and "\" in proper places of script; # "@" tells "make" to not to print the script to stdout during execution; # http://forums.fedoraforum.org/showthread.php?t=87434 cdw.1: $(src_MANS) @if test "x$(TXT2TAGS)" = "x"; then \ echo "txt2tags program not found on target system, not compiling man page"; \ else \ $(TXT2TAGS) -o - $(src_MANS) > $(man_MANS); \ fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/man/cdw.10000644000175000017500000004727411735413145010651 00000000000000.TH "cdw 0.7.1" 1 "1 April 2012" "" .SH NAME .P cdw \- front\-end for cdrecord, mkisofs, growisofs and other tools .SH SYNOPSIS .P cdw [\-\-help] [\-\-version] [\-\-enable\-dvd\-rp\-dl] [\-\-escdelay=X] .SH DESCRIPTION .P cdw is a front\-end for command\-line tools used for burning data CD and DVD discs and for related tasks. The tools are: cdrecord/wodim, mkisofs/genisoimage, growisofs, dvd+rw\-mediainfo, dvd+rw\-format, xorriso. You can also use cdw to rip tracks from your audio CD to raw audio files. Limited support for copying content of CD and DVD discs to image files is also provided. cdw can utilize md5sum program to verify correctness of writing ISO image to CD and DVD disc. .P cdw uses ncurses library to build user\-friendly interface and it can be used in UNIX terminal window and in terminal emulator (like konsole, rxvt or gnome\-console) in X environment. .P cdw supports only ISO9660 filesystem for optical media. Other filesystem for optical media are not supported nor recognized. .SH SUPPORTED MEDIA .P Scope of supported features depends on which tools are installed on end user's system. Full list of supported media and actions is listed below. .TP CD\-AUDIO ripping audio tracks to raw audio files .TP CD\-R writing files and ISO images (single\- and multi\-session) with cdrecord/wodim and xorriso; copying content of first session to image file on your hard disc .TP CD\-RW writing files and ISO images (single\- and multi\-session), erasing (erasing only TOC or blanking whole disc) with cdrecord/wodim and xorriso; copying content of first session to image file on your hard disc .TP DVD\-R, DVD+R writing files and ISO images (multi\-session, but without closing disc, or single\-session) with cdrecord/wodim, dvd+rw\-tools and xorriso .TP DVD\-RW writing files and ISO images (multi\-session or single\-session); erasing, formatting \- quick or slow (full) method; dvd+rw\-tools only. \fBWARNING\fR: multiple blanking may quickly render your DVD\-RW unusable. .TP DVD+RW writing files and ISO images (both writing to disc from scratch and appending data), without closing disc; blanking disc, but takes lots of time, and you don't need to do it anyway \- you can always start writing to the same disc like you would write to blank disc. DVD+RW can be handled by both cdrecord/wodim and dvd+rw\-tools. .TP DVD+R DL there is now partial support for DVD+R DL discs: cdw can burn ISO image and files in single session. User has to explicitly enable it by passing "\-\-enable\-dvd\-rp\-dl" command line argument to cdw; cdw can handle DVD+R DL discs only using dvd+rw\-tools; this feature is very incomplete and possibly buggy. Dual\-layer media other than DVD+R DL are not yet supported. DVD\-RAM, Blu\-ray, HD\-DVD discs are not supported. .SH MANUAL .P You can write data discs either by using previously created ISO image file, or by selecting files from hard drive and writing them directly to disc. cdw provides UI elements for both actions. .P First action before creating new ISO image or writing files to disc is selecting files from your hard drive. You can do this by selecting "Add files" in left\-hand menu. You will be presented with simple file selector. Use Up/Down arrows or Page Up/Page Down keys to move, Enter key to change current directory, Space key to select files or directories. Selected items will be added to list displayed in cdw window. Use Escape key to close file selector window. The selector window shows you all files and directories (including hidden files) in current directory, in alphabetical order. You will see file size information for every file on the list. You can also delete previously selected files from list: select "Delete files" from the menu and use Up/Down arrow keys to move and Delete key to delete highlighted item. Use Escape key when you finish deleting files from list of selected files. .P Now you can select "Create image" from left\-hand menu. cdw will display a wizard window where you can change most common options, and where you can select path to target ISO9660 image file on your hard disc. .P You can also select "Write files to disc" to write selected files to optical disc. If you select the option, cdw will display a wizard dialog window, in which you can adjust most common options related to burning files to disc. .P If you want to write ISO image file to optical disc, use "Write image to disc" option in left hand menu. You will be presented with file picker dialog that allows you to select existing ISO image file from your hard disc. After that cdw will display a wizard window, where you can modify most common options available for burning a disc. .P cdw allows you to verify correctness of this operation by checking a digest (e.g. md5 sum) of ISO file and of track written to disc. You can request this by checking "Verify write" checkbox that will appear in write wizard. Please note that this checkbox is visible only when you are writing ISO file to empty CD or DVD disc. This function is still experimental. Make sure that a program for calculating digests is installed on your machine. cdw supports following programs: md5sum sha1sum sha224sum sha256sum sha384sum sha512sum .P Another operation you can perform is erasing optical disc \- CD\-RW, DVD\-RW (both Sequential Recording and Restricted Overwrite) or DVD+RW. You can do this by selecting "Erase disc" option in cdw left\-hand menu. Please note that extensive erasing of DVD\-RW may render your disc unusable if used extensively. In case of CD\-RW and DVD\-RW you will be asked what type of blanking you want to perform. You can choose fast mode or full mode. First one doesn't take too much time (in case of CD\-RW it only erases table of content of your disc), second one can be very time\-consuming, depending on disc size and selected speed. .P When you will attempt to blank DVD\-RW disc, blanking wizard will display dropdown that allows you to choose mode (format) of DVD\-RW disc: Restricted Overwrite or Sequential Recording. .P cdw can be useful when you want to copy your data CD or DVD to ISO image on your hard drive. You do this by selecting "Read disc" option from left\-hand menu. This function allows you to copy first track from your data CD or DVD. Reading second and following tracks from data discs, and reading discs written in mixed mode (one or more data tracks + audio tracks) discs are not supported. .P You can also use cdw to copy your audio CD to separate files (each track will be written to separate file). You do this by selecting "Read disc" option from menu. cdw can't convert audio tracks to any popular audio format. The tracks are written to files in the same format as they appear on CD (2 channels, 44100 samples per second, 16 bit signed PCM, little endian (intel)). The file names have following name format: track_xx.raw (where xx is track number). You can convert raw track file to wav file using e.g. sox command: .P \fBsox \-c 2 \-r 44100 \-L \-2 \-s track_name.raw \-t wav track_name.wav\fR .P The last operation that cdw offers is verification of data. You can use it for two purposes: .RS .IP \(bu 3 calculating a digest of selected file from hard disc; .IP \(bu 3 comparing selected file with content of first track on optical disc; The second option also utilizes digest tool (e.g. md5sum), but may not work correctly, so it is marked in cdw as "Experimental". .RE .P cdw has Configuration window, accessed by selecting "Configuration" item in left\-hand menu. The window allows you to set up some options for tools used by cdw, and for cdw itself. Configuration window has following tabs (you can access them using keys F2\-F5): .RS .IP \(bu 3 Log and misc \- contains options related to log file in which cdw logs its operations, and to some aspects of behavior of cdw. .IP \(bu 3 Tools \- options in this tab allow you to select tools from your operating system that will be used to create ISO9660 images, burn data to disc etc. You can safely leave "Configure tools manually" checkbox unmarked. .IP \(bu 3 Audio \- contains options related to ripping audio CDs. .IP \(bu 3 Hardware \- probably will be visited only once, when you use cdw for the first time or when you change your hardware configuration. Here you can set paths to your devices used by cdw. .RE .P All options available in Configuration window are described below, in CONFIGURATION section. .P You have to use F9 or F10 key to save any changes made in Configuration window and close the window. To close Configuration window without saving changes use Escape key. Values from "Tools" tab are saved only temporarily, they aren't stored in permanent configuration file. .P You can control cdw using application's menu (visible on left side of screen), or using hotkeys. .SS Main menu items .RS .IP \(bu 3 Add files: Select files and directories that you want to write to optical disc or to ISO image on your hard disc. Press Space to select a file or directory, use Up and Down arrows to move on the list, press Enter key to change directory, press Escape key to close file selection dialog. .IP \(bu 3 Delete files: List of selected files is displayed on the right side of the screen. If you want to delete files from the list, select this button and use Delete key to delete a file, Up and Down arrows to move on the list or press Escape to end deleting. .IP \(bu 3 Write files to disc: write selected files to optical disc that is currently in drive. You will be warned if there is no disc in drive, the drive is not ready or the disc is mounted. .IP \(bu 3 Create image: write selected files to ISO image file. The ISO image file can be selected in file picker window. .IP \(bu 3 Write image to disc: write ISO image file to optical disc. The ISO image file can be selected in file picker window. You will be warned if there is no disc in drive, the drive is not ready or the disc is mounted. .IP \(bu 3 Read disc: Copy content of your single session data CD/DVD or audio CD to files on hard drive. In case of data CD/DVD discs cdw will create correct image file on your hard disc, but only for first track on disc, rest of tracks won't be read (cdw can't read them correctly). In case of audio CDs cdw will copy each audio track to separate raw audio file. You will have to recode the raw audio track files in order to play them in your media player. .IP \(bu 3 Erase disc: Erase data (partially or fully) from rewritable disc (CD\-RW, DVD\-RW, DVD+RW) that is currently in drive. You can select mode of erasing CD\-RW or DVD\-RW: fast or full. You can't select mode of erasing of DVD+RW. .IP \(bu 3 Verify data: Calculate digest of file selected from hard drive, or compare any file with first track of optical disc. .IP \(bu 3 Configuration: Selecting this menu option will display cdw Configuration window, where you can set various options. .IP \(bu 3 Quit: close cdw and return to your command line. .RE .SS Keys (hotkeys, available in main cdw window) .RS .IP \(bu 3 \fBF1, H, ? \- Show this help\fR: Display help window with list of hotkeys. .IP \(bu 3 \fBF9/F10 \- Show license of this program\fR: display cdw license. .IP \(bu 3 \fBC \- Show Configuration window\fR .IP \(bu 3 \fBD \- Show information about disc\fR: cdw will run external tool to get some meta\-information about optical disc in your drive and display this information in text window. .IP \(bu 3 \fBE \- Eject drive tray\fR: open your optical drive tray (will close tray if it is already open). .IP \(bu 3 \fBF \- Write selected files to disc\fR: Write currently selected files to optical disc. .IP \(bu 3 \fBG \- Read content of CD\fR: Copy content of your audio or data CD to your hard drive. .IP \(bu 3 \fBI \- Write ISO image to disc\fR: Write ISO image to optical disc. .IP \(bu 3 \fBL \- Show log of last operation\fR: view file with record of latest operations. .IP \(bu 3 \fBR \- Refresh information about disc\fR: cdw will run external tool to get some meta\-information about optical disc in your drive and will display short summary in lower\-left part of main cdw window. .IP \(bu 3 \fBV \- Verify data\fR: calculate digest of selected file (and of first track on optical disc). .IP \(bu 3 \fBQ \- Quit\fR: close cdw and return to your command line .RE .SH CONFIGURATION .P This section describes Configuration module available via "Configuration" button in left\-hand menu in main cdw window. You have to press F9/F10 in Configuration window to save changes made in the window and exit or press Escape key to close configuration window without saving changes. Please note that changes made in "Tools" tab are saved only for current session with cdw. .RS .IP \(bu 3 Log and misc (first tab): .RS .IP \(bu 3 Log file path \- path to file, in which cdw writes its messages and messages from external tools (mkisofs, cdrecord, growisofs, dvd+rw\-mediainfo, xorriso). Specifying this path is obligatory. .IP \(bu 3 Show log after actions \- show the content of log file after some of actions performed by cdw. .IP \(bu 3 ISO volume size \- size of ISO filesystem that you want to create. Most often it is equal to capacity of optical disc that you want burn data to. This is a dropdown, from which you can select one of preselected values, or select "Custom value". This custom value can be entered below the dropdown. .IP \(bu 3 Custom ISO volume size \- size of ISO filesystem that you want to create. This is the place where you can enter nonstandard value of target ISO filesystem size. .RE .IP \(bu 3 Tools (second tab): First thing that you will see in this tab "Configure tools manually" checkbox, it is unchecked by default, and this is safe default value. In this state cdw select tools itself. If you check this checkbox you will be presented with six dropdowns: first three allow you to select tools or families of tools intended for specific tasks. Remaining dropdowns allow you to select paths to some tools used by cdw for some tasks. All these dropdowns are explained below. .RS .IP \(bu 3 "Tool for creating stand alone ISO9660 file" \- here you select a tool used to create ISO9660 file saved on hard disc (stand\-alone file). Depending on configuration of your software, here you can find mkisofs (genisoimage) and xorriso. .IP \(bu 3 "Tools for handling CDs" dropdown \- here you select a tool that will be used to burn data to CD/CD\-RW discs and to erase CD\-RW discs. Depending on configuration of your software, here you can find cdrecord (wodim) and xorriso. .IP \(bu 3 "Tools for handling DVDs" dropdown \- here you select a tool that will be used to burn data to DVD discs and to erase DVD+/\-RW discs. Depending on configuration of your software, here you can find dvd+rw\-tools, cdrecord (wodim) and xorriso. Note that xorriso can be used only for DVD+/\-R discs. .IP \(bu 3 "Path to mkisofs" dropdown \- here you can select one of implementations of mkisofs installed in your system (e.g. if you have mkisofs and genisoimage). .IP \(bu 3 "Path to cdrecord" dropdown \- here you can select one of implementations of cdrecord installed in your system (e.g. if you have cdrecord and wodim). .IP \(bu 3 "Digest tool" \- here you can select a tool used for calculating digest (checksum) \- the tool is used e.g. during verification of burning of ISO9660 file to optical disc. md5sum tool is the default one, if found. Remember that these settings are saved only for your current session with cdw, and that the settings will be discarded when you close cdw. .RE .IP \(bu 3 Audio (third tab): .RS .IP \(bu 3 Audio output dir \- path to directory, into which cdw will write raw audio tracks, ripped from audio CD. .RE .IP \(bu 3 Hardware (fourth tab): .RS .IP \(bu 3 "cdw should use this drive" dropdown \- option allowing you to select one of detected drives, or to use path to drive entered manually ("custom path"); .IP \(bu 3 "Custom path to drive" \- field in which you can specify your own path to a device, to be used when cdw can't autodetect all drives in your computer. .IP \(bu 3 SCSI device \- parameters describing your SCSI hardware, in following format: scsibus,target,lun (for a SCSI\-emulated IDE CDRW: 0,0,0). It is used only by cdrecord and you should enter appropriate value only if cdrecord has problems with device path in form of '/dev/xxx'. Otherwise this field should be left empty. This option hasn't been tested, so use it at your own risk. .RE .RE .SH OPTIONS .P Command line options are following: .TP \-h, \-\- help displays information about invoking cdw and its options .TP \-v, \-\-version displays cdw version and copyright information .TP \-\-enable\-dvd+rp\-dl enables very basic support for DVD+R DL discs .TP \-\-escdelay=X modifies delay time between pressing Escape key in cdw window and reaction to the key .SH FILES .RS .IP \(bu 3 cdw.conf: Configuration file, usually stored in $HOME/.cdw/ directory. .IP \(bu 3 cdw.log: Log file, by default stored in $HOME/.cdw/ directory. Path to this file can be modified in Configuration window ("Log and misc" tab > 'Log file path' field). .IP \(bu 3 cdw.colors: File with definition of color schemes used to customize interface of cdw. File is stored in $HOME/.cdw/ directory. .IP \(bu 3 temporary files: cdw uses some small temporary files to store various information. They are usually created in /tmp directory. If everything goes well they are very short lived and are removed as soon as they are no longer needed. .RE .SH ENVIRONMENT .RS .IP \(bu 3 HOME \- cdw assumes that this variable exists and is set to valid user directory. If not, then user is asked to select some other 'base' directory. .IP \(bu 3 PATH \- cdw reads this environment variable to find directories with executable files. cdw will search in these directories for some tools. .RE .SH DIAGNOSTICS .P cdw uses log file ($HOME/.cdw/cdw.log by default) to store information about actions performed. You can access this file using your file manager, or pressing 'L' key in cdw window. Read this file for any hints if you experience any problems. .SH BUGS .P There are still some bugs related to memory management. .P cdw is developed and tested almost exclusively on x64 GNU/Linux, running cdw on other configurations may produce some platform\-specific bugs. Currently I can't verify them in any way. .P cdw still fails to detect some problems reported by wodim/cdrecord mkisofs/genisoimage or growisofs, although things have improved in latest few versions). Support for xorriso is brand new, so there is a lot error messages printed by xorriso, that cdw is unaware of, and will happily ignore them. It is recommended to read log file after every operation. .P Copying data CDs to ISO image may finish with message "Problems occurred when copying tracks". This does not have to mean that output ISO file is corrupted: this be a sign of some low\-level problems when reading from optical disc. Similar message displayed after ripping audio CD may mean that one or more track files created on your hard disc is corrupted and it is caused by invalid audio CD. .P If you notice any other bugs please let me know. You can do this either using bug tracker on cdw project site (http://sourceforge.net/projects/cdw/) or by sending me an e\-mail: acerion@wp.pl. .SH AUTHOR .P cdw is currently developed by Kamil Ignacak (acerion@wp.pl). First developer of cdw was Varkonyi Balazs (http://sourceforge.net/users/vbali/). .SH COPYRIGHT .P Copyright (C) 2002 Varkonyi Balazs, Copyright (C) 2007 \- 2012 Kamil Ignacak. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/licenses/old\-licenses/gpl\-2.0.html for details. .SH SEE ALSO .P cdrecord(1), mkisofs(8), growisofs(1), dvd+rw\-mediainfo(1), dvd+rw\-format(1), cdrdao, mybashburn, k3b(1), gnomebaker(1), xorriso(1), libisoburn1, libburn4, libcdio. .\" man code generated by txt2tags 2.6 (http://txt2tags.org) .\" cmdline: txt2tags -o - cdw.t2t cdw-0.7.1/man/Makefile.am0000644000175000017500000000131411606072576012035 00000000000000src_MANS = cdw.t2t man_MANS = cdw.1 # each line of shell script in Makefile will be treated as separate # shell command; a workaround for this is either put whole "if/then/fi" # in one line, or add ";" and "\" in proper places of script; # "@" tells "make" to not to print the script to stdout during execution; # http://forums.fedoraforum.org/showthread.php?t=87434 cdw.1: $(src_MANS) @if test "x$(TXT2TAGS)" = "x"; then \ echo "txt2tags program not found on target system, not compiling man page"; \ else \ $(TXT2TAGS) -o - $(src_MANS) > $(man_MANS); \ fi # cdw.1 file may not get built (e.g. because there is no txt2tags # installed), but it needs to be distributed EXTRA_DIST = $(man_MANS) $(src_MANS) cdw-0.7.1/man/cdw.t2t0000644000175000017500000004735211735412263011217 00000000000000cdw 0.7.1 1 April 2012 %!target: man %!options(html): --mask-email % TRANSLATOR: uncomment the next line and fill the right encoding %%!encoding: utf-8 %% LOG %% 29 March 2012 acerion: updated the file for cdw 0.7.1 %% 9 July 2011 acerion: updated the file for cdw 0.7.0 %% 20 October 2010 acerion: updated file for cdw 0.6.0 %% 10 July 2010 acerion: updated file for cdw 0.5.0 %% 30 March 2010 acerion: got an example file from http://txt2tags.sourceforge.net/manpage.t2t = NAME = cdw - front-end for cdrecord, mkisofs, growisofs and other tools = SYNOPSIS = ``cdw [--help] [--version] [--enable-dvd-rp-dl] [--escdelay=X]`` = DESCRIPTION = cdw is a front-end for command-line tools used for burning data CD and DVD discs and for related tasks. The tools are: cdrecord/wodim, mkisofs/genisoimage, growisofs, dvd+rw-mediainfo, dvd+rw-format, xorriso. You can also use cdw to rip tracks from your audio CD to raw audio files. Limited support for copying content of CD and DVD discs to image files is also provided. cdw can utilize md5sum program to verify correctness of writing ISO image to CD and DVD disc. cdw uses ncurses library to build user-friendly interface and it can be used in UNIX terminal window and in terminal emulator (like konsole, rxvt or gnome-console) in X environment. cdw supports only ISO9660 filesystem for optical media. Other filesystem for optical media are not supported nor recognized. = SUPPORTED MEDIA = Scope of supported features depends on which tools are installed on end user's system. Full list of supported media and actions is listed below. : CD-AUDIO ripping audio tracks to raw audio files : CD-R writing files and ISO images (single- and multi-session) with cdrecord/wodim and xorriso; copying content of first session to image file on your hard disc : CD-RW writing files and ISO images (single- and multi-session), erasing (erasing only TOC or blanking whole disc) with cdrecord/wodim and xorriso; copying content of first session to image file on your hard disc : DVD-R, DVD+R writing files and ISO images (multi-session, but without closing disc, or single-session) with cdrecord/wodim, dvd+rw-tools and xorriso : DVD-RW writing files and ISO images (multi-session or single-session); erasing, formatting - quick or slow (full) method; dvd+rw-tools only. **WARNING**: multiple blanking may quickly render your DVD-RW unusable. : DVD+RW writing files and ISO images (both writing to disc from scratch and appending data), without closing disc; blanking disc, but takes lots of time, and you don't need to do it anyway - you can always start writing to the same disc like you would write to blank disc. DVD+RW can be handled by both cdrecord/wodim and dvd+rw-tools. : DVD+R DL there is now partial support for DVD+R DL discs: cdw can burn ISO image and files in single session. User has to explicitly enable it by passing "--enable-dvd-rp-dl" command line argument to cdw; cdw can handle DVD+R DL discs only using dvd+rw-tools; this feature is very incomplete and possibly buggy. Dual-layer media other than DVD+R DL are not yet supported. DVD-RAM, Blu-ray, HD-DVD discs are not supported. = MANUAL = You can write data discs either by using previously created ISO image file, or by selecting files from hard drive and writing them directly to disc. cdw provides UI elements for both actions. First action before creating new ISO image or writing files to disc is selecting files from your hard drive. You can do this by selecting "Add files" in left-hand menu. You will be presented with simple file selector. Use Up/Down arrows or Page Up/Page Down keys to move, Enter key to change current directory, Space key to select files or directories. Selected items will be added to list displayed in cdw window. Use Escape key to close file selector window. The selector window shows you all files and directories (including hidden files) in current directory, in alphabetical order. You will see file size information for every file on the list. You can also delete previously selected files from list: select "Delete files" from the menu and use Up/Down arrow keys to move and Delete key to delete highlighted item. Use Escape key when you finish deleting files from list of selected files. Now you can select "Create image" from left-hand menu. cdw will display a wizard window where you can change most common options, and where you can select path to target ISO9660 image file on your hard disc. You can also select "Write files to disc" to write selected files to optical disc. If you select the option, cdw will display a wizard dialog window, in which you can adjust most common options related to burning files to disc. If you want to write ISO image file to optical disc, use "Write image to disc" option in left hand menu. You will be presented with file picker dialog that allows you to select existing ISO image file from your hard disc. After that cdw will display a wizard window, where you can modify most common options available for burning a disc. cdw allows you to verify correctness of this operation by checking a digest (e.g. md5 sum) of ISO file and of track written to disc. You can request this by checking "Verify write" checkbox that will appear in write wizard. Please note that this checkbox is visible only when you are writing ISO file to empty CD or DVD disc. This function is still experimental. Make sure that a program for calculating digests is installed on your machine. cdw supports following programs: md5sum sha1sum sha224sum sha256sum sha384sum sha512sum Another operation you can perform is erasing optical disc - CD-RW, DVD-RW (both Sequential Recording and Restricted Overwrite) or DVD+RW. You can do this by selecting "Erase disc" option in cdw left-hand menu. Please note that extensive erasing of DVD-RW may render your disc unusable if used extensively. In case of CD-RW and DVD-RW you will be asked what type of blanking you want to perform. You can choose fast mode or full mode. First one doesn't take too much time (in case of CD-RW it only erases table of content of your disc), second one can be very time-consuming, depending on disc size and selected speed. When you will attempt to blank DVD-RW disc, blanking wizard will display dropdown that allows you to choose mode (format) of DVD-RW disc: Restricted Overwrite or Sequential Recording. cdw can be useful when you want to copy your data CD or DVD to ISO image on your hard drive. You do this by selecting "Read disc" option from left-hand menu. This function allows you to copy first track from your data CD or DVD. Reading second and following tracks from data discs, and reading discs written in mixed mode (one or more data tracks + audio tracks) discs are not supported. You can also use cdw to copy your audio CD to separate files (each track will be written to separate file). You do this by selecting "Read disc" option from menu. cdw can't convert audio tracks to any popular audio format. The tracks are written to files in the same format as they appear on CD (2 channels, 44100 samples per second, 16 bit signed PCM, little endian (intel)). The file names have following name format: track_xx.raw (where xx is track number). You can convert raw track file to wav file using e.g. sox command: **sox -c 2 -r 44100 -L -2 -s track_name.raw -t wav track_name.wav** The last operation that cdw offers is verification of data. You can use it for two purposes: - calculating a digest of selected file from hard disc; - comparing selected file with content of first track on optical disc; The second option also utilizes digest tool (e.g. md5sum), but may not work correctly, so it is marked in cdw as "Experimental". cdw has Configuration window, accessed by selecting "Configuration" item in left-hand menu. The window allows you to set up some options for tools used by cdw, and for cdw itself. Configuration window has following tabs (you can access them using keys F2-F5): - Log and misc - contains options related to log file in which cdw logs its operations, and to some aspects of behavior of cdw. - Tools - options in this tab allow you to select tools from your operating system that will be used to create ISO9660 images, burn data to disc etc. You can safely leave "Configure tools manually" checkbox unmarked. - Audio - contains options related to ripping audio CDs. - Hardware - probably will be visited only once, when you use cdw for the first time or when you change your hardware configuration. Here you can set paths to your devices used by cdw. All options available in Configuration window are described below, in CONFIGURATION section. You have to use F9 or F10 key to save any changes made in Configuration window and close the window. To close Configuration window without saving changes use Escape key. Values from "Tools" tab are saved only temporarily, they aren't stored in permanent configuration file. You can control cdw using application's menu (visible on left side of screen), or using hotkeys. == Main menu items == - Add files: Select files and directories that you want to write to optical disc or to ISO image on your hard disc. Press Space to select a file or directory, use Up and Down arrows to move on the list, press Enter key to change directory, press Escape key to close file selection dialog. - Delete files: List of selected files is displayed on the right side of the screen. If you want to delete files from the list, select this button and use Delete key to delete a file, Up and Down arrows to move on the list or press Escape to end deleting. - Write files to disc: write selected files to optical disc that is currently in drive. You will be warned if there is no disc in drive, the drive is not ready or the disc is mounted. - Create image: write selected files to ISO image file. The ISO image file can be selected in file picker window. - Write image to disc: write ISO image file to optical disc. The ISO image file can be selected in file picker window. You will be warned if there is no disc in drive, the drive is not ready or the disc is mounted. - Read disc: Copy content of your single session data CD/DVD or audio CD to files on hard drive. In case of data CD/DVD discs cdw will create correct image file on your hard disc, but only for first track on disc, rest of tracks won't be read (cdw can't read them correctly). In case of audio CDs cdw will copy each audio track to separate raw audio file. You will have to recode the raw audio track files in order to play them in your media player. - Erase disc: Erase data (partially or fully) from rewritable disc (CD-RW, DVD-RW, DVD+RW) that is currently in drive. You can select mode of erasing CD-RW or DVD-RW: fast or full. You can't select mode of erasing of DVD+RW. - Verify data: Calculate digest of file selected from hard drive, or compare any file with first track of optical disc. - Configuration: Selecting this menu option will display cdw Configuration window, where you can set various options. - Quit: close cdw and return to your command line. == Keys (hotkeys, available in main cdw window) == - **F1, H, ? - Show this help**: Display help window with list of hotkeys. - **F9/F10 - Show license of this program**: display cdw license. - **C - Show Configuration window** - **D - Show information about disc**: cdw will run external tool to get some meta-information about optical disc in your drive and display this information in text window. - **E - Eject drive tray**: open your optical drive tray (will close tray if it is already open). - **F - Write selected files to disc**: Write currently selected files to optical disc. - **G - Read content of CD**: Copy content of your audio or data CD to your hard drive. - **I - Write ISO image to disc**: Write ISO image to optical disc. - **L - Show log of last operation**: view file with record of latest operations. - **R - Refresh information about disc**: cdw will run external tool to get some meta-information about optical disc in your drive and will display short summary in lower-left part of main cdw window. - **V - Verify data**: calculate digest of selected file (and of first track on optical disc). - **Q - Quit**: close cdw and return to your command line = CONFIGURATION = This section describes Configuration module available via "Configuration" button in left-hand menu in main cdw window. You have to press F9/F10 in Configuration window to save changes made in the window and exit or press Escape key to close configuration window without saving changes. Please note that changes made in "Tools" tab are saved only for current session with cdw. - Log and misc (first tab): - Log file path - path to file, in which cdw writes its messages and messages from external tools (mkisofs, cdrecord, growisofs, dvd+rw-mediainfo, xorriso). Specifying this path is obligatory. - Show log after actions - show the content of log file after some of actions performed by cdw. - ISO volume size - size of ISO filesystem that you want to create. Most often it is equal to capacity of optical disc that you want burn data to. This is a dropdown, from which you can select one of preselected values, or select "Custom value". This custom value can be entered below the dropdown. - Custom ISO volume size - size of ISO filesystem that you want to create. This is the place where you can enter nonstandard value of target ISO filesystem size. - Tools (second tab): First thing that you will see in this tab "Configure tools manually" checkbox, it is unchecked by default, and this is safe default value. In this state cdw select tools itself. If you check this checkbox you will be presented with six dropdowns: first three allow you to select tools or families of tools intended for specific tasks. Remaining dropdowns allow you to select paths to some tools used by cdw for some tasks. All these dropdowns are explained below. - "Tool for creating stand alone ISO9660 file" - here you select a tool used to create ISO9660 file saved on hard disc (stand-alone file). Depending on configuration of your software, here you can find mkisofs (genisoimage) and xorriso. - "Tools for handling CDs" dropdown - here you select a tool that will be used to burn data to CD/CD-RW discs and to erase CD-RW discs. Depending on configuration of your software, here you can find cdrecord (wodim) and xorriso. - "Tools for handling DVDs" dropdown - here you select a tool that will be used to burn data to DVD discs and to erase DVD+/-RW discs. Depending on configuration of your software, here you can find dvd+rw-tools, cdrecord (wodim) and xorriso. Note that xorriso can be used only for DVD+/-R discs. - "Path to mkisofs" dropdown - here you can select one of implementations of mkisofs installed in your system (e.g. if you have mkisofs and genisoimage). - "Path to cdrecord" dropdown - here you can select one of implementations of cdrecord installed in your system (e.g. if you have cdrecord and wodim). - "Digest tool" - here you can select a tool used for calculating digest (checksum) - the tool is used e.g. during verification of burning of ISO9660 file to optical disc. md5sum tool is the default one, if found. Remember that these settings are saved only for your current session with cdw, and that the settings will be discarded when you close cdw. - Audio (third tab): - Audio output dir - path to directory, into which cdw will write raw audio tracks, ripped from audio CD. - Hardware (fourth tab): - "cdw should use this drive" dropdown - option allowing you to select one of detected drives, or to use path to drive entered manually ("custom path"); - "Custom path to drive" - field in which you can specify your own path to a device, to be used when cdw can't autodetect all drives in your computer. - SCSI device - parameters describing your SCSI hardware, in following format: scsibus,target,lun (for a SCSI-emulated IDE CDRW: 0,0,0). It is used only by cdrecord and you should enter appropriate value only if cdrecord has problems with device path in form of '/dev/xxx'. Otherwise this field should be left empty. This option hasn't been tested, so use it at your own risk. = OPTIONS = Command line options are following: : ``-h, -- help`` displays information about invoking cdw and its options : ``-v, --version`` displays cdw version and copyright information : ``--enable-dvd+rp-dl`` enables very basic support for DVD+R DL discs : ``--escdelay=X`` modifies delay time between pressing Escape key in cdw window and reaction to the key = FILES = - ``cdw.conf``: Configuration file, usually stored in $HOME/.cdw/ directory. - ``cdw.log``: Log file, by default stored in $HOME/.cdw/ directory. Path to this file can be modified in Configuration window ("Log and misc" tab > 'Log file path' field). - ``cdw.colors``: File with definition of color schemes used to customize interface of cdw. File is stored in $HOME/.cdw/ directory. - ``temporary files``: cdw uses some small temporary files to store various information. They are usually created in /tmp directory. If everything goes well they are very short lived and are removed as soon as they are no longer needed. = ENVIRONMENT = - HOME - cdw assumes that this variable exists and is set to valid user directory. If not, then user is asked to select some other 'base' directory. - PATH - cdw reads this environment variable to find directories with executable files. cdw will search in these directories for some tools. = DIAGNOSTICS = cdw uses log file ($HOME/.cdw/cdw.log by default) to store information about actions performed. You can access this file using your file manager, or pressing 'L' key in cdw window. Read this file for any hints if you experience any problems. = BUGS = There are still some bugs related to memory management. cdw is developed and tested almost exclusively on x64 GNU/Linux, running cdw on other configurations may produce some platform-specific bugs. Currently I can't verify them in any way. cdw still fails to detect some problems reported by wodim/cdrecord mkisofs/genisoimage or growisofs, although things have improved in latest few versions). Support for xorriso is brand new, so there is a lot error messages printed by xorriso, that cdw is unaware of, and will happily ignore them. It is recommended to read log file after every operation. Copying data CDs to ISO image may finish with message "Problems occurred when copying tracks". This does not have to mean that output ISO file is corrupted: this be a sign of some low-level problems when reading from optical disc. Similar message displayed after ripping audio CD may mean that one or more track files created on your hard disc is corrupted and it is caused by invalid audio CD. If you notice any other bugs please let me know. You can do this either using bug tracker on cdw project site (http://sourceforge.net/projects/cdw/) or by sending me an e-mail: acerion@wp.pl. = AUTHOR = cdw is currently developed by Kamil Ignacak (acerion@wp.pl). First developer of cdw was [Varkonyi Balazs http://sourceforge.net/users/vbali/]. = COPYRIGHT = Copyright (C) 2002 Varkonyi Balazs, Copyright (C) 2007 - 2012 Kamil Ignacak. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html for details. = SEE ALSO = cdrecord(1), mkisofs(8), growisofs(1), dvd+rw-mediainfo(1), dvd+rw-format(1), cdrdao, mybashburn, k3b(1), gnomebaker(1), xorriso(1), libisoburn1, libburn4, libcdio. cdw-0.7.1/missing0000644000175000017500000002557710670754623010643 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: cdw-0.7.1/Makefile.am0000644000175000017500000000131511523062116011246 00000000000000# hand-made Makefile.am (work includes CTRL+C SHIFT+Ins) # # references, sources, acknowledgements: # http://inti.sourceforge.net/tutorial/libinti/autotoolsproject.html#AP03 # http://mij.oltrelinux.com/devel/autoconf-automake/ # # The SUBDIRS variable is used to list the subdirectories that must be built. SUBDIRS = gnulib src man # tools # http://www.gnu.org/software/hello/manual/automake/Basics-of-Distribution.html # "Still, sometimes there are files that must be distributed, but which # are not covered in the automatic rules. These files should be listed # in the EXTRA_DIST variable." EXTRA_DIST = $(top_srcdir)/Makefile.cdw.am \ $(top_srcdir)/cdw.conf \ $(top_srcdir)/cdw.colors \ $(top_srcdir)/TODO cdw-0.7.1/TODO0000644000175000017500000000212611656005724007714 00000000000000TO DO: - new implementation of debug messages: debug messages should be printed to .cdw.log file - full support for xorriso - remove unnecessary stuff from cdw_config_t, move it to cdw_task_t; create "cdw_task_t permanent_task" that stores parts of configuration; - corretcly handle situation when verifying a disc and an image file, and the image is larger than track on disc - cdio may throw an error while reading end of track, and cdw will interpret this as disc access error; - make sure that "eject tray after X" checkbox works properly - more signal handlers for signals causing exit; - make controlling of menus more consistent: I'm noticing it's quite awkward to select files and try to decide whether to use ESC or 'q' to quit. The cdw menus and cdw application seem to be diverse as to which key it requires to exit/quit and leave a menu. Personally, I'm for specifying both. Make it easy for the user! DONE: - add "-root" option in mkisofs options - move .cdw.log, .cdw.conf and .cdw.colors to ~/.cdw/ - add support for ~/.mkisofsrc (but only reading the file)cdw-0.7.1/ChangeLog0000644000175000017500000015036111734662514011006 00000000000000This is top-level ChangeLog. It describes changes in application, without delving into details at source code level. See src/ChangeLog for details on changes in source files. 2012-03-28 Kamil Ignacak * gettext: updating gettext information and cdw.pot template file; one step closer to release; 2012-03-25 Kamil Ignacak * xorriso: cdw now can recognize "not a known option" error message printed by xorriso to stderr, and inform user about the fact; * bugfixing: fixing small bug introduced recently: cdw recognized a disc as empty right after burning ISO9660 image to the disc; the problem was a result of reusing old cdio data structure after reloading a disc tray (the data structure should have been discarded, and then created again); * ISO9660: fixing usage of meta information fields - they are used only when they are accessible during task creation, i.e. preparer/publisher/copyright fields are only used during creation of standalone ISO9660 file system (because there is this "meta" tab in ISO9660 wizard), but not during creation of ISO9660 file system on the fly, because the "meta" tab is currently missing in write wizard; 2012-03-06 Kamil Ignacak * bugfixing: fixing problem with ejecting drive tray; after a bit of googling it turned out that this may be caused by the drive being locked; today's change in cdw_drive.c provides a workaround for this problem; 2012-02-26 Kamil Ignacak * general: program version has been changed from 0.7.0 to 0.7.1; this won't be any significant release, just few small changes, so such change of version is justified; * bugfixing: there has been made small change that should help to resolve problems with saving data in configuration window or in wizards with F10 key, when user runs cdw in terminal emulators that use F10 for their own purposes; see also http://sourceforge.net/tracker/index.php?func=detail&aid=3424993&group_id=124080&atid=698428 * user interface: there is one small change (disabled for now) in signal handler code, that suggests that handling "resize main window" requests will be possible in future versions of cdw; * signal handling: few more signals are now handled by cdw's signal handler (essentially exit() is called, together with all the functions registered with atexit()); state of terminal (or terminal emulator) should be correct after cdw closes abruptly; * removing src/user_interface/widgets/cdw_textarea.[ch] - content of the file has been already moved elsewhere; 2012-02-19 Kamil Ignacak * general: lots of small changes that are supposed to silence compiler warnings; * debug: fixing problems with cdw_string_wrap(), only to realize that the function and related functions will require redesigning and rewriting at some point in the future; * signals: code handling signals has been improved: more signals are being handled, and code has been modified to make sure that final debug message is printed correctly, and that exit() is called properly; 2012-02-17 Kamil Ignacak * burning files: when burning second or following session to a disc, cdw now tries to check which tool has been used to create ISO file system already existing on a disc, and select the same tool for creating appended file system; user is warned if cdw can't recognize a tool used to create ISO file system existing on the disc; there is now also a second type of check: cdw checks value of ISO level of existing ISO file system, and preselects the same level for creating appended file system; both changes should decrease possibility of problems when burning files to a disc; see this post for related information: http://sourceforge.net/mailarchive/forum.php?thread_name=4EA08379.7090302%40wp.pl&forum_name=cdw-user * user interface: dropdowns, button dialogs and few more places, like log window, recognize 'q' and 'Q' keys as cancel/escape keys; this change has been suggested by RogerX; * external tools: solving Sourceforge defect #3487958 (cdw was unable to detect installed wodim and genisoimage if they weren't symlinked as cdrecord and mkisofs); 2012-02-11 Kamil Ignacak * general: this commit should be the last one made because of refactoring/review. The refactoring included: - moving implementation of some ncurses widgets to separate files in user_interface/widgets/ dir; - remodeling optical file system -> cdw cdio disc -> cdw disc stack of files/data abstractions; - creating new file: cdw_window.c; I'll try to focus now on implementing new features that will be more visible to end user than any changes made so far in this dev cycle. The next step would be looking for problems with valgrind, general testing, and release. 2012-01-04 Kamil Ignacak * src/user_interface/widgets/cdw_textarea.c: Moving remaining content from the file to cdw_window module. Some of the code from cdw_window goes there too. 2011-12-27 Kamil Ignacak * src/user_interface/cdw_widgets.c: Content of the file has been moved to widgets/*.c files before, now removing the file completely. 2011-12-19 Kamil Ignacak * starting new round of development; * moving content of src/user_interface/cdw_wizard.[ch] to new files, to keep widgets better organized/encapsulated. The new files are: src/user_interface/widgets/cdw_button.c src/user_interface/widgets/cdw_button.h src/user_interface/widgets/cdw_checkbox.c src/user_interface/widgets/cdw_checkbox.h src/user_interface/widgets/cdw_dialog.c src/user_interface/widgets/cdw_dialog.h src/user_interface/widgets/cdw_dropdown.c src/user_interface/widgets/cdw_dropdown.h src/user_interface/widgets/cdw_input_line.c src/user_interface/widgets/cdw_input_line.h src/user_interface/widgets/cdw_textarea.c src/user_interface/widgets/cdw_textarea.h 2011-10-14 Kamil Ignacak * COPYING: Updating GPL license text, it seems that at some point in time the FSF has changed its address in the US, and that has updated GPL text with this new information. Also the new text uses 'Lesser' instead of 'Library'. This doesn't seem to change the spirit of the license, nor the letter. Current GPL v2 text online: http://www.gnu.org/licenses/gpl-2.0.txt. This change has been spotted by user Sergio. Thanks! 2011-07-09 Kamil Ignacak * fixing a small bug in code related to burning image to a disc; * updating some meta files (NEWS, README, THANKS), updating documentation; other minor changes 2011-06-27 Kamil Ignacak * write wizard: adding "volume ID" input field in write wizard, the field is visible when wizard is used to prepare "burn files" task; 2011-06-19 Kamil Ignacak * bugfixes: testing phase is in progress; some minor changes, but some bug fixes as well: - proper initialization of "colors" module (cdw now properly reads colors configuration file from ~/.cdw/cdw.colors); - configuration module now can properly read custom drive path from config file; - improvement of disc size recognition by cdrecord and xorriso; - mkisofs options panel now correctly displays all values of "RR information" dropdown; - code preparing commands for calling xorriso now properly adds "-dummy" option; - writing speeds for CDs are now properly recognized by libburn module; 2011-05-18 Kamil Ignacak * configuration: merging cdw_config_ui.* and cdw_config_ui_internals.* into cdw_config_window.* * pre-release activities: bumping version to 0.7.0; current source code tree is pretty much how 0.7.0 will look like; all that is left to do is to test new version of cdw and update documentation; 2011-05-08 Kamil Ignacak * bugfixing: fixing one bug: not all digest tools existing in user's system were correctly detected/displayed/utilized, this should be now fixed; This commit marks a beginning of final (cursory) code review, which will be followed by testing phase. 2011-04-21 Kamil Ignacak * verification, bugfixing: a commit that attempts to finally solve problem described in sourceforge defect #3111089 (http://sourceforge.net/tracker/?func=detail&aid=3111089&group_id=47851&atid=451091); 2011-04-10 Kamil Ignacak * includes: in response to feature request #3249439 on SourceForge (http://sourceforge.net/tracker/?func=detail&aid=3249439&group_id=47851&atid=451094) I'm changing the way of using ncurses header files; this is only tested on my Debian box, still needs to be tested on Arch Linux; 2011-04-02 Kamil Ignacak * xorriso: adding initial code for handling DVD-R and DVD+R discs with xorriso; * libburn: added a file with wrapper around libburn calls; this wrapper provides information about disc that could not have been provided by xorriso; for now libburn calls are/will be used only for getting disc meta information, but it's very probable that libburn calls will eventually replace calls to xorriso; This commit adds new dependency: libburn from libburnia project (http://libburnia-project.org) 2011-03-11 Kamil Ignacak * xorriso: adding code for burning ISO image to CD-R/RW discs, and for erasing CD-RW discs; support for xorriso is still in early development phase, so code implementing this support is still unreachable; 2011-03-11 Kamil Ignacak * xorriso: adding more code for handling CDs with xorriso; handling CDs with xorriso is still disabled; * bugfixing: fixing small bugs that were introduced in development code (i.e. post-0.6.0); 2011-03-11 Kamil Ignacak * verification: adding support for two more digest tools: sha224sum and sha384sum; * xorriso: adding some code for handling CDs with xorriso (currently only reading disc meta info); the functionality is unreachable at the moment; 2011-03-06 Kamil Ignacak * verification: cdw now displays progress information during calculating digest of source ISO file; * verification: added "verify data" button in main menu, the button invokes wizard that configures new functionality of cdw: calculating digest of arbitrary disc file, or calculating digest of file system on current optical disc, or comparing digests of selected file and file system on optical disc; 2011-03-05 Kamil Ignacak * verification: few changes in code that performs verification of burned track against source ISO9660 file - the changes make it possible to use verification module for new purposes, e.g. calculating digest of an arbitrary file selected by user; 2011-03-01 Kamil Ignacak * bugfixing: there was a bug in post-0.6.0 code that caused cdw to always perform "dummy" write of ISO image to disc (perhaps of files as well); this has been now fixed; * verification/external tools: code supporting digest tools other than md5sum (sha1sum, sha256sum and sha512sum) has been extended, and some very basic tests have been performed - it seems that this may somehow work; some small fixes and changes are still needed; 2011-02-28 Kamil Ignacak * external tools: added initial code for supporting checksum tools other than md5sum: sha1sum, sha256sum and sha512sum; the support doesn't work yet, but initial code for full support has been added; * user interface: a small defect in cdw form code, introduced in one of recent commits, has been fixed; the defect caused cdw to crash every time some window with cdw form has been closed; 2011-02-27 Kamil Ignacak * external tools: "tools" page in Configuration window has been updated: dropdowns for growisofs, dvd+rw-mediainfo and dvd+rw-format have been removed: the tools aren't as "controversial" as cdrecord/wodim and mkisofs/genisoimage are - dropdowns for the two tools have been left intact; new dropdown - "CD handler" has been added; currently the only item is "cdrecord", but in future "xorriso" may be easily added; 2011-02-16 Kamil Ignacak * mkisofsrc: adding very basic functionality of reading content of $HOME/.mkisofsrc file into options form, so that user can modify the options; 2011-02-08 Kamil Ignacak * configuration: moving configuration file and log file from their original default locations (in $HOME dir) into their new location (in $HOME/.cdw/ dir); this is related to Sourceforge bug #3168259; 2011-02-06 Kamil Ignacak * ISO9660: adding new fields to mkisofs and xorriso options, that allow adding Publisher, System ID, Volume Set ID and (in case of mkisofs) Preparer, Copyright and Abstract; currently user has to enter values for these options manually, but in future it will be possible to read them from appropriate config file; 2011-02-04 Kamil Ignacak * configuration: removed "ISO9660" and "Writing" pages from Configuration window - settings from the pages are available only in new, separate windows accessed from wizards; * TODO: added TODO file 2011-02-03 Kamil Ignacak * user interface: more progress on moving configuration of burning/creating ISO9660 file system from Configuration window to more specialized, specially tailored Options windows, accessible from wizards; 2011-01-30 Kamil Ignacak * user interface: "eject" checkbox is slowly moved to write/erase wizards; * xorriso: improving support for xorriso; currently xorriso is used only as tool that created stand alone ISO9660 files; I will start using other functions of xorriso as soon as creating ISO files becomes stable; 2011-01-25 Kamil Ignacak * bugfixing: added missing -lm library in src/Makefile.am 2011-01-25 Kamil Ignacak * feature: ISO9660 image file wizard: currently call to the wizard function is disabled; the wizard displays most basic options used when creating ISO9660 image file, and also displays button forwarding to window with more advanced options; the options are either for mkisofs or for xorriso; adding new options or even new pages of options is simple thanks to recent changes in cdw form, tabbed window widgets and code related to config ui; 2011-01-22 Kamil Ignacak * xorriso: added first lines of code and files that are foundation for supporting xorriso in cdw; 2011-01-20 Kamil Ignacak * feature: added hiding of hidden files in file system browser widget - you can toggle the hiding using '.' (dot) character; 2011-01-09 Kamil Ignacak * bugfixing/new feature: adding new command-line argument "escdelay" which allows user to control ESC key delay in cdw; other changes in code set the value to 50ms by default - much less than original 1000ms; 2011-01-08 Kamil Ignacak * new features: adding code that reads disc capacity, updating code that reads disc usage - this will allow me to display this information in main window, in "selected files info" area; the code works only for DVDs, and is disabled; unfortunately this doesn't work for DVDs+wodim; * new features (2): adding code that reads disc capacity for CD discs as well; enabling displaying disc usage and capacity in main window in volume info area; * ui: readjusting main window layout so that there is no external border around 4 main areas anymore; this gives us a bit more space for more important thing and tidies up the main application window; 2011-01-05 Kamil Ignacak * widgets: adding new widget: tabbed window (well, the widget already exists, but it's heavily coupled with implementation of configuration window; code in new file is an essence of the widget); 2011-01-04 Kamil Ignacak * ISO9660: today's commit changes how RockRidge extensions to IS9660 are configured in cdw: instead of two checkboxes there is now one dropdown; 2011-01-02 Kamil Ignacak * disc modes: code generating list of available disc modes (tao/dao/sao) that can be seen in write wizard, has been updated; major change in this update is the fact that when cdrecord is used as a tool, cdw will display only those modes, that are reported by cdrecord as supported by current disc/drive combo; this may mean that the list may be shorter than in previous versions of cdw. * other: I've added 'q' key to list of keys that close write wizard and erase wizard without performing writing/erasing; this has been suggested by rogerx as a workaround for long delay between pressing ESC key and a reaction to the key by ncurses; this solution will be implemented in other parts of cdw; 2011-01-01 Kamil Ignacak * fixing bugs: fixing sourceforge bug #3149329, reported by rogerx; I've tried to be correct when listing disc types for which "dummy" write is possible; a thorough testing is required to check that the list is correct; 2010-12-28 Kamil Ignacak * fixing bugs: fixing small annoyance (pointed to by user rogerx): drive tray was reloaded twice during burning/verification process, the second time was unnecessary; 2010-12-23 Kamil Ignacak * fixing bugs: changes in two files should fix sourceforge defect #3111089; * features: changes in cdrecord regex code to add detection of track modes supported by a drive - this information may be used later to build write wizard with more relevant options in "track format" dropdown; 2010-10-22 Kamil Ignacak * fixing bugs: small improvements (well, almost bugfixes) after doing some final tests; one of changes is larger default padding size for burning with cdrecord - the original one may have been too small for DVDs * pre-release activities: small updates in few files; 2010-10-21 Kamil Ignacak * fixing bugs: fixing a bug that occurs when there are no drives in user's computer - cdw crashed when user presses 'E' key to eject a tray, on other occasions cdw didn't work 100% correctly either; * pre-release activities: bumped version to 0.6.0, basically the code in repository is the new version of cdw; updated few files (README, NEWS, po/cdw.pot); release is quite close 2010-10-19 Kamil Ignacak * fixing bugs: fixing some memory leaks (thanks valgrind!); silencing some compiler warnings that showed up during tests on my other machine (32 bit Debian); * testing: did some basic tests on 32 bit machine: some basic functional tests + make distcheck; 2010-10-16 Kamil Ignacak * fixing bugs: fixing problem with ejecting tray after writing to discs (most often DVD-RW discs): cdw attempted to eject a drive tray, but was unable to do so; this may have resulted in incorrect reading of disc meta information and to other problems; fixing one bug in Configuration window -> Tools, the bug resulted in crash whenever there were no programs for DVDs installed, but user wanted to configure them anyway; it seems that it was introduced in cdw 0.5.0, perhaps even earlier; this fix closes sourceforge defect #3088902 I'm much closer to finishing testing of cdw, I think that within a week I will be done with the testing, and will start preparing a new release - cdw 0.6.0; 2010-10-03 Kamil Ignacak * fixing bugs: fixing one problem that may have occurred when writing data to discs with cdrecord with large speeds (when drive buffer was filled in less than 100%) - as a result process window wasn't refreshed properly; 2010-09-17 Kamil Ignacak * fixing bugs: fixing bug that caused cdw to crash when reading meta information from empty CD disc; this bug was introduced in development version of cdw, after releasing version 0.5.0 2010-09-17 Kamil Ignacak * new file: utilities/cdw_regex.c: new file with code that handles variables of cdw_regex_t type - this is a type that collects few variables useful in using regular expressions in cdw; 2010-09-12 Kamil Ignacak * general: updating structure of source code tree by moving some files to subdirectories; list of changes is following: cdda2wav.[ch] -> tasks/cdw_cdda2wav.[ch] cdw_cdio.[ch] -> disc_and_drive/cdw_cdio.[ch] cdw_cdio_drives.[ch] -> disc_and_drive/cdw_cdio_drives.[ch] cdw_drive.[ch] -> disc_and_drive/cdw_drive.[ch] cdw_disc.[ch] -> disc_and_drive/cdw_disc.[ch] cdw_config.[ch] -> configuration/cdw_config.[ch] cdw_config_ui.[ch] -> configuration/cdw_config_ui.[ch] cdw_config_ui_internals.[ch] -> configuration/cdw_config_ui_internals.[ch] cdw_file.[ch] -> native_file_system/cdw_file.[ch] cdw_fs.[ch] -> native_file_system/cdw_fs.[ch] cdw_file_manager.[ch] -> native_file_system/cdw_file_manager.[ch] cdw_fs_ui.[ch] -> native_file_system/cdw_file_picker.[ch] cdw_fs_browser.[ch] -> native_file_system/cdw_fs_browser.[ch] cdw_graftpoints.[ch] -> optical_file_systems/cdw_graftpoints.[ch] cdw_iso_image.[ch] -> optical_file_systems/cdw_iso9660.[ch] iso9660.h -> optical_file_systems/iso9660.h isosize.[ch] -> optical_file_systems/isosize.[ch] cdw_logging.[ch] -> utilities/cdw_logging.[ch] gettext.h -> utilities/gettext.h cdw_task.[ch] -> tasks/cdw_task.[ch] help.[ch] -> user_interface/cdw_help.[ch] thread.[ch] -> external_tools/cdw_thread.[ch] 2010-09-07 Kamil Ignacak * general: updating structure of source code tree by moving some files to subdirectories; list of changes is following: cdw_cdll.[ch] -> utilities/cdw_cdll.[ch] cdw_dll.[ch] -> utilities/cdw_dll.[ch] cdw_string.[ch] -> utilities/cdw_string.[ch] utils.[ch] -> utilities/cdw_utils.[ch] cdw_debug.h -> utilities/cdw_debug.h external_tools.[ch] -> external_tools/cdw_ext_tools.[ch] mkisofs_pipe_regexp.[ch] -> external_tools/cdw_mkisofs_regex.[ch] cdrecord_pipe_regexp.[ch] -> external_tools/cdw_cdrecord_regex.[ch] dvd_rw_format_pipe_regexp.[ch] -> external_tools/cdw_dvd_rw_format_regex.[ch] dvd_rw_mediainfo_pipe_regexp.[ch] -> external_tools/cdw_dvd_rw_mediainfo_regex.[ch] growisofs_pipe_regexp.[ch] -> external_tools/cdw_growisofs_regex.[ch] md5sum_pipe_regexp.[ch] -> external_tools/cdw_md5sum_regex.[ch] pipe_regexp.[ch] -> external_tools/cdw_regex_dispatch.[ch] cdw_colors.[ch] -> user_interface/cdw_colors.[ch] cdw_ncurses.[ch] -> user_interface/cdw_ncurses.[ch] cdw_form.[ch] -> user_interface/cdw_form.[ch] cdw_list_display.[ch] -> user_interface/cdw_list_display.[ch] cdw_processwin.[ch] -> user_interface/cdw_processwin.[ch] cdw_widgets.[ch] -> user_interface/cdw_widgets.[ch] cdw_text_file_viewer.[ch] -> user_interface/cdw_text_file_viewer.[ch] write_wizard.[ch] -> user_interface/cdw_write_wizard.[ch] blank_wizard.[ch] -> user_interface/cdw_erase_wizard.[ch] cdw_ui_main.[ch] -> user_interface/cdw_main_window.[ch] 2010-09-04 Kamil Ignacak * reading DVDs: I have added calls to code that checks if operating system kernel supports ISO9660 file system; the support should be available on most systems, but there may be those that don't have the support enabled - it is better to check this; 2010-09-04 Kamil Ignacak * fixes: fixing one defect introduced in previous commit: cdw was unable to read content of disc, so any attempts to read data disc, or to verify burning an image, failed 2010-09-01 Kamil Ignacak * general: some refactoring in cdw_disc.[ch]; * dependencies: adding libiso9660 as a new dependency for cdw; this library provides functions (among other) for reading information from ISO9660 file systems; the library is part of cdio project, so I think that this new dependency shouldn't be problematic, as libiso9660 should be distributed/packaged together with libcdio; * build scripts: "configure" script checks for libraries (as it used to do), and exits if a library is not available (this is the new part); 2010-08-29 Kamil Ignacak * fixes: fixing small memory leak in cdrecord_pipe_regexp.c; fixing problem with drives that in fact were symbolic links to device files - using them may have caused problems during burning process (see src/ChangeLog for more information); * changes: list of selected files and file selector/picker window recognize 'q' and 'Q' as key that works similarly to Escape, i.e. focus moves back from list of selected files to main menu, and file selector window is closed; * new file: src/utilities/cdw_sys.c: new file with functions that interact with some operating system files or handle operating system signals; some functions from this file will be used to detect if operating system supports ISO9660 or UDF file system; 2010-08-24 Kamil Ignacak * general: updating structure of source code tree by moving some files to subdirectories; list of changes is following: src/cdw_burn_disc.[ch] -> src/tasks/cdw_burn_disc.[ch] src/cdw_create_image.[ch] -> src/tasks/cdw_create_image.[ch] src/cdw_erase_disc.[ch] -> src/tasks/cdw_erase_disc.[ch] src/cdw_read_disc.[ch] -> src/tasks/cdw_read_disc.[ch] src/cdrecord_interface.[ch] -> src/external_tools/cdw_cdrecord.[ch] src/mkisofs_interface.[ch] -> src/external_tools/cdw_mkisofs.[ch] src/dvd_rw_format_interface.[ch] -> src/external_tools/cdw_dvd_rw_format.[ch] src/dvd_rw_mediainfo_interface.[ch] -> src/external_tools/cdw_dvd_rw_mediainfo.[ch] src/growisofs_interface.[ch] -> src/external_tools/cdw_growisofs.[ch] src/md5sum_interface.[ch] -> src/external_tools/cdw_md5sum.[ch] thanks to adminrepo tool on sourceforge.net history of changes in repository will be (hopefully) preserved; 2010-08-22 Kamil Ignacak * boot disc: I have simplified (well, stripped some functionality from) "boot image file" input field - from now user has to manually enter into this field all options related to boot image and boot disc; I have never tested this functionality, so I'm pushing responsibility for proper options to user; this may change in some distant future, but in next release this will feature will be "crippled" 2010-08-22 Kamil Ignacak * hardware: cdw now can autodetect optical disc drives available in user's system; capabilities of available drives can't be (yet) evaluated, but at least user doesn't have to enter a path to a device in text input field - in worst case scenario user will have to select one entry from a list (dropdown); there are still some things to be fixed in this new code, but it seems to work; * license: I have fixed a bug that prevented cdw from displaying full text of GPL license - the license text is read from text file in some default system path, the path used by cdw was incorrect; 2010-08-15 Kamil Ignacak * fixes: one fix of code that updates size of selected files: the size may have been incorrectly calculated when user changed value of "follow symlinks" option; * other: fixing few FIXMEs, doing some TODOs, doing some refactoring; 2010-08-14 Kamil Ignacak * ISO9660 options: added checkbox for "Long Joliet names" in configuration window - user doesn't have to manually enter "-joliet-long" option in "other mkisofs options" field; added button that activates file selector window for selecting boot image file in configuration window; * reading data discs: cdw no longer reads second and following tracks from multi-track data discs; user is clearly informed about this; * burning: information about burning speed, if it is printed by cdrecord or growisofs, is displayed in process window during burning; * fix: one of latest commits introduced a bug in displaying progress information when reading an audio CD disc; this has been now fixed; 2010-08-11 Kamil Ignacak * general: added handling of SIGSEGV signal, when cdw receives the signal, it does proper clean up of resources, including restoring state of a terminal; cdw now can correctly display information about state of DVD+RW and DVD-RW Res discs: if they are empty or not; 2010-08-08 Kamil Ignacak * ui, process window: today's changes are mostly related to process window - the small window displayed when user performs some tasks, the window displays current status of a task, and sometimes progress of the task; until now there were some gaps in displaying the window, so sometimes user could get an impression that cdw has frozen, when - in fact - it was busy doing something in the background, or waiting for external tool to complete its task. Now, the process window is displayed almost all the time when there is something going on. User has more feedback from cdw. It is still a bit experimental, there may be problems with refreshing the window, sometimes the window may not display all available information, but problem of gaps in presenting the information to user is solved. 2010-08-01 Kamil Ignacak * reading discs: added support for reading DVDs with ISO9660 file system (i.e. for copying content of their first track to file on hard disc); * verification: added verification of burning ISO9660 image to DVDs; * ui: added "wrapping" in main menu: when focus is on last position of the menu and user presses down arrow, focus is moved to first item; similarly for topmost item; * burning: added a warning dialog displayed when user attempts to burn ISO image larger than 4GB with wodim; 2010-07-17 Kamil Ignacak * pre-release activities: making last fixes to source code files and other files, adding "compile" file that may be needed on some occasions during compilation; * release: today will be the release day of cdw 0.5.0 :) 2010-07-10 Kamil Ignacak * fixes: small fix of serious error in configuration window: cdw crashing whenever volume label is longer than 19 chars, which was initial width of input field; * updates: updating man page, NEWS and README file 2010-07-09 Kamil Ignacak * fixes: small changes after testing cdw on i38g machine; one change in ncurses wrapper fixing bug that potentially may cause crashes, or at least memory leaks; little modification in processwin code, that prevents processwin from closing too fast, without waiting for user's key; 2010-07-07 Kamil Ignacak * various: first patch from user :) thanks, rogerx! 2010-07-01 Kamil Ignacak * prerelease: various changes in files other than source code files, preparing for upcoming release; officially changing version number to 0.5.0; removing some old or duplicate files; 2010-06-29 Kamil Ignacak * testing, prerelease: main part of testing has been finished, I'm moving to next steps before release; today I did some changes related to gettext 2010-06-09 Kamil Ignacak: * verifying: there may have been a problem during burning of ISO file to disc and attempt to verify burned image: if the disc was mounted by user's automounter after burning image and before attempting to read it, cdw reported an error and abandoned the process; now user is asked to unmount disc, and then cdw can proceed with verification; * burning to disc: default burning mode for burning files to empty disc is now "make single session" instead of "start multisession"; this is a result of short discussion with user rogerx on cdw-devel mailing list; 2010-05-28 Kamil Ignacak: * build system: there are now two explicit build targets: main and "check" targets for "/src" and "/src/external_tools" modules, each with its own set of preprocessor/compiler/ linker flags; "./configure" now accepts "--enable-debug" flag, which controls whether debug facilities (debug info for gdb, debug messages printed to stderr) are included in the build or not, and whether or not additional set of compiler warnings are enabled - this removes necessity of editing Makefile.cdw.am file to enable or disable debug build; almost all build system files were updated; "./configure" script now does a bit more tests * unit tests: several *_tests.* files are removed, and their code is moved to source code files, which functionality is tested; this results in more self-contained modules that implement both functionality and tests of the functionality; this also results in decreased number of files; 2010-05-23 (2) Kamil Ignacak * ui: today's commit removes few dialog windows that were available through hotkeys in main window: volume id editor, cdrecord parameters editor and volume size selector; these parameters can be now edited only in main configuration window; this change was made to make editing parameters more consistent: now they aren't scattered in few different windows; * testing: I think that I have implemented all changes that I intended for cdw version 0.4.1, so I'm ready to start testing phase; 2010-05-23 Kamil Ignacak * config ui: today's commits add new fields in "Log" tab of config window, the fields are used for selecting size of ISO file (volume size); this functionality existed (and still exists) in separate dialog window available through F4 hotkey, but this window will be removed in future; 2010-05-18 Kamil Ignacak * build system: "make distcheck" works :) autotools have their advantages ;) 2010-05-16 Kamil Ignacak * file picker: recent changes in configuration window code add small buttons next to few input fields in configuration window (the fields are input fields where user can enter path); these buttons invoke file picker widget that allows user to select a file or dir more comfortably than by entering path manually; file picker needs a lot of testing and some more improvements, but calling it in "real world scenarios" will make the testing easier 2010-05-14 Kamil Ignacak: * which: adding source code file that implements functionality of "which" utility; the file was created to ensure that on every platform cdw can obtain full list of implementations of specified external tool; in previous versions of cdw it was only possible when native "which" supported "-a" option; sourceforge defect #2996758 proves that not all implementations of "which" support "-a"; this change should close defect 2996758, I will close it after testing phase; * build system: I'm adding Makefile.cdw.am: a file with common definitions that should be included by all Makefile.am files; other tweaks in build system files; 2010-05-08 Kamil Ignacak * bugfixing: today's changes should fix sourceforge defects 2996770 and 2998671; thanks to user robwoj44 for initial bug reports and for providing further information; 2010-05-05 Kamil Ignacak * gnulib: I'm adding few files from gnulib, as found in findutils-4.2.31; they are licensed under GPL 2 or later, so no mismatch of licenses; main reason behind including them in cdw is canonicalize_filename_mode() from canonicalize.c, so only few files are copied from gnulib; the files that I have included into cdw are a bit modified to limit number of files copied from gnulib (no xmalloc, no xgetwd, etc.); After including gnulib files I had to update build system files, but I'm afraid that this was more like hacking them rather than making smart, well thought-out updates, so build system may be now unreliable; perhaps I should switch to non-recursive makefile So be warned: build system may not work as expected; 2010-04-18 Kamil Ignacak: * user interface: cdw can now handle some file names that previously could not be printed by ncurses interface; e.g. "Schlaflos_in_M�nchen/" previously was not printed at all, leaving only empty row, now it will be printed as "Schlaflos_in_M?nchen/"; current state is now not perfect, but surely better; 2010-04-12 Kamil Ignacak * fixes: few changes fix small memory leaks that on some occasions may have lead to application crash; * file picker: file picker dialog (for selecting single file) is closer to be fully functional; next version of cdw will use it as a main widget for selecting single file or directory, e.g. when specifying target ISO image file; this is not the same as file selector window - the file selector does not allow to enter path to non-existing file; * unit tests: unit tests for fs module have been moved from cdw_fs_tests.c to cdw_fs.c; thus cdw_fs_tests.* files are removed; 2010-03-28 Kamil Ignacak * misc: this commit (and few previous) adds capturing few error messages printed by external tools (mkisofs, cdrecord etc.) and displaying appropriate dialog messages with information for user; * DVD+R DL: I have tested handling of DVD+R DL discs, from now on this type of disc will be handled only by dvd+rw-tools, and only after explicitly enabling such support by command line option; this command line option already existed, but now I intend to document it in man page and put it in help printed when cdw is called with "--help" argument; * testing: testing is basically finished; now I have to update documentation and the release will be ready; 2010-03-21 Kamil Ignacak * burning with growisofs: I have updated and tested code that makes sure that growisofs uses proper (as in: selected in Configuration-> Tools) instance of mkisofs; * creating ISO file system: added piece of code that warns user when he attempts to create ISO file system using file larger than 4GB, and iso level is lower than 3; 2010-03-13 Kamil Ignacak * bugfixes: I have implemented an input widget that checks entered strings for unsafe chars; the widget will be used in places which didn't check user input yet; "unsafe" input dialog is removed; this should finally resolve sourceforge defect #2965153; testing continues; 2010-03-07 Kamil Ignacak * bugfixes: today's commit will fix two defects: - insecure characters in input dialogs (partial fix of sourceforge defect #2965153) - incorrect handling of spaces in path to ISO image files (fix of sourceforge defect #2965149) I have started testing phase before releasing version 0.4.0. 2010-02-25 Kamil Ignacak * erasing: yesterday I was too lazy to test my changes in erase wizard, and as a result a bug has slipped into committed code; result of this bug was an application crash when user attempted to erase a disc; today's commit fixes this bug; 2010-02-08 Kamil Ignacak * src/ChangeLog: fixing typos * src/*.c: various small fixes and improvements, often cosmetic; one or two changes may fix problems introduced in previous commit, one certain problem occurred in file selector window: on some occasions adding files failed, and size of selected files turned into -1, this is now fixed; * selecting files: few small changes in filesystem module and file manager module result in more feedback to user when cdw can't scan files selected by user: a dialog message is displayed, informing about problems, and more detailed information is printed to log file; this is far from perfect solution (the perfect solution would be to suggest to user skipping the files in process of creating ISO image or burning the files to optical disc, and happily continue scanning "valid" files), but it is still an improvement; try adding directories without read permissions if you want to test new behavior 2010-01-31 Kamil Ignacak * ui: I have added basic code for file picker dialog (similar to file selection dialogs in other applications, where you can see one when e.g. saving file) - it will be used e.g. for selecting ISO image file; right now it is disabled, as it doesn't work correctly yet; * burning: simple change in threading code will (probably) fix a defect where growisofs always used mkisofs from /usr/bin, regardless of configuration of the tool in cdw configuration module; this hasn't been tested yet, but it should work :) 2010-01-16 Kamil Ignacak * general: small fix in threads code significantly limits CPU usage, which should be noticeable on older machines; added catching some more error messages from external tools * burning: added warning when user wants to burn file that is larger than 4GB, as some tools can't handle this well; cdw now can catch message printed by cdrecord when burned files may not fit onto optical disc - appropriate error dialog is displayed 2010-01-10 Kamil Ignacak * burning: after finishing tests for cdrecord and DVD-R I have tested burning DVD+R with cdrecord; there was only one defect noticed: wodim doesn't close DVD+R disc when writing in single session mode (no -multi arg); this will be deferred to next version, without workaround but with note in "known bugs" section; 2010-01-07 Kamil Ignacak * burning: tested and improved code supporting DVD-R + cdrecord combination (only burning ISO file for now); by cdrecord I mean the original cdrecord and wodim; my wodim version is 1.1.10 and cdrecord is Cdrecord-ProDVD-ProBD-Clone 2.01.01a37, and cdrecord is much better at the job than wodim, but growisofs 7.1 is better than cdrecord 2009-12-21 Kamil Ignacak * erasing: I have introduced one small change in code responsible for erasing of DVD+RW discs with dvd+rw-format - if there were some problems with it, they may be fixed with this commit * burning: cdw now can recognize when growisofs reports insufficient space on optical disc for burning ISO image (previously this was done only for problems with burning files); * other: '+' char is now allowed input char in configuration window fields; I have added "Approximate size of selected files" label in main window to stress that size of files displayed in main window may be imprecise; I'm continuing testing of cdw, so there are some small improvements in supporting cdrecord and dvd+rw-tools 2009-12-06 Kamil Ignacak * calculating file size: cdw has problems with correct handling (calculating size) of directories with relative symbolic links if "follow symbolic links" option is enabled in configuration; these links will be recognized as invalid, and thus size of linked files will not be added to total size of all selected files; this defect does not influence how mkisofs calculates size of files before creating ISO image, so the defect is not critical; * DVD-ROM: small fixes that allow cdrecord / wodim to recognize DVD-ROM discs and a fix that is a workaround for wodim's problem with checking "empty / appendable" status of DVD-ROM 2009-11-23 Kamil Ignacak * burning: slowly starting to test cdw 0.3.95; this commit is a result of few simple testcases of use of cdrecord to burn to DVD+RW; 2009-11-01 Kamil Ignacak * build: today's commit will probably fix sourceforge defect 2890402 * burning: today's commit should fix sourceforge defect 2890403; * burning, creating images: today's commit fixes sourceforge defect 2890399; 2009-10-25 Kamil Ignacak * general, important!: this problem was discovered and fixed some time ago, but I stumbled upon it today, and I've noticed that I didn't describe it here. The problem is that cdw 0.3.93 displayed "can't get any media information" error message at the beginning of almost every action, and refused to do anything useful; source of the problem was libcdio driver: cdw 0.3.93 (and all previous versions) used one specific driver, and if it failed, cdw refused to work; now cdw can fallback to generic driver, and things work ok again; this problem most probably appeared after updating libcdio version; * cdrecord, dvd: added / enabled handling of DVDs by cdrecord; this was fairly easy, because most of code required to do this already existed in cdw 0.3.39, and missing pieces were added in this development cycle; cdrecord (even this original) show some shortcomings: it doesn't provide options for formatting DVD-RW disc, getting detailed ATIP media info from some blank DVD discs takes a lot of time; I suspect that other problems will arise during testing phase; similarly to handling CDs, handling of DVDs can be done with both original cdrecord from Jörg Schilling, and wodim; * configuration: changes in Tools page of config window: dropdown "tools for dvd" now can also show "cdrecord" (if available), but the default and recommended tool set for DVD discs is growisofs and friends; 2009-10-24 Kamil Ignacak * config: changes in Tools page of config window: - new "manual selection" checkbox that shows or hides items in the panel, switching between manual and automatic selection of tools - new dropdown "tools for dvd" where user can select if (in case of manual tools selection) DVD discs will be handled by growisofs and related tools, or by cdrecord; currently only growisofs is available in the dropdown, but cdrecord will be added in final version; other tools (like xorriso) also can be added; similar dropdown for CD disc is also planned; * write wizard: when opening configuration window from write wizard, "Tools" tab is disabled to prevent changing tool sets (cdrecord vs growisofs) in the middle of preparations for writing; 2009-10-10 Kamil Ignacak * ui: two main menu items: "Copy data CD" and "Copy audio CD" are now merged into "Copy CD", which works for both data and audio CD; tooltip for the button was updated accordingly; 2009-10-04 Kamil Ignacak: * dvd+r dl: today's modifications make support for DVD+R DL turned off by default, the support can be turned on by calling cdw with command line argument; please see utils.c -> process_commandline_args() for name of this option 2009-10-03 Kamil Ignacak * general: on some occasions cdw consumed 100% of available CPU time because of idle looping; I have fixed this by slight modification in threads code; * dvd+r dl: added pieces of code that enable recognizing DVD+R DL and writing to DVD+R DL using cdrecord; after wasting 20 or so DVD+R DL discs I decided that support for DVD+R DL will be disabled by default, because I can't get correct results neither with growisofs nor cdrecord; a disc is burned, but verification of burned data fails; there are several possible culprits: kernel configuration, drive (used-up burner, old firmware), media (cheap discs), software (insufficient support by burning software); I did tests with Cdrecord-ProDVD-ProBD-Clone 2.01.01a37, growisofs 7.1, xorriso 0.3.4, xfburn 0.4.2 (libburn 0.6.4-1, libisofs 0.6.16-1) and two types of media using DRW-2014L1T burner; I can't provide official support for DVD+R DL until I can do fully correct, verifiable burning; in this commit the feature will be still enabled, next commit will include code which enables the feature only after specifying command line argument for cdw * cdrecord: if cdrecord complained about incorrect driver option "burnproof", it shouldn't do this anymore, since the option is now corrected as "burnfree" 2009-09-23 Kamil Ignacak * dvd+r dl: this commit contains few changes that are basis for supporting DVD+R DL disc; the support is very, very basic: only writing files as first session to empty DVD+R DL disc; this is barely tested, so don't depend on this feature; 2009-08-30 Kamil Ignacak * tests: added more unit tests for functions from cdw_file.c; I will be moving all unit test code to the same source code files in which tested functions are defined, and away from *_tests.c files - this is to reduce number of source files, solve problem of "unit test files in separate dir" vs. "unit test files always with their respective files", and ensure that unit testing code always has access to all functions in given c file, without using declarations of all functions in h file (which was "dirty" way to do things); first example of this approach is cdw_file.c: first come definitions of cdw_file*() functions, and then there is part of file with unit tests 2009-08-09 Kamil Ignacak * general: it turned out that there are still some changes to do in source code files; also updated Makefile.am file, cdw.pot and some documentation; now I'm even closer to release 2009-08-02 Kamil Ignacak * general: I'm done with testing, new cdw.pot file is generated, program version is updated, debug messages are disabled - source files are is ready, just need to update man page and README; 2009-06-27 Kamil Ignacak * ui, external tools: today's commit (and some previous as well) adds capturing and handling of some errors reported by external tools (like mkisfos and cdrecord); most often "handling" is nothing more than a message dialog stating that tool X reported problem Y, and in few cases some form of solution is suggested 2009-05-23 Kamil Ignacak * configuration: added direct support for padsize option of cdrecord, user can now enter value in appropriate field in config window; he is informed that it is recommended to use pad ('-pad') and padsize ('padsize') options of cdrecord, in the second case suggested value of the parameter (63) is specified in config window; see http://www.troubleshooters.com/linux/coasterless.htm for details on usage of padsize option; 2009-05-15 Kamil Ignacak * ui: now user can shift content of file listings (in file selector and in list of selected files) to view long file or dir names that may be truncated in not-too-wide windows; 2009-05-14 Kamil Ignacak * filesystem module: on some systems cdw might have not recognized correctly when disc was mounted, because device path provided in configuration can be in reality a link to device file; today's commit fixes this (cdw_fs.c) 2009-04-09 Kamil Ignacak * cdw testing facility: cdw_tests now recognizes '-i' command line option, which enables interactive tests: right now only testing of drive tray is implemented * writing image: writing image as initial session of multisession CD disc is now disabled, because I have some problems with discs written this way (can't read them properly) 2009-03-22 Kamil Ignacak * configuration: adding "Follow symbolic links" option that influences what is included in generated ISO image and how size of selected files is counted; 2009-03-15 Kamil Ignacak * compile-time: build tool no longer checks for external tools (cdrecord, mkisofs, etc.) at run-time, now application searches the tools at run time; this means that packager doesn't have to have the tools installed when he prepares deb or rpm package; this also means these tools can be installed on user's system after he compiles cdw; * write wizard: now write wizard doesn't display "verify" checkbox if there is no "md5sum" tool installed on user's system; * configuration: configuring paths to external tools (i.e. selecting desired version of tool if there are two or more various available on user's system) now (kinda) works: it hasn't been tested extensively, but it seems to work; 2009-03-08 Kamil Ignacak * configuration: moving towards discovering of paths to external tools (cdrecord, mkisofs, growisofs, dvd+rw-mediainfo, dvd+rw-format) at runtime; this is not yet 100% ready, but the basics are already there ("which" code, external_tools.c) 2009-03-07 Kamil Ignacak * iso file: user is presented with dialog window that allows him to enter path to iso file when he wants to create new iso image file or when he wants to write iso image file to disc; thanks to this user is not surprised or confused what or where sth is written / burned; 2009-03-02 Kamil Ignacak * configuration: removed "dao" checkbox, this option (in expanded form) is now available in write wizard; * write wizard: write wizard dialog window now displays a dropdown in which user can select "tao", "dao" or "default" value for mode of writing data to disc; * progress window: progress information for writing to CD with cdrecord now can display progress more smoothly, without jumps in progress values thanks to improvements in thread.c 2009-02-28 Kamil Ignacak: * configuration: configuration window was remodeled: now it has five pages: "Writing", "Hardware", "Audio", "ISO filesystem" and "Tools". This new division should make finding right option easier. "Tools" page has paths to external tools used by cdw (like cdrecord or md5sum), but for now they are inactive. In future this will allow me to remove compile-time requirement of having these tools installed at compile time; additionally user will be able to select other implementation of, say, cdrecord. Order of pages can be easily changed to match requirements of user. * speeds of writing to CD: I deployed new (correct) method of getting allowed / available speeds for writing to CD; previously list of available writing speeds was incorrect, so if user selected value from this list, it was most probably ignored by cdrecord; now it should work correctly; cdw-0.7.1/configure.ac0000644000175000017500000001207011722442157011510 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # AC_PREREQ(2.61) AC_INIT(cdw, 0.7.1, acerion@wp.pl) AM_INIT_AUTOMAKE(cdw, 0.7.1) # part of checking (autoconf) and building (automake) systems AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # needed since adding convenience library in gnulib/lib dir AC_PROG_YACC # enabe usage of per-target preprocessor flags AM_PROG_CC_C_O # Checks for libraries. Succesfull AC_CHECK_LIB will append "-l" # to compiler flags (to LIBS?), unless third argument to the macro defines # some other "action-if-found" is defined; we define empty (dummy) # "action-if-found" with bash built in null command ":" # reference: # http://www.gnu.org/software/autoconf/manual/autoconf.html#Libraries # http://tldp.org/LDP/abs/html/special-chars.html AC_CHECK_LIB([cdio], [cdio_open], [:], [echo -e "\nError! Can't find cdio library (part of cdio project).\n" exit -1]) AC_CHECK_LIB([iso9660], [iso9660_open], [:], [echo -e "\nError! Can't find iso9660 library (part of cdio project).\n" exit -1]) AC_CHECK_LIB([formw], [new_form], [:], [echo -e "\nError! Can't find formw library (part of ncurses project).\n" exit -1]) AC_CHECK_LIB([menuw], [new_menu], [:], [echo -e "\nError! Can't find menuw library (part of ncurses project).\n" exit -1]) AC_CHECK_LIB([ncursesw], [newwin], [:], [echo -e "\nError! Can't find ncursesw library (part of ncurses project).\n" exit -1]) AC_CHECK_LIB([panelw], [new_panel], [:], [echo -e "\nError! Can't find panelw library (part of ncurses project).\n" exit -1]) AC_CHECK_LIB([pthread], [pthread_create], [:], [echo -e "\nError! Can't find pthread library.\n" exit -1]) AC_CHECK_LIB([burn], [burn_initialize], [:], [echo -e "\nError! Can't find burn library.\n" exit -1]) #enable_debug=no AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debug messages printed to stderr, include debug info for gdb]), [enable_debug=yes], [enable_debug=no]) AC_MSG_CHECKING([whether to enable debugging]) if test "x$enable_debug" = "xyes" then CFLAGS= # cure annoying default arguments for CFLAGS AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi # conditionals: http://sources.redhat.com/autobook/autobook/autobook_179.html AM_CONDITIONAL(CDW_BUILD_DEBUG_ENABLED, test "$enable_debug" = yes) # info about "x$var_name" thing: # http://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyes # program used to generate man page AC_CHECK_PROG(TXT2TAGS, txt2tags, txt2tags, "") if test "x$TXT2TAGS" = "x" then AC_MSG_NOTICE([Can't find txt2tags program. cdw man page won't be built locally, cdw.1 file from distribution package will be used instead.]) fi if test "x$prefix" = xNONE; then prefix="${ac_default_prefix}" fi AC_DEFINE(GNULIB_CANONICALIZE, 1, [gnulib provides canonicalize_filename_mode()]) AC_DEFINE_UNQUOTED(LOCALEDIR, "${prefix}/share/locale/", [Checking localdir...]) AC_DEFINE_UNQUOTED(DOCDIR, "${prefix}/share/doc/${PACKAGE}/", [Checking docdir...]) AC_DEFINE_UNQUOTED(CDWDIR, "${prefix}/share/${PACKAGE}/", [Checking binary dir...]) AC_DEFINE_UNQUOTED(COMMON, "/usr/share/common-licenses/", [Checking common licenses dir...]) # Checks for header files. AC_FUNC_ALLOCA AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h libintl.h locale.h limits.h malloc.h nl_types.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h unistd.h cdio/cdio.h cdio/mmc.h cdio/iso9660.h mntent.h]) AC_CHECK_HEADERS([ncursesw/form.h ncursesw/menu.h ncursesw/ncurses.h ncursesw/panel.h]) AC_CHECK_HEADERS([form.h menu.h ncurses.h panel.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_INLINE AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_CHECK_MEMBERS([struct stat.st_blksize]) AC_STRUCT_ST_BLOCKS AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T AC_CHECK_TYPES([ptrdiff_t]) # Checks for library functions. # AM_GNU_GETTEXT AC_FUNC_FORK AC_FUNC_GETMNTENT AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_FUNC_MALLOC AC_FUNC_MMAP AC_FUNC_REALLOC # AC_FUNC_CLOSEDIR_VOID AC_FUNC_FORK AC_FUNC_LSTAT AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_FUNC_STAT # AC_FUNC_STRFTIME AC_CHECK_FUNCS([getpass mempcpy memset mkdir regcomp setlocale \ strncasecmp strrchr strspn strdup asprintf \ canonicalize_file_name floor getmntent memmove \ pathconf realpath resolvepath setenv strerror \ strndup strpbrk strtol]) # Checks for system services. # let autoconf generate a configure script that will # output Makefiles for some directories: AC_CONFIG_FILES([Makefile src/Makefile gnulib/Makefile gnulib/lib/Makefile man/Makefile src/external_tools/Makefile src/tasks/Makefile src/user_interface/widgets/Makefile src/user_interface/Makefile src/disc_and_drive/Makefile src/native_file_system/Makefile src/optical_file_systems/Makefile src/configuration/Makefile src/utilities/Makefile]) AC_OUTPUT cdw-0.7.1/ABOUT-NLS0000644000175000017500000002660307475402072010462 00000000000000Notes on the Free Translation Project ************************************* Free software is going international! The Free Translation Project is a way to get maintainers of free software, translators, and users all together, so that will gradually become able to speak many languages. A few packages already provide translations for their messages. If you found this `ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU `gettext' internally, itself available at your nearest GNU archive site. But you do *not* need to install GNU `gettext' prior to configuring, installing or using this package with messages translated. Installers will find here some useful hints. These notes also explain how users should proceed for getting the programs to use the available translations. They tell how people wanting to contribute and work at translations should contact the appropriate team. When reporting bugs in the `intl/' directory or bugs which may be related to internationalization, you should tell about the version of `gettext' which is used. The information can be found in the `intl/VERSION' file, in internationalized packages. One advise in advance ===================== If you want to exploit the full power of internationalization, you should configure it using ./configure --with-included-gettext to force usage of internationalizing routines provided within this package, despite the existence of internationalizing capabilities in the operating system where this package is being installed. So far, only the `gettext' implementation in the GNU C library version 2 provides as many features (such as locale alias or message inheritance) as the implementation here. It is also not possible to offer this additional functionality on top of a `catgets' implementation. Future versions of GNU `gettext' will very likely convey even more functionality. So it might be a good idea to change to GNU `gettext' as soon as possible. So you need not provide this option if you are using GNU libc 2 or you have installed a recent copy of the GNU gettext package with the included `libintl'. INSTALL Matters =============== Some packages are "localizable" when properly installed; the programs they contain can be made to speak your own native language. Most such packages use GNU `gettext'. Other packages have their own ways to internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system provides usable `catgets' (if using this is selected by the installer) or `gettext' functions. If neither is available, the GNU `gettext' own library will be used. This library is wholly contained within this package, usually in the `intl/' subdirectory, so prior installation of the GNU `gettext' package is *not* required. Installers may use special options at configuration time for changing the default behaviour. The commands: ./configure --with-included-gettext ./configure --with-catgets ./configure --disable-nls will respectively bypass any pre-existing `catgets' or `gettext' to use the internationalizing routines provided within this package, enable the use of the `catgets' functions (if found on the locale system), or else, *totally* disable translation of messages. When you already have GNU `gettext' installed on your system and run configure without an option for your new package, `configure' will probably detect the previously built and installed `libintl.a' file and will decide to use this. This might be not what is desirable. You should use the more recent version of the GNU `gettext' library. I.e. if the file `intl/VERSION' shows that the library which comes with this package is more recent, you should use ./configure --with-included-gettext to prevent auto-detection. By default the configuration process will not test for the `catgets' function and therefore they will not be used. The reasons are already given above: the emulation on top of `catgets' cannot provide all the extensions provided by the GNU `gettext' library. If you nevertheless want to use the `catgets' functions use ./configure --with-catgets to enable the test for `catgets' (this causes no harm if `catgets' is not available on your system). If you really select this option we would like to hear about the reasons because we cannot think of any good one ourself. Internationalized packages have usually many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless translations have been forbidden at `configure' time by using the `--disable-nls' switch, all available translations are installed together with the package. However, the environment variable `LINGUAS' may be set, prior to configuration, to limit the installed set. `LINGUAS' should then contain a space separated list of two-letter codes, stating which languages are allowed. Using This Package ================== As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate ISO 639 `LL' two-letter code prior to using the programs in the package. For example, let's suppose that you speak German. At the shell prompt, merely execute `setenv LANG de' (in `csh'), `export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This can be done from your `.login' or `.profile' file, once and for all. An operating system might already offer message localization for many of its programs, while other programs have been installed locally with the full capabilities of GNU `gettext'. Just using `gettext' extended syntax for `LANG' would break proper localization of already available operating system programs. In this case, users should set both `LANGUAGE' and `LANG' variables in their environment, as programs using GNU `gettext' give preference to `LANGUAGE'. For example, some Swedish users would rather read translations in German than English for when Swedish is not available. This is easily accomplished by setting `LANGUAGE' to `sv:de' while leaving `LANG' to `sv'. Translating Teams ================= For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list, courtesy of Linux International. You may reach your translation team at the address `LL@li.org', replacing LL by the two-letter ISO 639 code for your language. Language codes are *not* the same as the country codes given in ISO 3166. The following translation teams exist, as of December 1997: Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en', Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja', Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es', Swedish `sv', and Turkish `tr'. For example, you may reach the Chinese translation team by writing to `zh@li.org'. If you'd like to volunteer to *work* at translating messages, you should become a member of the translating team for your own language. The subscribing address is *not* the same as the list itself, it has `-request' appended. For example, speakers of Swedish can send a message to `sv-request@li.org', having this message body: subscribe Keep in mind that team members are expected to participate *actively* in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to get started, please write to `translation@iro.umontreal.ca' to reach the coordinator for all translator teams. The English team is special. It works at improving and uniformizing the terminology in use. Proven linguistic skill are praised more than programming skill, here. Available Packages ================== Languages are not equally supported in all packages. The following matrix shows the current state of internationalization, as of December 1997. The matrix shows, in regard of each package, for which languages PO files have been submitted to translation coordination. Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv .----------------------------------------------------. bash | [] [] [] | 3 bison | [] [] [] | 3 clisp | [] [] [] [] | 4 cpio | [] [] [] [] [] [] | 6 diffutils | [] [] [] [] [] | 5 enscript | [] [] [] [] [] [] | 6 fileutils | [] [] [] [] [] [] [] [] [] [] | 10 findutils | [] [] [] [] [] [] [] [] [] | 9 flex | [] [] [] [] | 4 gcal | [] [] [] [] [] | 5 gettext | [] [] [] [] [] [] [] [] [] [] [] | 12 grep | [] [] [] [] [] [] [] [] [] [] | 10 hello | [] [] [] [] [] [] [] [] [] [] [] | 11 id-utils | [] [] [] | 3 indent | [] [] [] [] [] | 5 libc | [] [] [] [] [] [] [] | 7 m4 | [] [] [] [] [] [] | 6 make | [] [] [] [] [] [] | 6 music | [] [] | 2 ptx | [] [] [] [] [] [] [] [] | 8 recode | [] [] [] [] [] [] [] [] [] | 9 sh-utils | [] [] [] [] [] [] [] [] | 8 sharutils | [] [] [] [] [] [] | 6 tar | [] [] [] [] [] [] [] [] [] [] [] | 11 texinfo | [] [] [] | 3 textutils | [] [] [] [] [] [] [] [] [] | 9 wdiff | [] [] [] [] [] [] [] [] | 8 `----------------------------------------------------' 17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv 27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are used for implementing regional variants of languages, or language dialects. For a PO file in the matrix above to be effective, the package to which it applies should also have been internationalized and distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. If December 1997 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. cdw-0.7.1/config.h.in0000644000175000017500000002355411722444340011252 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Checking binary dir... */ #undef CDWDIR /* Checking common licenses dir... */ #undef COMMON /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Checking docdir... */ #undef DOCDIR /* gnulib provides canonicalize_filename_mode() */ #undef GNULIB_CANONICALIZE /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF /* Define to 1 if you have the `canonicalize_file_name' function. */ #undef HAVE_CANONICALIZE_FILE_NAME /* Define to 1 if you have the header file. */ #undef HAVE_CDIO_CDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_CDIO_ISO9660_H /* Define to 1 if you have the header file. */ #undef HAVE_CDIO_MMC_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `floor' function. */ #undef HAVE_FLOOR /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the header file. */ #undef HAVE_FORM_H /* Define to 1 if you have the `getmntent' function. */ #undef HAVE_GETMNTENT /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the `getpass' function. */ #undef HAVE_GETPASS /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if `lstat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_LSTAT_EMPTY_STRING_BUG /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the header file. */ #undef HAVE_MENU_H /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file. */ #undef HAVE_MNTENT_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSESW_FORM_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSESW_MENU_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSESW_NCURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSESW_PANEL_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_NL_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_PANEL_H /* Define to 1 if you have the `pathconf' function. */ #undef HAVE_PATHCONF /* Define to 1 if the system has the type `ptrdiff_t'. */ #undef HAVE_PTRDIFF_T /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the `resolvepath' function. */ #undef HAVE_RESOLVEPATH /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP /* Define to 1 if you have the `strpbrk' function. */ #undef HAVE_STRPBRK /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strspn' function. */ #undef HAVE_STRSPN /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS /* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #undef HAVE_ST_BLOCKS /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Checking localdir... */ #undef LOCALEDIR /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define for Solaris 2.5.1 so the uint8_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT8_T /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef uint16_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define to the type of an unsigned integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef uint8_t /* Define as `fork' if `vfork' does not work. */ #undef vfork cdw-0.7.1/install-sh0000644000175000017500000003160010670754623011230 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) mode=$2 shift shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac done if test $# -ne 0 && test -z "$dir_arg$dstarg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix=/ ;; -*) prefix=./ ;; *) prefix= ;; esac case $posix_glob in '') if (set -f) 2>/dev/null; then posix_glob=true else posix_glob=false fi ;; esac oIFS=$IFS IFS=/ $posix_glob && set -f set fnord $dstdir shift $posix_glob && set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dst"; then $doit $rmcmd -f "$dst" 2>/dev/null \ || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } } || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: cdw-0.7.1/COPYING0000644000175000017500000004325111646120523010255 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. cdw-0.7.1/config.rpath0000755000175000017500000003521710000613345011525 00000000000000#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2003 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; mingw* | pw32* | os2*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; newsos6) ;; linux*) case $CC in icc|ecc) wl='-Wl,' ;; ccc) wl='-Wl,' ;; esac ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; sco3.2v5*) ;; solaris*) wl='-Wl,' ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) wl='-Wl,' ;; sysv4*MP*) ;; uts4*) ;; esac fi # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then case "$host_os" in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi4*) ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then hardcode_direct=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd1*) ld_shlibs=no ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; freebsd2*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10* | hpux11*) if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=no ;; ia64*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; *) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; openbsd*) hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; sco3.2v5*) ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4.2uw2*) hardcode_direct=yes hardcode_minus_L=no ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) ;; sysv5*) hardcode_libdir_flag_spec= ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. libname_spec='lib$name' case "$host_os" in aix3*) ;; aix4* | aix5*) ;; amigaos*) ;; beos*) ;; bsdi4*) ;; cygwin* | mingw* | pw32*) shrext=.dll ;; darwin* | rhapsody*) shrext=.dylib ;; dgux*) ;; freebsd1*) ;; freebsd*) ;; gnu*) ;; hpux9* | hpux10* | hpux11*) case "$host_cpu" in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac ;; irix5* | irix6* | nonstopux*) case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux*) ;; netbsd*) ;; newsos6) ;; nto-qnx) ;; openbsd*) ;; os2*) libname_spec='$name' shrext=.dll ;; osf3* | osf4* | osf5*) ;; sco3.2v5*) ;; solaris*) ;; sunos4*) ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; sysv4*MP*) ;; uts4*) ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: cdw-0.7.1/src/0000755000175000017500000000000011736031301010057 500000000000000cdw-0.7.1/src/user_interface/0000755000175000017500000000000011736031302013056 500000000000000cdw-0.7.1/src/user_interface/cdw_help.c0000644000175000017500000001777611725463030014756 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "cdw_main_window.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "gettext.h" #include "cdw_help.h" #include "cdw_debug.h" /** \brief Show window with list of hotkeys available in main application window */ void show_help_main(void) { int n_lines = 20; int n_cols = 60; cdw_assert (LINES > n_lines, "ERROR: LINES is too small: %d\n", LINES); cdw_assert (COLS > n_cols, "ERROR: COLS is too small: %d\n", COLS); int begin_y = (LINES - n_lines) / 2; int begin_x = (COLS - n_cols) / 2; WINDOW *window = cdw_window_new((WINDOW *) NULL, n_lines, n_cols, begin_y, begin_x, CDW_COLORS_DIALOG, /* 2TRANS: this is title of small help window displaying hotkeys */ _("Help"), /* 2TRANS: this is message at the bottom of help window */ _("Press ESCAPE to close window")); if (window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create window for help panel\n"); return; } int col = 2; int r = 2; /* 2TRANS: this is label explaining content of help window */ mvwprintw(window, r++, col, _("Hotkeys available in main window:")); /* 2TRANS: this is hotkey label: "show this help window"; keep position of '-' */ mvwprintw(window, r++, col,_("F1, H, ? - Show this help")); /* 2TRANS: this is hotkey label: "show window displaying cdw license"; keep position of '-' */ mvwprintw(window, r++, col, _("F9 / F10 - Show license of this program")); /* 2TRANS: this is hotkey label; keep position of '-' */ mvwprintw(window, r++, col, _("C - Show Configuration window")); /* 2TRANS: this is hotkey label: "show window with some disc meta-data"; keep position of '-' */ mvwprintw(window, r++, col, _("D - Show information about disc")); /* 2TRANS: this is hotkey label: "eject tray of your CD/DVD drive"; keep position of '-' */ mvwprintw(window, r++, col, _("E - Eject drive tray")); /* 2TRANS: this is hotkey label: "burn files that you selected to optical disc"; keep position of '-' */ mvwprintw(window, r++, col, _("F - Write selected files to disc")); /* 2TRANS: this is hotkey label, it means "copy tracks from audio or data CD to your hard disc"; keep position of '-' */ mvwprintw(window, r++, col, _("G - Read content of CD")); /* 2TRANS: this is hotkey label: "burn ISO9660 file to optical disc"; keep position of '-' */ mvwprintw(window, r++, col, _("I - Write ISO image to disc")); /* 2TRANS: this is hotkey label: "show window displaying log file of cdw program"; keep position of '-' */ mvwprintw(window, r++, col, _("L - Show log file")); /* 2TRANS: this is hotkey label: "read some information about disc that is in drive and display it in app window"; keep position of '-' */ mvwprintw(window, r++, col, _("R - Refresh information about disc")); /* 2TRANS: this is hotkey label: "verify data in disc or on optical media */ mvwprintw(window, r++, col, _("V - Verify data")); /* 2TRANS: this is hotkey label, it means "close application"; keep position of '-' */ mvwprintw(window, r++, col, _("Q - Quit cdw")); r++; /* 2TRANS: this is label explaining content of help window */ mvwprintw(window, r++, col, _("Hotkeys available in other places:")); /* 2TRANS: this is label in a window, describing hotkeys */ mvwprintw(window, r++, col, _("'Q', 'q' and 'Escape' - 'close'/'quit' action")); wrefresh(window); int key = 'a'; while (key != CDW_KEY_ESCAPE && key != 'q' && key != 'Q') { key = wgetch(window); } cdw_window_delete(&window); cdw_main_ui_main_window_wrefresh_part(n_lines, n_cols, begin_y, begin_x); return; } void show_help_cddb(void) { int c = 0; WINDOW *help=newwin(20,60,(LINES-20)/2,(COLS-60)/2); wbkgd(help, COLOR_PAIR(CDW_COLORS_DIALOG)); werase(help); box(help,0,0); keypad(help, TRUE); mvwaddch(help, 0, 2, ACS_RTEE); mvwprintw(help, 0, 3, " %s ", _("Help")); waddch(help, ACS_LTEE); mvwprintw(help, 19, 2, "( %s )", _("Press ESC to close window")); mvwprintw(help, 2, 2, "%s", _("-> - Step into catalogized files window")); mvwprintw(help, 3, 2, "%s", _("<- - Step into menu window")); mvwprintw(help, 4, 2, "%s", _("ENTER - Change category or disk or directory")); mvwprintw(help, 5, 2, "%s", _("BSPACE")); mvwprintw(help, 6, 2, "%s", _("/ - Move one level up")); mvwprintw(help, 7, 2, "%s", _("DEL - Delete category or disk")); mvwprintw(help, 8, 2, "%s", _("A - Add disk into catalog")); mvwprintw(help, 9, 2, "%s", _("S - Show all disks")); mvwprintw(help,10, 2, "%s", _("Q - Quit Disk catalog")); wrefresh(help); while (c != CDW_KEY_ESCAPE) { c=wgetch(help); } delwin(help); } void display_tooltip(int item) { WINDOW *subwindow = cdw_main_ui_get_tooltips_subwindow(); cdw_assert (subwindow != (WINDOW *) NULL, "ERROR: tooltips subwindow is not initialized yet\n"); werase(subwindow); switch(item) { case CDW_MENU_ADD_FILES: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Select files from hard drive for further processing."), CDW_ALIGN_LEFT); break; case CDW_MENU_DELETE_FILES: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Deselect files from list using Delete key."), CDW_ALIGN_LEFT); break; case CDW_MENU_CREATE_IMAGE: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Create ISO9660 image from selected files."), CDW_ALIGN_LEFT); break; case CDW_MENU_RIP_DISC: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Copy content of optical disc to to your hard drive."), CDW_ALIGN_LEFT); break; case CDW_MENU_BURN_FILES: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Write selected files to optical disc."), CDW_ALIGN_LEFT); break; case CDW_MENU_BURN_IMAGE: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Write ISO9660 image file to optical disc."), CDW_ALIGN_LEFT); break; case CDW_MENU_ERASE_DISC: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Blank CD-RW or DVD+/-RW disc. Reformat DVD-RW disc."), CDW_ALIGN_LEFT); break; case CDW_MENU_VERIFY: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Calculate a digest of a file or data on optical disc."), CDW_ALIGN_LEFT); break; case CDW_MENU_CONFIG: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("cdw configuration: hardware, external tools and other."), CDW_ALIGN_LEFT); break; case CDW_MENU_EXIT_CDW: /* 2TRANS: this is tooltip displayed at the bottom of main cdw window */ cdw_window_print_message(subwindow, _("Close this program, return to command line session."), CDW_ALIGN_LEFT); break; default: werase(subwindow); break; } wrefresh(subwindow); return; } cdw-0.7.1/src/user_interface/Makefile.in0000644000175000017500000016354311722443565015074 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.cdw.am subdir = src/user_interface ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libcdwuserinterface_a_AR = $(AR) $(ARFLAGS) libcdwuserinterface_a_LIBADD = am__objects_1 = cdw_colors.$(OBJEXT) cdw_ncurses.$(OBJEXT) \ cdw_form.$(OBJEXT) cdw_list_display.$(OBJEXT) \ cdw_processwin.$(OBJEXT) cdw_window.$(OBJEXT) \ cdw_text_file_viewer.$(OBJEXT) cdw_write_wizard.$(OBJEXT) \ cdw_iso9660_wizard.$(OBJEXT) cdw_erase_wizard.$(OBJEXT) \ cdw_verify_wizard.$(OBJEXT) cdw_main_window.$(OBJEXT) \ cdw_help.$(OBJEXT) cdw_tabs_window.$(OBJEXT) am_libcdwuserinterface_a_OBJECTS = $(am__objects_1) libcdwuserinterface_a_OBJECTS = $(am_libcdwuserinterface_a_OBJECTS) libcdwuserinterface_check_a_AR = $(AR) $(ARFLAGS) libcdwuserinterface_check_a_LIBADD = am__objects_2 = libcdwuserinterface_check_a-cdw_colors.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_ncurses.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_form.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_list_display.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_processwin.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_window.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_text_file_viewer.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_write_wizard.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_iso9660_wizard.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_erase_wizard.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_verify_wizard.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_main_window.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_help.$(OBJEXT) \ libcdwuserinterface_check_a-cdw_tabs_window.$(OBJEXT) am_libcdwuserinterface_check_a_OBJECTS = $(am__objects_2) libcdwuserinterface_check_a_OBJECTS = \ $(am_libcdwuserinterface_check_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libcdwuserinterface_a_SOURCES) \ $(libcdwuserinterface_check_a_SOURCES) DIST_SOURCES = $(libcdwuserinterface_a_SOURCES) \ $(libcdwuserinterface_check_a_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ METASOURCES = AUTO SUBDIRS = widgets sources = cdw_colors.c cdw_colors.h \ cdw_ncurses.c cdw_ncurses.h \ cdw_form.c cdw_form.h \ cdw_list_display.c cdw_list_display.h \ cdw_processwin.c cdw_processwin.h \ cdw_widgets.h \ cdw_window.c cdw_window.h \ cdw_text_file_viewer.c cdw_text_file_viewer.h \ cdw_write_wizard.c cdw_write_wizard.h \ cdw_iso9660_wizard.c cdw_iso9660_wizard.h \ cdw_erase_wizard.c cdw_erase_wizard.h \ cdw_verify_wizard.c cdw_verify_wizard.h \ cdw_main_window.c cdw_main_window.h \ cdw_help.c cdw_help.h \ cdw_tabs_window.c cdw_tabs_window.h # _FILE_OFFSET_BITS=64 - large file support (>2GB on 32-bit systems); # this is unnecessary on 64-bit systems, but I had to add this # after doing some basic tests on i386 machine; see sourceforge # #2545568 defect for details; # # This is aso required by libburn - see information on top of # /usr/include/libburn/libburn.h # "include" files of convenience libraries # don't use $(top_builddir), it fails during "make distcheck" CDW_BUILD_CPPFLAGS = -D _FILE_OFFSET_BITS=64 -I$(top_srcdir)/src/ \ -I$(top_srcdir)/src/external_tools/ -I$(top_srcdir)/src/tasks/ \ -I$(top_srcdir)/src/utilities/ \ -I$(top_srcdir)/src/user_interface/widgets/ \ -I$(top_srcdir)/src/user_interface/ \ -I$(top_srcdir)/src/configuration/ \ -I$(top_srcdir)/src/native_file_system/ \ -I$(top_srcdir)/src/optical_file_systems/ \ -I$(top_srcdir)/src/disc_and_drive/ \ -I$(top_srcdir)/gnulib/lib/ # quoted descriptions of flags come from # http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html # using C99 standard + gnu extensions; I don't use pure c99, because # it may trigger problems caused by asm/byteorder.h, which is included # by linux/cdrom.h header, which in turn is included by cdw_drive.h CDW_BUILD_CFLAGS_C_STD = -std=gnu99 CDW_BUILD_CFLAGS_PEDANTIC = -pedantic # "Check calls to printf and scanf, etc., to make sure that the arguments # supplied have types appropriate to the format string specified..." # "If -Wformat is specified, also warn about uses of format functions that # represent possible security problems..." # "If -Wformat is specified, also warn if the format string is not # a string literal..." # "These warnings will help you find at compile time code that can try # to write into a string constant..." # "Warn about anything that depends on the “size of” a function type or # of void...." # "Warn whenever a switch statement does not have a default case" # sometimes gcc can complain about unreachable code when using constant # strings like that: strcmp(some_string, "some string"); # "Warn whenever a pointer is cast such that the required alignment of # the target is increased..." # "Warn whenever a pointer is cast so as to remove a type qualifier from # the target type..." # "Warn whenever a function call is cast to a non-matching type..." CDW_BUILD_CFLAGS_WARNINGS = -Wformat -Wformat-security \ -Wformat-nonliteral -Wwrite-strings -Wpointer-arith \ -Wswitch-default -Wunreachable-code -Wcast-align -Wcast-qual \ -Wbad-function-cast -Wall -Wshadow -Wextra -Wswitch-enum \ -Wfloat-equal -Wchar-subscripts -Winline -Wsign-compare \ -Wnested-externs -Wredundant-decls -Wconversion -Wlogical-op \ -Wno-declaration-after-statement -Wmissing-prototypes \ -Wmissing-declarations -Wstrict-prototypes @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) -DNDEBUG @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -O2 @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -g -O0 $(CDW_BUILD_CFLAGS_WARNINGS) $(CDW_BUILD_CFLAGS_PEDANTIC) # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake # don't use $(top_builddir), it fails during "make distcheck" # static convenience library; "noinst" means: "build, but # don't install in user's system" noinst_LIBRARIES = libcdwuserinterface.a libcdwuserinterface_a_SOURCES = $(sources) # library built only for purposes of testing (checking) check_LIBRARIES = libcdwuserinterface_check.a libcdwuserinterface_check_a_SOURCES = $(sources) libcdwuserinterface_check_a_CPPFLAGS = -DCDW_UNIT_TEST_CODE $(AM_CPPFLAGS) all: all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.cdw.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/user_interface/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/user_interface/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.cdw.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkLIBRARIES: -test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES) clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libcdwuserinterface.a: $(libcdwuserinterface_a_OBJECTS) $(libcdwuserinterface_a_DEPENDENCIES) $(EXTRA_libcdwuserinterface_a_DEPENDENCIES) -rm -f libcdwuserinterface.a $(libcdwuserinterface_a_AR) libcdwuserinterface.a $(libcdwuserinterface_a_OBJECTS) $(libcdwuserinterface_a_LIBADD) $(RANLIB) libcdwuserinterface.a libcdwuserinterface_check.a: $(libcdwuserinterface_check_a_OBJECTS) $(libcdwuserinterface_check_a_DEPENDENCIES) $(EXTRA_libcdwuserinterface_check_a_DEPENDENCIES) -rm -f libcdwuserinterface_check.a $(libcdwuserinterface_check_a_AR) libcdwuserinterface_check.a $(libcdwuserinterface_check_a_OBJECTS) $(libcdwuserinterface_check_a_LIBADD) $(RANLIB) libcdwuserinterface_check.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_colors.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_erase_wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_form.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_iso9660_wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_list_display.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_main_window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_ncurses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_processwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_tabs_window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_text_file_viewer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_verify_wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_write_wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_colors.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_erase_wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_form.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_iso9660_wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_list_display.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_main_window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_ncurses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_processwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_tabs_window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_text_file_viewer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_verify_wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwuserinterface_check_a-cdw_write_wizard.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` libcdwuserinterface_check_a-cdw_colors.o: cdw_colors.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_colors.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_colors.Tpo -c -o libcdwuserinterface_check_a-cdw_colors.o `test -f 'cdw_colors.c' || echo '$(srcdir)/'`cdw_colors.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_colors.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_colors.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_colors.c' object='libcdwuserinterface_check_a-cdw_colors.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_colors.o `test -f 'cdw_colors.c' || echo '$(srcdir)/'`cdw_colors.c libcdwuserinterface_check_a-cdw_colors.obj: cdw_colors.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_colors.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_colors.Tpo -c -o libcdwuserinterface_check_a-cdw_colors.obj `if test -f 'cdw_colors.c'; then $(CYGPATH_W) 'cdw_colors.c'; else $(CYGPATH_W) '$(srcdir)/cdw_colors.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_colors.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_colors.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_colors.c' object='libcdwuserinterface_check_a-cdw_colors.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_colors.obj `if test -f 'cdw_colors.c'; then $(CYGPATH_W) 'cdw_colors.c'; else $(CYGPATH_W) '$(srcdir)/cdw_colors.c'; fi` libcdwuserinterface_check_a-cdw_ncurses.o: cdw_ncurses.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_ncurses.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_ncurses.Tpo -c -o libcdwuserinterface_check_a-cdw_ncurses.o `test -f 'cdw_ncurses.c' || echo '$(srcdir)/'`cdw_ncurses.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_ncurses.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_ncurses.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_ncurses.c' object='libcdwuserinterface_check_a-cdw_ncurses.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_ncurses.o `test -f 'cdw_ncurses.c' || echo '$(srcdir)/'`cdw_ncurses.c libcdwuserinterface_check_a-cdw_ncurses.obj: cdw_ncurses.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_ncurses.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_ncurses.Tpo -c -o libcdwuserinterface_check_a-cdw_ncurses.obj `if test -f 'cdw_ncurses.c'; then $(CYGPATH_W) 'cdw_ncurses.c'; else $(CYGPATH_W) '$(srcdir)/cdw_ncurses.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_ncurses.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_ncurses.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_ncurses.c' object='libcdwuserinterface_check_a-cdw_ncurses.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_ncurses.obj `if test -f 'cdw_ncurses.c'; then $(CYGPATH_W) 'cdw_ncurses.c'; else $(CYGPATH_W) '$(srcdir)/cdw_ncurses.c'; fi` libcdwuserinterface_check_a-cdw_form.o: cdw_form.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_form.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_form.Tpo -c -o libcdwuserinterface_check_a-cdw_form.o `test -f 'cdw_form.c' || echo '$(srcdir)/'`cdw_form.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_form.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_form.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_form.c' object='libcdwuserinterface_check_a-cdw_form.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_form.o `test -f 'cdw_form.c' || echo '$(srcdir)/'`cdw_form.c libcdwuserinterface_check_a-cdw_form.obj: cdw_form.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_form.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_form.Tpo -c -o libcdwuserinterface_check_a-cdw_form.obj `if test -f 'cdw_form.c'; then $(CYGPATH_W) 'cdw_form.c'; else $(CYGPATH_W) '$(srcdir)/cdw_form.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_form.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_form.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_form.c' object='libcdwuserinterface_check_a-cdw_form.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_form.obj `if test -f 'cdw_form.c'; then $(CYGPATH_W) 'cdw_form.c'; else $(CYGPATH_W) '$(srcdir)/cdw_form.c'; fi` libcdwuserinterface_check_a-cdw_list_display.o: cdw_list_display.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_list_display.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_list_display.Tpo -c -o libcdwuserinterface_check_a-cdw_list_display.o `test -f 'cdw_list_display.c' || echo '$(srcdir)/'`cdw_list_display.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_list_display.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_list_display.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_list_display.c' object='libcdwuserinterface_check_a-cdw_list_display.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_list_display.o `test -f 'cdw_list_display.c' || echo '$(srcdir)/'`cdw_list_display.c libcdwuserinterface_check_a-cdw_list_display.obj: cdw_list_display.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_list_display.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_list_display.Tpo -c -o libcdwuserinterface_check_a-cdw_list_display.obj `if test -f 'cdw_list_display.c'; then $(CYGPATH_W) 'cdw_list_display.c'; else $(CYGPATH_W) '$(srcdir)/cdw_list_display.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_list_display.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_list_display.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_list_display.c' object='libcdwuserinterface_check_a-cdw_list_display.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_list_display.obj `if test -f 'cdw_list_display.c'; then $(CYGPATH_W) 'cdw_list_display.c'; else $(CYGPATH_W) '$(srcdir)/cdw_list_display.c'; fi` libcdwuserinterface_check_a-cdw_processwin.o: cdw_processwin.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_processwin.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_processwin.Tpo -c -o libcdwuserinterface_check_a-cdw_processwin.o `test -f 'cdw_processwin.c' || echo '$(srcdir)/'`cdw_processwin.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_processwin.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_processwin.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_processwin.c' object='libcdwuserinterface_check_a-cdw_processwin.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_processwin.o `test -f 'cdw_processwin.c' || echo '$(srcdir)/'`cdw_processwin.c libcdwuserinterface_check_a-cdw_processwin.obj: cdw_processwin.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_processwin.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_processwin.Tpo -c -o libcdwuserinterface_check_a-cdw_processwin.obj `if test -f 'cdw_processwin.c'; then $(CYGPATH_W) 'cdw_processwin.c'; else $(CYGPATH_W) '$(srcdir)/cdw_processwin.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_processwin.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_processwin.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_processwin.c' object='libcdwuserinterface_check_a-cdw_processwin.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_processwin.obj `if test -f 'cdw_processwin.c'; then $(CYGPATH_W) 'cdw_processwin.c'; else $(CYGPATH_W) '$(srcdir)/cdw_processwin.c'; fi` libcdwuserinterface_check_a-cdw_window.o: cdw_window.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_window.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_window.Tpo -c -o libcdwuserinterface_check_a-cdw_window.o `test -f 'cdw_window.c' || echo '$(srcdir)/'`cdw_window.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_window.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_window.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_window.c' object='libcdwuserinterface_check_a-cdw_window.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_window.o `test -f 'cdw_window.c' || echo '$(srcdir)/'`cdw_window.c libcdwuserinterface_check_a-cdw_window.obj: cdw_window.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_window.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_window.Tpo -c -o libcdwuserinterface_check_a-cdw_window.obj `if test -f 'cdw_window.c'; then $(CYGPATH_W) 'cdw_window.c'; else $(CYGPATH_W) '$(srcdir)/cdw_window.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_window.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_window.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_window.c' object='libcdwuserinterface_check_a-cdw_window.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_window.obj `if test -f 'cdw_window.c'; then $(CYGPATH_W) 'cdw_window.c'; else $(CYGPATH_W) '$(srcdir)/cdw_window.c'; fi` libcdwuserinterface_check_a-cdw_text_file_viewer.o: cdw_text_file_viewer.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_text_file_viewer.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_text_file_viewer.Tpo -c -o libcdwuserinterface_check_a-cdw_text_file_viewer.o `test -f 'cdw_text_file_viewer.c' || echo '$(srcdir)/'`cdw_text_file_viewer.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_text_file_viewer.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_text_file_viewer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_text_file_viewer.c' object='libcdwuserinterface_check_a-cdw_text_file_viewer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_text_file_viewer.o `test -f 'cdw_text_file_viewer.c' || echo '$(srcdir)/'`cdw_text_file_viewer.c libcdwuserinterface_check_a-cdw_text_file_viewer.obj: cdw_text_file_viewer.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_text_file_viewer.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_text_file_viewer.Tpo -c -o libcdwuserinterface_check_a-cdw_text_file_viewer.obj `if test -f 'cdw_text_file_viewer.c'; then $(CYGPATH_W) 'cdw_text_file_viewer.c'; else $(CYGPATH_W) '$(srcdir)/cdw_text_file_viewer.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_text_file_viewer.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_text_file_viewer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_text_file_viewer.c' object='libcdwuserinterface_check_a-cdw_text_file_viewer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_text_file_viewer.obj `if test -f 'cdw_text_file_viewer.c'; then $(CYGPATH_W) 'cdw_text_file_viewer.c'; else $(CYGPATH_W) '$(srcdir)/cdw_text_file_viewer.c'; fi` libcdwuserinterface_check_a-cdw_write_wizard.o: cdw_write_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_write_wizard.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_write_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_write_wizard.o `test -f 'cdw_write_wizard.c' || echo '$(srcdir)/'`cdw_write_wizard.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_write_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_write_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_write_wizard.c' object='libcdwuserinterface_check_a-cdw_write_wizard.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_write_wizard.o `test -f 'cdw_write_wizard.c' || echo '$(srcdir)/'`cdw_write_wizard.c libcdwuserinterface_check_a-cdw_write_wizard.obj: cdw_write_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_write_wizard.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_write_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_write_wizard.obj `if test -f 'cdw_write_wizard.c'; then $(CYGPATH_W) 'cdw_write_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_write_wizard.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_write_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_write_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_write_wizard.c' object='libcdwuserinterface_check_a-cdw_write_wizard.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_write_wizard.obj `if test -f 'cdw_write_wizard.c'; then $(CYGPATH_W) 'cdw_write_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_write_wizard.c'; fi` libcdwuserinterface_check_a-cdw_iso9660_wizard.o: cdw_iso9660_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_iso9660_wizard.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_iso9660_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_iso9660_wizard.o `test -f 'cdw_iso9660_wizard.c' || echo '$(srcdir)/'`cdw_iso9660_wizard.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_iso9660_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_iso9660_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_iso9660_wizard.c' object='libcdwuserinterface_check_a-cdw_iso9660_wizard.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_iso9660_wizard.o `test -f 'cdw_iso9660_wizard.c' || echo '$(srcdir)/'`cdw_iso9660_wizard.c libcdwuserinterface_check_a-cdw_iso9660_wizard.obj: cdw_iso9660_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_iso9660_wizard.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_iso9660_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_iso9660_wizard.obj `if test -f 'cdw_iso9660_wizard.c'; then $(CYGPATH_W) 'cdw_iso9660_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_iso9660_wizard.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_iso9660_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_iso9660_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_iso9660_wizard.c' object='libcdwuserinterface_check_a-cdw_iso9660_wizard.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_iso9660_wizard.obj `if test -f 'cdw_iso9660_wizard.c'; then $(CYGPATH_W) 'cdw_iso9660_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_iso9660_wizard.c'; fi` libcdwuserinterface_check_a-cdw_erase_wizard.o: cdw_erase_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_erase_wizard.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_erase_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_erase_wizard.o `test -f 'cdw_erase_wizard.c' || echo '$(srcdir)/'`cdw_erase_wizard.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_erase_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_erase_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_erase_wizard.c' object='libcdwuserinterface_check_a-cdw_erase_wizard.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_erase_wizard.o `test -f 'cdw_erase_wizard.c' || echo '$(srcdir)/'`cdw_erase_wizard.c libcdwuserinterface_check_a-cdw_erase_wizard.obj: cdw_erase_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_erase_wizard.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_erase_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_erase_wizard.obj `if test -f 'cdw_erase_wizard.c'; then $(CYGPATH_W) 'cdw_erase_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_erase_wizard.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_erase_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_erase_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_erase_wizard.c' object='libcdwuserinterface_check_a-cdw_erase_wizard.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_erase_wizard.obj `if test -f 'cdw_erase_wizard.c'; then $(CYGPATH_W) 'cdw_erase_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_erase_wizard.c'; fi` libcdwuserinterface_check_a-cdw_verify_wizard.o: cdw_verify_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_verify_wizard.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_verify_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_verify_wizard.o `test -f 'cdw_verify_wizard.c' || echo '$(srcdir)/'`cdw_verify_wizard.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_verify_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_verify_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_verify_wizard.c' object='libcdwuserinterface_check_a-cdw_verify_wizard.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_verify_wizard.o `test -f 'cdw_verify_wizard.c' || echo '$(srcdir)/'`cdw_verify_wizard.c libcdwuserinterface_check_a-cdw_verify_wizard.obj: cdw_verify_wizard.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_verify_wizard.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_verify_wizard.Tpo -c -o libcdwuserinterface_check_a-cdw_verify_wizard.obj `if test -f 'cdw_verify_wizard.c'; then $(CYGPATH_W) 'cdw_verify_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_verify_wizard.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_verify_wizard.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_verify_wizard.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_verify_wizard.c' object='libcdwuserinterface_check_a-cdw_verify_wizard.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_verify_wizard.obj `if test -f 'cdw_verify_wizard.c'; then $(CYGPATH_W) 'cdw_verify_wizard.c'; else $(CYGPATH_W) '$(srcdir)/cdw_verify_wizard.c'; fi` libcdwuserinterface_check_a-cdw_main_window.o: cdw_main_window.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_main_window.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_main_window.Tpo -c -o libcdwuserinterface_check_a-cdw_main_window.o `test -f 'cdw_main_window.c' || echo '$(srcdir)/'`cdw_main_window.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_main_window.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_main_window.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_main_window.c' object='libcdwuserinterface_check_a-cdw_main_window.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_main_window.o `test -f 'cdw_main_window.c' || echo '$(srcdir)/'`cdw_main_window.c libcdwuserinterface_check_a-cdw_main_window.obj: cdw_main_window.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_main_window.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_main_window.Tpo -c -o libcdwuserinterface_check_a-cdw_main_window.obj `if test -f 'cdw_main_window.c'; then $(CYGPATH_W) 'cdw_main_window.c'; else $(CYGPATH_W) '$(srcdir)/cdw_main_window.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_main_window.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_main_window.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_main_window.c' object='libcdwuserinterface_check_a-cdw_main_window.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_main_window.obj `if test -f 'cdw_main_window.c'; then $(CYGPATH_W) 'cdw_main_window.c'; else $(CYGPATH_W) '$(srcdir)/cdw_main_window.c'; fi` libcdwuserinterface_check_a-cdw_help.o: cdw_help.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_help.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_help.Tpo -c -o libcdwuserinterface_check_a-cdw_help.o `test -f 'cdw_help.c' || echo '$(srcdir)/'`cdw_help.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_help.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_help.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_help.c' object='libcdwuserinterface_check_a-cdw_help.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_help.o `test -f 'cdw_help.c' || echo '$(srcdir)/'`cdw_help.c libcdwuserinterface_check_a-cdw_help.obj: cdw_help.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_help.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_help.Tpo -c -o libcdwuserinterface_check_a-cdw_help.obj `if test -f 'cdw_help.c'; then $(CYGPATH_W) 'cdw_help.c'; else $(CYGPATH_W) '$(srcdir)/cdw_help.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_help.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_help.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_help.c' object='libcdwuserinterface_check_a-cdw_help.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_help.obj `if test -f 'cdw_help.c'; then $(CYGPATH_W) 'cdw_help.c'; else $(CYGPATH_W) '$(srcdir)/cdw_help.c'; fi` libcdwuserinterface_check_a-cdw_tabs_window.o: cdw_tabs_window.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_tabs_window.o -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_tabs_window.Tpo -c -o libcdwuserinterface_check_a-cdw_tabs_window.o `test -f 'cdw_tabs_window.c' || echo '$(srcdir)/'`cdw_tabs_window.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_tabs_window.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_tabs_window.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_tabs_window.c' object='libcdwuserinterface_check_a-cdw_tabs_window.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_tabs_window.o `test -f 'cdw_tabs_window.c' || echo '$(srcdir)/'`cdw_tabs_window.c libcdwuserinterface_check_a-cdw_tabs_window.obj: cdw_tabs_window.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwuserinterface_check_a-cdw_tabs_window.obj -MD -MP -MF $(DEPDIR)/libcdwuserinterface_check_a-cdw_tabs_window.Tpo -c -o libcdwuserinterface_check_a-cdw_tabs_window.obj `if test -f 'cdw_tabs_window.c'; then $(CYGPATH_W) 'cdw_tabs_window.c'; else $(CYGPATH_W) '$(srcdir)/cdw_tabs_window.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwuserinterface_check_a-cdw_tabs_window.Tpo $(DEPDIR)/libcdwuserinterface_check_a-cdw_tabs_window.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_tabs_window.c' object='libcdwuserinterface_check_a-cdw_tabs_window.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwuserinterface_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwuserinterface_check_a-cdw_tabs_window.obj `if test -f 'cdw_tabs_window.c'; then $(CYGPATH_W) 'cdw_tabs_window.c'; else $(CYGPATH_W) '$(srcdir)/cdw_tabs_window.c'; fi` # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) check: check-recursive all-am: Makefile $(LIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-checkLIBRARIES clean-generic clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-checkLIBRARIES \ clean-generic clean-noinstLIBRARIES ctags ctags-recursive \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ ps ps-am tags tags-recursive uninstall uninstall-am # used by flymake check-syntax: $(CC) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(AM_CFLAGS) -fsyntax-only $(CHK_SOURCES) .PHONY: check-syntax # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/src/user_interface/cdw_ncurses.h0000644000175000017500000000412111701124211015456 00000000000000#ifndef H_CDW_NCURSES #define H_CDW_NCURSES #include #include "config.h" /* Some systems put ncurses headers in /usr/include, and somehow Autotools can't see them there; see Sourceforge for a feature request in cdw: http://sourceforge.net/tracker/?func=detail&aid=3249439&group_id=47851&atid=451094 See also bug in Arch Linux bug tracker on location of ncurses includes: https://bugs.archlinux.org/task/5263?opened=2039&status[0]= Anyway, AC_CHECK_HEADERS in configure.ac + this preprocessor code should give good results. It works on my Debian box, to be tested on Arch. */ #if (HAVE_NCURSESW_FORM_H && HAVE_NCURSESW_MENU_H && HAVE_NCURSESW_NCURSES_H && HAVE_NCURSESW_PANEL_H) #include #include #include #include #elif (HAVE_FORM_H && HAVE_MENU_H && HAVE_NCURSES_H && HAVE_PANEL_H) #include #include #include #include #endif #include "main.h" #include "cdw_colors.h" /* type of data that can be put in input field, and if it should be invisible */ enum { CDW_NCURSES_INPUT_NONE = 0, CDW_NCURSES_INPUT_HIDDEN = 1, CDW_NCURSES_INPUT_INTEGER = 2, CDW_NCURSES_INPUT_NUMERIC = 4 }; cdw_rv_t cdw_ncurses_init(void); void cdw_ncurses_clean(void); cdw_rv_t cdw_ncurses_get_field_buffer(FIELD *field, char **buffer, size_t limit); const char *cdw_ncurses_error_string(int ret_val); bool cdw_ncurses_get_field_bit(FIELD *field); char *cdw_ncurses_get_field_string(FIELD *field); FORM *cdw_ncurses_new_form(WINDOW *window, WINDOW *subwindow, FIELD **field); FIELD *cdw_ncurses_new_input_field(int n_lines, int n_cols, int begin_y, int begin_x, const char *initial_value, size_t len_max, int input_type, cdw_colors_t colors); FIELD *cdw_ncurses_new_label_field(int n_lines, int n_cols, int begin_y, int begin_x, const char *initial_value); FIELD *cdw_ncurses_new_checkbox_field(int begin_y, int begin_x, const char *initial_value); void cdw_ncurses_delete_menu_and_items(MENU **menu); const char *cdw_ncurses_key_label(int c); #endif /* H_CDW_NCURSES */ cdw-0.7.1/src/user_interface/cdw_list_display.c0000644000175000017500000006612711727147005016523 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_list_display.c \brief File implements "list display" widget "list display" widget is a data structure consisting of following basic items: \li doubly linked list of items, each item being some data that has some printable representation \li ncurses window, on which this data (its printable representation) can be drawn, one item from list in one row \li pointer to a function (referred to in comments as "item display function"), used to draw single item from list (print its printable representation) in ncurses window This is assisted by some glue code: driver that handles keys, scroll() function that calls "item display function" repetitively for some range of list items and window rows. Constructor and destructor of a display widget are also provided. List of items is a field of display structure, but should be grown, shrinked, and filled with data by code using given instance of display. Display itself doesn't know anything about data format stored on list. All that a display can do with the list (knows how to do this and does it) is deallocating list data structure, but not the data stored on the list. Implementation of "item display function" must be provided by code creating and using given instance of display. The function must know what is the printable representation of data stored in list's item, and must know how to print the data properly. Correct declaration of such function is void name(void *display, void *data, size_t row, size_t h_offset, bool isreverse); The function should cast "void *display" argument to "CDW_LIST_DISPLAY *" type to access display's subwindow (display->subwindow) in which to print. The widget seem to handle displays with empty lists quite well. TODO: test it thoroughly. New display by default doesn't react to any keys other than movement keys and Escape key. This can be changed later by using cdw_list_display_add_return_key() TODO: decouple list and display - list should be separate and independent data structure (perhaps coupled with two pointers to functions that can: a: deallocate content of list; b: display one item of list) */ #include #include "cdw_debug.h" #include "cdw_list_display.h" #include "cdw_ncurses.h" static void cdw_list_display_scroll_to_current(CDW_LIST_DISPLAY *display, size_t h_offset, bool highlight); static int cdw_list_display_driver_loop(CDW_LIST_DISPLAY *display, size_t *h_offset); /** \brief Create new display widget with empty list Function creates new display widget. List of items associated with given display is initialized as empty, and can be later accessed as display->list. Data on the list belongs to code creating and using the display - the data won't be destroyed by the display. The list itself should be created, expanded and shrinked by code creating and using the display. List data structure (but not payload of the list) will be destroyed when display is destroyed. You should deallocate all content of list before deleting a display. New display is embedded into a given existing \p parent window: the function creates a new subwindow (a child window of \p parent). The subwindow is then used as main drawing area of the display. Main window (\p parent window) can be accessed by parent->window. It is up to creator of a given display to draw or redraw its border if needed (by accessing display->window). Pointer to function drawing a single line in display ("item display function") is initialized as NULL. It can be set by owner of display by accessing display->display_item. \param parent is an existing ncurses window, into which new display should be embedded. \p parent always belongs to caller, but may be refreshed by display functions. \p n_lines and \p n_cols are sizes of new subwindow created as a child of \p parent \p begin_y and \p begin_x are offset of new subwindow created as a child of \p parent, the offset relative to beginning of \p parent. \param colors - color scheme of new display \return pointer to new display on success \return NULL on errors */ CDW_LIST_DISPLAY *cdw_list_display_new(WINDOW *parent, int n_lines, int n_cols, int begin_y, int begin_x, cdw_colors_t colors) { cdw_assert (parent != (WINDOW *) NULL, "ERROR: called the function with null parent window\n"); CDW_LIST_DISPLAY *display = (CDW_LIST_DISPLAY *) malloc(sizeof(CDW_LIST_DISPLAY)); if (display == (CDW_LIST_DISPLAY *) NULL) { cdw_vdm ("ERROR: failed to allocate memory for display\n"); return (CDW_LIST_DISPLAY *) NULL; } /* begin_y and begin_x are beginning of embedded window relative to beginning of parent window, and n_lines and n_cols are sizes of subwindow */ display->n_lines = n_lines; display->n_cols = n_cols; display->begin_y = begin_y; display->begin_x = begin_x; display->colors = colors; display->n_return_chars = 0; for (int i = 0; i < N_RETURN_KEYS_MAX; i++) { display->return_chars[i] = 0; } display->window = parent; display->subwindow = derwin(display->window, (int) display->n_lines, (int) display->n_cols, (int) display->begin_y, (int) display->begin_x); if (display->subwindow == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create subwindow for embedded display\n"); free(display); display = (CDW_LIST_DISPLAY *) NULL; return (CDW_LIST_DISPLAY *) NULL; } display->display_format = CDW_LIST_DISPLAY_FORMAT_SHORT; display->display_item = NULL; display->n_items = 0; display->current_item_ind = 0; display->list = (cdw_dll_item_t *) NULL; keypad(display->window, TRUE); wbkgd(display->window, A_NORMAL | COLOR_PAIR(display->colors)); (void) wattrset(display->window, A_NORMAL | COLOR_PAIR(display->colors)); wbkgd(display->subwindow, A_NORMAL | COLOR_PAIR(display->colors)); (void) wattrset(display->subwindow, A_NORMAL | COLOR_PAIR(display->colors)); cdw_list_display_add_return_keys(display, CDW_KEY_ESCAPE, 'q', 'Q', 0); return display; } /** \brief Deallocated resources of given display Function deallocates some resources related to given display: its subwindow, its main window (if created by display code), associated list data structure, and the display itself. Function does not deallocate data stored on the list, it is a task of code using the display to free the data before destroying given display. \param display - display to destroy */ void cdw_list_display_delete(CDW_LIST_DISPLAY **display) { if (*display == (CDW_LIST_DISPLAY *) NULL) { cdw_vdm ("ERROR: \"display\" argument is NULL\n"); return; } if ((*display)->subwindow == (WINDOW *) NULL) { cdw_vdm ("ERROR: \"display->subwindow\" is NULL\n"); } else { delwin((*display)->subwindow); (*display)->subwindow = (WINDOW *) NULL; } if ((*display)->window == (WINDOW *) NULL) { cdw_vdm ("ERROR: \"display->window\" is NULL\n"); } /* no "else", we can't free parent window */ (*display)->n_lines = 0; (*display)->n_cols = 0; (*display)->begin_y = 0; (*display)->begin_x = 0; if ((*display)->list != (cdw_dll_item_t *) NULL) { if ((*display)->list->data != (void *) NULL) { cdw_vdm ("ERROR: caller didn't deallocate properly data stored on the list\n"); cdw_vdm ("ERROR: data stored on display's list belongs to owner\n"); } cdw_dll_clean((*display)->list); (*display)->list = (cdw_dll_item_t *) NULL; } (*display)->n_items = 0; free(*display); *display = (CDW_LIST_DISPLAY *) NULL; return; } /** \brief Function handling keys pressed when a display has focus Function reacts to keys pressed in given display's window. By default a display reacts only to movement keys and Escape key, moving highlight (selection) on the list up and down. Content of list associated with the display and displayed in display's subwindow is scrolled if necessary (i.e. if there are more items on the list than rows in the window) to follow cursor's movement. If function ("item display function") provided by code using a display supports horizontal offset of displayed item, then the driver reacts to Left/Right arrows as well. Supporting of other keys (characters) can be enabled by adding these characters with cdw_list_display_add_return_key() function. The only "reaction" to enabled key is to return with value corresponding to key pressed. It is up to caller of the driver function to act upon such event, including calling the driver function again to resume reacting to keys in driver. "item_i" field of the display struct can be used by caller to check for which item a key was pressed. "item_i" field of display struct is constantly updated by driver to always indicate (point at) item which currently is highlighted (selected) in the display. Function returns with CDW_ESCAPE when it catches Escape key pressed by user. Function can also return with value corresponding to other keys (e.g. Space, Enter, Delete) if handling such keys by display is enabled. \param display - display that currently has keyboard focus \return CDW_KEY_ESCAPE if user pressed escape key \return other specific key, if display was configured to react to other keys */ int cdw_list_display_driver(CDW_LIST_DISPLAY *display) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: \"display\" argument in NULL\n"); cdw_assert (display->display_item != NULL, "ERROR: the display doesn't have ->display_item() set\n"); size_t h_offset = 0; /* indicates if and how much content of the window was moved to left */ if (display->n_items != 0) { /* initialization: highlight initial item */ size_t subwindow_row = display->current_item_ind % (size_t) display->n_lines; cdw_dll_item_t *item = cdw_dll_ith_item(display->list, display->current_item_ind); display->display_item(display, item->data, subwindow_row, h_offset, true); } wrefresh(display->subwindow); int key = cdw_list_display_driver_loop(display, &h_offset); if (display->n_items != 0) { /* control (and focus) is leaving display area, and to indicate this, we un-highlight current item */ cdw_dll_item_t *item = cdw_dll_ith_item(display->list, display->current_item_ind); size_t subwindow_row = display->current_item_ind % (size_t) display->n_lines; display->display_item(display, item->data, subwindow_row, h_offset, false); } wrefresh(display->subwindow); return key; } int cdw_list_display_driver_loop(CDW_LIST_DISPLAY *display, size_t *h_offset) { int key = 'a'; /* safe (?) initial value */ while ((key = wgetch(display->window)) != ERR) { switch (key) { case KEY_HOME: /* first Home key should move content of window to beginning of lines, leaving vertical position unchanged */ if (*h_offset > 0) { *h_offset = 0; cdw_list_display_scroll_to_current(display, *h_offset, true); } else { if (display->current_item_ind > 0) { display->current_item_ind = 0; *h_offset = 0; cdw_list_display_scroll_to_current(display, *h_offset, true); } } break; case KEY_END: /* go to last item */ if (display->current_item_ind < display->n_items - 1) { display->current_item_ind = display->n_items - 1; cdw_list_display_scroll_to_current(display, *h_offset, true); } break; case KEY_DOWN: /* go to next item */ if (display->current_item_ind < display->n_items - 1) { display->current_item_ind++; cdw_list_display_scroll_to_current(display, *h_offset, true); } break; case KEY_UP: /* go to previous item */ if (display->current_item_ind > 0) { display->current_item_ind--; cdw_list_display_scroll_to_current(display, *h_offset, true); } break; case KEY_RIGHT: /* some modules using list display may use "item display function" that does not support non-zero h_offset, it will be ignored by such "item display function" */ (*h_offset)++; cdw_list_display_scroll_to_current(display, *h_offset, true); break; case KEY_LEFT: /* see comment for KEY_RIGHT */ if (*h_offset > 0) { (*h_offset)--; cdw_list_display_scroll_to_current(display, *h_offset, true); } break; case KEY_PPAGE: /* Previous Page, Page Up */ if (display->current_item_ind > 0) { if (display->current_item_ind < (size_t) display->n_lines) { /* we are on top of listing, so there is only one place to move cursor and item index */ display->current_item_ind = 0; } else { /* move item index exactly one screen size up */ display->current_item_ind -= (size_t) display->n_lines; } cdw_list_display_scroll_to_current(display, *h_offset, true); } break; case KEY_NPAGE: /* Next Page, Page Down */ if (display->current_item_ind < display->n_items - 1) { display->current_item_ind += (size_t) display->n_lines; if (display->current_item_ind > display->n_items - 1) { display->current_item_ind = display->n_items - 1; } cdw_list_display_scroll_to_current(display, *h_offset, true); } break; default: ; // break; } /* switch (c) */ if (cdw_list_display_is_return_key(display, key)) { break; } } /* while () */ if (key == 'q' || key == 'Q' || key == CDW_KEY_ESCAPE) { return CDW_KEY_ESCAPE; } else { return key; } } /** \brief Refresh windows associated with given display Function calls wrefresh() function for its window and subwindow \param display - display that you want to refresh */ void cdw_list_display_refresh(CDW_LIST_DISPLAY *display) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: \"display\" argument is NULL\n"); cdw_assert (display->window != (WINDOW *) NULL, "ERROR: \"display->window\" is NULL\n"); cdw_assert (display->subwindow != (WINDOW *) NULL, "ERROR: \"display->subwindow\" is NULL\n"); wrefresh(display->subwindow); redrawwin(display->window); wrefresh(display->window); return; } /** \brief Display part of list associated with given display Function displays given \p item_i item (item from display's list, indicated by index \p item_i), and all surrounding items that fit in a single display's subwindow. If \p highlight is true, then the item is additionally highlighted. \p h_offset indicates how many columns to left should the lines in the display be moved. This is useful when displayed item is represented by line with more chars than there is columns in display's subwindow - the line should be moved (shifted) to left to display content truncated by display's border. This value affects all lines displayed in the display, however: read next paragraph. This function doesn't draw representation of item itself. It uses pointer to a function: display->display_item ("item display function"), which must be set and provided by code using the display (set by display->display_item). "item display function" is allowed not to implement support for h_offset, and to ignore its value. \param display - display, in which given item exists, and which you want to use to display the item \param h_offset - value of horizontal offset, with which lines should be displayed in the display \param highlight - should an item indicated by \p item_i be highlighted? */ void cdw_list_display_scroll_to_current(CDW_LIST_DISPLAY *display, size_t h_offset, bool highlight) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: \"display\" argument is NULL\n"); cdw_assert (display->subwindow != (WINDOW *) NULL, "ERROR: \"display->subwindow\" is NULL\n"); cdw_assert (display->display_item != NULL, "ERROR: ->display_item() function pointer is NULL\n"); if (display->n_items == 0) { /* perfectly normal situation, but it means that we have completely nothing to do */ return; } /* we use werase() here, because this function call may display only tail of list, so old items at the bottom of subwindow would be still visible */ werase(display->subwindow); /* get first item to be displayed in 0-th row of subwindow; get it with expensive cdw_dll_ith_item() call, we will get rest of items by traversing list "manually" in loop */ size_t item_ind = display->current_item_ind - (display->current_item_ind % (size_t) display->n_lines); cdw_dll_item_t *item = cdw_dll_ith_item(display->list, item_ind); /* increment subwindow row number and traverse list at the same time */ for (int subwindow_row = 0; subwindow_row < display->n_lines && item != (cdw_dll_item_t *) NULL; subwindow_row++, item = item->next, item_ind++) { display->display_item(display, item->data, (size_t) subwindow_row, h_offset, false); /* since we already traverse list of items, we can update value of "current_item" field: since this function was called, it is *very* probable that display->current_item_ind has been updated, so updating display->current_item is also necessary */ if (item_ind == display->current_item_ind) { display->current_item = item; } } if (highlight) { /* highlight current item */ item = cdw_dll_ith_item(display->list, display->current_item_ind); size_t subwindow_row = display->current_item_ind % (size_t) display->n_lines; display->display_item(display, item->data, subwindow_row, h_offset, true); } wrefresh(display->subwindow); return; } /** \brief Add char that, if captured by display's driver, will cause return of control by driver Function registers a char \p c, which, if captured by driver, will cause the driver to return control to it's (driver's) caller. You may want to use this function e.g. when you want to perform some action whenever ENTER key is hit. In that case you have to configure a display before using it by calling this function with CDW_ENTER as second argument. Similarly for other keys: Space, Delete, any digit or letter. Digits should be passed as characters. \param display - display that you want to configure \param c - character that you want to add to given \p display */ void cdw_list_display_add_return_key(CDW_LIST_DISPLAY *display, int c) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: \"display\" argument is NULL\n"); cdw_assert (display->n_return_chars < N_RETURN_KEYS_MAX, "ERROR: there are already %d / %d return chars in the display, can't add another one\n", display->n_return_chars, N_RETURN_KEYS_MAX); cdw_assert (c != 0, "ERROR: trying to add char == 0, but 0 is an initializer value\n"); if (cdw_list_display_is_return_key(display, c)) { cdw_vdm ("WARNING: attempting to add char %d / \"%s\", but it is already on the list of return chars\n", c, cdw_ncurses_key_label(c)); } else { display->return_chars[display->n_return_chars++] = c; } return; } /** \brief Add key(s) that, if captured by display's driver, will cause return of control by driver Function registers keys, which, if captured by driver, will cause the driver to return control to it's (driver's) caller. You may want to use this function e.g. when you want to perform some action whenever ENTER key is hit. In that case you have to configure a display before using it by calling this function with CDW_KEY_ENTER as second argument. Similarly for other keys: Space, Delete, any digit or letter. Digits should be passed as characters. \param display - display that you want to configure \param ... - list of keys to add; use '0' as a last key (guard) */ void cdw_list_display_add_return_keys(CDW_LIST_DISPLAY *display, ...) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: \"display\" argument is NULL\n"); cdw_assert (display->n_return_chars < N_RETURN_KEYS_MAX, "ERROR: there are already %d / %d return keys in the form, can't add another one\n", display->n_return_chars, N_RETURN_KEYS_MAX); va_list ap; va_start(ap, display); int key = 'a'; while ((key = va_arg(ap, int)) != 0) { cdw_list_display_add_return_key(display, key); } va_end(ap); return; } /** \brief Check if given char is one of configured "return" chars Function checks if given \p c char was earlier added to given \p display as "return on the char" character. \param display - display that you want to query \param c - character you want to check if it is added to display \return true if given character was added to given \p display \return false if given character was not added to given \p display */ bool cdw_list_display_is_return_key(CDW_LIST_DISPLAY *display, int c) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: \"display\" argument is NULL\n"); cdw_assert (c != 0, "ERROR: asking for 0, which is an initialization value\n"); int i = 0; for (i = 0; i < display->n_return_chars; i++) { if (display->return_chars[i] == c) { return true; } } return false; } /** \brief Remove i-th item from given display Function looks up \p item_i-th item in given display, removes it from associated window and associated list. It also updates value of 'number of items' variable associated with the display. The function does not deallocate payload associated with list item: the payload is application-specific, and this function doesn't know (yet) how to deallocate all the various data types that can be put as payloads. So: you have to get the payload and free it yourself before calling the function. \param display - display from which to remove an item \param item_i - index of item to be removed \return CDW_OK if removing was successfull \return CDW_GEN_ERROR if it failed */ cdw_rv_t cdw_list_display_remove_item(CDW_LIST_DISPLAY *display, size_t item_i) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: display is null\n"); cdw_assert (display->n_items > 0, "ERROR: you called the function for display with empty list\n"); cdw_assert (display->list != (cdw_dll_item_t *) NULL, "ERROR: list associated with the display is null\n"); display->current_item_ind = item_i; #ifndef NDEBUG cdw_dll_item_t *item = cdw_dll_ith_item(display->list, display->current_item_ind); cdw_assert (item->data == NULL, "ERROR: item payload is not NULL, trying to leak memory?\n"); #endif #ifndef NDEBUG size_t len1 = cdw_dll_length(display->list); #endif cdw_rv_t crv = cdw_dll_remove_ith_item(&(display->list), display->current_item_ind); #ifndef NDEBUG size_t len2 = cdw_dll_length(display->list); #endif if (crv == CDW_OK) { display->n_items--; /* to avoid calling cdw_dll_length() */ cdw_assert (len2 == len1 - 1, "ERROR: lengths of list do not differ by one: len before: %zd, len after: %zd\n", len1, len2); cdw_assert (len2 == display->n_items, "ERROR: length mismatch\n"); if (display->n_items > 0) { if (display->current_item_ind == 0) { ; /* removed item was first, no need to reposition cursor in new list; new current item will also be first */ } else if (display->current_item_ind == display->n_items) { /* removed item was last one; here n_files has new, decreased value */ display->current_item_ind = display->n_items - 1; /* we could have achieved the same effect by simple display->current_item_ind--; */ } else { ; /* removed item was somewhere in between beginning and end, no need to change item_i */ } cdw_list_display_scroll_to_current(display, 0, true); } else { werase(display->subwindow); wrefresh(display->subwindow); } return CDW_OK; } else { return CDW_ERROR; } } cdw_rv_t cdw_list_display_add_item(CDW_LIST_DISPLAY *display, void *data, bool (*pred)(const void *, const void *)) { #ifndef NDEBUG size_t len1 = cdw_dll_length(display->list); #endif cdw_rv_t crv = cdw_dll_append(&(display->list), data, pred); #ifndef NDEBUG size_t len2 = cdw_dll_length(display->list); #endif if (crv == CDW_OK) { display->n_items++; /* this is to avoid using cdw_dll_length() */ if (display->n_items == 1) { /* this is kind of initialization of 'current_item_ind' and 'current_item' */ display->current_item_ind = 0; display->current_item = display->list; } cdw_assert (len2 == len1 + 1, "ERROR: length didn't increase\n"); cdw_assert (len2 == display->n_items, "ERROR: list len mismatch"); } else if (crv == CDW_NO) { /* given data was already on a list, no need to do anything */ ; } else { cdw_vdm ("ERROR: failed to add data\n"); /* this warning was all we could do */ } return crv; } void cdw_list_display_scroll_to(CDW_LIST_DISPLAY *display, size_t current_item_ind, size_t h_offset, bool highlight) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: passed NULL display to function\n"); if (display->n_items > 0) { cdw_assert (current_item_ind < display->n_items, "ERROR: item index %zd is larger than number of items %zd\n", current_item_ind, display->n_items); display->current_item_ind = current_item_ind; cdw_list_display_scroll_to_current(display, h_offset, highlight); } else { cdw_vdm ("%s: called the function for empty list, requested_item_ind = %zd\n", current_item_ind == 0 ? "WARNING" : "ERROR", current_item_ind); } return; } void *cdw_list_display_get_current_item_data(CDW_LIST_DISPLAY *display) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: passed NULL display to function\n"); cdw_assert (display->n_items > display->current_item_ind, "ERROR, current item index (0-based) is %zd but number of items is %zd\n", display->current_item_ind, display->n_items); if (display->n_items > 0) { return display->current_item->data; } else { return (void *) NULL; } } /** \brief Wrapper for cdw_dll_is_member() This is a wrapper for cdw_dll_is_member() so that code using list display doesn't have to reach to lower-level code. \p pred is predicate function that will check if given \p data is member of list associated with \p display or not. \param display - display which you want to query for given data \param data - data for which you want to check in given display \param pred - predicate function \return true if \p data is on a list associated with \p display \return false if \p data isn't on a list associated with \p display */ bool cdw_list_display_is_member(CDW_LIST_DISPLAY *display, void *data, bool (*pred)(const void *, const void *)) { cdw_assert (display != (CDW_LIST_DISPLAY *) NULL, "ERROR: display is NULL\n"); cdw_assert (pred != (bool (*)(const void *, const void *)) NULL, "ERROR: predicate function is NULL\n"); return cdw_dll_is_member(display->list, data, pred); } cdw-0.7.1/src/user_interface/cdw_verify_wizard.c0000644000175000017500000003057711734660410016705 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "cdw_widgets.h" #include "cdw_main_window.h" #include "cdw_string.h" #include "cdw_verify_wizard.h" #include "cdw_debug.h" #include "gettext.h" #include "cdw_calculate_digest.h" #include "cdw_form.h" #include "cdw_task.h" #include "cdw_window.h" /** \file cdw_verify_wizard.c Simple, one page wizard: a dialog window with dropdown in which user can select mode of verification, i.e. what he wants to verify. */ static void cdw_verify_wizard_init(void); static cdw_rv_t cdw_verify_wizard_build(void); static cdw_rv_t cdw_verify_wizard_driver(void); static void cdw_verify_wizard_destroy(void); static cdw_rv_t cdw_verify_wizard_build_fields(void); static CDW_DROPDOWN *cdw_verify_wizard_make_verify_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width); static int cdw_verify_wizard_on_enter_on_cancel(cdw_form_t *cdw_form, void *dummy); static int cdw_verify_wizard_on_enter_on_verify(cdw_form_t *cdw_form, void *dummy); static char *cdw_verify_wizard_make_message(int n_cols); static struct { cdw_id_t mode; cdw_form_t *cdw_form; } wizard; static cdw_form_dropdown_maker_t dropdown_makers[] = { cdw_verify_wizard_make_verify_mode_dropdown }; static cdw_form_text_maker_t text_makers[] = { cdw_verify_wizard_make_message }; /* constants for layout of elements in wizard window */ #define window_n_cols 52 #define window_n_lines 20 #define subwindow_n_cols (window_n_cols - 2) #define subwindow_n_lines (window_n_lines - 2) #define label_n_cols (subwindow_n_cols - 2) #define dropdown_n_cols (subwindow_n_cols - 2) #define first_col 1 /* main message and some labels start in leftmost column */ #define top_message_row 1 #define mode_row 8 #define buttons_row (subwindow_n_lines - 3) /* Verify and Cancel buttons are at the bottom of window */ #define CDW_VERIFY_WIZARD_N_FIELDS 4 /* does not include ending NULL element */ static FIELD *wizard_fields[CDW_VERIFY_WIZARD_N_FIELDS + 1]; enum { f_top_message_t = 0, f_mode_dd, f_ok_b, f_cancel_b }; /** \brief Window displayed just before erasing is performed Wizard window displayed before actual erasing. User can select here some erasing / formatting options. In case of erasing a CD user can select erasing mode and erasing speed. In case of erasing a DVD user can select erasing mode, formatting mode and erasing / formatting speed. In case of erasing of DVD+/-RW user is also warned that multiple erasing of DVD can quickly render it unusable. \return CDW_OK if user pressed accepts erasing \return CDW_CANCEL if user cancels erasing \return CDW_GEN_ERROR on errors */ cdw_id_t cdw_verify_wizard(void) { /* TODO: there is a problem with implicit initialization of dropdowns in the wizard: dropdowns are initialized with some deeply hidden values in functions creating dropdown, and then (below) states of the dropdowns are explicitly used to set values of fields in task variable; this mix of implicit/explicit assignments is confusing */ cdw_verify_wizard_init(); cdw_rv_t crv = cdw_verify_wizard_build(); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create wizard\n"); cdw_verify_wizard_destroy(); /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("ERROR"), /* 2TRANS: this is message in dialog window */ _("Failed to create erasing wizard. Please restart cdw and try again."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); return CDW_ERROR; } crv = cdw_verify_wizard_driver(); if (crv == CDW_OK) { CDW_DROPDOWN *dd = cdw_form_get_dropdown(wizard.cdw_form, f_mode_dd); wizard.mode = cdw_dropdown_get_current_item_id(dd); } else { cdw_vdm ("INFO: not attempting erasing, not displaying settings\n"); wizard.mode = CDW_CALCULATE_DIGEST_MODE_NONE; } cdw_verify_wizard_destroy(); /* redraw parent */ cdw_main_ui_main_window_wrefresh(); return wizard.mode; } cdw_rv_t cdw_verify_wizard_driver(void) { int fi = f_mode_dd; /* initial focus on "mode" dropdown */ int key = 'a'; /* safe initial value */ while (key != CDW_KEY_ESCAPE && key != 'q' && key != 'Q') { key = cdw_form_driver(wizard.cdw_form, fi); /* in this wizard driver we are interested only in ENTER being pressed on either "verify" or "cancel" buttons */ if (key == CDW_KEY_ENTER) { fi = field_index(current_field(wizard.cdw_form->form)); if (fi == f_ok_b) { /* flush */ form_driver(wizard.cdw_form->form, REQ_VALIDATION); return CDW_OK; } else if (fi == f_cancel_b) { return CDW_CANCEL; } else { ; } } else { ; } } return CDW_CANCEL; } /** \brief Initialize wizard data structures */ void cdw_verify_wizard_init(void) { cdw_assert (LINES > window_n_lines, "ERROR: LINES is too small: %d\n", LINES); cdw_assert (COLS > window_n_cols, "ERROR: COLS is too small: %d\n", COLS); return; } /** \brief Cleanup function for verify wizard Function deallocates all resources used by wizard window. Call this function when you close wizard in normal mode or when you want to clean up after unsuccessful creation of wizard. */ void cdw_verify_wizard_destroy(void) { if (wizard.cdw_form->window != (WINDOW *) NULL) { delwin(wizard.cdw_form->window); wizard.cdw_form->window = (WINDOW *) NULL; } if (wizard.cdw_form->subwindow != (WINDOW *) NULL) { delwin(wizard.cdw_form->subwindow); wizard.cdw_form->subwindow = (WINDOW *) NULL; } if (wizard.cdw_form != (cdw_form_t *) NULL) { cdw_form_delete_form_objects(wizard.cdw_form); cdw_form_delete(&(wizard.cdw_form)); } return; } /** \brief Create all UI elements in wizard window \param task - variable describing current task \param disc - variable describing disc currently in drive \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_verify_wizard_build(void) { wizard.cdw_form = cdw_form_new(CDW_VERIFY_WIZARD_N_FIELDS); if (wizard.cdw_form == (cdw_form_t *) NULL) { cdw_vdm ("ERROR: failed to create cdw form\n"); return CDW_ERROR; } int begin_y = ((LINES - window_n_lines) / 2) - 2; int begin_x = (COLS - window_n_cols) / 2; wizard.cdw_form->window = cdw_window_new((WINDOW *) NULL, window_n_lines, window_n_cols, begin_y, begin_x, CDW_COLORS_DIALOG, /* 2TRANS: this is title of wizard window; "verify" as in "Erasing an optical disc" */ _("Verify wizard"), /* 2TRANS: this is tip at the bottom of window - user can switch between window elements using tab key */ _("Use 'Tab' key to move")); if (wizard.cdw_form->window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create window\n"); return CDW_ERROR; } wizard.cdw_form->subwindow = cdw_window_new(wizard.cdw_form->window, subwindow_n_lines, subwindow_n_cols, 1, 1, CDW_COLORS_DIALOG, (char *) NULL, (char *) NULL); if (wizard.cdw_form->subwindow == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create subwindow\n"); return CDW_ERROR; } cdw_verify_wizard_build_fields(); wizard.cdw_form->form = cdw_ncurses_new_form(wizard.cdw_form->window, wizard.cdw_form->subwindow, wizard.cdw_form->fields); if (wizard.cdw_form->form == (FORM *) NULL) { cdw_vdm ("ERROR: failed to create form\n"); return CDW_ERROR; } cdw_form_redraw_widgets(wizard.cdw_form); cdw_form_add_return_chars(wizard.cdw_form, CDW_KEY_ENTER, CDW_KEY_ESCAPE, 'q', 'Q', 0); cdw_form_set_function(wizard.cdw_form, f_ok_b, cdw_verify_wizard_on_enter_on_verify); cdw_form_set_function(wizard.cdw_form, f_cancel_b, cdw_verify_wizard_on_enter_on_cancel); wrefresh(wizard.cdw_form->subwindow); wrefresh(wizard.cdw_form->window); return CDW_OK; } cdw_rv_t cdw_verify_wizard_build_fields(void) { cdw_form_descr_t descr[] = { /* widget type begin_y begin_x n_cols n_lines field enum data1 data2 */ /* 2TRANS: this is label in verify wizard */ { CDW_WIDGET_TEXT, top_message_row, first_col, label_n_cols, 4, f_top_message_t, text_makers, 0 }, { CDW_WIDGET_DROPDOWN, mode_row, first_col + 1, dropdown_n_cols - 2, 1, f_mode_dd, dropdown_makers, 0 }, /* 2TRANS: button label, "verify" means "verify data" */ { CDW_WIDGET_BUTTON, buttons_row, 3, 2, 1, f_ok_b, _("Verify"), CDW_COLORS_DIALOG }, /* 2TRANS: button label */ { CDW_WIDGET_BUTTON, buttons_row, 15, 2, 1, f_cancel_b, _("Cancel"), CDW_COLORS_DIALOG }, /* guard */ { -1, 0, 0, 0, 0, 0, (void *) NULL, 0 }}; wizard.cdw_form->n_fields = CDW_VERIFY_WIZARD_N_FIELDS; wizard.cdw_form->fields = wizard_fields; cdw_rv_t crv = cdw_form_description_to_fields(descr, wizard.cdw_form); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to convert form description to form\n"); return CDW_ERROR; } else { return CDW_OK; } } CDW_DROPDOWN *cdw_verify_wizard_make_verify_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width) { CDW_DROPDOWN *dropdown = cdw_dropdown_new(window, begin_y, begin_x, width, 3, /* n_items_max */ CDW_COLORS_DIALOG); if (dropdown == (CDW_DROPDOWN *) NULL) { cdw_vdm ("ERROR: failed to create new dropdown\n"); return (CDW_DROPDOWN *) NULL; } /* 2TRANS: this is a label in dropdown list; digest is an output of tools such as md5sum or sha512 sum */ cdw_rv_t crv = cdw_dropdown_add_item(dropdown, CDW_CALCULATE_DIGEST_MODE_FILE, _("Calculate digest of a file")); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create verify mode dropdown label 0\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } #if 0 /* I don't have 100% certain method of obtaining correct size of data on disc, so this functionality might provide invalid results. I'm disabling it for now. */ /* 2TRANS: this is a label in dropdown list; "disc" is an optical disc */ crv = cdw_dropdown_add_item(dropdown, CDW_CALCULATE_DIGEST_MODE_DISC, _("Verify first track of a disc")); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create verify mode dropdown label 1\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } #endif /* 2TRANS: this is a label in dropdown list; "disc" is an optical disc */ crv = cdw_dropdown_add_item(dropdown, CDW_CALCULATE_DIGEST_MODE_DISC_FILE, _("Compare a disc against a file (experimental)")); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create verify mode dropdown label 2\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } crv = cdw_dropdown_finalize(dropdown); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to finalize dropdown\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } else { cdw_dropdown_set_current_item_by_id(dropdown, CDW_CALCULATE_DIGEST_MODE_FILE); return dropdown; } } int cdw_verify_wizard_on_enter_on_cancel(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ESCAPE; } int cdw_verify_wizard_on_enter_on_verify(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ENTER; } char *cdw_verify_wizard_make_message(int n_cols) { /* 2TRANS: this is message printed in a wizard; */ return cdw_string_wrap(_("Select what you want to verify. Verification algorithm (md5sum, sha1sum etc.) can be changed in main window -> Configuration -> Tools -> Digest tool."), (size_t) n_cols, CDW_ALIGN_LEFT); } cdw-0.7.1/src/user_interface/cdw_processwin.h0000644000175000017500000000276611546706534016232 00000000000000#ifndef H_CDW_PROCESSWIN #define H_CDW_PROCESSWIN #include #include "main.h" #include "cdw_colors.h" #include "cdw_ncurses.h" /* size of processwin */ #define PROCESSWIN_COLS 40 #define PROCESSWIN_ROWS 14 /* maximal length of text that can be displayed in one line of processwin (does not include ending '\0') */ #define PROCESSWIN_MAX_RTEXT_LEN (PROCESSWIN_COLS - 2 - 1) cdw_rv_t cdw_processwin_create(const char *title, const char *label, bool show_progress); void cdw_processwin_destroy(const char *status_string, bool wait); void cdw_processwin_wrefresh(void); void cdw_processwin_wgetch(void); bool cdw_processwin_is_active(void); void cdw_processwin_display_main_info(const char *string); void cdw_processwin_display_sub_info(const char *string); void cdw_processwin_display_fifo_and_speed(int fifo_level, int speed_decimal, int speed_fract); void cdw_processwin_erase_fifo_and_speed(void); void cdw_processwin_display_eta(const char *eta_line); void cdw_processwin_erase_eta(void); void cdw_processwin_display_progress_conditional(long current, long total, const char *description); void cdw_processwin_display_progress(long current_amount, long total_amount, const char *description); void cdw_processwin_add_progress_bar(void); void cdw_processwin_delete_progress_bar(void); void cdw_processwin_draw_progress_bar(int value, cdw_colors_t color1, cdw_colors_t color2, chtype c); void cdw_processwin_reset_progress(void); void cdw_processwin_force_refresh(void); #endif /* H_CDW_PROCESSWIN */ cdw-0.7.1/src/user_interface/cdw_window.c0000644000175000017500000002363711722441437015332 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _GNU_SOURCE /* strndup() */ /** \file cdw_window.c */ #include #include #include "cdw_window.h" #include "cdw_string.h" #include "cdw_debug.h" /** \brief Create new or derived ncurses window Function creates new (newwin()) or derived (derwin()) ncurses window and draws a box around it (possibly with top and bottom titles). \p parent NULL pointer if you want to create new window with newwin(); pointer to parent window if you want to create derived window with derwin() \p n_lines \p n_cols \p begin_y - beginning of window, relative to stdscr for new window, \p begin_x - beginning of window, relative to origin of parent window for derived window \p cdw_colors window is boxed with cdw_ncurses_nice_box(), these two strings are arguments to the function \p top_string \p bottom_string \return NULL on errors \return pointer to new window on success */ WINDOW *cdw_window_new(WINDOW *parent, int n_lines, int n_cols, int begin_y, int begin_x, chtype cdw_colors, const char *top_string, const char *bottom_string) { WINDOW *window = (WINDOW *) NULL; if (parent == (WINDOW *) NULL) { window = newwin(n_lines, n_cols, begin_y, begin_x); } else { window = derwin(parent, n_lines, n_cols, begin_y, begin_x); } if (window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create %s window\n", parent == (WINDOW *) NULL ? "new" : "derived"); cdw_vdm ("ERROR: problem occurred when creating \"%s\" / \"%s\" window\n", top_string, bottom_string); return (WINDOW *) NULL; } wbkgd(window, COLOR_PAIR(cdw_colors)); int rv = keypad(window, TRUE); if (rv != OK) { cdw_vdm ("ERROR: keypad() returns !OK, but continuing\n"); cdw_vdm ("ERROR: problem occurred when creating \"%s\" / \"%s\" window\n", top_string, bottom_string); } rv = werase(window); if (rv != OK) { cdw_vdm ("ERROR: werase() returns !OK, but continuing\n"); cdw_vdm ("ERROR: problem occurred when creating \"%s\" / \"%s\" window\n", top_string, bottom_string); } if (parent != (WINDOW *) NULL) { return window; } cdw_rv_t crv = cdw_window_add_strings(window, top_string, bottom_string); if (crv != CDW_OK) { cdw_vdm ("ERROR: cdw_ncurses_nice_box() returns !CDW_OK\n"); cdw_vdm ("ERROR: problem occurred when creating \"%s\" / \"%s\" window\n", top_string, bottom_string); delwin(window); window = (WINDOW *) NULL; } else { rv = wrefresh(window); if (rv != OK) { cdw_vdm ("ERROR: wrefresh() returns !OK, but continuing\n"); cdw_vdm ("ERROR: problem occurred when creating \"%s\" / \"%s\" window\n", top_string, bottom_string); } } return window; } /** \brief Delete ncurses window, set pointer to NULL This is such a common piece of code that I had to put it in a separate function. The function accepts pointer to NULL window. The function sets window pointer to NULL. \param window - window to delete */ void cdw_window_delete(WINDOW **window) { if (*window == (WINDOW *) NULL) { cdw_vdm ("WARNING: passing NULL window to the function\n"); return; } else { delwin(*window); *window = (WINDOW *) NULL; return; } } /** \brief Add '?' char in upper right corner of given window The char indicates that pressing '?' key in this window invokes small help window, displaying some help text. \param window - window for which to display the char \param n_cols - number of columns in the window */ void cdw_window_add_help(WINDOW *window) { int n_cols = getmaxx(window); mvwprintw(window, 0, n_cols - 1, "?"); mvwaddch(window, 0, n_cols - 2, ACS_RTEE); mvwaddch(window, 1, n_cols - 1, ACS_TTEE); return; } /** \brief Draw nice box around window, with label on top and at the bottom of window Both top_string and bottom_string are optional and can be set to NULL or "" string. If the strings are longer than window width, then they will be truncated. Three dots will be appended to end of top string and/or to front of bottom string. \param window - initialized ncurses window to be boxed \param top_string - string that will appear on top of window \param bottom_string - string that will appear on bottom of window \return CDW_ERROR on malloc errors \return CDW_OK when no problems occurred */ cdw_rv_t cdw_window_add_strings(WINDOW *window, const char *top_string, const char *bottom_string) { cdw_assert (window, "cannot box NULL window\n"); /* 6 cells: left corner, left paren, space, , space, right paren, right corner - that is 6 chars in top and bottom border of window, which should be preserved and can't be overwritten by top_string nor bottom string */ cdw_assert (getmaxx(window) > 6, "window width is 6 or less, it is a tad to small\n"); size_t usable_n_cols = (size_t) getmaxx(window) - 6; /* draw standard ncurses box, and then overwrite parts of border with string(s) and custom decoration */ box(window, 0, 0); /* If bottom string will be truncated, then truncation should occur at the beginning of the string. This is because when nice_box() is used to box a file system browser window, bottom string in file browser window represents current full directory path, and truncation of beginning of path (while keeping it's end with current directory intact) is better than the second possibility. */ if ( bottom_string && strcmp(bottom_string, "") ) { bool malloced = false; char *buf = (char *) NULL; size_t len = strlen(bottom_string); if (len > usable_n_cols) { /* this is how far you have to move start of bottom string to display correctly tail of bottom string */ size_t offset = len - usable_n_cols; buf = strdup(bottom_string + offset); if (!buf) { cdw_vdm ("ERROR: failed to duplicate bottom string \"%s\" with strdup(bottom_string + offset)\n", bottom_string); cdw_vdm ("ERROR: details: strlen(bottom_string) = %zd, offset = %zd\n", strlen(bottom_string), offset); return CDW_ERROR; } else { malloced = true; strncpy(buf, "...", 3); } } else { malloced = false; /* display original argument string */ buf = bottom_string; } mvwprintw(window, getmaxy(window) - 1, 1, "( %s )", buf); if (malloced) { free(buf); buf = (char *) NULL; } } if ( top_string && strcmp(top_string, "") ) { bool malloced = false; char *buf = (char *) NULL; size_t len = strlen(top_string); if (len > usable_n_cols) { /* we can display no more than usable_n_cols chars, counting from start of string */ buf = strndup(top_string, usable_n_cols); if (!buf) { cdw_vdm ("ERROR: failed to duplicate top string \"%s\" with strndup(top_string, usable_n_cols)\n", top_string); cdw_vdm ("ERROR: details: strlen(top_string) = %zd, usable_n_cols = %zd\n", strlen(top_string), usable_n_cols); return CDW_ERROR; } else { malloced = true; strncpy(buf + usable_n_cols - 3, "...", 3); *(buf + usable_n_cols) = '\0'; } } else { malloced = false; /* display original string, without any modifications */ buf = top_string; } mvwaddch(window, 0, 1, ACS_RTEE); mvwprintw(window, 0, 2, " %s ", buf); waddch(window, ACS_LTEE); if (malloced) { free(buf); buf = (char *) NULL; } } return CDW_OK; } /** \brief Print message in given window, wrap message to not to cross window border Print given \p message in a \p window. Text can be longer than window width. The function takes care of wrapping the text so that line breaks occur on white chars. Line breaks ('\n' chars) that exist in original message will be preserved. Caller of the function must make sure that window has correct height and width, e.g. by calling cdw_textarea_calculate_height(). Caller must refresh \p window after calling this function. \param window - area in which you want to print the message \param message - message that has to be printed in a window \param align - alignment of message in window (CDW_ALIGN_CENTER, CDW_ALIGN_LEFT, CDW_ALIGN_RIGHT) \return -1 on errors \return 0 if \p window has just enough or more rows than needed to print a message without truncations \return number of lines that weren't displayed because \p window doesn't have enough rows */ int cdw_window_print_message(WINDOW *window, const char *message, int align) { cdw_assert (window != (WINDOW *) NULL, "ERROR: cannot print in NULL window\n"); cdw_assert (message != (char *) NULL, "ERROR: cannot print NULL message\n"); int n_cols = getmaxx(window); int n_rows = getmaxy(window); int n_lines = (int) cdw_string_count_lines(message, (size_t) n_cols); if (n_lines > n_rows) { cdw_vdm ("WARNING: message has more lines (%d) than number of rows in the window (%d)\n", n_lines, n_rows); cdw_vdm ("WARNING: \"%s\"\n", message); } char *string = cdw_string_wrap(message, (size_t) n_cols, align); if (string == (char *) NULL) { cdw_vdm ("ERROR: can't produce wrapped string\n"); return -1; } mvwprintw(window, 0, 0, string); free(string); string = (char *) NULL; if (n_rows < n_lines) { cdw_vdm ("ERROR: function returns %d, there were more lines of text than rows in window\n", n_lines - n_rows); return n_lines - n_rows; } else { return 0; } } cdw-0.7.1/src/user_interface/cdw_widgets.h0000644000175000017500000000164211702271374015465 00000000000000#ifndef H_CDW_WIDGETS #define H_CDW_WIDGETS #include /* size_t */ #include "main.h" #include "cdw_colors.h" #include "cdw_ncurses.h" #include "cdw_dropdown.h" #include "cdw_button.h" #include "cdw_checkbox.h" #include "cdw_input_line.h" #include "cdw_dialog.h" #include "cdw_string.h" /* widget IDs, useful e.g. for selecting constructors when building form with many widgets */ #define CDW_WIDGET_LABEL 1 #define CDW_WIDGET_CHECKBOX 2 #define CDW_WIDGET_INPUT 3 #define CDW_WIDGET_DROPDOWN 4 #define CDW_WIDGET_BUTTON 5 #define CDW_WIDGET_TEXT 6 /* like label, but larger, and with special requirements */ /* some widgets have table of return keys - keys on which a driver returns control to caller; 20 seems to be reasonable limit at this time; there is no guard, widgets have to maintain n_return_keys counter */ #define N_RETURN_KEYS_MAX 20 #endif /* ifndef H_CDW_WIDGETS */ cdw-0.7.1/src/user_interface/cdw_form.h0000644000175000017500000000550411550300704014752 00000000000000#ifndef H_CDW_FORM #define H_CDW_FORM #include #include #include "main.h" #include "cdw_ncurses.h" #include "cdw_config.h" #include "cdw_widgets.h" /* this data structure is in "draft" version, it may change many times */ typedef struct { cdw_id_t widget_type; /* widget type from cdw_widgets.h */ int begin_y; /* start row in parent window */ int begin_x; /* start col in parent window */ int n_cols; /* number of columns occupied by widget */ int n_lines; /* number of lines occupied by widget */ int field_enum; /* field index, useful when widgets are placed in ncurses form */ void *data1; /* e.g. for initial label string or for widget associated with field */ size_t data2; /* generic int, usage depends on type of widget */ } cdw_form_descr_t; struct cdw_form_type { /* these three fields are "foreign" - they are just pointers to data provided and managed by client's code */ WINDOW *window; WINDOW *subwindow; FIELD **fields; /* this is pointer to memory allocated by cdw form, but it's client's responsibility to free this memory */ FORM *form; /* TODO: make "form" and "fields" fields fully "owned" by cdw form */ int n_fields; cdw_id_t *field_widget_types; /* table of widget types/IDs, allocated at runtime */ cdw_id_t form_id; /* useful when client code uses several forms */ int return_keys[N_RETURN_KEYS_MAX]; int n_return_keys; /* this one you have to initialize yourself */ int (* handle_enter)(cdw_form_t *cdw_form, int fi); }; /* these are for "cdw form" data structure */ cdw_form_t *cdw_form_new(int n_fields); void cdw_form_delete_form_objects(cdw_form_t *cdw_form); void cdw_form_delete(cdw_form_t **cdw_form); int cdw_form_driver(cdw_form_t *cdw_form, int initial_fi); cdw_rv_t cdw_form_description_to_fields(cdw_form_descr_t descr[], cdw_form_t *cdw_form); void cdw_form_add_return_char(cdw_form_t *form, int key); void cdw_form_add_return_chars(cdw_form_t *form, ...); void cdw_form_driver_go_to_field(cdw_form_t *cdw_form, int fi); bool cdw_form_is_movement_key(int key); CDW_DROPDOWN *cdw_form_get_dropdown(cdw_form_t *cdw_form, int fi); CDW_BUTTON *cdw_form_get_button(cdw_form_t *cdw_form, int fi); CDW_CHECKBOX *cdw_form_get_checkbox(cdw_form_t *cdw_form, int fi); bool cdw_form_get_checkbox_state(cdw_form_t *cdw_form, int fi); const char *cdw_form_get_string(cdw_form_t *cdw_form, int fi); void cdw_form_redraw_widgets(cdw_form_t *cdw_form); void *cdw_form_set_function(cdw_form_t *cdw_form, int fi, cdw_form_widget_function_t function); typedef CDW_DROPDOWN * (* cdw_form_dropdown_maker_t)(WINDOW *window, int begin_y, int begin_x, int width); typedef char * (* cdw_form_text_maker_t)(int n_cols); #endif /* H_CDW_FORM */ cdw-0.7.1/src/user_interface/cdw_tabs_window.h0000644000175000017500000000437111722441423016335 00000000000000#ifndef H_CDW_TABS_WINDOW #define H_CDW_TABS_WINDOW #include "main.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" typedef struct { PANEL *panel; /* ncurses panel; tabbed window is implemented using ncurses panels, private field */ WINDOW *window; WINDOW *subwindow; char *label; /* tab-specific label, displayed in right part of tabbed window */ cdw_id_t id; /* tab ID, to be used mainly by client code */ int hotkey; /* key associated with a tab; pressing the key causes switching to associated tab */ } cdw_tab_t; typedef int (* cdw_tabs_window_driver_reader_t) (void *twindow); typedef struct { cdw_tab_t *tabs; /* table of tabs */ int n_tabs; /* total number of tabs in tabbed window */ int current_tab; /* index of currently visible/selected tab */ char *title; /* window title, common for all tabs */ char *subtitle; /* window subtitle, displayed at the bottom of tabbed window, common for all tabs */ void *user_data; struct { int n_lines; int n_cols; int begin_y; int begin_x; int tabs_width; /* width of area in which tab labels are displayed; usable area of tab window is n_cols - tabs_width */ } geometry; cdw_tabs_window_driver_reader_t driver_reader; int return_keys[N_RETURN_KEYS_MAX]; /* return keys, i.e. "return control after pressing this key" keys; private field */ int n_return_keys; /* current number of return keys; private field */ } cdw_tabs_window_t; cdw_tabs_window_t *cdw_tabs_window_init(int n_tabs, const char *title, const char *subtitle); void cdw_tabs_window_delete(cdw_tabs_window_t **twindow); void cdw_tabs_window_set_geometry(cdw_tabs_window_t *twindow, int n_lines, int n_cols, int begin_y, int begin_x, int tabs_width); cdw_rv_t cdw_tabs_window_append_tab(cdw_tabs_window_t *twindow, cdw_id_t id, int hotkey, const char *label); cdw_rv_t cdw_tabs_window_finalize(cdw_tabs_window_t *twindow); int cdw_tabs_window_driver(cdw_tabs_window_t *twindow); void cdw_tabs_window_draw_tabs(cdw_tabs_window_t *twindow); cdw_rv_t cdw_tabs_window_show_tab_by_id(cdw_tabs_window_t *twindow, cdw_id_t id); void cdw_tabs_window_add_return_key(cdw_tabs_window_t *twindow, int key); void cdw_tabs_window_add_return_keys(cdw_tabs_window_t *twindow, ...); #endif /* H_CDW_TABS_WINDOW */ cdw-0.7.1/src/user_interface/cdw_ncurses.c0000644000175000017500000005765311722440226015505 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _GNU_SOURCE /* strndup() */ /** \file cdw_ncurses.c \brief Set of functions that support use of ncurses library termcap/terminfo: it seems that in some circumstances keys F1-F4 emit very different values than keys F5-F12. Output from demo_altkeys tool (from ncurses examples) gives following results for F1-F10 keys: Keycode 27, name ^[ Keycode 91, name [ Keycode 49, name 1 Keycode 49, name 1 Keycode 126, name ~ Keycode 27, name ^[ Keycode 91, name [ Keycode 49, name 1 Keycode 50, name 2 Keycode 126, name ~ Keycode 27, name ^[ Keycode 91, name [ Keycode 49, name 1 Keycode 51, name 3 Keycode 126, name ~ Keycode 27, name ^[ Keycode 91, name [ Keycode 49, name 1 Keycode 52, name 4 Keycode 126, name ~ Keycode 269, name KEY_F(5) Keycode 270, name KEY_F(6) Keycode 271, name KEY_F(7) Keycode 272, name KEY_F(8) Keycode 273, name KEY_F(9) Keycode 274, name KEY_F(10) Key F1 emits n characters instead of one: "^[OP" or "^[[11~", where "^[" is an escape sequence ("\033"). Normally such sequences can't be recognized as function keys, and any code awaiting for function keys may fail. Using define_key() adds new definitions of function keys, and that fixes the problem. Initial bug report on this was sent by robwoj44, more info on function keys was found in mc-4.7.0.2/lib/tty/key.c and here: [1] http://fixunix.com/bsd/88211-ncurses-function-keys.html [2] http://invisible-island.net/ncurses/ncurses.faq.html#xterm_color [3] http://totalrecall.wordpress.com/2008/12/22/xterm-color-key-issues-fixed/ [4] https://bugs.launchpad.net/gnome-terminal/+bug/96676 [2] mentions terminal type (xterm-color) as one of conditions under which the problem occurs. Example of usage of define_key() was found in ncurses-5.7+20090803/test/demo_altkeys.c */ #include #include #include #include #include #include "cdw_string.h" #include "cdw_debug.h" #include "main.h" #include "cdw_ncurses.h" #include "cdw_utils.h" #include "cdw_widgets.h" #include "gettext.h" extern cdw_arguments_t cdw_commandline_arguments; /* used by cdw_ncurses_get_field_string() */ static char empty_string[] = ""; static void cdw_ncurses_get_field_buffer_check(FIELD *field, size_t limit); static void cdw_ncurses_make_custom_key_definitions(void); /** \brief Run common ncurses setup code Simple wrapper for few ncuses functions that should be called when every ncurses program starts. \return CDW_OK on success \return CDW_GEN_ERROR on failure */ cdw_rv_t cdw_ncurses_init(void) { initscr(); start_color(); cbreak(); noecho(); keypad(stdscr, TRUE); if (cdw_commandline_arguments.escdelay_ms != -1) { set_escdelay(cdw_commandline_arguments.escdelay_ms); } else { /* we are about to modify global variable ESCDELAY; this is a library variable, not a shell variable; I'm not sure what "global" means in this context, man page for set_escdelay suggests that it is global in "screen" scope; just to be on the safe side I will check if the variable isn't already modified by other apps to "low enough" level; of course this does not prevent cdw from modifying ESCDELAY if some other app modified it to some "large enough" value... */ if (ESCDELAY <= 150) { /* low enough, don't modify */ } else { set_escdelay(50); /* milliseconds */ } } /* turn cursor off - now cursor will be turned on only if needed */ curs_set(0); /* can't do this here since cdw colors module depends on paths being set in fs module; fs module is called after cdw_curses_init(); you have to call curses_colors_init() after cdw_fs_init(); */ /* curses_colors_init(); */ int lines = getmaxy(stdscr); int cols = getmaxx(stdscr); if ((lines < 24) || (cols < 80)) { cdw_ncurses_clean(); /* 2TRANS: this message displayed in console when program detects that requirement about console size is not met and exits; please keep '\n' chars */ fprintf(stderr, _("\nCannot start cdw: cdw needs at least 80x24 terminal!\n")); cdw_vdm ("ERROR: failed to initialize curses, either lines (%d) or cols (%d) value is too small\n", lines, cols); return CDW_ERROR; } else { cdw_sdm ("INFO: lines = %d, cols = %d\n", lines, cols); } cdw_ncurses_make_custom_key_definitions(); return CDW_OK; } void cdw_ncurses_clean(void) { endwin(); return; } /** \brief Copy content of buffer associated with given field to given buffer Function copies content of buffer nr 0 of given field to given buffer. If \p limit > 0, then no more than \p limit chars are copied. Data in target buffer is ended with '\0'. The function was closely related to cdw_one_line_input() and copies its specification of \p limit and \p buffer and relation between them. \param field - field from which data will be copied \param buffer - buffer to which the data will be copied \param limit - maximal number of chars to copy, does not include ending nul \return CDW_OK on success \return CDW_ERROR on malloc error */ cdw_rv_t cdw_ncurses_get_field_buffer(FIELD *field, char **buffer, size_t limit) { #ifndef NDEBUG cdw_ncurses_get_field_buffer_check(field, limit); #endif /* note that this also works for empty field buffer (field buffer = ""); caller of this function must decide if empty string is a valid value */ size_t len = strlen((char *) cdw_string_rtrim(field_buffer(field, 0))); cdw_vdm ("INFO: len of R-trimmed field's buffer = %zd, R-trimmed buffer = \"%s\"\n", len, cdw_string_rtrim(field_buffer(field, 0))); if (limit != 0) { if (len > limit) { /* this shouldn't happen since we limited size of field with set_max_field(field[0], limit) */ cdw_vdm ("ERROR: field's buffer will be truncated from %zd to %zd because of len limit\n", len, limit); len = limit; } } cdw_vdm ("INFO: reallocing buffer for len = %zd\n", len); char *tmp = (char *) realloc(*buffer, len + 1); if (tmp == (char *) NULL) { cdw_vdm ("ERROR: failed to reallocate buffer with new len %zd\n", len); return CDW_ERROR; } else { *buffer = tmp; strncpy(*buffer, (char *) cdw_string_rtrim(field_buffer(field, 0)), len); *(*buffer + len) = '\0'; cdw_vdm ("INFO: field's buffer saved as \"%s\"\n", *buffer); cdw_vdm ("INFO: %zd chars in saved string / %zd chars limit\n", len, limit); return CDW_OK; } } /** \brief Check some assertions about cdw_ncurses_get_field_buffer()'s arguments */ void cdw_ncurses_get_field_buffer_check(FIELD *field, size_t limit) { Field_Options opts = field_opts(field); if ((unsigned int) opts & O_STATIC) { int rows; int cols; int frow; int fcol; int nrow; int nbuf; int res = field_info(field, &rows, &cols, &frow, &fcol, &nrow, &nbuf); cdw_assert (res == CDW_OK, "ERROR: failed to fetch dynamic field info\n"); if (rows * cols >= (int) limit) { cdw_vdm ("ERROR: field->rows * field->cols < (int) limit (%d < %zd), you passed wrong limit to the function\n", rows * cols , limit); } } else { int rows; int cols; int max; int res = dynamic_field_info(field, &rows, &cols, &max); cdw_assert (res == CDW_OK, "ERROR: failed to fetch dynamic field info\n"); if (max != (int) limit) { cdw_vdm ("ERROR: field->max_size != field limit (%d != %zd), you passed wrong limit to the function\n", max, limit); } } return; } /* names are from /usr/include/ncursesw/eti.h, descriptions come from ncurses man pages */ static cdw_id_clabel_t cdw_ncurses_error_strings[] = { { E_OK, "E_OK" }, /* The routine succeeded */ { E_SYSTEM_ERROR, "E_SYSTEM_ERROR" }, /* System error occurred, e.g., malloc failure. */ { E_BAD_ARGUMENT, "E_BAD_ARGUMENT" }, /* Routine detected an incorrect or out-of-range argument. */ { E_POSTED, "E_POSTED" }, /* The form has already been posted. */ { E_CONNECTED, "E_CONNECTED" }, /* Field is connected. */ { E_BAD_STATE, "E_BAD_STATE" }, /* Routine was called from an initialization or termination function. */ { E_NO_ROOM, "E_NO_ROOM" }, /* Form is too large for its window. */ { E_NOT_POSTED, "E_NOT_POSTED" }, /* The form has not been posted. */ { E_UNKNOWN_COMMAND, "E_UNKNOWN_COMMAND" }, /* The form driver code saw an unknown request code. */ { E_NO_MATCH, "E_NO_MATCH" }, /* */ { E_NOT_SELECTABLE, "E_NOT_SELECTABLE" }, /* */ { E_NOT_CONNECTED, "E_NOT_CONNECTED" }, /* No items are connected to the form. */ { E_REQUEST_DENIED, "E_REQUEST_DENIED" }, /* The form driver could not process the request. */ { E_INVALID_FIELD, "E_INVALID_FIELD" }, /* Contents of field is invalid. */ { E_CURRENT, "E_CURRENT" }, /* The field is the current field */ { 0, (char *) NULL }}; const char *cdw_ncurses_error_string(int error) { return cdw_utils_id_label_table_get_label(cdw_ncurses_error_strings, error); } /** \brief Remove given ncurses MENU and all its ITEMs Unpost and deallocate given ncurses MENU data and all ITEMs that belong to this menu. \param menu - menu that you want to remove */ void cdw_ncurses_delete_menu_and_items(MENU **menu) { if (*menu != (MENU *) NULL) { /* order of cleaning up a menu (from http://invisible-island.net/ncurses/ncurses-intro.html#moverview): # Unpost the menu using unpost_menu(). # Free the menu, using free_menu(). # Free the items using free_item(). */ unpost_menu(*menu); ITEM **items = menu_items(*menu); int rv = free_menu(*menu); *menu = (MENU *) NULL; if (rv == E_OK) { ; } else if (rv == E_SYSTEM_ERROR) { int e = errno; cdw_vdm ("ERROR: failed to free menu, error = \"%s\"\n", strerror(e)); } else if (rv == E_BAD_ARGUMENT) { cdw_vdm ("ERROR: failed to free menu, bad argument\n"); } else if (rv == E_POSTED) { cdw_vdm ("ERROR: failed to free menu, menu is posted\n"); } else { cdw_vdm ("ERROR: unrecognized error when calling free_menu: %d\n", rv); } if (items != (ITEM **) NULL) { for (int i = 0; items[i] != (ITEM *) NULL; i++){ free_item(items[i]); items[i] = (ITEM *) NULL; } free(items); items = (ITEM **) NULL; } else { cdw_sdm ("WARNING: menu items were NULL for non-NULL menu\n"); } } return; } static cdw_id_clabel_t cdw_ncurses_key_labels[] = { { CDW_KEY_ENTER, "ENTER" }, { CDW_KEY_ESCAPE, "ESCAPE" }, { KEY_DOWN, "KEY_DOWN" }, { KEY_UP, "KEY_UP" }, { KEY_LEFT, "KEY_LEFT" }, { KEY_RIGHT, "KEY_RIGHT" }, { KEY_PPAGE, "Page Up" }, { KEY_NPAGE, "Page Down" }, { KEY_HOME, "KEY_HOME" }, { KEY_END, "KEY_END" }, { ' ', "SPACE" }, { '\t', "TAB" }, { CDW_KEY_TAB, "TAB" }, { KEY_F(1), "F1" }, { KEY_F(2), "F2" }, { KEY_F(3), "F3" }, { KEY_F(4), "F4" }, { KEY_F(5), "F5" }, { KEY_F(6), "F6" }, { KEY_F(7), "F7" }, { KEY_F(8), "F8" }, { KEY_F(9), "F9" }, { KEY_F(10), "F10" }, { KEY_F(11), "F11" }, { KEY_F(12), "F12" }, { KEY_IC, "Insert" }, { 0, (char *) NULL }}; static char cdw_ncurses_key_printable[2]; const char *cdw_ncurses_key_label(int key) { if (isprint(key)) { snprintf(cdw_ncurses_key_printable, 1 + 1, "%c", toascii(key)); return cdw_ncurses_key_printable; } else { return cdw_utils_id_label_table_get_label(cdw_ncurses_key_labels, key); } } /** \brief Create input field Function creates one ncurses form fiels of given size and type. Function takes a lot of arguments, but it returns fully configured and tested field. \param n_lines - number of lines in a field \param n_cols - number of columns in a field \param begin_y \param begin_x \param initial_string - initial content of a field, may be NULL \param input_type - specifies behavior or input field \param len_max - specifies maximal number of characters that can be entered into the field, may be zero for no limit \param colors - colors scheme for the field \return pointer to new field on success \return NULL on errors */ FIELD *cdw_ncurses_new_input_field(int n_lines, int n_cols, int begin_y, int begin_x, const char *initial_value, size_t len_max, int input_type, cdw_colors_t colors) { int e = 0; /* input field new_field params: height, width, starty, startx, number of offscreen rows and number of additional working buffers */ FIELD *field = new_field((int) n_lines, (int) n_cols, (int) begin_y, (int) begin_x, 0, 0); if (field == (FIELD *) NULL) { cdw_vdm ("ERROR: failed to create new field, new_field() returns NULL, error = \"%s\"\n", cdw_ncurses_error_string(e)); return (FIELD *) NULL; } /* NOTE: call "field_opts_off(field[0], O_STATIC)" _before_ calling set_field_buffer(), otherwise string in field will be truncated to field width; */ /* data buffer can be longer than visible length of field */ e = field_opts_off(field, O_STATIC); if (e != E_OK) { cdw_vdm ("ERROR: failed to turn off static with field_opts_off(), error = \"%s\"\n", cdw_ncurses_error_string(e)); } /* either 0 (no limit to data size) or real limit */ e = set_max_field(field, (int) len_max); if (e != E_OK) { cdw_vdm ("ERROR: failed to set proper limit=%zd for field with set_max_field(), error = \"%s\"\n", len_max, cdw_ncurses_error_string(e)); } if (input_type & CDW_NCURSES_INPUT_NUMERIC) { cdw_vdm ("INFO: setting field type to numeric\n"); /* require validation of field, min value is 0, max is 0 (which gives no range checking) */ e = set_field_type(field, TYPE_NUMERIC, 0, 0.0, 0.0); if (e != E_OK) { cdw_vdm ("ERROR: failed to set field type to numeric with set_field_type(), error = \"%s\"\n", cdw_ncurses_error_string(e)); } } else if (input_type & CDW_NCURSES_INPUT_INTEGER) { cdw_vdm ("INFO: setting field type to integer\n"); /* require validation of field, min value is 0, max is 0 (which gives no range checking) */ e = set_field_type(field, TYPE_INTEGER, 0, 0.0, 0.0); if (e != E_OK) { cdw_vdm ("ERROR: failed to set field type to integer with set_field_type(), error = \"%s\"\n", cdw_ncurses_error_string(e)); } } else { /* no specific type */ } if (input_type & CDW_NCURSES_INPUT_HIDDEN) { /* don't display entered chars */ e = field_opts_off(field, O_PUBLIC); if (e != E_OK) { cdw_vdm ("ERROR: failed to turn off O_PUBLIC with field_opts_off(), error = \"%s\"\n", cdw_ncurses_error_string(e)); } } else { if (initial_value != (char *) NULL) { /* this may also set content of buffer to "" */ e = set_field_buffer(field, 0, initial_value); if (e != E_OK) { const char *tmp = (e == E_SYSTEM_ERROR) ? strerror(errno) : cdw_ncurses_error_string(e); cdw_assert (0, "ERROR: failed to set buffer content with string \"%s\", error = \"%s\"\n", initial_value, tmp); } } } e = field_opts_off(field, O_BLANK); if (e != E_OK) { cdw_vdm ("ERROR: failed to turn off blanking of field, error = \"%s\"\n", cdw_ncurses_error_string(e)); } e = set_field_just(field, JUSTIFY_LEFT); if (e != E_OK) { cdw_vdm ("ERROR: failed to justify field, error = \"%s\"\n", cdw_ncurses_error_string(e)); } /* disable moving cursor out of field when it reaches end of field */ e = field_opts_off(field, O_AUTOSKIP); if (e != E_OK) { cdw_vdm ("ERROR: failed to turn off autoskip with field_opts_off(), error = \"%s\"\n", cdw_ncurses_error_string(e)); } e = set_field_back(field, COLOR_PAIR(colors)); if (e != E_OK) { const char *tmp = (e == E_SYSTEM_ERROR) ? strerror(errno) : cdw_ncurses_error_string(e); cdw_assert (0, "ERROR: failed to set buffer content with string \"%s\", error = \"%s\"\n", initial_value, tmp); } e = set_field_fore(field, COLOR_PAIR(colors)); if (e != E_OK) { const char *tmp = (e == E_SYSTEM_ERROR) ? strerror(errno) : cdw_ncurses_error_string(e); cdw_assert (0, "ERROR: failed to set buffer content with string \"%s\", error = \"%s\"\n", initial_value, tmp); } return field; } /** * \brief Create new non-editable ncurses field that will be used as text label * * Create XxY input field that will be used in a page as text label. * * \return field - newly created field */ FIELD *cdw_ncurses_new_label_field(int n_lines, int n_cols, int begin_y, int begin_x, const char *initial_value) { FIELD *field = new_field(n_lines, n_cols, begin_y, begin_x, 0, 0); if (!field) { int e = errno; cdw_vdm ("ERROR: failed to create a field with new_field(), \"%s\"\n", cdw_ncurses_error_string(e)); return (FIELD *) NULL; } int rv = field_opts_on(field, O_STATIC); /* otherwise justification might fail */ if (rv != E_OK) { cdw_vdm ("ERROR: field_opts_on() returns !E_OK\n"); } rv = set_field_buffer(field, 0, initial_value); if (rv != E_OK) { cdw_vdm ("ERROR: failed to set field buffer with string = \"%s\"\n", initial_value); } /* supposedly you can't justify if field is inactive, so first justify and then deactivate */ rv = set_field_just(field, JUSTIFY_LEFT); if (rv != E_OK) { cdw_vdm ("ERROR: set_field_just() returns !E_OK\n"); } rv = field_opts_off(field, O_ACTIVE); if (rv != E_OK) { cdw_vdm ("ERROR: field_opts_off() returns !E_OK\n"); } rv = set_field_back(field, COLOR_PAIR(CDW_COLORS_DIALOG)); if (rv != E_OK) { cdw_vdm ("ERROR: set_field_back() returns !E_OK\n"); } rv = set_field_fore(field, COLOR_PAIR(CDW_COLORS_DIALOG)); if (rv != E_OK) { cdw_vdm ("ERROR: set_field_fore() returns !E_OK\n"); } return field; } /** * \brief Create new ncurses input field that will be used as checkbox * * Create 1x1 input field that will be used in a page as checkbox. Function * does not write '[' ']' characters around the field. * * \param begin_y - row in which the field will be put * \param begin_x - column in which the field will be put * \param buffer_content - initial state of the checkbox * * \return field - newly created field */ FIELD *cdw_ncurses_new_checkbox_field(int begin_y, int begin_x, const char *initial_value) { /* FIELD *new_field(int height, int width, int toprow, int leftcol, int offscreen, int nbuffers); */ FIELD *field = new_field(1, 1, begin_y, begin_x, 0, 0); if (field == (FIELD *) NULL) { cdw_vdm ("ERROR: failed to create a field with new_field\n"); return (FIELD *) NULL; } int rv = 0; if (initial_value != (char *) NULL) { rv = set_field_buffer(field, 0, initial_value); if (rv != E_OK) { cdw_vdm ("ERROR: set_field_buffer() returns !E_OK\n"); } } field_opts_off(field, O_AUTOSKIP); if (rv != E_OK) { cdw_vdm ("ERROR: field_opts_off() returns !E_OK\n"); } field_opts_on(field, O_STATIC); if (rv != E_OK) { cdw_vdm ("ERROR: field_opts_on() returns !E_OK\n"); } set_field_just(field, JUSTIFY_CENTER); if (rv != E_OK) { cdw_vdm ("ERROR: set_field_just() returns !E_OK\n"); } return field; } void cdw_ncurses_make_custom_key_definitions(void) { /* new definitions of keys: a workaround for problems with underlying termcap and/or terminfo; see "termcap/terminfo" note in header of this file */ struct { const char *string; int val; } keycodes[] = { { "\033[11~", KEY_F(1) }, { "\033[12~", KEY_F(2) }, { "\033[13~", KEY_F(3) }, { "\033[14~", KEY_F(4) }, { "\033OP", KEY_F(1) }, { "\033OQ", KEY_F(2) }, { "\033OR", KEY_F(3) }, { "\033OS", KEY_F(4) }, { "\x7f", KEY_BACKSPACE }, /* with xterm-color, found in hnb-1.9.14/src/ui.c */ #if 0 /* this doesn't work */ { "\x0a", KEY_ENTER }, /* 10, maybe this will replace #define in main.h */ #endif { "\033OH", KEY_HOME }, /* with xterm-color */ { "\033OF", KEY_END}, /* with xterm-color */ { (const char *) NULL, 0 }}; /* guard */ int i = 0; while (keycodes[i].val != 0) { int rv = define_key(keycodes[i].string, keycodes[i].val); if (rv != OK) { cdw_vdm ("WARNING: can't define key #%d / \"%s\"\n", keycodes[i].val, keycodes[i].string); /* not returning, missing key definitions aren't critical error */ } i++; } return; } /** \brief Create new form Create new form, do this with proper assignment of its window, subwindow and form. Function does full clean up and returns NULL in case of failure. Otherwise pointer to properly created form is returned. Since "Every form has an associated pair of curses windows" (quote from man pages for set_form_win() and set_form_sub()), you have to create two windows (main window and subwindow) before calling this function. \param window - window in which form will be placed \param subwindow - subwindow of the form \param field - set of fields to be put in the form \return form on success \return NULL on failure */ FORM *cdw_ncurses_new_form(WINDOW *window, WINDOW *subwindow, FIELD *field[]) { cdw_assert (window != (WINDOW *) NULL, "ERROR: function called with window == NULL\n"); cdw_assert (subwindow != (WINDOW *) NULL, "ERROR: function called with subwindow == NULL\n"); cdw_assert (field != (FIELD **) NULL, "ERROR: function called with fields array == NULL\n"); FORM *form = new_form(field); if (form == (FORM *) NULL) { #ifndef NDEBUG int e = errno; cdw_vdm ("ERROR: failed to create form with new_form(), error code is \"%s\"\n", cdw_ncurses_error_string(e)); #endif return (FORM *) NULL; } int r; r = set_form_win(form, window); if (r != E_OK) { cdw_vdm ("ERROR: failed to set form window with set_form_win(), error code is \"%s\"\n", cdw_ncurses_error_string(r)); free_form(form); form = (FORM *) NULL; return (FORM *) NULL; } r = set_form_sub(form, subwindow); if (r != E_OK) { cdw_vdm ("ERROR: failed to set form subwindow with set_form_sub(), error code is \"%s\"\n", cdw_ncurses_error_string(r)); free_form(form); form = (FORM *) NULL; return (FORM *) NULL; } r = post_form(form); if (r != E_OK) { cdw_vdm ("ERROR: failed to post form with post_form(), error code is \"%s\"\n", cdw_ncurses_error_string(r)); free_form(form); form = (FORM *) NULL; return (FORM *) NULL; } return form; } /** \brief Get string from given field's buffer Function removes trailing white chars from te string before returning it. Function returns empty string ("") if given field's buffer is NULL. \param field - field that you want to inspect \return string from field's buffer, may be empty string ("") */ char *cdw_ncurses_get_field_string(FIELD *field) { assert(field != (FIELD *) NULL); char *s = field_buffer(field, 0); if (s == (char *) NULL) { return empty_string; } else { cdw_vdm ("INFO: returning field string \"%s\"\n", s); return cdw_string_rtrim(s); } } /* *** unused code below */ # if 0 /** \brief Get 0/1 state from a checkbox widget associated with given field Check content of field's buffer (if it is "X" or not) and return 0 or 1. The field must be configured and used as a checkbox (field of size 1x1), because only first character of field's buffer is checked. \param field - field that you want to inspect \return true if given field's buffer contains "X" string \return false if given field's buffer does not contain "X" string */ bool cdw_ncurses_get_field_bit(FIELD *field) { cdw_assert (field != (FIELD *) NULL, "ERROR: field argument passed for examination is NULL\n"); return !strncmp(field_buffer(field, 0), "X", 1) ? true : false; } #endif cdw-0.7.1/src/user_interface/cdw_text_file_viewer.h0000644000175000017500000000044711204043107017351 00000000000000#ifndef H_CDW_TEXT_FILE_VIEWER #define H_CDW_TEXT_FILE_VIEWER #include #include "main.h" cdw_rv_t cdw_text_file_viewer(FILE *file, const char *title); cdw_rv_t cdw_text_file_viewer_with_fullpath(const char *fullpath, const char *title); #endif /* #ifndef H_CDW_TEXT_FILE_VIEWER */ cdw-0.7.1/src/user_interface/cdw_verify_wizard.h0000644000175000017500000000022211534532316016673 00000000000000#ifndef H_CDW_VERIFY_WIZARD #define H_CDWE_VERIFY_WIZARD #include "main.h" cdw_id_t cdw_verify_wizard(void); #endif /* H_CDW_VERIFY_WIZARD */ cdw-0.7.1/src/user_interface/cdw_form.c0000644000175000017500000006134211722440243014753 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include /* isprint() */ #include "cdw_debug.h" #include "cdw_form.h" #include "cdw_widgets.h" #include "cdw_string.h" static void cdw_form_driver_focus_off(cdw_form_t *cdw_form, int fi); static void cdw_form_driver_focus_on(cdw_form_t *cdw_form, int fi); static void cdw_form_driver_toggle_focus(cdw_form_t *cdw_form, int fi, bool off); static void cdw_form_driver_toggle_checkbox(cdw_form_t *cdw_form, int fi); static bool cdw_form_is_return_key(cdw_form_t *form, int key); static int cdw_form_handle_enter(cdw_form_t *cdw_form, int fi); static bool cdw_form_is_checkbox_field_index(cdw_form_t *cdw_form, int fi); static bool cdw_form_is_dropdown_field_index(cdw_form_t *cdw_form, int fi); static bool cdw_form_is_button_field_index(cdw_form_t *cdw_form, int fi); static bool cdw_form_is_input_field_index(cdw_form_t *cdw_form, int fi); /** \brief Constructor \param n_fields - expected maximal number of fields in a form */ cdw_form_t *cdw_form_new(int n_fields) { cdw_form_t *cdw_form = (cdw_form_t *) malloc(sizeof (cdw_form_t)); if (cdw_form == (cdw_form_t *) NULL) { cdw_vdm ("ERROR: failed to allocate memory for new cdw form\n"); return (cdw_form_t *) NULL; } cdw_form->n_fields = n_fields; cdw_form->field_widget_types = malloc((size_t) cdw_form->n_fields * sizeof (cdw_id_t)); if (cdw_form->field_widget_types == NULL) { cdw_vdm ("ERROR: failed to allocate fields widget ids table\n"); free(cdw_form); cdw_form = (cdw_form_t *) NULL; return (cdw_form_t *) NULL; } cdw_form->window = (WINDOW *) NULL; cdw_form->subwindow = (WINDOW *) NULL; cdw_form->form = (FORM *) NULL; cdw_form->fields = (FIELD **) NULL; cdw_form->form_id = 0; cdw_form->n_return_keys = 0; for (int i = 0; i < N_RETURN_KEYS_MAX; i++) { cdw_form->return_keys[i] = 0; } /* may be overwritten by form-specific handler */ cdw_form->handle_enter = cdw_form_handle_enter; return cdw_form; } /** \brief cdw form destructor - stage 2 */ void cdw_form_delete(cdw_form_t **cdw_form) { cdw_assert (cdw_form != (cdw_form_t **) NULL, "ERROR: incorrect argument\n"); if (*cdw_form == (cdw_form_t *) NULL) { cdw_vdm ("WARNING: passing NULL form to function\n"); return; } if ((*cdw_form)->field_widget_types != (cdw_id_t *) NULL) { free((*cdw_form)->field_widget_types); (*cdw_form)->field_widget_types = (cdw_id_t *) NULL; } free(*cdw_form); *cdw_form = (cdw_form_t *) NULL; return; } /** \brief cdw form destructor - stage 1 Variable of type cdw_form_t needs to be deallocated in stages, this is first of them; second stage is cdw_form_delete() */ void cdw_form_delete_form_objects(cdw_form_t *cdw_form) { if (cdw_form == (cdw_form_t *) NULL) { cdw_vdm ("WARNING: passing NULL form to function\n"); return; } /* from ncurses docs: "The functions free_field() and free_form are available to free field and form objects. It is an error to attempt to free a field connected to a form, but not vice-versa; thus, you will generally free your form objects first. */ if (cdw_form->form != (FORM *) NULL) { unpost_form(cdw_form->form); free_form(cdw_form->form); cdw_form->form = (FORM *) NULL; } for (int i = 0; i < cdw_form->n_fields; i++) { if (cdw_form->fields[i] != (FIELD *) NULL) { if (cdw_form->field_widget_types[i] == CDW_WIDGET_CHECKBOX) { CDW_CHECKBOX *cb = (CDW_CHECKBOX *) field_userptr(cdw_form->fields[i]); cdw_assert (cb != (CDW_CHECKBOX *) NULL, "ERROR: field #%d is checkbox, but the pointer is null\n", i); cdw_checkbox_free(cb); } else if (cdw_form->field_widget_types[i] == CDW_WIDGET_BUTTON) { CDW_BUTTON *b = (CDW_BUTTON *) field_userptr(cdw_form->fields[i]); cdw_assert (b != (CDW_BUTTON *) NULL, "ERROR: field #%d is button, but the pointer is null\n", i); cdw_button_free(b); } else if (cdw_form->field_widget_types[i] == CDW_WIDGET_DROPDOWN) { CDW_DROPDOWN *d = (CDW_DROPDOWN *) field_userptr(cdw_form->fields[i]); cdw_assert (d != (CDW_DROPDOWN *) NULL, "ERROR: field #%d is dropdown, but the pointer is null\n", i); cdw_dropdown_free(d); } else { ; } free_field(cdw_form->fields[i]); cdw_form->fields[i] = (FIELD *) NULL; } } return; } int cdw_form_driver(cdw_form_t *cdw_form, int initial_fi) { cdw_assert (cdw_form->handle_enter != (int (*)(cdw_form_t *, int)) NULL, "ERROR: this form has no Enter handler set up\n"); cdw_form_driver_go_to_field(cdw_form, initial_fi); initial_fi = field_index(current_field(cdw_form->form)); cdw_form_driver_focus_on(cdw_form, initial_fi); form_driver(cdw_form->form, REQ_END_LINE); wrefresh(cdw_form->subwindow); int key = KEY_END; /* safe initial value */ do { wrefresh(cdw_form->subwindow); key = wgetch(cdw_form->subwindow); if (cdw_form_is_movement_key(key)) { int fi = field_index(current_field(cdw_form->form)); cdw_form_driver_focus_off(cdw_form, fi); } if (key == KEY_HOME) { form_driver(cdw_form->form, REQ_BEG_LINE); } else if (key == KEY_END) { form_driver(cdw_form->form, REQ_END_LINE); } else if (key == KEY_LEFT) { form_driver(cdw_form->form, REQ_PREV_CHAR); } else if (key == KEY_RIGHT) { form_driver(cdw_form->form, REQ_NEXT_CHAR); } else if (key == KEY_DOWN || key == CDW_KEY_TAB) { form_driver(cdw_form->form, REQ_NEXT_FIELD); form_driver(cdw_form->form, REQ_END_LINE); } else if (key == KEY_UP || key == KEY_BTAB) { form_driver(cdw_form->form, REQ_PREV_FIELD); form_driver(cdw_form->form, REQ_END_LINE); } else if (key == KEY_BACKSPACE) { form_driver(cdw_form->form, REQ_DEL_PREV); } else if (key == KEY_DC) { form_driver(cdw_form->form, REQ_DEL_CHAR); } else if (key == CDW_KEY_ENTER) { int fi = field_index(current_field(cdw_form->form)); /* the function may return dummy key 'a' which means to continue in driver loop */ key = cdw_form->handle_enter(cdw_form, fi); } else { int fi = field_index(current_field(cdw_form->form)); if (cdw_form_is_checkbox_field_index(cdw_form, fi)) { if (key == ' ' || key == 'x' || key == 'X') { cdw_form_driver_toggle_checkbox(cdw_form, fi); } } else if (cdw_form_is_dropdown_field_index(cdw_form, fi)) { /* dropdown in its initial state reacts only to enter, and this has already been handled elsewhere by cdw_form->handle_enter() */ ; } else { /* normal text/input field, pass char from keyboard to field */ form_driver(cdw_form->form, key); } } if (cdw_form_is_movement_key(key)) { int fi = field_index(current_field(cdw_form->form)); cdw_form_driver_focus_on(cdw_form, fi); } if (cdw_form_is_return_key(cdw_form, key)) { int fi = field_index(current_field(cdw_form->form)); if (isprint(key) && cdw_form_is_input_field_index(cdw_form, fi)) { /* keys like 'q'/'Q' may be configured as return keys, but they shouldn't be considered as such in regular text input fields */ ; } else { break; } } } while (key != CDW_KEY_ESCAPE); form_driver(cdw_form->form, REQ_VALIDATION); curs_set(0); /* turn cursor off */ return key; } bool cdw_form_is_return_key(cdw_form_t *form, int key) { for (int i = 0; i < N_RETURN_KEYS_MAX; i++) { if (form->return_keys[i] == 0) { break; } else if (form->return_keys[i] == key) { return true; } else { ; } } return false; } void cdw_form_add_return_char(cdw_form_t *form, int key) { cdw_assert (form != (cdw_form_t *) NULL, "ERROR: \"form\" argument is NULL\n"); cdw_assert (form->n_return_keys < N_RETURN_KEYS_MAX, "ERROR: there are already %d / %d return keys in the form, can't add another one\n", form->n_return_keys, N_RETURN_KEYS_MAX); cdw_assert (key != 0, "ERROR: trying to add key '0', but '0' is an initializer value\n"); if (cdw_form_is_return_key(form, key)) { cdw_vdm ("WARNING: attempting to add key %d / \"%s\", but it is already on the list of return keys\n", key, cdw_ncurses_key_label(key)); } else { form->return_keys[form->n_return_keys++] = key; } return; } void cdw_form_add_return_chars(cdw_form_t *form, ...) { cdw_assert (form != (cdw_form_t *) NULL, "ERROR: \"form\" argument is NULL\n"); cdw_assert (form->n_return_keys < N_RETURN_KEYS_MAX, "ERROR: there are already %d / %d return keys in the form, can't add another one\n", form->n_return_keys, N_RETURN_KEYS_MAX); va_list ap; va_start(ap, form); int key = 'a'; while ((key = va_arg(ap, int)) != 0) { cdw_form_add_return_char(form, key); } va_end(ap); return; } cdw_rv_t cdw_form_description_to_fields(cdw_form_descr_t descr[], cdw_form_t *cdw_form) { FIELD **fields = cdw_form->fields; /* "<=" - to set proper value of guard in fields table */ for (int i = 0; i <= cdw_form->n_fields; i++) { fields[i] = (FIELD *) NULL; } cdw_assert (cdw_form->field_widget_types != (cdw_id_t *) NULL, "ERROR: table of widget ids is NULL\n"); for (int i = 0; i < cdw_form->n_fields; i++) { cdw_id_t widget_type = descr[i].widget_type; cdw_assert (i == descr[i].field_enum, "ERROR: order of items! field iterator (%d) != field enum (%d)\n", i, descr[i].field_enum); if (widget_type == -1) { /* guard in form description table */ cdw_assert (0, "ERROR: reached descr guard, so loop condition is incorrect; i = %d, n_fields = %d\n", i, cdw_form->n_fields); break; } else if (widget_type == CDW_WIDGET_LABEL) { cdw_vdm ("INFO: creating field #%d: label with string = \"%s\"\n", i, (char *) descr[i].data1); fields[i] = cdw_ncurses_new_label_field(descr[i].n_lines, descr[i].n_cols, descr[i].begin_y, descr[i].begin_x, (char *) descr[i].data1); } else if (widget_type == CDW_WIDGET_CHECKBOX) { cdw_vdm ("INFO: creating field #%d: checkbox (new)\n", i); fields[i] = cdw_ncurses_new_checkbox_field(descr[i].begin_y, descr[i].begin_x, (char *) NULL); /* I don't know why, but sometimes moving into a checkbox field erases content displayed in overlaying window; turning off O_PUBLIC seems to fix this problem */ field_opts_off(fields[i], O_PUBLIC); CDW_CHECKBOX *cb = cdw_checkbox_new(cdw_form->subwindow, descr[i].begin_y, descr[i].begin_x, descr[i].data2); int rv = set_field_userptr(fields[i], (void *) cb); cdw_assert (rv == E_OK, "ERROR: can't set userptr for field #%d\n", i); } else if (widget_type == CDW_WIDGET_INPUT) { cdw_vdm ("INFO: creating field #%d: input with initial string = \"%s\"\n", i, (char *) descr[i].data1); fields[i] = cdw_ncurses_new_input_field(descr[i].n_lines, descr[i].n_cols, descr[i].begin_y, descr[i].begin_x, (char *) descr[i].data1, descr[i].data2, CDW_NCURSES_INPUT_NONE, CDW_COLORS_INPUT); } else if (widget_type == CDW_WIDGET_BUTTON) { cdw_vdm ("INFO: creating field #%d: button\n", i); fields[i] = cdw_ncurses_new_input_field(descr[i].n_lines, descr[i].n_cols, descr[i].begin_y, descr[i].begin_x, (char *) NULL, 0, //descr[i].data2, CDW_NCURSES_INPUT_NONE, CDW_COLORS_INPUT); /* to avoid situation when user presses some alphanumeric key and the key is entered into field under a button */ field_opts_off(fields[i], O_EDIT); CDW_BUTTON *b = cdw_button_new(cdw_form->subwindow, descr[i].begin_y, descr[i].begin_x, descr[i].data1, descr[i].data2); if (b == (CDW_BUTTON *) NULL) { cdw_vdm ("ERROR: failed to create \"log path\" button for field #%d\n", i); return CDW_ERROR; } int rv = set_field_userptr(fields[i], (void *) b); cdw_assert (rv == E_OK, "ERROR: can't set userptr for field #%d\n", i); } else if (widget_type == CDW_WIDGET_DROPDOWN) { cdw_vdm ("INFO: creating field #%d: dropdown (new)\n", i); fields[i] = cdw_ncurses_new_input_field(descr[i].n_lines, descr[i].n_cols, descr[i].begin_y, descr[i].begin_x, (char *) NULL, 0, CDW_NCURSES_INPUT_NONE, CDW_COLORS_INPUT); cdw_form_dropdown_maker_t *makers = (cdw_form_dropdown_maker_t *) descr[i].data1; int ind = (int) descr[i].data2; CDW_DROPDOWN *dd = makers[ind](cdw_form->subwindow, descr[i].begin_y, descr[i].begin_x, descr[i].n_cols); int rv = set_field_userptr(fields[i], (void *) dd); cdw_assert (rv == E_OK, "ERROR: can't set userptr, i = %d\n", i); } else if (widget_type == CDW_WIDGET_TEXT) { cdw_vdm ("INFO: creating field #%d: text area\n", i); cdw_form_text_maker_t *makers = (cdw_form_text_maker_t *) descr[i].data1; int ind = (int) descr[i].data2; char *message = makers[ind]((int) descr[i].n_cols); fields[i] = cdw_ncurses_new_label_field(descr[i].n_lines, descr[i].n_cols, descr[i].begin_y, descr[i].begin_x, message); free(message); message = (char *) NULL; field_opts_off(fields[i], O_ACTIVE); field_opts_off(fields[i], O_EDIT); } else { cdw_assert (0, "ERROR: unknown widget type: %lld (field #%d)\n", widget_type, i); } cdw_form->field_widget_types[i] = widget_type; if (fields[i] == (FIELD *) NULL) { cdw_vdm ("ERROR: failed to initialize field #%d\n", i); return CDW_ERROR; } } return CDW_OK; } bool cdw_form_is_movement_key(int key) { if (key == KEY_DOWN || key == CDW_KEY_TAB || key == KEY_UP || key == KEY_BTAB || key == KEY_BACKSPACE) { /* in some configurations backspace may be a movement key, i.e. when cursor is at the beginning of input field */ return true; } else { return false; } } /* this function is called when a movement key has been detected; this function checks if current focus is on a widget that implements highlighted/non-highlighted states, and if it is, then highlight of current widget is turned off */ void cdw_form_driver_focus_off(cdw_form_t *cdw_form, int fi) { cdw_form_driver_toggle_focus(cdw_form, fi, true); return; } /* this function is called when a movement key has been detected; this function checks if current focus is on a widget that implements highlighted/non-highlighted states, and if it is, then highlight of current widget is turned off */ void cdw_form_driver_focus_on(cdw_form_t *cdw_form, int fi) { cdw_form_driver_toggle_focus(cdw_form, fi, false); return; } /* this function is called when a movement key has been detected; this function checks if current focus is on a widget that implements highlighted/non-highlighted states, and if it is, then highlight of current widget is turned off */ void cdw_form_driver_toggle_focus(cdw_form_t *cdw_form, int fi, bool off) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); if (cdw_form_is_button_field_index(cdw_form, fi)) { CDW_BUTTON *button = cdw_form_get_button(cdw_form, fi); if (button != (CDW_BUTTON *) NULL) { void (*function)(CDW_BUTTON *) = (void (*)(CDW_BUTTON *)) NULL; if (off) { function = cdw_button_unfocus; /* moving away from button, display blinking cursor */ curs_set(1); } else { function = cdw_button_focus; /* moving into button, don't display blinking cursor */ curs_set(0); } function(button); } } else if (cdw_form_is_dropdown_field_index(cdw_form, fi)) { CDW_DROPDOWN *dropdown = cdw_form_get_dropdown(cdw_form, fi); if (dropdown != (CDW_DROPDOWN *) NULL) { void (*function)(CDW_DROPDOWN *) = (void (*)(CDW_DROPDOWN *)) NULL; if (off) { function = cdw_dropdown_unfocus; /* moving away from dropdown, display blinking cursor */ curs_set(1); } else { function = cdw_dropdown_focus; /* moving into dropdown, don't display blinking cursor */ curs_set(0); } function(dropdown); } } else if (cdw_form_is_checkbox_field_index(cdw_form, fi) || cdw_form_is_input_field_index(cdw_form, fi)) { if (off) { /* moving away from checkbox/input, don't display blinking cursor */ curs_set(0); } else { /* moving away from checkbox/input, display blinking cursor */ curs_set(1); } } else { ; } //form_driver(cdw_form->form, REQ_INS_MODE); wrefresh(cdw_form->subwindow); return; } CDW_DROPDOWN *cdw_form_get_dropdown(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); FIELD *field = cdw_form->fields[fi]; cdw_assert (field != (FIELD *) NULL, "ERROR: field %d is NULL\n", fi); CDW_DROPDOWN *dropdown = (CDW_DROPDOWN *) NULL; if (cdw_form->field_widget_types[fi] == CDW_WIDGET_DROPDOWN) { dropdown = (CDW_DROPDOWN *) field_userptr(field); cdw_assert (dropdown != (CDW_DROPDOWN *) NULL, "ERROR: field user pointer is NULL dropdown (fi = %d)\n", fi); } return dropdown; } const char *cdw_form_get_string(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); FIELD *field = cdw_form->fields[fi]; cdw_assert (field != (FIELD *) NULL, "ERROR: field %d is NULL\n", fi); char *string = (char *) NULL; if (cdw_form->field_widget_types[fi] == CDW_WIDGET_INPUT) { string = field_buffer(cdw_form->fields[fi], 0); cdw_string_rtrim(string); cdw_assert (string != (char *) NULL, "ERROR: field user pointer is NULL char (fi = %d)\n", fi); } return string; } CDW_BUTTON *cdw_form_get_button(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); FIELD *field = cdw_form->fields[fi]; cdw_assert (field != (FIELD *) NULL, "ERROR: field %d is NULL\n", fi); CDW_BUTTON *button = (CDW_BUTTON *) NULL; if (cdw_form->field_widget_types[fi] == CDW_WIDGET_BUTTON) { button = (CDW_BUTTON *) field_userptr(field); cdw_assert (button != (CDW_BUTTON *) NULL, "ERROR: field user pointer is NULL button (fi = %d)\n", fi); } return button; } CDW_CHECKBOX *cdw_form_get_checkbox(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); FIELD *field = cdw_form->fields[fi]; cdw_assert (field != (FIELD *) NULL, "ERROR: field %d is NULL\n", fi); CDW_CHECKBOX *checkbox = (CDW_CHECKBOX *) NULL; if (cdw_form->field_widget_types[fi] == CDW_WIDGET_CHECKBOX) { checkbox = (CDW_CHECKBOX *) field_userptr(field); cdw_assert (checkbox != (CDW_CHECKBOX *) NULL, "ERROR: field user pointer is NULL checkbox (fi = %d)\n", fi); } return checkbox; } bool cdw_form_is_checkbox_field_index(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); cdw_id_t type = cdw_form->field_widget_types[fi]; if (type == CDW_WIDGET_CHECKBOX) { return true; } else { return false; } } bool cdw_form_is_dropdown_field_index(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); if (cdw_form->field_widget_types[fi] == CDW_WIDGET_DROPDOWN) { return true; } else { return false; } } bool cdw_form_is_button_field_index(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); return cdw_form->field_widget_types[fi] == CDW_WIDGET_BUTTON ? true : false; } bool cdw_form_is_input_field_index(cdw_form_t *cdw_form, int fi) { cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); return cdw_form->field_widget_types[fi] == CDW_WIDGET_INPUT ? true : false; } /** \brief Toggle state of checkbox Toggle state of checkbox that is placed in field with index\p fi. Make sure that this is really a checkbox before calling the function. Additionally the function shows/hides widgets in "tools" page as state of related checkbox changes. \param cdw_form - form in which a checkbox is placed \param fi - field index, index of field of form, that is related to the checkbox */ void cdw_form_driver_toggle_checkbox(cdw_form_t *cdw_form, int fi) { cdw_assert (cdw_form->field_widget_types[fi] == CDW_WIDGET_CHECKBOX, "ERROR: called the function for non-checkbox\n"); cdw_assert (fi < cdw_form->n_fields, "ERROR: fi is larger than number of fields: %d / %d\n", fi, cdw_form->n_fields); CDW_CHECKBOX *checkbox = cdw_form_get_checkbox(cdw_form, fi); cdw_checkbox_toggle(checkbox); if (checkbox->on_toggle != (cdw_form_widget_function_t) NULL) { bool state = cdw_checkbox_get_state(checkbox); checkbox->on_toggle(cdw_form, &state); } return; } void cdw_form_driver_go_to_field(cdw_form_t *cdw_form, int fi) { FORM *form = cdw_form->form; if (fi < 0 || fi >= cdw_form->n_fields) { cdw_vdm ("WARNING: fi = %d out of bounds (n_fields = %d)\n", fi, cdw_form->n_fields); fi = 0; } int rv = form_driver(form, REQ_FIRST_FIELD); if (rv != E_OK) { cdw_vdm ("ERROR: form_driver() returns \"%s\"\n", cdw_ncurses_error_string(rv)); } /* initial field may not be first when driver needs to switch to field in which there is an error */ /* TODO: check why using simple for() loop fails: iterating stops before correct field */ int i = field_index(current_field(form)); if (i == fi) { ; } else { while (i < fi && i < cdw_form->n_fields - 1) { rv = form_driver(form, REQ_NEXT_FIELD); if (rv != E_OK) { cdw_vdm ("ERROR: form_driver() returns \"%s\"\n", cdw_ncurses_error_string(rv)); break; } else { i = field_index(current_field(form)); } } } cdw_form_driver_focus_on(cdw_form, fi); return; } void cdw_form_redraw_widgets(cdw_form_t *cdw_form) { for (int i = 0; i < cdw_form->n_fields; i++) { cdw_id_t id = cdw_form->field_widget_types[i]; if (id == CDW_WIDGET_CHECKBOX) { CDW_CHECKBOX *cb = cdw_form_get_checkbox(cdw_form, i); cdw_checkbox_draw(cb); } else if (id == CDW_WIDGET_BUTTON) { CDW_BUTTON *b = cdw_form_get_button(cdw_form, i); cdw_button_unfocus(b); } else if (id == CDW_WIDGET_DROPDOWN) { CDW_DROPDOWN *dd = cdw_form_get_dropdown(cdw_form, i); cdw_dropdown_display_current_item(dd); } else { ; } } return; } bool cdw_form_get_checkbox_state(cdw_form_t *cdw_form, int fi) { cdw_assert (cdw_form->field_widget_types[fi] == CDW_WIDGET_CHECKBOX, "ERROR: trying to get state of field which isn't a CHECKBOX\n"); CDW_CHECKBOX *cb = cdw_form_get_checkbox(cdw_form, fi); return cdw_checkbox_get_state(cb); } void *cdw_form_set_function(cdw_form_t *cdw_form, int fi, cdw_form_widget_function_t function) { cdw_id_t id = cdw_form->field_widget_types[fi]; if (id == CDW_WIDGET_BUTTON) { CDW_BUTTON *b = field_userptr(cdw_form->fields[fi]); b->on_click = function; set_field_userptr(cdw_form->fields[fi], (void *) b); return (void *) b; } else if (id == CDW_WIDGET_CHECKBOX) { CDW_CHECKBOX *cb = field_userptr(cdw_form->fields[fi]); cb->on_toggle = function; set_field_userptr(cdw_form->fields[fi], (void *) cb); return (void *) cb; } else { cdw_assert(0, "ERROR: called the function for widget, which doesn't have a function to set\n"); return (void *) NULL; } } int cdw_form_handle_enter(cdw_form_t *cdw_form, int fi) { if (cdw_form_is_button_field_index(cdw_form, fi)) { CDW_BUTTON *b = cdw_form_get_button(cdw_form, fi); return b->on_click((void *) cdw_form, (void *) NULL); } else if (cdw_form_is_dropdown_field_index(cdw_form, fi)) { CDW_DROPDOWN *dropdown = cdw_form_get_dropdown(cdw_form, fi); cdw_assert (dropdown != (CDW_DROPDOWN *) NULL, "ERROR: dropdown is NULL\n"); int key = cdw_dropdown_driver(dropdown); if (key == CDW_KEY_ENTER) { const char *label = cdw_dropdown_get_current_item_label(dropdown); FIELD **fields = form_fields(cdw_form->form); /* setting buffer makes field to display string, but slightly moved to left */ set_field_buffer(*(fields + fi), 0, label); /* call to cdw_dropdown_focus() fixes it */ cdw_dropdown_focus(dropdown); form_driver(cdw_form->form, REQ_VALIDATION); } else { ; } return 'a'; } else { return 'a'; } } cdw-0.7.1/src/user_interface/cdw_write_wizard.c0000644000175000017500000012665411734660612016541 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file write_wizard.c \brief Window with basic write options, displayed when user selects writing action The window displays message "You are writing to X disc", allows user to select writing speed, and writing mode. 'More options' button is also available, so user can jump to separate window to set more advanced options without closing write wizard. If current task is writing ISO image to blank CD/DVD, then 'Verify' checkbox is also available. It is coupled with task->burn.verify (where task is argument passed to write_wizard()). Writing speed values and modes that can be selected in wizard window are calculated every time the window is displayed and are disc-specific. They are calculated by functions defined in this file using values stored in disc argument. Be sure to call run_command_cdrecord_atip(), run_command_cdrecord_msinfo() or run_command_dvd_rw_mediainfo() before calling write_wizard(). Code in this file does not check writing preconditions - be sure to check burning preconditions before calling write_wizard(). */ #define _GNU_SOURCE /* asprintf() */ #include #include #include #include "cdw_config.h" #include "cdw_config_window.h" #include "gettext.h" #include "cdw_string.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "cdw_write_wizard.h" #include "cdw_main_window.h" #include "cdw_debug.h" #include "cdw_ext_tools.h" #include "cdw_form.h" #include "cdw_growisofs.h" #include "cdw_growisofs_options.h" #include "cdw_cdrecord.h" #include "cdw_cdrecord_options.h" #include "cdw_mkisofs_options.h" #include "cdw_xorriso.h" #include "cdw_xorriso_options.h" #include "cdw_utils.h" extern cdw_config_t global_config; /* main cdw configuration variable */ enum field_ids { f_header_l = 0, f_volume_id_l, f_volume_id_i, f_speed_l, f_speed_dd, f_session_l, f_session_dd, f_disc_l, f_disc_dd, f_verify_l, f_verify_i, f_dummy_l, f_dummy_i, f_eject_l, f_eject_cb, f_other_options_b, f_write_i, f_cancel_i }; static cdw_rv_t cdw_write_wizard_init(cdw_task_t *task, cdw_disc_t *disc); static cdw_rv_t cdw_write_wizard_build(cdw_task_t *task, cdw_disc_t *disc); static void cdw_write_wizard_destroy(void); static int cdw_write_wizard_driver(void); static cdw_rv_t cdw_write_wizard_build_fields(cdw_task_t *task); static cdw_rv_t cdw_write_wizard_validate_and_save(cdw_task_t *task, int *fi); static CDW_DROPDOWN *cdw_write_wizard_make_speed_dropdown(WINDOW *window, int begin_y, int begin_x, int width); static CDW_DROPDOWN *cdw_write_wizard_make_session_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width); static CDW_DROPDOWN *cdw_write_wizard_make_disc_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width); static cdw_rv_t cdw_write_wizard_options(cdw_task_t *task); static cdw_rv_t cdw_write_wizard_options_validate_and_save(cdw_task_t *task, cdw_id_t *page_id, int *fi); static int cdw_write_wizard_options_window_driver(cdw_task_t *task); static void cdw_write_wizard_options_window_destroy(void); static int cdw_write_wizard_on_enter_on_cancel(cdw_form_t *cdw_form, void *dummy); static int cdw_write_wizard_on_enter_on_write(cdw_form_t *cdw_form, void *dummy); static int cdw_write_wizard_on_enter_on_config(cdw_form_t *cdw_form, void *dummy); static void cdw_write_wizard_debug_at_exit(cdw_task_t *task); static void cdw_write_wizard_debug_verify_invisible(cdw_task_t *task, cdw_disc_t *disc); static bool cdw_write_wizard_show_verify_checkbox(cdw_task_t *task, cdw_disc_t *disc); static bool cdw_write_wizard_show_dummy_checkbox(cdw_task_t *task, cdw_disc_t *disc); #define CDW_WRITE_WIZARD_N_FIELDS 18 static FIELD *wizard_fields[CDW_WRITE_WIZARD_N_FIELDS + 1]; static struct { /* used in code related to 'Verify' checkbox, we can do verification only for first track of data on CD*/ bool verify_checkbox_visible; /* only some disc types allow "dummy" option; use cdw_growisofs_allow_dummy() or cdw_cdrecord_allow_dummy() to check if the checkbox should be visible */ bool dummy_checkbox_visible; /* you can't pass dao/tao/sao parameter to xorriso, so there is no point in showing the dropdown in wizard */ bool disc_mode_dd_visible; bool volume_id_visible; char *header; /* main message in wizard window */ cdw_form_t *cdw_form; } wizard; static cdw_form_dropdown_maker_t dropdown_makers[] = { cdw_write_wizard_make_speed_dropdown, cdw_write_wizard_make_session_mode_dropdown, cdw_write_wizard_make_disc_mode_dropdown }; static cdw_task_t *local_task = (cdw_task_t *) NULL; static cdw_disc_t *local_disc = (cdw_disc_t *) NULL; /* *** some layout constraints *** */ #define first_col 2 /* main message and some labels start in leftmost column */ #define top_label_row 1 /* main message is displayed on top of window */ #define volume_id_label_row 2 #define write_speed_label_row 4 #define session_mode_label_row 6 #define disc_mode_label_row 8 #define verify_checkbox_label_row 11 #define dummy_checkbox_label_row 12 #define eject_checkbox_label_row 13 #define other_options_button_row 14 /* button invoking "other options" window */ #define buttons_row 16 /* Write, Cancel and Help buttons are at the bottom of window */ #define window_n_cols 52 #define window_n_lines 20 #define subwindow_n_cols (window_n_cols - 2) #define subwindow_n_lines (window_n_lines - 2) #define wide_label_n_cols (subwindow_n_cols - 2) #define narrow_label_n_cols (subwindow_n_cols - 15) #define wide_dropdown_n_cols (subwindow_n_cols - 6) #define narrow_dropdown_n_cols 8 /** \brief Ncurses window showing summary of prepared write process A window that shows 'You are writing to X' message and mode and speed of writing. Mode and speed can be adjusted in the window. User can press 'Configuration' button to see and change other options. Two other buttons available are 'Write' and 'Cancel'. \param task - variable describing current task \param disc - variable describing disc currently in drive \return CDW_OK if user selects 'Write' button \return CDW_CANCEL if user presses Escape key or selects 'Cancel' button \return CDW_GEN_ERROR on errors */ cdw_rv_t cdw_write_wizard(cdw_task_t *task, cdw_disc_t *disc) { cdw_assert (task->id == CDW_TASK_BURN_FROM_FILES || task->id == CDW_TASK_BURN_FROM_IMAGE, "ERROR: incorrect task id %lld\n", task->id); cdw_assert (disc->type_writable == CDW_TRUE, "ERROR: disc type is not writable\n"); local_task = task; local_disc = disc; wizard.header = (char *) NULL; if (disc->type_writable != CDW_TRUE) { cdw_vdm ("ERROR: disc type is not writable\n"); return CDW_ERROR; } cdw_rv_t crv = cdw_write_wizard_init(task, disc); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to init wizard\n"); cdw_write_wizard_destroy(); return CDW_ERROR; } crv = cdw_write_wizard_build(task, disc); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to build wizard\n"); cdw_write_wizard_destroy(); return CDW_ERROR; } wrefresh(wizard.cdw_form->subwindow); int key = cdw_write_wizard_driver(); cdw_write_wizard_destroy(); /* redraw parent */ cdw_main_ui_main_window_wrefresh(); if (key == CDW_KEY_ENTER) { #ifndef NDEBUG cdw_write_wizard_debug_at_exit(task); #endif if (wizard.disc_mode_dd_visible) { cdw_assert (task->burn.disc_mode != CDW_DISC_MODE_INIT, "ERROR: write wizard didn't set disc writing mode\n"); } cdw_assert (task->burn.session_mode != CDW_SESSION_MODE_INIT, "ERROR: write wizard didn't set session writing mode\n"); return CDW_OK; } else { cdw_sdm ("INFO: not attempting writing, not displaying settings\n"); return CDW_CANCEL; } } /** \brief Set initial values of some variables global in the file Function sets values of various fields of "wizard" variable. */ cdw_rv_t cdw_write_wizard_init(cdw_task_t *task, cdw_disc_t *disc) { wizard.verify_checkbox_visible = cdw_write_wizard_show_verify_checkbox(task, disc); wizard.dummy_checkbox_visible = cdw_write_wizard_show_dummy_checkbox(task, disc); wizard.disc_mode_dd_visible = task->burn.tool.id == CDW_TOOL_XORRISO ? false : true; wizard.volume_id_visible = task->id == CDW_TASK_BURN_FROM_FILES ? true : false; wizard.cdw_form = cdw_form_new(CDW_WRITE_WIZARD_N_FIELDS); if (wizard.cdw_form == (cdw_form_t *) NULL) { cdw_vdm ("ERROR: failed to create cdw form\n"); return CDW_ERROR; } return CDW_OK; } int cdw_write_wizard_driver(void) { int fi = 0; int key = 'a'; while (key != CDW_KEY_ESCAPE && key != 'q' && key != 'Q') { key = cdw_form_driver(wizard.cdw_form, fi); /* in this wizard driver we are interested only in ENTER being pressed on either "write" or "cancel" buttons */ if (key == CDW_KEY_ENTER) { fi = field_index(current_field(wizard.cdw_form->form)); if (fi == f_write_i) { /* flush */ form_driver(wizard.cdw_form->form, REQ_VALIDATION); cdw_write_wizard_validate_and_save(local_task, &fi); /* not checking return value after validation as none of options available directly in wizard options are validated */ return CDW_KEY_ENTER; } else if (fi == f_cancel_i) { return CDW_KEY_ESCAPE; } else { ; } } else { ; } } return CDW_KEY_ESCAPE; } /* labels for _all_ possible session modes allowed for any optical disc */ cdw_id_clabel_t all_session_modes[] = { /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_SESSION_MODE_START_MULTI, gettext_noop("Start new, appendable disc") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_SESSION_MODE_CREATE_SINGLE, gettext_noop("Create non-appendable disc") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_SESSION_MODE_CONTINUE_MULTI, gettext_noop("Append data, don't close disc") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_SESSION_MODE_WRITE_FINAL, gettext_noop("Append data and close disc") }, /* 2TRANS: label visible in dropdown menu - some error occurred */ { CDW_SESSION_MODE_ERROR, gettext_noop("(ERROR)") }, { -1, (char *) NULL } }; /** \brief Create dropdown with values showing allowed session modes Function returns dropdown with items presenting session modes acceptable by current disc. Location of the dropdown in wizard window is specified by variables global in this file. The function creates all necessary dropdown labels and calls cdw_dropdown_finalize() on the dropdown, so result of this function is a ready to use dropdown. \param task - variable describing current task \return NULL on errors \return pointer to dropdown on success */ CDW_DROPDOWN *cdw_write_wizard_make_session_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width) { cdw_id_clabel_t items[CDW_SESSION_MODE_N_MAX]; int n_items = 0; for (n_items = 0; n_items < CDW_SESSION_MODE_N_MAX; ) { /* session_modes is non-sparse up until element of value CDW_SESSION_MODE_INIT */ int allowed_mode_id = local_task->burn.session_modes[n_items]; if (allowed_mode_id == CDW_SESSION_MODE_INIT) { break; } else { items[n_items].id = allowed_mode_id; items[n_items].label = cdw_utils_id_label_table_get_label(all_session_modes, allowed_mode_id); n_items++; } } CDW_DROPDOWN *dd = cdw_dropdown_maker_wrapper(window, begin_y, begin_x, width, n_items, items); /* 0 - first mode (set by "task" module) is the default one */ cdw_dropdown_set_current_item_by_ind(dd, 0); return dd; } /* _all_ possible types of writing mode allowed for any optical disc */ cdw_id_clabel_t all_disc_modes[] = { /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_UNSPECIFIED, gettext_noop("Unspecified") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_TAO, gettext_noop("TAO") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_DAO, gettext_noop("DAO") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_SAO, gettext_noop("SAO") }, #if 0 /* unsupported disc modes */ /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_RAW, gettext_noop("RAW") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_RAW96P, gettext_noop("RAW96R") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_RAW96R, gettext_noop("RAW96P") }, /* 2TRANS: label visible in dropdown menu - mode of writing data to optical disc */ { CDW_DISC_MODE_RAW16, gettext_noop("RAW16") }, #endif /* 2TRANS: label visible in dropdown menu - some error occurred */ { CDW_DISC_MODE_ERROR, gettext_noop("(ERROR)") }, { -1, "ERROR: guard value in \"disc mode labels\" table" } }; /** \brief Create dropdown with values showing allowed disc modes Function returns dropdown with items presenting allowed (and supported by cdw) modes of writing to current disc. Location of the dropdown in wizard window is specified by variables global in this file. The function creates all necessary dropdown labels and calls cdw_dropdown_finalize() on the dropdown, so result of this function is a ready to use dropdown. \param task - variable describing current task \return NULL on errors \return pointer to dropdown on success */ CDW_DROPDOWN *cdw_write_wizard_make_disc_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width) { cdw_id_clabel_t items[CDW_DISC_MODE_N_MODES]; int n_items = 0; for (n_items = 0; n_items < CDW_DISC_MODE_N_MODES; ) { /* disc_modes is non-sparse up until element of value CDW_DISC_MODE_INIT */ cdw_id_t allowed_mode_id = local_task->burn.disc_modes[n_items]; if (allowed_mode_id == CDW_DISC_MODE_INIT) { break; } else { items[n_items].id = allowed_mode_id; items[n_items].label = cdw_utils_id_label_table_get_label(all_disc_modes, allowed_mode_id); n_items++; } } CDW_DROPDOWN *dd = cdw_dropdown_maker_wrapper(window, begin_y, begin_x, width, n_items, items); /* 0 - first mode (set by "task" module) is the default one */ cdw_dropdown_set_current_item_by_ind(dd, 0); return dd; } /** \brief Create dropdown with values showing allowed write speeds Function returns dropdown with items presenting write speeds acceptable by current disc. Location of the dropdown in wizard window is specified by variables global in this file. The function creates all necessary dropdown labels and calls cdw_dropdown_finalize() on the dropdown, so result of this function is a ready to use dropdown. \param disc - variable describing current disc \return NULL on errors \return pointer to dropdown on success */ CDW_DROPDOWN *cdw_write_wizard_make_speed_dropdown(WINDOW *window, int begin_y, int begin_x, int width) { CDW_DROPDOWN *dropdown = cdw_dropdown_new(window, begin_y, begin_x, width, local_disc->write_speeds.n_speeds, /* n_items_max */ CDW_COLORS_DIALOG); if (dropdown == (CDW_DROPDOWN *) NULL) { cdw_vdm ("ERROR: failed to create new dropdown\n"); return (CDW_DROPDOWN *) NULL; } for (int i = 0; i < local_disc->write_speeds.n_speeds; i++) { char label[4 + 1]; snprintf(label, 4 + 1, "%d", local_disc->write_speeds.speeds[i]); cdw_rv_t crv = cdw_dropdown_add_item(dropdown, local_disc->write_speeds.speeds[i], label); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create dropdown label #%d of value %d\n", i, local_disc->write_speeds.speeds[i]); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } } cdw_rv_t crv = cdw_dropdown_finalize(dropdown); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to finalize dropdown\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } else { cdw_dropdown_set_current_item_by_id(dropdown, local_task->burn.speed_id); return dropdown; } } /** \brief Deallocate all resources allocated by write wizard */ void cdw_write_wizard_destroy(void) { if (wizard.cdw_form->subwindow != (WINDOW *) NULL) { delwin(wizard.cdw_form->subwindow); wizard.cdw_form->subwindow = (WINDOW *) NULL; } if (wizard.cdw_form->window != (WINDOW *) NULL) { delwin(wizard.cdw_form->window); wizard.cdw_form->window = (WINDOW *) NULL; } if (wizard.cdw_form != (cdw_form_t *) NULL) { cdw_form_delete_form_objects(wizard.cdw_form); cdw_form_delete(&(wizard.cdw_form)); } if (wizard.header != (char *) NULL) { free(wizard.header); wizard.header = (char *) NULL; } return; } /** \brief Print to stderr values of \p task fields set in write wizard \param task - task variable, in which some fields were set in write wizard */ void cdw_write_wizard_debug_at_exit(cdw_task_t *task) { /* use "task" variable to which wizard saves result at return, not values from dropdowns/checkboxes */ cdw_vdm ("INFO: disc mode dropdown is %svisible\n", wizard.disc_mode_dd_visible ? "" : "not "); cdw_vdm ("INFO: volume id field is %svisible\n", wizard.volume_id_visible ? "" : "not "); cdw_task_debug_print_burn_options(task); cdw_task_debug_print_iso9660_options(task); return; } bool cdw_write_wizard_show_verify_checkbox(cdw_task_t *task, cdw_disc_t *disc) { bool disc_blank = disc->state_empty == CDW_TRUE; bool disc_overwritable = disc->type == CDW_DVD_RWP || disc->type == CDW_DVD_RW_RES; bool tool_available = cdw_ext_tools_is_digest_tool(task->calculate_digest.tool.id); if ((disc_blank || disc_overwritable) && task->id == CDW_TASK_BURN_FROM_IMAGE && tool_available) { return true; } else { return false; } } /* for some combinations of burn tool and disc type dummy burning is just not possible */ bool cdw_write_wizard_show_dummy_checkbox(cdw_task_t *task, cdw_disc_t *disc) { if (task->burn.tool.id == CDW_TOOL_CDRECORD) { return cdw_cdrecord_allow_dummy(disc); } else if (task->burn.tool.id == CDW_TOOL_GROWISOFS) { return cdw_growisofs_allow_dummy(disc); } else if (task->burn.tool.id == CDW_TOOL_XORRISO) { return cdw_xorriso_allow_dummy(disc); } else { return false; } } /** \brief Print to stderr information why "verify" checkbox is not visible If some conditions are met, write wizard may display "verify write" checkbox. This function should be called if any of the conditions is not met to investigate these conditions and print to stderr information which of them was not met. This is a debug function \param task - variable describing current task \param disc - variable describing current disc */ void cdw_write_wizard_debug_verify_invisible(cdw_task_t *task, cdw_disc_t *disc) { if (disc->state_empty != CDW_TRUE) { cdw_vdm ("INFO: \"verify\" checkbox is not visible because disc is not blank (according to cdio)\n"); } if (disc->cdio->simple_type == CDW_DISC_SIMPLE_TYPE_DVD) { if (! (disc->type == CDW_DVD_RWP || disc->type == CDW_DVD_RW_RES)) { cdw_vdm ("INFO: \"verify\" checkbox is not visible because disc is not DVD+RW or DVD-RW RES\n"); } } if (task->id != CDW_TASK_BURN_FROM_IMAGE) { cdw_vdm ("INFO: \"verify\" checkbox is not visible because task is not CDW_TASK_BURN_FROM_IMAGE\n"); } if (!cdw_ext_tools_digest_tool_available()) { cdw_vdm ("INFO: \"verify\" checkbox is not visible because there is no digest tool available\n"); } if (!cdw_ext_tools_is_digest_tool(task->calculate_digest.tool.id)) { cdw_vdm ("INFO: \"verify\" checkbox is not visible because digest tool is not set (is %lld)\n", task->calculate_digest.tool.id); } return; } /** \brief Create all UI elements in wizard window \param task - variable describing current task \param disc - variable describing disc currently in drive \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_write_wizard_build(cdw_task_t *task, cdw_disc_t *disc) { int begin_y = ((LINES - window_n_lines) / 2); int begin_x = (COLS - window_n_cols) / 2; wizard.cdw_form->window = cdw_window_new((WINDOW *) NULL, window_n_lines, window_n_cols, begin_y, begin_x, CDW_COLORS_DIALOG, /* 2TRANS: this is title of wizard window; 'write' as in 'writing to optical disc */ _("Write wizard"), /* 2TRANS: this is tip at the bottom of window - user can switch between window elements using tab key */ _("Use 'Tab' key to move")); if (wizard.cdw_form->window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create window\n"); return CDW_ERROR; } wizard.cdw_form->subwindow = cdw_window_new(wizard.cdw_form->window, subwindow_n_lines, subwindow_n_cols, 1, 1, CDW_COLORS_DIALOG, (char *) NULL, (char *) NULL); if (wizard.cdw_form->subwindow == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create subwindow\n"); return CDW_ERROR; } /* 2TRANS: this is message to user: current action will be writing to %s, where %s is DVD or CD */ int rv = asprintf(&(wizard.header), _("You are writing to %s disc"), disc->cdio->simple_type_label); if (rv == -1) { cdw_vdm ("ERROR: failed to create top message\n"); return CDW_ERROR; } cdw_write_wizard_build_fields(task); wizard.cdw_form->form = cdw_ncurses_new_form(wizard.cdw_form->window, wizard.cdw_form->subwindow, wizard.cdw_form->fields); if (wizard.cdw_form->form == (FORM *) NULL) { cdw_vdm ("ERROR: failed to create form\n"); return CDW_ERROR; } set_current_field(wizard.cdw_form->form, wizard.cdw_form->fields[f_cancel_i]); if (!wizard.volume_id_visible) { field_opts_off(wizard.cdw_form->fields[f_volume_id_l], O_VISIBLE); field_opts_off(wizard.cdw_form->fields[f_volume_id_i], O_VISIBLE); } CDW_CHECKBOX *cb = cdw_form_get_checkbox(wizard.cdw_form, f_verify_i); if (wizard.verify_checkbox_visible) { /* this last one is added just in case */ cdw_checkbox_set_state(cb, task->burn.verify); } else { cdw_checkbox_set_visibility(cb, false); /* invisible AND inactive */ field_opts_off(wizard.cdw_form->fields[f_verify_i], O_VISIBLE); field_opts_off(wizard.cdw_form->fields[f_verify_l], O_VISIBLE); #ifndef NDEBUG cdw_write_wizard_debug_verify_invisible(task, disc); #endif } cb = cdw_form_get_checkbox(wizard.cdw_form, f_dummy_i); if (wizard.dummy_checkbox_visible) { cdw_checkbox_set_state(cb, task->burn.dummy); } else { cdw_checkbox_set_visibility(cb, false); /* invisible AND inactive */ field_opts_off(wizard.cdw_form->fields[f_dummy_i], O_VISIBLE); field_opts_off(wizard.cdw_form->fields[f_dummy_l], O_VISIBLE); #ifndef NDEBUG // TODO: to be implemented: cdw_write_wizard_debug_dummy_invisible(task, disc); #endif } if (!wizard.disc_mode_dd_visible) { CDW_DROPDOWN *dd = cdw_form_get_dropdown(wizard.cdw_form, f_disc_dd); cdw_dropdown_make_invisible(dd); field_opts_off(wizard.cdw_form->fields[f_disc_l], O_VISIBLE); field_opts_off(wizard.cdw_form->fields[f_disc_dd], O_VISIBLE); } /* current items are set in functions creating respective dropdowns; now just display them */ cdw_form_redraw_widgets(wizard.cdw_form); cdw_form_add_return_chars(wizard.cdw_form, CDW_KEY_ENTER, CDW_KEY_ESCAPE, 'q', 'Q', 0); cdw_form_set_function(wizard.cdw_form, f_write_i, cdw_write_wizard_on_enter_on_write); cdw_form_set_function(wizard.cdw_form, f_cancel_i, cdw_write_wizard_on_enter_on_cancel); cdw_form_set_function(wizard.cdw_form, f_other_options_b, cdw_write_wizard_on_enter_on_config); wrefresh(wizard.cdw_form->subwindow); wrefresh(wizard.cdw_form->window); return CDW_OK; } cdw_rv_t cdw_write_wizard_build_fields(cdw_task_t *task) { /* 2TRANS: this is a button label of a button that opens configuration window */ char *other_options = _("Other options"); int other_options_n_cols = (int) strlen(other_options) + 2; cdw_form_descr_t descr[] = { /* type begin_y begin_x n_cols n_lines field enum data1 data2 */ { CDW_WIDGET_LABEL, top_label_row, first_col, wide_label_n_cols, 1, f_header_l, wizard.header, 0 }, /* 2TRANS: this is label next to input field, where user can enter a label describing created ISO9660 volume */ { CDW_WIDGET_LABEL, volume_id_label_row, first_col, wide_label_n_cols, 1, f_volume_id_l, _("Volume ID:"), 0 }, { CDW_WIDGET_INPUT, volume_id_label_row + 1, first_col + 3, CDW_ISO9660_VOLI_LEN, 1, f_volume_id_i, task->create_image.volume_id, CDW_ISO9660_VOLI_LEN }, /* 2TRANS: this is a label in write wizard, after which a writing speed selection list will be displayed */ { CDW_WIDGET_LABEL, write_speed_label_row, first_col, wide_label_n_cols, 1, f_speed_l, _("Writing speed:"), 0 }, { CDW_WIDGET_DROPDOWN, write_speed_label_row + 1, first_col + 3, narrow_dropdown_n_cols - 2, 1, f_speed_dd, dropdown_makers, 0 }, /* 2TRANS: this is a label in write wizard, after which a session writing mode selection list will be displayed */ { CDW_WIDGET_LABEL, session_mode_label_row, first_col, wide_label_n_cols, 1, f_session_l, _("Session writing mode:"), 0 }, { CDW_WIDGET_DROPDOWN, session_mode_label_row + 1, first_col + 3, wide_dropdown_n_cols - 2, 1, f_session_dd, dropdown_makers, 1 }, /* 2TRANS: this is a label in write wizard, after which a disc writing mode selection list will be displayed */ { CDW_WIDGET_LABEL, disc_mode_label_row, first_col, wide_label_n_cols, 1, f_disc_l, _("Disc writing mode:"), 0 }, { CDW_WIDGET_DROPDOWN, disc_mode_label_row + 1, first_col + 3, wide_dropdown_n_cols - 2, 1, f_disc_dd, dropdown_makers, 2 }, /* 2TRANS: this is label next to checkbox; marked checkbox enables verification of correctness of writing to CD; this feature is experimental */ { CDW_WIDGET_LABEL, verify_checkbox_label_row, first_col + 4, narrow_label_n_cols, 1, f_verify_l, _("Verify write (experimental)"), 0 }, { CDW_WIDGET_CHECKBOX, verify_checkbox_label_row, first_col + 1, 1, 1, f_verify_i, (void *) NULL, task->burn.verify ? 1 : 0 }, /* 2TRANS: this is checkbox label: keep no longer than original; "Dummy write" means attempting to write to a disc and performing all normal operations (just for a try), but without actual burning */ { CDW_WIDGET_LABEL, dummy_checkbox_label_row, first_col + 4, narrow_label_n_cols, 1, f_dummy_l, _("Dummy write"), 0 }, { CDW_WIDGET_CHECKBOX, dummy_checkbox_label_row, first_col + 1, 1, 1, f_dummy_i, (void *) NULL, task->burn.dummy ? 1 : 0 }, /* 2TRANS: this is a checkbox label; "tray" is a tray of optical drive; "writing" is burning to optical disc */ { CDW_WIDGET_LABEL, eject_checkbox_label_row, first_col + 4, narrow_label_n_cols, 1, f_eject_l, _("Eject tray after writing"), 0 }, { CDW_WIDGET_CHECKBOX, eject_checkbox_label_row, first_col + 1, 1, 1, f_eject_cb, (void *) NULL, task->burn.eject ? 1 : 0 }, /* 2TRANS: button label */ { CDW_WIDGET_BUTTON, other_options_button_row, first_col, other_options_n_cols, 1, f_other_options_b, other_options, CDW_COLORS_DIALOG }, /* 2TRANS: button label, it refers to writing to optical disc */ { CDW_WIDGET_BUTTON, buttons_row, 3, 2, 1, f_write_i, _("Write"), CDW_COLORS_DIALOG }, /* 2TRANS: button label */ { CDW_WIDGET_BUTTON, buttons_row, 15, 2, 1, f_cancel_i, _("Cancel"), CDW_COLORS_DIALOG }, /* guard */ { -1, 0, 0, 0, 0, 0, (void *) NULL, 0 }}; wizard.cdw_form->n_fields = CDW_WRITE_WIZARD_N_FIELDS; wizard.cdw_form->fields = wizard_fields; /* the function adds guard at the end of fields */ cdw_rv_t crv = cdw_form_description_to_fields(descr, wizard.cdw_form); if (crv == CDW_OK) { return CDW_OK; } else { cdw_vdm ("ERROR: failed to convert form description to form\n"); return CDW_ERROR; } } int cdw_write_wizard_on_enter_on_cancel(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ESCAPE; } int cdw_write_wizard_on_enter_on_write(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ENTER; } int cdw_write_wizard_on_enter_on_config(cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { cdw_write_wizard_options(local_task); cdw_main_ui_main_window_wrefresh(); redrawwin(cdw_form->window); redrawwin(cdw_form->subwindow); wrefresh(cdw_form->window); wrefresh(cdw_form->subwindow); return 'a'; } /* some size and layout constants */ /* width and height of main options window can't be smaller than size of minimal supported terminal */ /** \brief Width of options window */ #define OPTIONS_WIDTH 80 /** \brief Height of options window */ #define OPTIONS_HEIGHT 24 /** \brief Width of right-hand area with tabs */ #define TABS_WIDTH 23 /** \brief Width of (most) labels in options window */ #define LABEL_WIDTH 30 /** \brief Width of some fields that should be as wide as possible: input fields storing file path, some dropdowns, "other options" fields, txt subwins, long labels */ #define WIDE_FIELD_WIDTH (OPTIONS_WIDTH - TABS_WIDTH - 4) /** \brief Window column of first column of items in options page */ #define FIRST_COL 1 /** \brief Window column of second column of items in options page */ #define SECOND_COL (FIRST_COL + LABEL_WIDTH + 2) /* text displayed at the bottom of wizard window */ static char *cdw_wizard_window_tip = (char *) NULL; #define WRITE_CDRECORD 0 #define WRITE_GROWISOFS 1 #define WRITE_XORRISO_BURN 2 #define WRITE_MKISOFS 3 #define WRITE_XORRISO_ISO 4 /* this is first main component of options window: a big table aggregating data and functions that prepare the data; the data represents widgets displayed in pages of options window */ static cdw_config_page_t c_pages[] = { /* 2TRANS: label of a tab in configuration window with options related burning */ { false, CDW_CDRECORD_OPTIONS_N_FIELDS, cdw_cdrecord_options_form, gettext_noop("Write"), (cdw_form_t *) NULL }, /* 2TRANS: label of a tab in configuration window with options related burning */ { false, CDW_GROWISOFS_OPTIONS_N_FIELDS, cdw_growisofs_options_form, gettext_noop("Write"), (cdw_form_t *) NULL }, /* 2TRANS: label of a tab in configuration window with options related burning */ { false, CDW_XORRISO_BURN_OPTIONS_N_FIELDS, cdw_xorriso_burn_options_form, gettext_noop("Write"), (cdw_form_t *) NULL }, /* 2TRANS: label of a tab in configuration window with options related to ISO9660; probably you don't want to translate this */ { false, CDW_MKISOFS_OPTIONS_N_FIELDS, cdw_mkisofs_options_form, gettext_noop("ISO9660"), (cdw_form_t *) NULL }, /* 2TRANS: label of a tab in configuration window with options related to ISO9660; probably you don't want to translate this */ { false, CDW_XORRISO_ISO_OPTIONS_N_FIELDS, cdw_xorriso_iso_options_form, gettext_noop("ISO9660"), (cdw_form_t *) NULL }}; /* this is a pointer to second main component of options window: tabbed window, which enables switching between pages */ static cdw_tabs_window_t *c_twindow = (cdw_tabs_window_t *) NULL; cdw_rv_t cdw_write_wizard_options(cdw_task_t *task) { /* 2TRANS: this is message at the bottom of options window; cancel means: quit without saving; '%d' is an integer used to create label of function key, e.g. "F10" */ int rv = asprintf(&cdw_wizard_window_tip, _("Press F%d / F%d key to save changes or ESC to cancel"), CDW_CONFIG_UI_SnC_KEY_B, CDW_CONFIG_UI_SnC_KEY_A); if (cdw_wizard_window_tip == (char *) NULL || rv == -1) { cdw_vdm ("ERROR: failed to create window tip\n"); return CDW_ERROR; } int n_tabs = 0; if (task->id == CDW_TASK_BURN_FROM_FILES) { n_tabs = 2; /* (cdrecord|growisofs|xorriso) + (mkisofs|xorriso) */ } else { /* CDW_TASK_BURN_FROM_IMAGE */ n_tabs = 1; /* (cdrecord|growisofs|xorriso) */ } /* 2TRANS: this is title of cdw options main window */ c_twindow = cdw_tabs_window_init(n_tabs, _("Write options"), cdw_wizard_window_tip); cdw_tabs_window_set_geometry(c_twindow, OPTIONS_HEIGHT, OPTIONS_WIDTH, 4, 4, TABS_WIDTH); /* prepare tabbed window */ cdw_id_t id = 0; int ind = 0; /* tool-specific options: cdrecord or growisofs */ if (task->burn.tool.id == CDW_TOOL_CDRECORD) { id = WRITE_CDRECORD; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); } else if (task->burn.tool.id == CDW_TOOL_XORRISO) { id = WRITE_XORRISO_BURN; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); } else { id = WRITE_GROWISOFS; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); } /* options of tool creating ISO9660 file system; the tool may be mkisofs or xorriso */ if (task->id == CDW_TASK_BURN_FROM_FILES) { if (task->burn.tool.id == CDW_TOOL_CDRECORD || task->burn.tool.id == CDW_TOOL_GROWISOFS) { cdw_assert (task->create_image.tool.id == CDW_TOOL_MKISOFS, "ERROR: invalid ISO tool: %lld\n", task->create_image.tool.id); ind++; id = WRITE_MKISOFS; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); } else if (task->burn.tool.id == CDW_TOOL_XORRISO) { cdw_assert (task->create_image.tool.id == CDW_TOOL_XORRISO, "ERROR: invalid ISO tool: %lld\n", task->create_image.tool.id); ind++; id = WRITE_XORRISO_ISO; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); } else { cdw_assert (0, "ERROR: invalid burn tool: %lld\n", task->burn.tool.id); } } cdw_tabs_window_add_return_keys(c_twindow, KEY_F(CDW_CONFIG_UI_SnC_KEY_A), KEY_F(CDW_CONFIG_UI_SnC_KEY_B), CDW_KEY_ESCAPE, 'q', 'Q', 0); c_twindow->driver_reader = cdw_config_ui_tabs_window_form_reader; cdw_tabs_window_finalize(c_twindow); /* prepare forms in the tabbed window */ for (int i = 0; i < n_tabs; i++) { id = c_twindow->tabs[i].id; c_pages[id].cdw_form = cdw_form_new(c_pages[id].n_fields); c_pages[id].cdw_form->form_id = id; c_pages[id].cdw_form->window = c_twindow->tabs[i].window; c_pages[id].cdw_form->subwindow = c_twindow->tabs[i].subwindow; c_pages[id].visible = true; cdw_rv_t crv = c_pages[id].fields_builder(c_pages[id].cdw_form, task, FIRST_COL, SECOND_COL, WIDE_FIELD_WIDTH, LABEL_WIDTH); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to build fields in page #%d\n", i); return CDW_ERROR; } c_pages[id].cdw_form->form = cdw_ncurses_new_form(c_pages[id].cdw_form->window, c_pages[id].cdw_form->subwindow, c_pages[id].cdw_form->fields); for (int j = 0; j < n_tabs; j++) { cdw_form_add_return_char(c_pages[id].cdw_form, KEY_F(j + CDW_CONFIG_UI_FX_START_KEY)); } cdw_form_add_return_char(c_pages[id].cdw_form, KEY_F(CDW_CONFIG_UI_SnC_KEY_A)); cdw_form_add_return_char(c_pages[id].cdw_form, KEY_F(CDW_CONFIG_UI_SnC_KEY_B)); } c_twindow->user_data = (void *) c_pages; cdw_tabs_window_draw_tabs(c_twindow); cdw_config_ui_tabs_window_form_draw(c_twindow, c_pages); bool follow_symlinks = task->create_image.follow_symlinks; cdw_write_wizard_options_window_driver(task); cdw_main_ui_handle_follow_symlinks_change(follow_symlinks, task->create_image.follow_symlinks); cdw_write_wizard_options_window_destroy(); return CDW_OK; } /** \brief Destructor function for write options window */ void cdw_write_wizard_options_window_destroy(void) { if (cdw_wizard_window_tip != (char *) NULL) { free(cdw_wizard_window_tip); cdw_wizard_window_tip = (char *) NULL; } for (int i = 0; i < c_twindow->n_tabs; i++) { cdw_id_t id = c_twindow->tabs[i].id; if (c_pages[id].cdw_form != (cdw_form_t *) NULL) { cdw_form_delete_form_objects(c_pages[id].cdw_form); } if (c_pages[id].cdw_form != (cdw_form_t *) NULL) { cdw_form_delete(&(c_pages[id].cdw_form)); } } cdw_tabs_window_delete(&c_twindow); return; } /** \brief Function reacting to keys pressed when options window is displayed Function catches all keys pressed when options window is displayed, and reacts to them either by switching pages, or by passing the keys to page driver(s). Keys configured as hotkeys for "tabbed window" tabs are used to switch between pages. F(CDW_CONFIG_SnC_KEY) key is interpreted as "save and close" key - values of all option fields are stored in \p config and validated. Function then returns CDW_OK if validation is successful, or displays incorrect field to user. ESCAPE key causes the function to return with CDW_CANCEL. \param config - variable in which function saves values of all option fields \return CDW_KEY_ESCAPE if user pressed ESCAPE key in options window \return CDW_KEY_ENTER if user pressed F10 and validation of \p tmp config was successful */ int cdw_write_wizard_options_window_driver(cdw_task_t *task) { while (1) { int key = cdw_tabs_window_driver(c_twindow); if (key == CDW_KEY_ESCAPE) { break; } else if (key == KEY_F(CDW_CONFIG_UI_SnC_KEY_A) || key == KEY_F(CDW_CONFIG_UI_SnC_KEY_B)) { /* SnC = Save and Close */ /* flush */ for (int i = 0; i < c_twindow->n_tabs; i++) { cdw_id_t id = c_twindow->tabs[i].id; form_driver(c_pages[id].cdw_form->form, REQ_VALIDATION); } cdw_id_t page_id = 0; int fi = 0; cdw_rv_t valid = cdw_write_wizard_options_validate_and_save(task, &page_id, &fi); if (valid == CDW_NO) { /* some option field is invalid */ /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("One of option fields is incorrect or contains character that is not allowed. Please fix it."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); cdw_tabs_window_show_tab_by_id(c_twindow, page_id); cdw_form_driver_go_to_field(c_pages[page_id].cdw_form, fi); /* loop */ } else { /* options from window with advanced options are validated and saved into task variable */ return CDW_KEY_ENTER; } } else { /* loop */ } } /* while (1) */ return CDW_KEY_ESCAPE; } cdw_rv_t cdw_write_wizard_options_validate_and_save(cdw_task_t *task, cdw_id_t *page_id, int *fi) { cdw_form_t *cdw_form = (cdw_form_t *) NULL; if (task->burn.tool.id == CDW_TOOL_CDRECORD) { cdw_id_t id = WRITE_CDRECORD; cdw_form = c_pages[id].cdw_form; cdw_rv_t crv = cdw_cdrecord_options_validate(cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } } else if (task->burn.tool.id == CDW_TOOL_GROWISOFS) { cdw_id_t id = WRITE_GROWISOFS; cdw_form = c_pages[id].cdw_form; cdw_rv_t crv = cdw_growisofs_options_validate(cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } } else if (task->burn.tool.id == CDW_TOOL_XORRISO) { cdw_id_t id = WRITE_XORRISO_BURN; cdw_form = c_pages[id].cdw_form; cdw_rv_t crv = cdw_xorriso_burn_options_validate(cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } } else { cdw_assert (0, "ERROR: invalid tool id for task \"burn\": %lld\n", task->burn.tool.id); return CDW_NO; } if (task->create_image.tool.id == CDW_TOOL_MKISOFS) { cdw_id_t id = WRITE_MKISOFS; cdw_form = c_pages[id].cdw_form; cdw_rv_t crv = cdw_mkisofs_options_validate(cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } } else if (task->create_image.tool.id == CDW_TOOL_XORRISO) { cdw_id_t id = WRITE_XORRISO_ISO; cdw_form = c_pages[id].cdw_form; cdw_rv_t crv = cdw_xorriso_iso_options_validate(cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } } else { ; } if (task->burn.tool.id == CDW_TOOL_CDRECORD) { cdw_form = c_pages[WRITE_CDRECORD].cdw_form; cdw_cdrecord_options_save(cdw_form, task); } else if (task->burn.tool.id == CDW_TOOL_GROWISOFS) { cdw_form = c_pages[WRITE_GROWISOFS].cdw_form; cdw_growisofs_options_save(cdw_form, task); } else if (task->burn.tool.id == CDW_TOOL_XORRISO) { cdw_form = c_pages[WRITE_XORRISO_BURN].cdw_form; cdw_xorriso_burn_options_save(cdw_form, task); } else { ; } if (task->create_image.tool.id == CDW_TOOL_MKISOFS) { cdw_form = c_pages[WRITE_MKISOFS].cdw_form; cdw_mkisofs_options_save(cdw_form, task); } else if (task->create_image.tool.id == CDW_TOOL_XORRISO) { cdw_form = c_pages[WRITE_XORRISO_ISO].cdw_form; cdw_xorriso_iso_options_save(cdw_form, task); } else { ; } return CDW_OK; } /** \brief Validate options from main wizard window, and save them Function validates values of all options in wizard window (but not in "other options" window), and stores the values in \p task. Since there are no variables in the window that could be really validated, the function jumps right to saving values. Since the result of validation can't be negative, the function always returns CDW_OK. \param task - task variable to save values to \param fi - unused, field index return CDW_OK */ cdw_rv_t cdw_write_wizard_validate_and_save(cdw_task_t *task, __attribute__((unused)) int *fi) { /* validate */ const char *s = field_buffer(wizard.cdw_form->fields[f_volume_id_i], 0); cdw_rv_t crv = cdw_string_security_parser(s, (char *) NULL); if (crv == CDW_NO) { *fi = f_volume_id_i; return CDW_NO; } /* save */ s = cdw_form_get_string(wizard.cdw_form, f_volume_id_i); strncpy(task->create_image.volume_id, s, CDW_ISO9660_VOLI_LEN); task->create_image.volume_id[CDW_ISO9660_VOLI_LEN] = '\0'; if (wizard.verify_checkbox_visible) { task->burn.verify = cdw_form_get_checkbox_state(wizard.cdw_form, f_verify_i); } else { task->burn.verify = false; } if (wizard.dummy_checkbox_visible) { task->burn.dummy = cdw_form_get_checkbox_state(wizard.cdw_form, f_dummy_i); } else { task->burn.dummy = false; } task->burn.eject = cdw_form_get_checkbox_state(wizard.cdw_form, f_eject_cb); CDW_DROPDOWN *dd = cdw_form_get_dropdown(wizard.cdw_form, f_speed_dd); task->burn.speed_id = cdw_dropdown_get_current_item_id(dd); dd = cdw_form_get_dropdown(wizard.cdw_form, f_session_dd); task->burn.session_mode = cdw_dropdown_get_current_item_id(dd); if (wizard.disc_mode_dd_visible) { dd = cdw_form_get_dropdown(wizard.cdw_form, f_disc_dd); task->burn.disc_mode = cdw_dropdown_get_current_item_id(dd); } return CDW_OK; } cdw-0.7.1/src/user_interface/cdw_iso9660_wizard.h0000644000175000017500000000027711517101165016513 00000000000000#ifndef H_CDW_ISO9660_WIZARD #define H_CDW_ISO9660_WIZARD #include "main.h" #include "cdw_task.h" cdw_rv_t cdw_iso9660_wizard(cdw_task_t *task); #endif /* #ifndef H_CDW_ISO9660_WIZARD */ cdw-0.7.1/src/user_interface/cdw_window.h0000644000175000017500000000102511700650315015313 00000000000000#ifndef H_CDW_WINDOW #define H_CDW_WINDOW #include "cdw_ncurses.h" WINDOW *cdw_window_new(WINDOW *window, int n_lines, int n_cols, int begin_y, int begin_x, chtype cdw_colors, const char *top_string, const char *bottom_string); void cdw_window_delete(WINDOW **window); void cdw_window_add_help(WINDOW *window); cdw_rv_t cdw_window_add_strings(WINDOW *window, const char *top_string, const char *bottom_string); int cdw_window_print_message(WINDOW *window, const char *message, int align); #endif /* H_CDW_WINDOW */ cdw-0.7.1/src/user_interface/cdw_iso9660_wizard.c0000644000175000017500000006254411734660045016523 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_iso9660_wizard.c */ #define _GNU_SOURCE /* asprintf() */ #include #include #include #include "cdw_file_picker.h" #include "cdw_config_window.h" #include "gettext.h" #include "cdw_string.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "cdw_main_window.h" #include "cdw_debug.h" #include "cdw_ext_tools.h" #include "cdw_form.h" #include "cdw_task.h" #include "cdw_mkisofs_options.h" #include "cdw_mkisofsrc.h" #include "cdw_xorriso_options.h" #include "cdw_xorrisorc.h" #include "cdw_tabs_window.h" #include "cdw_iso9660_wizard.h" enum field_ids { f_volume_id_l = 0, f_volume_id_i, f_iso_file_l, f_iso_file_i, f_iso_file_b, f_options_b, f_create_b, f_cancel_b, }; #define CDW_WRITE_WIZARD_N_FIELDS 8 static FIELD *wizard_fields[CDW_WRITE_WIZARD_N_FIELDS + 1]; static cdw_rv_t cdw_iso9660_wizard_options(cdw_task_t *task); static void cdw_iso9660_options_window_destroy(void); static cdw_rv_t cdw_iso9660_wizard_options_window_driver(cdw_task_t *task); static cdw_rv_t cdw_iso9660_wizard_init(void); static cdw_rv_t cdw_iso9660_wizard_build(cdw_task_t *task); static void cdw_iso9660_wizard_destroy(void); static int cdw_iso9660_wizard_driver(void); static cdw_rv_t cdw_iso9660_wizard_options_validate_and_save(cdw_task_t *task, cdw_id_t *page_id, int *fi); static cdw_rv_t cdw_iso9660_wizard_validate_and_save(cdw_task_t *task, int *fi); static int cdw_iso9660_wizard_on_enter_on_cancel(cdw_form_t *cdw_form, void *dummy); static int cdw_iso9660_wizard_on_enter_on_create(cdw_form_t *cdw_form, void *dummy); static int cdw_iso9660_wizard_on_enter_on_options(cdw_form_t *cdw_form, void *dummy); static int cdw_iso9660_wizard_on_enter_on_iso_file(cdw_form_t *cdw_form, void *dummy); static void cdw_iso9660_wizard_debug_at_exit(cdw_task_t *task); static struct { cdw_form_t *cdw_form; } wizard; static cdw_task_t *local_task = (cdw_task_t *) NULL; /* *** some layout constraints *** */ #define first_col 2 /* main message and some labels start in leftmost column */ #define volume_id_label_row 2 #define iso_file_label_row 5 #define options_button_row 10 #define buttons_row 13 /* Create and Cancel buttons are at the bottom of window */ #define window_n_cols 52 #define window_n_lines 20 #define subwindow_n_cols (window_n_cols - 2) #define subwindow_n_lines (window_n_lines - 4) #define wide_label_n_cols (subwindow_n_cols - 2) #define narrow_label_n_cols (subwindow_n_cols - 15) /** \brief Ncurses window showing summary of prepared write process A window that shows 'You are writing to X' message and mode and speed of writing. Mode and speed can be adjusted in the window. User can press 'More options' button to see and change other options. Two other buttons available are 'Write' and 'Cancel'. \param task - variable describing current task \return CDW_OK if user selects 'Write' button \return CDW_CANCEL if user presses Escape key or selects 'Cancel' button \return CDW_GEN_ERROR on errors */ cdw_rv_t cdw_iso9660_wizard(cdw_task_t *task) { cdw_assert (task->id == CDW_TASK_CREATE_IMAGE, "ERROR: incorrect task id %lld\n", task->id); local_task = task; cdw_rv_t crv = cdw_iso9660_wizard_init(); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to init wizard\n"); cdw_iso9660_wizard_destroy(); return CDW_ERROR; } crv = cdw_iso9660_wizard_build(task); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to build wizard\n"); cdw_iso9660_wizard_destroy(); return CDW_ERROR; } wrefresh(wizard.cdw_form->subwindow); int rv = cdw_iso9660_wizard_driver(); if (rv == CDW_KEY_ENTER) { #ifndef NDEBUG /* use task variable, to which wizard saves result at return, not values from dropdowns/checkboxes */ cdw_iso9660_wizard_debug_at_exit(task); #endif } else { cdw_vdm ("INFO: not attempting writing, not displaying settings\n"); } cdw_iso9660_wizard_destroy(); /* redraw parent */ cdw_main_ui_main_window_wrefresh(); cdw_vdm ("INFO: path at exit from wizard: %s\n", task->create_image.iso9660_file_fullpath); return rv == CDW_KEY_ENTER ? CDW_OK : CDW_CANCEL; } /** \brief Set initial values of some variables global in the file Function sets values of various fields of "wizard" variable. */ cdw_rv_t cdw_iso9660_wizard_init(void) { wizard.cdw_form = cdw_form_new(CDW_WRITE_WIZARD_N_FIELDS); if (wizard.cdw_form == (cdw_form_t *) NULL) { cdw_vdm ("ERROR: failed to create cdw form\n"); return CDW_ERROR; } wizard.cdw_form->fields = wizard_fields; return CDW_OK; } int cdw_iso9660_wizard_driver(void) { int fi = 0; int key = 'a'; while (key != CDW_KEY_ESCAPE && key != 'q' && key != 'Q') { key = cdw_form_driver(wizard.cdw_form, fi); fi = field_index(current_field(wizard.cdw_form->form)); if (key == CDW_KEY_ENTER) { if (fi == f_create_b) { /* flush */ form_driver(wizard.cdw_form->form, REQ_VALIDATION); cdw_rv_t crv = cdw_iso9660_wizard_validate_and_save(local_task, &fi); if (crv == CDW_NO) { /* one of option strings in main wizard window is invalid */ /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("One of option fields is incorrect or contains character that is not allowed. Please fix it."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); cdw_form_driver_go_to_field(wizard.cdw_form, fi); /* loop */ } else { /* fields in main page of the wizard are validated and saved into task variable */ return CDW_KEY_ENTER; } } else if (fi == f_cancel_b) { return CDW_KEY_ESCAPE; } else { ; } } else if (key == CDW_KEY_ESCAPE) { return CDW_KEY_ESCAPE; } else { ; } } return CDW_KEY_ESCAPE; } /** \brief Deallocate all resources allocated by write wizard */ void cdw_iso9660_wizard_destroy(void) { if (wizard.cdw_form->subwindow != (WINDOW *) NULL) { delwin(wizard.cdw_form->subwindow); wizard.cdw_form->subwindow = (WINDOW *) NULL; } if (wizard.cdw_form->window != (WINDOW *) NULL) { delwin(wizard.cdw_form->window); wizard.cdw_form->window = (WINDOW *) NULL; } if (wizard.cdw_form != (cdw_form_t *) NULL) { cdw_form_delete_form_objects(wizard.cdw_form); cdw_form_delete(&(wizard.cdw_form)); } return; } /** \brief Print to stderr values of \p task fields set in write wizard \param task - task variable, in which some fields were set in write wizard */ void cdw_iso9660_wizard_debug_at_exit(cdw_task_t *task) { cdw_task_debug_print_iso9660_options(task); return; } /** \brief Create all UI elements in wizard window \param task - variable describing current task \param disc - variable describing disc currently in drive \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_iso9660_wizard_build(cdw_task_t *task) { int begin_y = ((LINES - window_n_lines) / 2) - 2; int begin_x = (COLS - window_n_cols) / 2; wizard.cdw_form->window = cdw_window_new((WINDOW *) NULL, window_n_lines, window_n_cols, begin_y, begin_x, CDW_COLORS_DIALOG, /* 2TRANS: this is title of wizard window; "write" as in 'writing to optical disc" */ _("ISO9660 wizard"), /* 2TRANS: this is tip at the bottom of window - user can switch between window elements using tab key */ _("Use 'Tab' key to move")); if (wizard.cdw_form->window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create window\n"); return CDW_ERROR; } wizard.cdw_form->subwindow = cdw_window_new(wizard.cdw_form->window, subwindow_n_lines, subwindow_n_cols, 3, 1, CDW_COLORS_DIALOG, (char *) NULL, (char *) NULL); if (wizard.cdw_form->subwindow == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create subwindow\n"); return CDW_ERROR; } int iso_button_col = first_col + wide_label_n_cols - 5; cdw_form_descr_t descr[] = { /* type begin_y begin_x n_cols n_lines field enum data1 data2 */ /* 2TRANS: this is label next to input field, where user can enter a label describing created ISO9660 volume */ { CDW_WIDGET_LABEL, volume_id_label_row, first_col, wide_label_n_cols, 1, f_volume_id_l, _("Volume ID:"), 0 }, { CDW_WIDGET_INPUT, volume_id_label_row + 1, first_col, CDW_ISO9660_VOLI_LEN, 1, f_volume_id_i, task->create_image.volume_id, CDW_ISO9660_VOLI_LEN }, /* 2TRANS: this is label next to input field, where user can specify path to ISO9660 file */ { CDW_WIDGET_LABEL, iso_file_label_row, first_col, wide_label_n_cols - 2, 1, f_iso_file_l, _("ISO9660 image file:"), 0 }, { CDW_WIDGET_INPUT, iso_file_label_row + 1, first_col, wide_label_n_cols - 8, 1, f_iso_file_i, task->create_image.iso9660_file_fullpath, 0 }, /* 2TRANS: do not translate */ { CDW_WIDGET_BUTTON, iso_file_label_row + 1, iso_button_col, 1, 1, f_iso_file_b, _(">"), CDW_COLORS_DIALOG }, /* 2TRANS: this is label of a button that opens configuration window; "more options" related to creating ISO9660 file */ { CDW_WIDGET_BUTTON, options_button_row, first_col, 1, 1, f_options_b, _("More options"), CDW_COLORS_DIALOG }, /* 2TRANS: button label, it refers to writing to optical disc */ { CDW_WIDGET_BUTTON, buttons_row, 3, 2, 1, f_create_b, _("Create"), CDW_COLORS_DIALOG }, /* 2TRANS: button label */ { CDW_WIDGET_BUTTON, buttons_row, 15, 2, 1, f_cancel_b, _("Cancel"), CDW_COLORS_DIALOG }, /* guard */ { -1, 0, 0, 0, 0, 0, (void *) NULL, 0 }}; wizard.cdw_form->n_fields = CDW_WRITE_WIZARD_N_FIELDS; cdw_rv_t crv = cdw_form_description_to_fields(descr, wizard.cdw_form); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to convert form description to form\n"); return CDW_ERROR; } wizard.cdw_form->form = cdw_ncurses_new_form(wizard.cdw_form->window, wizard.cdw_form->subwindow, wizard.cdw_form->fields); if (wizard.cdw_form->form == (FORM *) NULL) { cdw_vdm ("ERROR: failed to create form\n"); return CDW_ERROR; } /* current items are set in functions creating respective dropdowns; now just display them */ cdw_form_redraw_widgets(wizard.cdw_form); cdw_form_add_return_chars(wizard.cdw_form, CDW_KEY_ENTER, CDW_KEY_ESCAPE, 'q', 'Q', 0); cdw_form_set_function(wizard.cdw_form, f_create_b, cdw_iso9660_wizard_on_enter_on_create); cdw_form_set_function(wizard.cdw_form, f_cancel_b, cdw_iso9660_wizard_on_enter_on_cancel); cdw_form_set_function(wizard.cdw_form, f_iso_file_b, cdw_iso9660_wizard_on_enter_on_iso_file); cdw_form_set_function(wizard.cdw_form, f_options_b, cdw_iso9660_wizard_on_enter_on_options); wrefresh(wizard.cdw_form->subwindow); wrefresh(wizard.cdw_form->window); return CDW_OK; } int cdw_iso9660_wizard_on_enter_on_cancel(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ESCAPE; } int cdw_iso9660_wizard_on_enter_on_create(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ENTER; } int cdw_iso9660_wizard_on_enter_on_options(cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { cdw_rv_t crv = cdw_iso9660_wizard_options(local_task); cdw_main_ui_main_window_wrefresh(); redrawwin(cdw_form->window); redrawwin(cdw_form->subwindow); wrefresh(cdw_form->window); wrefresh(cdw_form->subwindow); /* the function needs to return int representing a char */ if (crv == CDW_OK) { return '1'; } else { return '0'; } } int cdw_iso9660_wizard_on_enter_on_iso_file(cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { /* 2TRANS: this is title of dialog window */ cdw_rv_t crv = cdw_fs_ui_file_picker(_("Path to iso image"), /* 2TRANS: this is message in dialog window; below it there is an input field where user can enter path to ISO image file */ _("Please enter FULL path to new iso image file:"), &(local_task->create_image.iso9660_file_fullpath), CDW_FS_FILE, R_OK | W_OK, CDW_FS_NEW | CDW_FS_EXISTING); cdw_main_ui_main_window_wrefresh(); redrawwin(wizard.cdw_form->window); wrefresh(wizard.cdw_form->window); redrawwin(wizard.cdw_form->subwindow); wrefresh(wizard.cdw_form->subwindow); char *fp = local_task->create_image.iso9660_file_fullpath; if (crv == CDW_OK) { int rv = set_field_buffer(cdw_form->fields[f_iso_file_i], 0, fp); if (rv != E_OK) { cdw_vdm ("ERROR: failed to set field buffer with string = \"%s\"\n", fp); } else { form_driver(cdw_form->form, REQ_END_LINE); } cdw_vdm ("INFO: file picker returns \"%s\"\n", fp); return '1'; } else if (crv == CDW_CANCEL) { cdw_vdm ("INFO: pressed escape in file picker, fullpath is \"%s\"\n", fp); return '0'; } else { cdw_vdm ("INFO: file picker returns CDW_ERROR, fullpath is \"%s\"\n", fp); return '0'; } } /* some size and layout constants */ /* width and height of main options window can't be smaller than size of minimal supported terminal */ /** \brief Width of options window */ #define OPTIONS_WIDTH 80 /** \brief Height of options window */ #define OPTIONS_HEIGHT 24 /** \brief Width of right-hand area with tabs */ #define TABS_WIDTH 23 /** \brief Width of (most) labels in options window */ #define LABEL_WIDTH 30 /** \brief Width of some fields that should be as wide as possible: input fields storing file path, some dropdowns, "other options" fields, txt subwins, long labels */ #define WIDE_FIELD_WIDTH (OPTIONS_WIDTH - TABS_WIDTH - 4) /** \brief Window column of first column of items in options page */ #define FIRST_COL 1 /** \brief Window column of second column of items in options page */ #define SECOND_COL (FIRST_COL + LABEL_WIDTH + 2) /* text displayed at the bottom of wizard window */ static char *cdw_wizard_window_tip = (char *) NULL; #define ISO9660_PAGE_ID_MKISOFS 0 #define ISO9660_PAGE_ID_XORRISO 1 #define ISO9660_PAGE_ID_MKISOFSRC 2 #define ISO9660_PAGE_ID_XORRISORC 3 /* this is first main component of options window: a big table aggregating data and functions that prepare the data; the data represents widgets displayed in pages of options window */ static cdw_config_page_t c_pages[] = { /* 2TRANS: label of a tab in configuration window with options related to ISO9660; probably you don't want to translate this */ { false, CDW_MKISOFS_OPTIONS_N_FIELDS, cdw_mkisofs_options_form, gettext_noop("ISO9660"), (cdw_form_t *) NULL }, /* 2TRANS: label of a tab in configuration window with options related to ISO9660; probably you don't want to translate this */ { false, CDW_XORRISO_ISO_OPTIONS_N_FIELDS, cdw_xorriso_iso_options_form, gettext_noop("ISO9660"), (cdw_form_t *) NULL }, /* 2TRANS: label of a tab in configuration window with options related to meta information of ISO9660 file system */ { false, CDW_MKISOFSRC_OPTIONS_N_FIELDS, cdw_mkisofsrc_options_form, gettext_noop("Meta data"), (cdw_form_t *) NULL }, /* 2TRANS: label of a tab in configuration window with options related to meta information of ISO9660 file system */ { false, CDW_XORRISORC_N_FIELDS, cdw_xorrisorc_form, gettext_noop("Meta data"), (cdw_form_t *) NULL }}; /* this is a pointer to second main component of options window: tabbed window, which enables switching between pages */ static cdw_tabs_window_t *c_twindow = (cdw_tabs_window_t *) NULL; cdw_rv_t cdw_iso9660_wizard_options(cdw_task_t *task) { /* 2TRANS: this is message at the bottom of options window; cancel means: quit without saving; '%d' is an integer used to create label of function key, e.g. "F10" */ int rv = asprintf(&cdw_wizard_window_tip, _("Press F%d / F%d key to save changes or ESC to cancel"), CDW_CONFIG_UI_SnC_KEY_B, CDW_CONFIG_UI_SnC_KEY_A); if (cdw_wizard_window_tip == (char *) NULL || rv == -1) { cdw_vdm ("ERROR: failed to create window tip\n"); return CDW_ERROR; } int n_tabs = 2; /* mkisofs|xorriso + mkisofsrc|xorrisorc */ /* 2TRANS: this is title of cdw options main window */ c_twindow = cdw_tabs_window_init(n_tabs, _("ISO9660 options"), cdw_wizard_window_tip); cdw_tabs_window_set_geometry(c_twindow, OPTIONS_HEIGHT, OPTIONS_WIDTH, 4, 4, TABS_WIDTH); /* prepare tabbed window */ cdw_id_t id = 0; int ind = 0; /* tool-specific options: mkisofs or xorriso */ if (task->create_image.tool.id == CDW_TOOL_MKISOFS) { id = ISO9660_PAGE_ID_MKISOFS; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); ind++; id = ISO9660_PAGE_ID_MKISOFSRC; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); ind++; } else { id = ISO9660_PAGE_ID_XORRISO; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); ind++; id = ISO9660_PAGE_ID_XORRISORC; cdw_tabs_window_append_tab(c_twindow, id, KEY_F(ind + 2), c_pages[id].label); ind++; } cdw_tabs_window_add_return_keys(c_twindow, KEY_F(CDW_CONFIG_UI_SnC_KEY_A), KEY_F(CDW_CONFIG_UI_SnC_KEY_B), CDW_KEY_ESCAPE, 'q', 'Q', 0); c_twindow->driver_reader = cdw_config_ui_tabs_window_form_reader; cdw_tabs_window_finalize(c_twindow); /* prepare forms in the tabbed window */ for (int i = 0; i < n_tabs; i++) { id = c_twindow->tabs[i].id; c_pages[id].cdw_form = cdw_form_new(c_pages[id].n_fields); c_pages[id].cdw_form->form_id = id; c_pages[id].cdw_form->window = c_twindow->tabs[i].window; c_pages[id].cdw_form->subwindow = c_twindow->tabs[i].subwindow; c_pages[id].visible = true; cdw_rv_t crv = c_pages[id].fields_builder(c_pages[id].cdw_form, task, FIRST_COL, SECOND_COL, WIDE_FIELD_WIDTH, LABEL_WIDTH); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to build fields in page #%d\n", i); break; } c_pages[id].cdw_form->form = cdw_ncurses_new_form(c_pages[id].cdw_form->window, c_pages[id].cdw_form->subwindow, c_pages[id].cdw_form->fields); for (int j = 0; j < n_tabs; j++) { cdw_form_add_return_char(c_pages[id].cdw_form, KEY_F(j + CDW_CONFIG_UI_FX_START_KEY)); } cdw_form_add_return_char(c_pages[id].cdw_form, KEY_F(CDW_CONFIG_UI_SnC_KEY_A)); cdw_form_add_return_char(c_pages[id].cdw_form, KEY_F(CDW_CONFIG_UI_SnC_KEY_B)); cdw_form_add_return_char(c_pages[id].cdw_form, 'q'); /* will work only for non-text fields */ } c_twindow->user_data = (void *) c_pages; cdw_tabs_window_draw_tabs(c_twindow); cdw_config_ui_tabs_window_form_draw(c_twindow, c_pages); bool old_follow_symlinks = task->create_image.follow_symlinks; cdw_rv_t crv = cdw_iso9660_wizard_options_window_driver(task); cdw_iso9660_options_window_destroy(); if (crv == CDW_OK) { cdw_main_ui_handle_follow_symlinks_change(old_follow_symlinks, task->create_image.follow_symlinks); return CDW_OK; } else { return CDW_CANCEL; } } /** \brief Destructor function for cdw options window */ void cdw_iso9660_options_window_destroy(void) { if (cdw_wizard_window_tip != (char *) NULL) { free(cdw_wizard_window_tip); cdw_wizard_window_tip = (char *) NULL; } for (int i = 0; i < c_twindow->n_tabs; i++) { cdw_id_t id = c_twindow->tabs[i].id; if (c_pages[id].cdw_form != (cdw_form_t *) NULL) { cdw_form_delete_form_objects(c_pages[id].cdw_form); } if (c_pages[id].cdw_form != (cdw_form_t *) NULL) { cdw_form_delete(&(c_pages[id].cdw_form)); } } cdw_tabs_window_delete(&c_twindow); return; } /** \brief Function reacting to keys pressed when options window is displayed Function catches all keys pressed when options window is displayed, and reacts to them either by switching pages, or by passing the keys to page driver(s). Keys configured as hotkeys for "tabbed window" tabs are used to switch between pages. F(CDW_CONFIG_SnC_KEY) key is interpreted as "save and close" key - values of all option fields are stored in \p config and validated. Function then returns CDW_OK if validation is successful, or displays incorrect field to user. ESCAPE key causes the function to return with CDW_CANCEL. \param config - variable in which function saves values of all option fields \return CDW_CANCEL if user pressed ESCAPE key in options window \return CDW_OK if user pressed F10 and validation of \p tmp config was successful */ cdw_rv_t cdw_iso9660_wizard_options_window_driver(cdw_task_t *task) { while (1) { int key = cdw_tabs_window_driver(c_twindow); if (key == CDW_KEY_ESCAPE || key == 'q' || key == 'Q') { break; } else if (key == KEY_F(CDW_CONFIG_UI_SnC_KEY_A) || key == KEY_F(CDW_CONFIG_UI_SnC_KEY_B)) { /* SnC = Save and Close */ /* flush */ for (int i = 0; i < c_twindow->n_tabs; i++) { cdw_id_t id = c_twindow->tabs[i].id; form_driver(c_pages[id].cdw_form->form, REQ_VALIDATION); } cdw_id_t page_id = 0; int fi = 0; cdw_rv_t valid = cdw_iso9660_wizard_options_validate_and_save(task, &page_id, &fi); if (valid == CDW_NO) { /* some option field is invalid */ /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("One of option fields is incorrect or contains character that is not allowed. Please fix it."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); cdw_tabs_window_show_tab_by_id(c_twindow, page_id); cdw_form_driver_go_to_field(c_pages[page_id].cdw_form, fi); /* loop */ } else { /* options from window with advanced options are validated and saved into task variable */ return CDW_OK; } } else { /* loop */ } } /* while (1) */ return CDW_CANCEL; } cdw_rv_t cdw_iso9660_wizard_options_validate_and_save(cdw_task_t *task, cdw_id_t *page_id, int *fi) { if (task->create_image.tool.id == CDW_TOOL_MKISOFS) { cdw_id_t id = ISO9660_PAGE_ID_MKISOFS; cdw_rv_t crv = cdw_mkisofs_options_validate(c_pages[id].cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } id = ISO9660_PAGE_ID_MKISOFSRC; crv = cdw_mkisofsrc_options_validate(c_pages[id].cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } } else if (task->create_image.tool.id == CDW_TOOL_XORRISO) { cdw_id_t id = ISO9660_PAGE_ID_XORRISO; cdw_rv_t crv = cdw_xorriso_iso_options_validate(c_pages[id].cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } id = ISO9660_PAGE_ID_XORRISORC; crv = cdw_xorrisorc_validate(c_pages[id].cdw_form, fi); if (crv == CDW_NO) { *page_id = id; return CDW_NO; } } else { cdw_assert (0, "ERROR: invalid tool id for task \"create image\": %lld\n", task->create_image.tool.id); return CDW_NO; } if (task->create_image.tool.id == CDW_TOOL_MKISOFS) { cdw_id_t id = ISO9660_PAGE_ID_MKISOFS; cdw_mkisofs_options_save(c_pages[id].cdw_form, task); id = ISO9660_PAGE_ID_MKISOFSRC; cdw_mkisofsrc_options_save(c_pages[id].cdw_form, task); } else { cdw_id_t id = ISO9660_PAGE_ID_XORRISO; cdw_xorriso_iso_options_save(c_pages[id].cdw_form, task); id = ISO9660_PAGE_ID_XORRISORC; cdw_xorrisorc_save(c_pages[id].cdw_form, task); } return CDW_OK; } /** \brief Validate and save values of options available in main page of the wizard Values of options will be saved in \p task. If any value is invalid, index of corresponding field will be saved in \fi, and function will return CDW_NO. \param task - variable describing current task \param fi - field index \return CDW_OK on success \return CDW_NO if any value in main wizard page is invalid */ cdw_rv_t cdw_iso9660_wizard_validate_and_save(cdw_task_t *task, int *fi) { /* validate */ const char *s = field_buffer(wizard.cdw_form->fields[f_volume_id_i], 0); cdw_rv_t crv = cdw_string_security_parser(s, (char *) NULL); if (crv == CDW_NO) { *fi = f_volume_id_i; return CDW_NO; } s = field_buffer(wizard.cdw_form->fields[f_iso_file_i], 0); crv = cdw_string_security_parser(s, (char *) NULL); if (crv == CDW_NO) { *fi = f_iso_file_i; return CDW_NO; } /* save */ s = cdw_form_get_string(wizard.cdw_form, f_volume_id_i); strncpy(task->create_image.volume_id, s, CDW_ISO9660_VOLI_LEN); task->create_image.volume_id[CDW_ISO9660_VOLI_LEN] = '\0'; s = cdw_form_get_string(wizard.cdw_form, f_iso_file_i); cdw_string_set(&(task->create_image.iso9660_file_fullpath), s); return CDW_OK; } cdw-0.7.1/src/user_interface/cdw_list_display.h0000644000175000017500000000524211717547107016525 00000000000000#ifndef H_CDW_LIST_DISPLAY #define H_CDW_LIST_DISPLAY #include #include /* size_t */ #include "cdw_dll.h" #include "cdw_colors.h" #include "cdw_ncurses.h" #include "cdw_widgets.h" /* N_RETURN_KEYS_MAX */ typedef struct { WINDOW *window; /* parent window of display's subwindow */ WINDOW *subwindow; /* window, in which content of display's list is drawn */ int display_format; /* see enum below */ /* sizes and offsets (vertical and horizontal) of subwindow created by a display; */ int n_lines; int n_cols; int begin_y; int begin_x; cdw_colors_t colors; /* color scheme used by a display */ /* "item display function" */ void (*display_item)(void *display, void *data, size_t row, size_t h_offset, bool isreverse); /* list of items displayed in a display */ cdw_dll_item_t *list; /* always points to current (currently highlighted) list item, or is null for empty list */ cdw_dll_item_t *current_item; /* index of current (currently highlighted) list item, undefined if list is empty */ size_t current_item_ind; /* number of items on the list, user of display should make sure that it is always correct */ size_t n_items; int n_return_chars; int return_chars[N_RETURN_KEYS_MAX]; } CDW_LIST_DISPLAY; /* Possible values assigned to display->display_format field. Assigned by code creating a display, read and acted upon by "item display function". */ enum { CDW_LIST_DISPLAY_FORMAT_SHORT, CDW_LIST_DISPLAY_FORMAT_MIDDLE, CDW_LIST_DISPLAY_FORMAT_LONG }; CDW_LIST_DISPLAY *cdw_list_display_new(WINDOW *parent, int n_lines, int n_cols, int begin_y, int begin_x, cdw_colors_t colors); void cdw_list_display_delete(CDW_LIST_DISPLAY **display); int cdw_list_display_driver(CDW_LIST_DISPLAY *display); void cdw_list_display_scroll_to(CDW_LIST_DISPLAY *display, size_t current_item_ind, size_t h_offset, bool highlight); cdw_rv_t cdw_list_display_remove_item(CDW_LIST_DISPLAY *display, size_t item_ind); cdw_rv_t cdw_list_display_add_item(CDW_LIST_DISPLAY *display, void *data, bool (*pred)(const void *, const void *)); void *cdw_list_display_get_current_item_data(CDW_LIST_DISPLAY *display); /* basically a wrapper around cdw_dll_is_member() */ bool cdw_list_display_is_member(CDW_LIST_DISPLAY *display, void *data, bool (*pred)(const void *, const void *)); void cdw_list_display_add_return_key(CDW_LIST_DISPLAY *display, int c); void cdw_list_display_add_return_keys(CDW_LIST_DISPLAY *display, ...); bool cdw_list_display_is_return_key(CDW_LIST_DISPLAY *display, int c); void cdw_list_display_refresh(CDW_LIST_DISPLAY *display); #endif /* #ifndef H_CDW_LIST_DISPLAY */ cdw-0.7.1/src/user_interface/cdw_colors.h0000644000175000017500000000133711704534267015326 00000000000000#ifndef H_CDW_COLORS #define H_CDW_COLORS #include "main.h" /* see beginning of color.c for more details on these names and on use of cdw_colors_t type */ typedef enum { CDW_COLORS_MAIN = 1, CDW_COLORS_DIALOG, CDW_COLORS_TITLE, CDW_COLORS_MENU, CDW_COLORS_PROGRESS, CDW_COLORS_INPUT, CDW_COLORS_WARNING, CDW_COLORS_SIZE_INFO, /* unused, kept for compatibilty with older versions */ CDW_COLORS_DISABLED, CDW_COLORS_UNUSED, CDW_COLORS_TOOLTIPS, CDW_COLORS_TEXTAREA, CDW_COLORS_ERROR, /* 13 */ CDW_COLORS_GUARD /* this value is not used to create color scheme - this is a guard value */ } cdw_colors_t; void cdw_colors_init_phase1(void); cdw_rv_t cdw_colors_init_phase2(void); #endif /* #ifndef H_CDW_COLORS */ cdw-0.7.1/src/user_interface/cdw_main_window.h0000644000175000017500000000503711706560422016333 00000000000000#ifndef H_CDW_MAIN_WINDOW #define H_CDW_MAIN_WINDOW #include #include "main.h" /* cdw_rv_t */ #include "cdw_disc.h" #include "cdw_ncurses.h" /* ________________________________________________________ |_______________ _____________________________________ | || | | | | || | | | | || | | | | || | | | | || main menu | | files list | | || | | | | || | | | | || | | | | || | | | | || | | | | || | | | | ||_____________| |___________________________________| | |_______________ _____________________________________ | || | | | | || disc info | | volume info | | || | | | | ||_____________| |___________________________________| | |______________________________________________________| */ /* be careful with order of fields in this enum - it has to be the same * as order of button labels in main menu built in cdw_ui.c */ typedef enum menu_items { CDW_MENU_ADD_FILES = 0, CDW_MENU_DELETE_FILES, CDW_MENU_BURN_FILES, CDW_MENU_CREATE_IMAGE, CDW_MENU_BURN_IMAGE, CDW_MENU_RIP_DISC, CDW_MENU_ERASE_DISC, CDW_MENU_VERIFY, CDW_MENU_CONFIG, CDW_MENU_EXIT_CDW } cdw_menu_items_t; cdw_rv_t cdw_main_ui_init(void); void cdw_main_ui_clean(void); void cdw_main_ui_main_window_wrefresh_part(int n_lines, int n_cols, int begin_y, int begin_x); void cdw_main_ui_main_window_wrefresh(void); //cdw_rv_t cdw_main_ui_disc_info_view_update(void); void cdw_main_ui_disc_info_view_display_data(const cdw_disc_t *disc); cdw_rv_t cdw_main_window_volume_info_view_update(long long disc_sectors_used, long long disc_sectors_total, bool rescan_selected_files, bool follow_symlinks); cdw_rv_t cdw_main_ui_add_to_selected_files(void); cdw_rv_t cdw_main_ui_delete_from_selected_files(void); void cdw_main_ui_show_license(void); void cdw_main_ui_handle_follow_symlinks_change(bool old_state, bool current_state); WINDOW *cdw_main_ui_get_tooltips_subwindow(void); WINDOW *cdw_main_ui_get_main_window(void); MENU *cdw_main_ui_get_main_menu(void); #endif /* H_CDW_MAIN_WINDOW */ cdw-0.7.1/src/user_interface/cdw_erase_wizard.h0000644000175000017500000000033011444474250016470 00000000000000#ifndef H_CDW_ERASE_WIZARD #define H_CDW_ERASE_WIZARD #include "main.h" #include "cdw_task.h" #include "cdw_disc.h" cdw_rv_t cdw_erase_wizard(cdw_task_t *task, cdw_disc_t *disc); #endif /* H_CDW_ERASE_WIZARD */ cdw-0.7.1/src/user_interface/Makefile.am0000644000175000017500000000230111701124454015031 00000000000000METASOURCES = AUTO SUBDIRS = widgets sources = cdw_colors.c cdw_colors.h \ cdw_ncurses.c cdw_ncurses.h \ cdw_form.c cdw_form.h \ cdw_list_display.c cdw_list_display.h \ cdw_processwin.c cdw_processwin.h \ cdw_widgets.h \ cdw_window.c cdw_window.h \ cdw_text_file_viewer.c cdw_text_file_viewer.h \ cdw_write_wizard.c cdw_write_wizard.h \ cdw_iso9660_wizard.c cdw_iso9660_wizard.h \ cdw_erase_wizard.c cdw_erase_wizard.h \ cdw_verify_wizard.c cdw_verify_wizard.h \ cdw_main_window.c cdw_main_window.h \ cdw_help.c cdw_help.h \ cdw_tabs_window.c cdw_tabs_window.h # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake # don't use $(top_builddir), it fails during "make distcheck" include $(top_srcdir)/Makefile.cdw.am # static convenience library; "noinst" means: "build, but # don't install in user's system" noinst_LIBRARIES = libcdwuserinterface.a libcdwuserinterface_a_SOURCES = $(sources) # library built only for purposes of testing (checking) check_LIBRARIES = libcdwuserinterface_check.a libcdwuserinterface_check_a_SOURCES = $(sources) libcdwuserinterface_check_a_CPPFLAGS = -DCDW_UNIT_TEST_CODE $(AM_CPPFLAGS)cdw-0.7.1/src/user_interface/cdw_text_file_viewer.c0000644000175000017500000002504411722440136017354 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _BSD_SOURCE /* strdup() */ #include #include #include #include #include #include "gettext.h" #include "cdw_list_display.h" #include "cdw_text_file_viewer.h" #include "cdw_main_window.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "cdw_debug.h" /** \file cdw_text_file_viewer.c \brief Implementation of text file viewer widget for cdw File implements viewer of text files, that can be used e.g. as viewer of log file. */ /* maximal number of characters read in one line from file; lines in file longer than this limit will be truncated in this viewer; value does not include ending '\0' */ #define READ_BUFFER_SIZE 1024 /* maximal number of lines that can be read from file; I'm using this limit for performance reasons */ #define N_LINES_READ_MAX 10000 static void cdw_text_file_viewer_print_line(void *display, void *data, size_t row, size_t h_offset, bool isreverse); static ssize_t cdw_text_file_viewer_read_file(FILE *file, cdw_dll_item_t **list); static cdw_rv_t cdw_text_file_viewer_dealloc_lines_from_list(cdw_dll_item_t *list); /** \brief Read content of the file to given list Function reads content of the \p file, line by line, and copies every line into \p list. There are two limits for this function: \li it can't read more than READ_BUFFER_SIZE chars at a time (this may lead to line truncations or some strange results in viewer's window) \li it can't read more than N_LINES_READ_MAX lines of file You can increase these two limits (independently) as you wish, memory and speed seem to be the only limiting factors (I haven't tested the limits very hard, currently they are set as 1024 and 10000, respectively). \p file must be already open for reading, \p list may be non-empty, the function will simply append more lines. Note that if any error occurs in the middle of reading file, the function does not rewind changes made to the \p list - it may be half-filled, possibly with incorrect data. Function uses cdw_dll_append_non_unique() so don't worry if repeating lines of text from file will be stored correctly on list, or about predicate for append() function. \param file - file to read from \param list - place where to copy lines read from file \return non-negative number of lines read from file (number of items appended to \p list) \return -1 on errors */ ssize_t cdw_text_file_viewer_read_file(FILE *file, cdw_dll_item_t **list) { rewind(file); char read_buffer[READ_BUFFER_SIZE + 1]; ssize_t n_lines = 0; bool success = true; while (n_lines < N_LINES_READ_MAX) { /* fgets() puts '\0' at the end of read buffer */ char *c = fgets(read_buffer, READ_BUFFER_SIZE + 1, file); if (c == (char *) NULL) { success = true; break; } char *data = strdup(read_buffer); if (data == (char *) NULL) { success = false; break; } cdw_dll_append_non_unique(list, (void *) data); n_lines++; } if (success) { return n_lines; } else { return -1; } } /** \brief Print one line of text in given display Function prints one line of text from \p data in given \p row of window associated with given \p display. Function can handle non-zero values of \p h_offset: displayed line of text will be shifted to the left accordingly. This is the "item display function" of text file viewer module. You should assign it to display->display_item after creating display for text file viewer. \param displ - display to use as a place to print a line \param data - data to be printed in given display \param row - specific row number of display's window, in which to print a line \param h_offset - horizontal offset, with which to print a line \param isreverse - should the function use reverse display attributes to display the line? */ void cdw_text_file_viewer_print_line(void *displ, void *data, size_t row, size_t h_offset, bool isreverse) { CDW_LIST_DISPLAY *display = (CDW_LIST_DISPLAY *) displ; char *buffer = (char *) data; if (buffer == (char *) NULL) { return; } #if 0 /* this code expands tabs into spaces to avoid "jumping tabs" in window */ size_t t = 0; bool end = false; /* did we got to end of read_buffer? */ for (t = 0; t < strlen(buffer); t++) { if (buffer[t] == '\t') { char tmp_line[READ_BUFFER_SIZE]; strncpy(tmp_line, buffer, t); size_t j = 0; /* 8 is 8 spaces for a TAB character */ for (j = 0; j < 8; j++) { if (t + j < READ_BUFFER_SIZE) { tmp_line[t + j] = ' '; } else { end = true; break; } } if (end) { break; } /* this puts content of 'read_buffer' that is after '\t' into place after eight spaces */ strncpy(tmp_line + t + 8, buffer + t + 1, READ_BUFFER_SIZE - t - 8); strncpy(buffer, tmp_line, READ_BUFFER_SIZE); buffer[READ_BUFFER_SIZE] = '\0'; } } #endif long unsigned int attr = 0; if (isreverse) { attr = A_REVERSE | COLOR_PAIR(display->colors); } else { attr = A_NORMAL | COLOR_PAIR(display->colors); } (void) wattrset(display->subwindow, attr); if (strlen(buffer) >= h_offset) { mvwprintw(display->subwindow, (int) row, 0, "%s", (char *) buffer + h_offset); } else { mvwprintw(display->subwindow, (int) row, 0, " "); } return; } /** \brief Open given file, display its content in window, close file Function opens file specified by \p fullpath, calls cdw_text_file_viewer() to create a viewer, display content of file and handle keys from user, and then closes file and returns. \p file_path may not be NULL nor empty, \p title may be empty string or NULL. \param fullpath - full path to file to be opened \param title - string used as title of display window \return CDW_OK on success \return CDW_ERROR on errors */ cdw_rv_t cdw_text_file_viewer_with_fullpath(const char *fullpath, const char *title) { cdw_assert (fullpath != (char *) NULL, "file path is null\n"); cdw_assert (strlen(fullpath), "file path len is zero\n"); FILE *file = fopen(fullpath, "r"); if (file == (FILE *) NULL) { return CDW_ERROR; } cdw_rv_t crv = cdw_text_file_viewer(file, title); fclose(file); file = (FILE *) NULL; return crv; } /** \brief Display content of file using list display widget Function creates instance of list display widget, calls cdw_text_file_viewer_read_file() to read content of \p file to list associated with the display, and calls driver function for the display. When user closes display window, function cleans some things up. \p file must be already open for reading. Function does not close it. \p title is a title of window displaying content of file. It may be empty string or NULL. \param file - open file that caller want to display \param title - string used as title of display window \return CDW_OK on success \return CDW_GEN_ERROR on errors */ cdw_rv_t cdw_text_file_viewer(FILE *file, const char *title) { cdw_assert (COLS > 6, "ERROR: COLS is %d, should be more than 6\n", COLS); cdw_assert (LINES > 4, "ERROR: LINES is %d, should be more than 4\n", LINES); /* these are parameters of parent, stand-alone window */ int n_cols = COLS - 2; int n_lines = LINES - 2; int begin_y = 1; int begin_x = 1; WINDOW *window = newwin(n_lines, n_cols, begin_y, begin_x); if (window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create window for text file viewer\n"); return CDW_ERROR; } CDW_LIST_DISPLAY *display = cdw_list_display_new(window, n_lines - 2, n_cols - 2, 1, 1, CDW_COLORS_DIALOG); if (display == (CDW_LIST_DISPLAY *) NULL) { delwin (window); window = (WINDOW *) NULL; cdw_vdm ("ERROR: failed to create display for text file viewer\n"); return CDW_ERROR; } display->display_item = cdw_text_file_viewer_print_line; display->display_format = CDW_LIST_DISPLAY_FORMAT_LONG; /* 2TRANS: this is help text displayed at the bottom of text file viewer window: it explains which keys can be used */ cdw_window_add_strings(display->window, title, _("Use ESC to close, use arrows, Home and End to move")); ssize_t n = cdw_text_file_viewer_read_file(file, &(display->list)); if (n != -1) { display->n_items = (size_t) n; cdw_list_display_scroll_to(display, 0, 0, false); cdw_list_display_refresh(display); /* this function will control the display until user pressed ESCAPE */ cdw_list_display_driver(display); } /* TODO: display should have pointer to function that knows how to free list content */ cdw_text_file_viewer_dealloc_lines_from_list(display->list); /* cdw_list_display_delete() also deallocates list data structure */ cdw_list_display_delete(&display); delwin(window); window = (WINDOW *) NULL; cdw_main_ui_main_window_wrefresh_part(n_lines, n_cols, begin_y, begin_x); if (n == -1) { cdw_vdm ("ERROR: problems occurred when reading file\n"); /* there will be no error message for user here, it should be handled by code calling text file viewer functions */ return CDW_ERROR; } else if (n == 0) { /* not necessarily an error, but it's worth informing in debug output */ cdw_vdm ("WARNING: zero lines read from file\n"); return CDW_OK; } else { return CDW_OK; } } /** \brief Deallocate data stored on given list Function deallocates date stored on given list. This function is specialized for data type used by text file viewer, which is ordinary "char *" C string. Call this function before destroying text file display. \param list - list from which to reallocate lines of text \return CDW_OK */ cdw_rv_t cdw_text_file_viewer_dealloc_lines_from_list(cdw_dll_item_t *list) { if (list != (cdw_dll_item_t *) NULL) { cdw_dll_item_t *item = list; for ( ; item != (cdw_dll_item_t *) NULL; item = item->next) { free((char *) item->data); item->data = (char *) NULL; } } return CDW_OK; } cdw-0.7.1/src/user_interface/cdw_write_wizard.h0000644000175000017500000000034011526306526016525 00000000000000#ifndef H_CDW_WRITE_WIZARD #define H_CDW_WRITE_WIZARD #include "main.h" #include "cdw_task.h" #include "cdw_disc.h" cdw_rv_t cdw_write_wizard(cdw_task_t *task, cdw_disc_t *disc); #endif /* #ifndef H_CDW_WRITE_WIZARD */ cdw-0.7.1/src/user_interface/cdw_help.h0000644000175000017500000000023611204042763014740 00000000000000#ifndef H_CDW_HELP #define H_CDW_HELP void show_help_main(void); void show_help_cddb(void); void display_tooltip(int item); #endif /* #ifndef H_CDW_HELP */ cdw-0.7.1/src/user_interface/cdw_main_window.c0000644000175000017500000012141311735605261016326 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _BSD_SOURCE /* strdup() */ #include #include #include #include #include "cdw_fs.h" #include "config.h" #include "cdw_main_window.h" #include "cdw_config.h" #include "gettext.h" #include "cdw_file_manager.h" #include "cdw_debug.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "cdw_text_file_viewer.h" #include "cdw_drive.h" #include "cdw_cdio_drives.h" #include "cdw_utils.h" extern cdw_config_t global_config; /* main cdw configuration variable */ static void cdw_main_ui_init_values(void); static void cdw_main_ui_recalculate_sizes(void); /** \brief Number of items in main cdw menu on the left; does not include last NULL item */ #define MENU_ITEMS 10 /* in theory this is just a length of labels in menu, and indirectly width of menu; but it also (indirectly) influences width of "disc info" box below menu */ #define MENU_LABEL_LEN 24 /* \brief Main menu on the left side of main cdw window */ struct cdw_menu { MENU *menu; ITEM **items; /** \brief Subwindow for a view - the one that will get a border, and the one that will be used in set_menu_win() */ WINDOW *subwindow; /** \brief Subwindow for a menu, the one used in set_menu_sub() */ WINDOW *menu_subwindow; int n_rows; int n_cols; int begin_y; int begin_x; }; struct cdw_ui_view { WINDOW *subwindow; int n_rows; int n_cols; int begin_y; int begin_x; }; static struct { struct cdw_menu main_menu; struct cdw_ui_view disc_info_view; struct cdw_ui_view files_list_view; struct cdw_ui_view volume_info_view; struct cdw_ui_view tooltips_view; WINDOW *window; int n_rows; int n_cols; } cdw_ui; static cdw_rv_t cdw_main_ui_main_menu_view_create(void); static cdw_rv_t cdw_main_ui_files_list_view_create(void); static cdw_rv_t cdw_main_ui_volume_info_view_create(void); static cdw_rv_t cdw_main_ui_disc_info_view_create(void); static cdw_rv_t cdw_main_ui_tooltips_view_create(void); static void cdw_main_ui_volume_info_view_display_data_new(bool show_disc_info, size_t n_files, double used_space, double selected_size, int total_space); /** \brief Initialize resources of main cdw window Initialize all windows and other data structures related to user interface that can be seen right after the application starts. \return CDW_MEM_ERROR if some malloc-related error occurred \return CDW_GEN_ERROR if some other error occurred \return CDW_OK if user interface was initialized properly */ cdw_rv_t cdw_main_ui_init(void) { cdw_main_ui_init_values(); /* main NCURSES window */ cdw_ui.window = newwin(cdw_ui.n_rows, cdw_ui.n_cols, 0, 0); if (!cdw_ui.window) { cdw_main_ui_clean(); cdw_vdm ("ERROR: failed to create main app window\n"); return CDW_ERROR; } keypad(cdw_ui.window, TRUE); wbkgd(cdw_ui.window, A_NORMAL | COLOR_PAIR(CDW_COLORS_MAIN)); /* left-hand, main app menu */ cdw_rv_t crv = cdw_main_ui_main_menu_view_create(); if (crv != CDW_OK) { cdw_main_ui_clean(); cdw_vdm ("ERROR: failed to create main app menu\n"); return CDW_ERROR; } mvwaddch(cdw_ui.window, 0, 1, ACS_RTEE); wattrset(cdw_ui.window, A_BOLD | COLOR_PAIR(CDW_COLORS_TITLE)); mvwprintw(cdw_ui.window, 0, 2, " ::: %s %s ::: ", PACKAGE, VERSION); wattrset(cdw_ui.window, A_NORMAL | COLOR_PAIR(CDW_COLORS_MAIN)); waddch(cdw_ui.window, ACS_LTEE); /* window in which selected files are displayed */ crv = cdw_main_ui_files_list_view_create(); if (crv != CDW_OK) { cdw_main_ui_clean(); cdw_vdm ("ERROR: failed to create selected files list view\n"); return CDW_ERROR; } /* area displaying summarized information about selected files and disc capacity/usage/estimated future usage */ crv = cdw_main_ui_volume_info_view_create(); if (crv != CDW_OK) { cdw_main_ui_clean(); cdw_vdm ("ERROR: failed to create selected files info view\n"); return CDW_ERROR; } cdw_main_window_volume_info_view_update(-1, -1, true, global_config.follow_symlinks); //selected_files_size_mb = 0.0; //cdw_ui_volume_info_view_display_data(); /* area displaying information about current optical disc */ crv = cdw_main_ui_disc_info_view_create(); if (crv != CDW_OK) { cdw_main_ui_clean(); cdw_vdm ("ERROR: failed to create disc info view\n"); return CDW_ERROR; } crv = cdw_main_ui_tooltips_view_create(); if (crv != CDW_OK) { cdw_main_ui_clean(); cdw_vdm ("ERROR: failed to create help view\n"); return CDW_ERROR; } wrefresh(cdw_ui.window); return CDW_OK; } /** \brief Deallocate all resources related to main app window This function may be called even when no resources are allocated yet: this functions and all functions called check if resource was allocated, and if so, then proceeds with cleaning resource. */ void cdw_main_ui_clean(void) { if (cdw_ui.main_menu.menu) { unpost_menu(cdw_ui.main_menu.menu); cdw_ncurses_delete_menu_and_items(&(cdw_ui.main_menu.menu)); cdw_assert (!cdw_ui.main_menu.menu, "failed to set cdw_ui.main_menu.menu to NULL\n") } /* IMPORTANT: first clean subwindows, then parent window */ /* FIXME: there may be a bug somewhere, steps to reproduce: 1. in cdw_curses_init() change this line: "if ((lines < 24) || (cols < 80))" to "if ((lines < 25) || (cols < 80))" 2. run cdw in 80x25 terminal 3. right after starting cdw press 'q' key to quit 4. in dialog window select 'ok' and press enter 5. cdw crashes debugger points to first delwin() below. Note that the bug doesn't occur in 2 circumstances: 1. if in dialog from point 4 above you select 'cancel' and then you press 'q' again and then select 'ok' 2. if you run cdw in 81x26 terminal */ cdw_window_delete(&cdw_ui.files_list_view.subwindow); cdw_window_delete(&cdw_ui.main_menu.menu_subwindow); cdw_assert (cdw_ui.main_menu.menu_subwindow == (WINDOW *) NULL, "ERROR: delete() function didn't set a window to NULL\n"); cdw_window_delete(&cdw_ui.main_menu.subwindow); cdw_window_delete(&cdw_ui.volume_info_view.subwindow); cdw_window_delete(&cdw_ui.disc_info_view.subwindow); cdw_window_delete(&cdw_ui.tooltips_view.subwindow); cdw_window_delete(&cdw_ui.window); return; } /** \brief Calculate values of some layout constraints and parameters Calculate values of variables that decide about height, width and position of subwindows in main cdw UI. This function must be used before cdw_ui_main_init() is called. Should be also called when application receives information that terminal size has changed (TODO: catching signal is to be implemented). */ void cdw_main_ui_recalculate_sizes(void) { /* There are only few known limitations on UI layout: - tooltips area at the bottom of window must have exactly 1 line; - disc info view needs to display 4 lines + 2 lines of window borders; - main menu area must fit labels of certain length; - minimal supported terminal size is 80 cols x 24 lines; Height of volume information area is the same as disc info area: 4 + 2, so I don't consider this height as an additional basic factor. Width of disc info area is the same as width of main menu - this seems to be sufficient. Width of volume size area and selected files area aren't very limiting factors. We have also remember about number of items in main menu, which is 9 items + 2 lines of window borders. However quick calculation shows that this is not an important factor: 24 lines of terminal - 1 line of tooltips - (4 + 2) lines of disc info gives 17 lines - this is how much lines we have for main menu area (and for selected files area). */ cdw_ui.n_rows = LINES; cdw_ui.n_cols = COLS; /* -2: don't let letters in tooltips area be displayed very close to window borders */ cdw_ui.tooltips_view.n_cols = cdw_ui.n_cols - 2; cdw_ui.tooltips_view.n_rows = 1; cdw_ui.tooltips_view.begin_y = cdw_ui.n_rows - cdw_ui.tooltips_view.n_rows; cdw_ui.tooltips_view.begin_x = 1; /* disc info area needs 4 lines of usable space (Type?, Empty?, Writable?, Erasable?) + 2 lines for borders */ int lower_n_rows = 4 + 2; int upper_n_rows = cdw_ui.n_rows - lower_n_rows - cdw_ui.tooltips_view.n_rows; int left_n_cols = MENU_LABEL_LEN; int right_n_cols = cdw_ui.n_cols - left_n_cols; int lower_begin_y = cdw_ui.n_rows - lower_n_rows - cdw_ui.tooltips_view.n_rows; int upper_begin_y = 0; int right_begin_x = left_n_cols; int left_begin_x = 0; cdw_ui.main_menu.n_cols = left_n_cols; cdw_ui.main_menu.n_rows = upper_n_rows; cdw_ui.main_menu.begin_y = upper_begin_y; cdw_ui.main_menu.begin_x = left_begin_x; cdw_ui.files_list_view.n_rows = upper_n_rows; cdw_ui.files_list_view.n_cols = right_n_cols; cdw_ui.files_list_view.begin_y = upper_begin_y; cdw_ui.files_list_view.begin_x = right_begin_x; cdw_ui.volume_info_view.n_rows = lower_n_rows; cdw_ui.volume_info_view.n_cols = right_n_cols; cdw_ui.volume_info_view.begin_y = lower_begin_y; cdw_ui.volume_info_view.begin_x = right_begin_x; cdw_ui.disc_info_view.n_cols = left_n_cols; cdw_ui.disc_info_view.n_rows = lower_n_rows; cdw_ui.disc_info_view.begin_y = lower_begin_y; cdw_ui.disc_info_view.begin_x = left_begin_x; return; } static const char *menu_labels[] = { /* 2TRANS: label of item main menu: Add files from file system to list of files that will be written to CD or to image files*/ gettext_noop(" Add files "), /* 2TRANS: label of item in main menu: Remove dir(s)/file(s) from list of files that will be written to CD or to image files */ gettext_noop(" Delete files "), /* 2TRANS: label of item in main menu: write selected dirs/files to optical disc */ gettext_noop(" Write files to disc "), /* 2TRANS: label of item in main menu: create ISO9660 image file using selected files/directories */ gettext_noop(" Create image "), /* 2TRANS: label of item in main menu: write (burn) ISO9660 image file to optical disc */ gettext_noop(" Write image to disc "), /* 2TRANS: label of item in main menu: read content of your audio CD / data CD / data DVD and write it to hard drive */ gettext_noop(" Read disc "), /* 2TRANS: label of item in main menu: erase content of optical disc */ gettext_noop(" Erase disc "), /* 2TRANS: label of item in main menu: perform verification of data */ gettext_noop(" Verify data "), /* 2TRANS: label of item in main menu: change configuration of cdw */ gettext_noop(" Configuration "), /* 2TRANS: label of item in main menu: exit cdw */ gettext_noop(" Quit ") }; /** \brief Create and initialize main app menu and its subwindow Create and initialize main CDW menu that is visible in main UI. Create its subwindow. \return CDW_OK if everything went ok \return CDW_MEM_ERROR if some malloc() error occurred \return CDW_ERROR if some other error */ cdw_rv_t cdw_main_ui_main_menu_view_create(void) { cdw_assert (cdw_ui.window, "calling the function for null main window\n"); cdw_ui.main_menu.subwindow = derwin(cdw_ui.window, cdw_ui.main_menu.n_rows, cdw_ui.main_menu.n_cols, cdw_ui.main_menu.begin_y, cdw_ui.main_menu.begin_x); if (!cdw_ui.main_menu.subwindow) { cdw_vdm ("ERROR: failed to create subwindow for main menu\n"); return CDW_ERROR; } cdw_ui.main_menu.menu_subwindow = derwin(cdw_ui.main_menu.subwindow, cdw_ui.main_menu.n_rows - 2, cdw_ui.main_menu.n_cols - 2, 1, 1); if (!cdw_ui.main_menu.menu_subwindow) { cdw_vdm ("ERROR: failed to create menu subwindow for main menu\n"); return CDW_ERROR; } werase(cdw_ui.main_menu.subwindow); werase(cdw_ui.main_menu.menu_subwindow); /* no title for this subarea - it would be overwritten with app name + version */ cdw_window_add_strings(cdw_ui.main_menu.subwindow, (char *) NULL, (char *) NULL); cdw_ui.main_menu.items = (ITEM **) calloc(MENU_ITEMS + 1, sizeof(ITEM *)); if (!cdw_ui.main_menu.items) { cdw_vdm ("ERROR: failed to allocate memory for menu items\n"); return CDW_ERROR; } for (int i = 0; i < MENU_ITEMS; i++) { /* label too long will be simply truncated by menu window */ /* cdw_ui.main_menu.labels[i][MENU_LABEL_LEN] = '\0'; */ cdw_ui.main_menu.items[i] = new_item(_(menu_labels[i]), ""); } cdw_ui.main_menu.items[MENU_ITEMS] = (ITEM *) NULL; cdw_ui.main_menu.menu = new_menu((ITEM **) cdw_ui.main_menu.items); if (!cdw_ui.main_menu.menu) { int e = errno; cdw_vdm ("ERROR: failed to create menu with new_menu(), errno is \"%s\"\n", cdw_ncurses_error_string(e)); return CDW_ERROR; } int r = set_menu_win(cdw_ui.main_menu.menu, cdw_ui.main_menu.subwindow); if (r != E_OK) { cdw_vdm ("ERROR: failed to set menu win with set_menu_win(), return value is \"%s\"\n", cdw_ncurses_error_string(r)); return CDW_ERROR; } r = set_menu_sub(cdw_ui.main_menu.menu, cdw_ui.main_menu.menu_subwindow); if (r != E_OK) { cdw_vdm ("ERROR: failed to set menu subwin with set_menu_sub(), return value is \"%s\"\n", cdw_ncurses_error_string(r)); return CDW_ERROR; } set_menu_fore(cdw_ui.main_menu.menu, COLOR_PAIR(CDW_COLORS_MENU) | A_REVERSE); set_menu_back(cdw_ui.main_menu.menu, COLOR_PAIR(CDW_COLORS_MENU)); r = set_menu_mark(cdw_ui.main_menu.menu, ""); if (r != E_OK) { cdw_vdm ("ERROR: failed to set menu mark with set_menu_mark(), return value is \"%s\"\n", cdw_ncurses_error_string(r)); return CDW_ERROR; } r = post_menu(cdw_ui.main_menu.menu); if (r != E_OK) { cdw_vdm ("ERROR: failed to post menu with post_menu(), return value is \"%s\"\n", cdw_ncurses_error_string(r)); return CDW_ERROR; } return CDW_OK; } /** \brief Create 'Selected files' part of main application window In case of errors function does not deallocate resources that it allocated (selected_files_sub). \return CDW_OK on success \return CDW_ERROR if some error occurred */ cdw_rv_t cdw_main_ui_files_list_view_create(void) { cdw_assert (cdw_ui.window, "ERROR: calling the function for null main window\n"); cdw_ui.files_list_view.subwindow = derwin(cdw_ui.window, cdw_ui.files_list_view.n_rows, cdw_ui.files_list_view.n_cols, cdw_ui.files_list_view.begin_y, cdw_ui.files_list_view.begin_x); if (!cdw_ui.files_list_view.subwindow) { cdw_vdm ("ERROR: failed to create files list view subwindow with derwin()\n"); return CDW_ERROR; } keypad(cdw_ui.files_list_view.subwindow, TRUE); cdw_window_add_strings(cdw_ui.files_list_view.subwindow, /* 2TRANS: this is title of biggest area in cdw UI that shows files selected for writing to cd or image file */ _("Selected files"), (char *) NULL); wattrset(cdw_ui.files_list_view.subwindow, A_NORMAL | COLOR_PAIR(CDW_COLORS_MAIN)); cdw_rv_t crv = cdw_file_manager_create_selected_files_view(cdw_ui.files_list_view.subwindow); if (crv == CDW_OK) { return CDW_OK; } else { cdw_vdm ("ERROR: failed to create files list view with cdw_file_manager*() call()\n"); /* file manager already displayed error message, caller will have to decide what to do with allocated resources (subwindow) */ return CDW_ERROR; } } /** \brief Create subwindow with information about optical disc Create subwindow in which information about current disc is displayed. Display initial view in this subwindow. \return CDW_OK on success \return CDW_ERROR if some error occurred */ cdw_rv_t cdw_main_ui_disc_info_view_create(void) { cdw_ui.disc_info_view.subwindow = derwin(cdw_ui.window, cdw_ui.disc_info_view.n_rows, cdw_ui.disc_info_view.n_cols, cdw_ui.disc_info_view.begin_y, cdw_ui.disc_info_view.begin_x); if (!cdw_ui.disc_info_view.subwindow) { cdw_vdm ("ERROR: failed to create subwindow with derwin() for disc info view\n"); return CDW_ERROR; } cdw_window_add_strings(cdw_ui.disc_info_view.subwindow, /* 2TRANS: this is title of area displaying basic information about disc currently in drive */ _("Disc info"), (char *) NULL); cdw_disc_t *disc = cdw_disc_new(); /* no call to cdw_disc_get() when UI is created; if there is no disc in drive, the user would be nagged to insert disc into drive - that nagging wouldn't be welcomed by the user cdw_disc_get(disc); */ cdw_main_ui_disc_info_view_display_data(disc); cdw_disc_delete(&disc); return CDW_OK; } /** \brief Display in subwindow current information about optical disc Read from proper variable information about current disc and display this information in 'Disc info' subwindow in main CDW window. The function does not retrieve from optical disc nor recalculate any data, it merely uses data existing in \p disc. \param disc - variable from which to take values to display */ void cdw_main_ui_disc_info_view_display_data(const cdw_disc_t *disc) { cdw_assert (cdw_ui.disc_info_view.subwindow, "called the function for NULL subwindow\n"); cdw_assert (disc, "called the function with NULL argument\n"); /* "parameter name" column and "parameter value" column */ const int pcol = 2; const int vcol = 14; const int row_h = 1; /* "header" row */ const int row_e = 2; /* "empty" row */ const int row_w = 3; /* "writable" row */ const int row_e2 = 4; /* "erasable" row */ /* erase; not using werase(cdw_ui.disc_info_view.subwindow) because it would erase subwindow borders too */ mvwhline(cdw_ui.disc_info_view.subwindow, row_h, 1, ' ', cdw_ui.main_menu.n_cols - 2); mvwhline(cdw_ui.disc_info_view.subwindow, row_e, 1, ' ', cdw_ui.main_menu.n_cols - 2); mvwhline(cdw_ui.disc_info_view.subwindow, row_w, 1, ' ', cdw_ui.main_menu.n_cols - 2); mvwhline(cdw_ui.disc_info_view.subwindow, row_e2, 1, ' ', cdw_ui.main_menu.n_cols - 2); wrefresh(cdw_ui.disc_info_view.subwindow); wattrset(cdw_ui.disc_info_view.subwindow, A_BOLD | COLOR_PAIR(CDW_COLORS_MAIN)); /* header: if no disc in drive then "No disc" if disc is empty then "" if disc is not empty then "/" */ if (disc->cdio->simple_type == CDW_DISC_SIMPLE_TYPE_UNKNOWN) { /* 2TRANS: "No disc" means "currently there is no disc in drive or no information about disc has been collected yet"; keep short */ mvwprintw(cdw_ui.disc_info_view.subwindow, row_h, pcol, _("No disc")); int n_drives = cdw_cdio_drives_get_n_drives(); if (n_drives == 0) { /* 2TRANS: "No drive" means "no optical drive detected by cdw", "?" means that cdw is not 100% sure about this; keep short */ mvwprintw(cdw_ui.disc_info_view.subwindow, row_h + 1, pcol, _("No drive (?)")); } /* 2TRANS: this is a hint about a hot key; keep short; "refresh" means - (re)read disc information and display it in disc information area */ mvwprintw(cdw_ui.disc_info_view.subwindow, row_h + 2, pcol, _("'R' key - refresh")); return; } else { if (disc->state_empty == CDW_TRUE) { mvwprintw(cdw_ui.disc_info_view.subwindow, row_h, pcol, disc->type_label); } else { mvwprintw(cdw_ui.disc_info_view.subwindow, row_h, pcol, /* 2TRANS: this is string displaying information about disc: 1st %s is disc type (e.g. CD-RW), 2nd %s is file system type on a disc; resulting string may look like "CD-RW / ISO9660"; keep short */ _("%s / %s"), disc->type_label, disc->cdio->ofs->type_label); } } /* empty? */ /* 2TRANS: 'Empty' means that there is no data on disc; 'Y', 'N' or '?' will follow after colon; keep short */ mvwprintw(cdw_ui.disc_info_view.subwindow, row_e, pcol, _("Empty: ")); mvwprintw(cdw_ui.disc_info_view.subwindow, row_e, vcol, _("%s"), cdw_utils_get_cdw_bool_type_char(disc->state_empty)); /* writable? */ /* 2TRANS: 'Writable' means that it is possible to write to disc; 'Y', 'N' or '?' will follow after colon; keep short */ mvwprintw(cdw_ui.disc_info_view.subwindow, row_w, pcol, _("Writable: ")); if (disc->type_writable == CDW_TRUE) { mvwprintw(cdw_ui.disc_info_view.subwindow, row_w, vcol, _("%s"), cdw_utils_get_cdw_bool_type_char(disc->state_writable)); } else { mvwprintw(cdw_ui.disc_info_view.subwindow, row_w, vcol, _("%s"), cdw_utils_get_cdw_bool_type_char(disc->type_writable)); } /* erasable? */ /* 2TRANS: "Erasable" means: 'content can be blanked/erased/wiped out' 'Y' or 'N' will follow after colon; keep short */ mvwprintw(cdw_ui.disc_info_view.subwindow, row_e2, pcol, _("Erasable: ")); mvwprintw(cdw_ui.disc_info_view.subwindow, row_e2, vcol, _("%s"), cdw_utils_get_cdw_bool_type_char(disc->type_erasable)); /* a special hack until cdw fully supports DVD+R DL */ #if 0 /* this code should probably be removed as this kind of decisions shouldn't be made at this level */ if (disc->type == CDW_DVD_RP_DL && config.support_dvd_rp_dl) { const char *label_unknown = cdw_utils_get_cdw_bool_type_char(CDW_UNKNOWN); mvwprintw(cdw_ui.disc_info_view.subwindow, row_e, vcol, _("%s"), label_unknown); mvwprintw(cdw_ui.disc_info_view.subwindow, row_w, vcol, _("%s"), label_unknown); mvwprintw(cdw_ui.disc_info_view.subwindow, row_e2, vcol, _("%s"), label_unknown); } #endif wattrset(cdw_ui.disc_info_view.subwindow, A_NORMAL | COLOR_PAIR(CDW_COLORS_MAIN)); wrefresh(cdw_ui.disc_info_view.subwindow); return; } /** Refresh part of main application window. */ void cdw_main_ui_main_window_wrefresh_part(int n_lines, int n_cols, int begin_y, int begin_x) { if (cdw_ui.window == (WINDOW *) NULL) { /* previously there was an assert() here, but this function may be called by dialogbox when main ui (and thus main window) is not initialized yet; example: when after starting cdw a path to log file is checked and it is reset, main window is still not created, but cdw displays dialog that informs user about resetting path, and the dialog window calls this function */ cdw_vdm ("ERROR: called the function for null window\n"); return; } WINDOW *window = derwin(cdw_ui.window, n_lines, n_cols, begin_y, begin_x); if (window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create derived window for refresh\n"); } else { wrefresh(window); cdw_window_delete(&window); } return; } /** \brief Redraw content of main app window */ void cdw_main_ui_main_window_wrefresh(void) { cdw_assert (cdw_ui.window, "called the function for null window\n"); redrawwin(cdw_ui.window); wrefresh(cdw_ui.window); return; } cdw_rv_t cdw_main_window_volume_info_view_update(long long disc_sectors_used, long long disc_sectors_total, bool rescan_selected_files, bool follow_symlinks) { static long long disc_capacity_sectors_used = 0; static long long disc_capacity_sectors_total = 0; if (disc_sectors_total >= 0) { disc_capacity_sectors_total = disc_sectors_total; if (disc_sectors_used >= 0) { disc_capacity_sectors_used = disc_sectors_used; } } size_t n_files = cdw_file_manager_number_of_selected_files(); cdw_sdm ("INFO: number of selected files = %zd\n", n_files); bool error = false; double selected_files_size_mb = 0.0; if (n_files != 0) { if (rescan_selected_files) { selected_files_size_mb = cdw_file_manager_calculate_selected_files_size_mb(follow_symlinks); if (selected_files_size_mb < 0.0) { error = true; } } else { long long int size = cdw_selected_files_get_size(); selected_files_size_mb = (((double) size) / 1024.0) / 1024.0; } } int total_space = 0; double used_space = 0.0; bool show_disc_info = false; if (global_config.volume_size_id == CDW_CONFIG_VOLUME_SIZE_AUTO) { used_space = (double) disc_capacity_sectors_used / 512.0; total_space = (int) disc_capacity_sectors_total / 512; if (total_space > 0) { show_disc_info = true; } else { /* some software/disc configurations may result in total_space == 0, e.g. I can't figure how to read DVD disc capacity from wodim's output; in such cases volume size window will behave like for "custom volume size" or "fixed volume size" */ } } else { /* either custom value, or constant value corresponding to total capacity of some preselected disc type */ total_space = (int) cdw_config_get_current_volume_size_value(); } cdw_main_ui_volume_info_view_display_data_new(show_disc_info, n_files, used_space, selected_files_size_mb, total_space); if (error) { cdw_vdm ("ERROR: size of selected files is < 0\n"); /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("One or more of selected files may be missing. Check log file for more information - press 'L' key in main window."), CDW_BUTTONS_OK, CDW_COLORS_WARNING); cdw_main_ui_main_window_wrefresh(); return CDW_ERROR; } else { return CDW_OK; } } /** \brief Display disc usage summary at the bottom of cdw window Display following info at the bottom of main UI window: - disc capacity and usage - number and size of new, selected files - amount of free space left on disc or in target volume - bar indicator and percentage value of free space left Disc capacity and usage is displayed only if \p show_disc_info is true (and the argument should be true if item selected from "ISO volume size" dropdown in configuration window is "Get sizes from disc"). The function does not collect nor calculate any data (except for some local variables), it just uses current values from some global variables. \param show_disc_info - controls if information about disc capacity and usage should be displayed \param n_files - number of files selected for burning \param used_space - amount of space already used on optical disc \param selected_size - size of selected files \param total_space - total capacity of optical disc */ void cdw_main_ui_volume_info_view_display_data_new(bool show_disc_info, size_t n_files, double used_space, double selected_size, int total_space) { cdw_assert (cdw_ui.volume_info_view.subwindow != (WINDOW *) NULL, "ERROR: called the function for NULL subwindow\n"); WINDOW *subwindow = cdw_ui.volume_info_view.subwindow; wattrset(subwindow, A_BOLD | COLOR_PAIR(CDW_COLORS_MAIN)); int bar_row = 4; /* usage bar row */ const int col = 2; /* start column for content drawn in window */ const int bar_width = 30; /* number of cells in bar, does not include borders */ /* clean row in which usage bar and information about space usage is displayed */ mvwhline(subwindow, 1, 1, ' ', cdw_ui.volume_info_view.n_cols - 2); mvwhline(subwindow, 2, 1, ' ', cdw_ui.volume_info_view.n_cols - 2); mvwhline(subwindow, 3, 1, ' ', cdw_ui.volume_info_view.n_cols - 2); mvwhline(subwindow, bar_row, 1, ' ', cdw_ui.volume_info_view.n_cols - 2); redrawwin(subwindow); wrefresh(subwindow); /* TODO: implement displaying size in kB or GB when applicable; this won't be simple as it will require changes in few different places */ mvwprintw(subwindow, 2, col, n_files ? /* 2TRANS: '%d' is a number of new files selected for burning, '%.1f' is a size of the files; keep tilde ('~') char or equivalent, as exact size of selected files is not 100% precise */ _("Selected files (%d): ~%.1f MB") : /* 2TRANS: '%d' is a number of new files selected for burning, '%.1f' is a size of the files; */ _("Selected files (%d): %.1f MB"), n_files, selected_size); if (total_space > 0) { if (show_disc_info) { /* 2TRANS: this is information about disc usage and capacity: '%.1f' is size of data on disc, '%d' is a capacity (total size) of disc; keep tilde ('~') char or equivalent, as exact sizes are not 100% precise */ mvwprintw(subwindow, 1, col, _("On disc: ~%.1f / ~%d MB"), used_space, total_space); } /* left and right border of usage bar */ mvwaddch(subwindow, bar_row, col, '['); mvwaddch(subwindow, bar_row, col + bar_width + 1, ']'); double percent_used = used_space * 100.0 / (double) total_space; double percent_selected = selected_size * 100.0 / (double) total_space; int n = (int) ((percent_used * (double) bar_width) / 100); int m = 0; double free_space = (double) total_space - used_space - selected_size; if (free_space > 0.0) { m = (int) ((percent_selected * (double) bar_width) / 100); if (percent_used + percent_selected > 90.0) { /* 90%: arbitrary value of 'safe' level of disc usage */ wattrset(subwindow, COLOR_PAIR(CDW_COLORS_WARNING)); } /* 2TRANS: this is information about available space left on disc; keep tilde ('~') char or equivalent */ mvwprintw(subwindow, 3, col, _("Free space: ~%.1f MB"), free_space); } else { /* files size (already burned + newly selected) is larger than capacity of disc */ m = bar_width - n; wattrset(subwindow, COLOR_PAIR(CDW_COLORS_ERROR)); /* 2TRANS: this is information about available space left on disc: 0 MB, i.e. no space left */ mvwprintw(subwindow, 3, col, _("Free space: 0 MB")); } wattrset(subwindow, COLOR_PAIR(CDW_COLORS_MAIN)); mvwhline(subwindow, bar_row, col + 1, ACS_BLOCK, n); /* +1 to skip left brace [ */ mvwhline(subwindow, bar_row, col + 1 + n, '+', m); /* +1 to skip left brace [ */ mvwprintw(subwindow, bar_row, col + bar_width + 3, /* 3 to move past indicator bar */ /* 2TRANS: this is information about usage of disc space: '%2.1f%%' is information about used space, displayed as percentage of total disc size; keep tilde ('~') char or equivalent */ percent_used + percent_selected > 0.1 ? _("~%2.1f%%") : _("%2.1f%%"), percent_used + percent_selected); } else { /* no information about total disc size; assume that size of files on disc is also unknown; the only thing that we know is size of selected files; information about new files has been already printed */ } wattrset(subwindow, A_NORMAL | COLOR_PAIR(CDW_COLORS_MAIN)); wrefresh(subwindow); return; } /** \brief Delete selected files, do necessary updates This function checks if there are any files to delete from list of selected files, and calls selected_files_delete() to allow user to delete files from the list. If selected_files_delete() was called, existing list of graftpoints is deleted because it is outdated (new one should be created only when attempting to do sth using selected files). */ cdw_rv_t cdw_main_ui_delete_from_selected_files(void) { size_t num = cdw_file_manager_number_of_selected_files(); if (num > 0) { /* if cd files list not empty */ /* first set_menu_fore() is used to un-highlight main menu 'Delete' button when focus is in file selection area */ set_menu_fore(cdw_ui.main_menu.menu, COLOR_PAIR(CDW_COLORS_MENU)); wrefresh(cdw_ui.main_menu.subwindow); cdw_file_manager_handle_deleting_from_selected_files(); set_menu_fore(cdw_ui.main_menu.menu, COLOR_PAIR(CDW_COLORS_MENU) | A_REVERSE); wrefresh(cdw_ui.main_menu.subwindow); } else { /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("No files to delete"), /* 2TRANS: this is message in dialog window. User wants to deselect files from list, but there are no files at this time */ _("Nothing to delete - no files selected."), CDW_BUTTONS_OK, CDW_COLORS_DIALOG); } return CDW_OK; } cdw_rv_t cdw_main_ui_add_to_selected_files(void) { cdw_file_manager_handle_adding_to_selected_files(); return CDW_OK; } /** Create subwindow in which information about selected files is displayed. Display initial view in this subwindow. \return CDW_OK on success \return CDW_ERROR if some error occurred */ cdw_rv_t cdw_main_ui_volume_info_view_create(void) { cdw_assert (cdw_ui.window, "calling the function for null main window\n"); cdw_ui.volume_info_view.subwindow = derwin(cdw_ui.window, cdw_ui.volume_info_view.n_rows, cdw_ui.volume_info_view.n_cols, cdw_ui.volume_info_view.begin_y, cdw_ui.volume_info_view.begin_x); if (!cdw_ui.volume_info_view.subwindow) { cdw_vdm ("ERROR: failed to create subwindow with derwin() for selected files info view\n"); return CDW_ERROR; } cdw_window_add_strings(cdw_ui.volume_info_view.subwindow, /* 2TRANS: this is title of area showing basic info (total size, CD usage) about selected files */ _("ISO volume"), (char *) NULL); return CDW_OK; } /** \brief Show program license Try to display GPL-2 file from system-default location, if this fails then display basic license info in dialog box. */ void cdw_main_ui_show_license(void) { size_t len1 = strlen(COMMON); size_t len2 = strlen("/GPL-2"); char *fullpath = (char *) malloc(len1 + len2 + 1); bool success = false; if (fullpath) { /* try to display license from /usr/share/common-licenses/ */ snprintf(fullpath, len1 + len2 + 1, "%s/GPL-2", COMMON); if (!access(fullpath, R_OK)) { /* display license information from standard file provided by OS */ /* 2TRANS: this is title of dialog window showing cdw license */ cdw_rv_t crv = cdw_text_file_viewer_with_fullpath(fullpath, _("License")); if (crv == CDW_OK) { success = true; } } free(fullpath); fullpath = (char *) NULL; } if (!success) { /* this text turned out to be too long for passing it directly as function's argument */ /* 2TRANS: this is standard information about licensing program under GPL; it may be non-translatable in your area */ char *msg = strdup(_("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA")); if (msg) { /* 2TRANS: this is title of dialog window, in which basic information about licensing is displayed */ cdw_buttons_dialog(_("cdw license"), msg, CDW_BUTTONS_OK, CDW_COLORS_DIALOG); free(msg); msg = (char *) NULL; } else { /* 2TRANS: this is title of dialog window, in which basic information about licensing is displayed */ cdw_buttons_dialog(_("cdw license"), /* 2TRANS: this is short information about licensing program under GPL; it may be non-translatable in your area */ _("This program is distributed under terms of GNU General Public License either version 2, or (at your option) any later version. This program is distributed WITHOUT ANY WARRANTY."), CDW_BUTTONS_OK, CDW_COLORS_DIALOG); } } return; } cdw_rv_t cdw_main_ui_tooltips_view_create(void) { cdw_assert (cdw_ui.window, "calling the function for null main window\n"); cdw_ui.tooltips_view.subwindow = derwin(cdw_ui.window, cdw_ui.tooltips_view.n_rows, cdw_ui.tooltips_view.n_cols, cdw_ui.tooltips_view.begin_y, cdw_ui.tooltips_view.begin_x); if (!cdw_ui.tooltips_view.subwindow) { cdw_vdm ("ERROR: failed to create subwindow with derwin() for tooltip view\n"); return CDW_ERROR; } else { wbkgd(cdw_ui.tooltips_view.subwindow, A_NORMAL | COLOR_PAIR(CDW_COLORS_MAIN)); wattrset(cdw_ui.tooltips_view.subwindow, A_BOLD | COLOR_PAIR(CDW_COLORS_TOOLTIPS)); return CDW_OK; } } WINDOW *cdw_main_ui_get_tooltips_subwindow(void) { cdw_assert(cdw_ui.tooltips_view.subwindow, "called help tooltip before initializing cdw ui -> tooltips view\n"); return cdw_ui.tooltips_view.subwindow; } MENU *cdw_main_ui_get_main_menu(void) { cdw_assert(cdw_ui.main_menu.menu, "called help tooltip before initializing cdw ui -> menu\n"); return cdw_ui.main_menu.menu; } WINDOW *cdw_main_ui_get_main_window(void) { cdw_assert(cdw_ui.window, "called help tooltip before initializing cdw ui -> window\n"); return cdw_ui.window; } void cdw_main_ui_init_values(void) { cdw_ui.tooltips_view.subwindow = (WINDOW *) NULL; cdw_ui.disc_info_view.subwindow = (WINDOW *) NULL; cdw_ui.volume_info_view.subwindow = (WINDOW *) NULL; cdw_ui.files_list_view.subwindow = (WINDOW *) NULL; cdw_ui.main_menu.menu = (MENU *) NULL; cdw_ui.main_menu.items = (ITEM **) NULL; cdw_ui.main_menu.subwindow = (WINDOW *) NULL; cdw_ui.main_menu.menu_subwindow = (WINDOW *) NULL; cdw_ui.window = (WINDOW *) NULL; /* 'sizes' are layout constraints and parameters */ cdw_main_ui_recalculate_sizes(); return; } void cdw_main_ui_handle_follow_symlinks_change(bool old_state, bool current_state) { if (current_state != old_state) { /* user changed the way how symlinks should be treated, and this may affect size of selected files */ cdw_vdm ("INFO: changed \"follow symlinks\" to %s, recalculating files size\n", current_state ? "true" : "false"); cdw_main_window_volume_info_view_update(-1, -1, true, current_state); cdw_file_manager_regenerate_selected_files_view(); } else { cdw_vdm ("INFO: \"follow symlinks\" is still %s\n", current_state ? "true" : "false"); } return; } /* *** unused code *** */ #if 0 /** \brief Display CD usage summary on bottom of cdw window Display amount of space used by selected files, amount of space that would stay free on disk, and percent of CD disk usage. CD/DVD size is taken from config panel/file. I try to pack all information in just two lines, so that it is always visible and always updated when file selector is on top and files_info area is partially covered by file selector. The function does not collect nor calculate any data (except for some local variables), it just uses current values from some global variables. */ void cdw_main_ui_volume_info_view_display_data(size_t n_files, double size_mb) { cdw_assert (cdw_ui.volume_info_view.subwindow != (WINDOW *) NULL, "called the function for null subwindow\n"); WINDOW *subwindow = cdw_ui.volume_info_view.subwindow; wattrset(subwindow, A_BOLD | COLOR_PAIR(CDW_COLORS_MAIN)); int s_row = 3; /* "Size: " row */ int b_row = 4; /* usage bar row */ const int col = 2; /* start column for content drawn in window */ const int bar_width = 30; /* number of cells in bar, does not include borders */ /* clean row in which usage bar and information about space usage is displayed */ mvwhline(subwindow, s_row, 1, ' ', cdw_ui.volume_info_view.n_cols - 2); mvwhline(subwindow, b_row, 1, ' ', cdw_ui.volume_info_view.n_cols - 2); /* left and right border of usage bar */ mvwaddch(subwindow, b_row, col, '['); mvwaddch(subwindow, b_row, col + bar_width + 1, ']'); bool too_much = false; if (size_mb > (double) global_config.volume_size_value) { too_much = true; wattrset(subwindow, COLOR_PAIR(CDW_COLORS_ERROR)); } else { /* 0.8 (80%): arbitrary value of 'safe' level of disc usage */ if (size_mb <= ((double) global_config.volume_size_value * 0.8)) { wattrset(subwindow, COLOR_PAIR(CDW_COLORS_MAIN)); } else { wattrset(subwindow, COLOR_PAIR(CDW_COLORS_WARNING)); } } double percent = size_mb * 100 / ((double) global_config.volume_size_value); int n = 0; if (too_much) { /* files size is larger than available space */ /* 2TRANS: this string displays total size of dirs/files selected ('%.1f'), total available space ('%d') and number of items selected (second '%d'). */ mvwprintw(subwindow, s_row, col, _("%.1f/%ld MB in %d items"), size_mb, global_config.volume_size_value, n_files); n = bar_width; } else { /* 2TRANS: this string displays total size of dirs/files selected ('%.1f'), total available space ('%d'), number of items selected (second '%d'), and free space left ('%.0f'). */ mvwprintw(subwindow, s_row, col, _("%.1f/%ld MB in %d items, %.0f MB free"), size_mb, global_config.volume_size_value, n_files, (double) global_config.volume_size_value - size_mb); n = (int) ((percent * (double) bar_width) / 100); } mvwhline(subwindow, b_row, col + 1, ACS_BLOCK, n); /* +1 to skip left brace [ */ mvwprintw(subwindow, b_row, col + bar_width + 3, /* 3 to move past indicator bar */ /* 2TRANS: this is information about usage of CD space: '%2.1f%%' is information about used space, displayed as percentage of total disc size */ _("%2.1f%%"), percent); wattrset(subwindow, A_NORMAL | COLOR_PAIR(CDW_COLORS_MAIN)); wrefresh(subwindow); return; } #endif cdw-0.7.1/src/user_interface/cdw_processwin.c0000644000175000017500000005604511733644142016216 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include /* floor() */ #include #include "cdw_main_window.h" #include "gettext.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "cdw_processwin.h" #include "cdw_debug.h" /* *** some processwin layout constants *** */ /* first goes primary information line, telling user what happens now */ #define SUBWINDOW_TXT1_ROW 2 /* then some additional text info (e.g. "press any key" or "fixating") */ #define SUBWINDOW_TXT2_ROW 4 #define PROCESSWIN_PERMANENT_INFO_TEXT_ROW 6 /* some data that might be most important to the user */ #define PROCESSWIN_ETA_ROW 7 #define PROCESSWIN_AMOUNT_ROW 8 /* some visualization - less important than numeric data presented above, because user can get data presented on progress bar from percentage information - both are calculated using the same data, but progress bar is less accurate; "CENTRAL_ROW" means that there is subwindow border around this one-line progress bar*/ #define PROCESSWIN_PROGRESSBAR_CENTRAL_ROW 10 /* boring stuff at the bottom - common user might not care */ #define PROCESSWIN_FIFO_ROW 12 /* this string is used to erase parts of processwin - it has to be * filled with spaces (and ended with \0') first */ #define EMPTY_STRING_LEN PROCESSWIN_COLS - 2 - 1 static char processwin_empty_string[EMPTY_STRING_LEN + 1]; /* This variable keeps track of changes of percentage of task done. Progressbar and percentage value is updated only when the percentage changes, avoiding useless refreshes. It must be set to zero every time new processwin is created. Perhaps 'float' type is too fine-grained and processwin is updated too often. Or perhaps it is not so. */ static float static_percent; static void cdw_processwin_display_text_info(int row, const char *string); static struct { /* has the window been created and displayed? can other modules print to the window? */ bool active; WINDOW *window; /* area where progress bar is displayed; may be used only by some instances of processwin */ WINDOW *progressbar_sub; WINDOW *subwindow_txt1; WINDOW *subwindow_txt2; int n_cols; int n_rows; int begin_y; int begin_x; int subwindow_txt1_row; int subwindow_txt2_row; } processwin; /** * \brief Create UI window in which progress of some process (perhaps created by fork()) is shown * * Create UI window to show progress of process, make some initialization, too. * Put \p window_title string in title area of window. * Put \p window_label in first row of window (below title). * * \param window_title - title of processwin window * \param window_label - initial information displayed in window * \param show_progress - should progress bar be displayed? * * \return CDW_OK on success * \return CDW_GEN_ERROR if function failed to create progress window */ cdw_rv_t cdw_processwin_create(const char *window_title, const char *window_label, bool show_progress) { if (processwin.active) { cdw_vdm ("ERROR: called the function for active process window\n"); return CDW_ERROR; } memset(processwin_empty_string, ' ', EMPTY_STRING_LEN + 1); processwin_empty_string[EMPTY_STRING_LEN] = '\0'; static_percent = 0.0; processwin.n_cols = PROCESSWIN_COLS; processwin.n_rows = PROCESSWIN_ROWS; processwin.begin_y = (LINES - processwin.n_rows) / 2; processwin.begin_x = (COLS - processwin.n_cols) / 2; processwin.subwindow_txt1_row = SUBWINDOW_TXT1_ROW; processwin.subwindow_txt2_row = SUBWINDOW_TXT2_ROW; processwin.window = newwin(processwin.n_rows, processwin.n_cols, processwin.begin_y, processwin.begin_x); if (processwin.window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create process window with newwin()\n"); return CDW_ERROR; } keypad(processwin.window, TRUE); wbkgd(processwin.window, COLOR_PAIR(CDW_COLORS_DIALOG)); werase(processwin.window); wtimeout(processwin.window, -1); processwin.subwindow_txt1 = derwin(processwin.window, 2, processwin.n_cols - 2, processwin.subwindow_txt1_row, 1); if (processwin.subwindow_txt1 == (WINDOW *) NULL) { delwin(processwin.window); processwin.window = (WINDOW *) NULL; cdw_vdm ("ERROR: failed to create subwindow_txt1 with derwin()\n"); return CDW_ERROR; } processwin.subwindow_txt2 = derwin(processwin.window, 2, processwin.n_cols - 2, processwin.subwindow_txt2_row, 1); if (processwin.subwindow_txt2 == (WINDOW *) NULL) { delwin(processwin.subwindow_txt1); processwin.subwindow_txt1 = (WINDOW *) NULL; delwin(processwin.window); processwin.window = (WINDOW *) NULL; cdw_vdm ("ERROR: failed to create subwindow_txt2 with derwin()\n"); return CDW_ERROR; } cdw_window_add_strings(processwin.window, window_title, (char *) NULL); if (show_progress) { cdw_processwin_add_progress_bar(); } processwin.active = true; /* display only primary label, secondary is empty */ cdw_processwin_display_main_info(window_label); cdw_processwin_display_sub_info((char *) NULL); cdw_processwin_wrefresh(); return CDW_OK; } /** * \brief Destroy UI window created by processwin_create() * * This is just wrapper for simple destroying of curses window * Set second argument as true if you want to wait for user key * before destroying the window - user will have time and opportunity * to read \p status_string. The string will be displayed * as primary information string in processwin. Secondary information * string will be sth like "press any key". If \p is false, then * \p status_string won't be displayed, and window will be destroyed * without waiting for any user action. * * \param status_string - text displayed in process window * \param wait - decides if the window should wait for a key from * user before closing. */ void cdw_processwin_destroy(const char *status_string, bool wait) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } if (wait) { cdw_processwin_display_main_info(status_string); /* 2TRANS: message displayed in progress window: user must press any key to close the window after task is completed */ cdw_processwin_display_sub_info(_("Press any key")); cdw_processwin_wrefresh(); cdw_processwin_wgetch(); } if (processwin.progressbar_sub) { cdw_processwin_delete_progress_bar(); } delwin(processwin.subwindow_txt1); processwin.subwindow_txt1 = (WINDOW *) NULL; delwin(processwin.subwindow_txt2); processwin.subwindow_txt1 = (WINDOW *) NULL; delwin(processwin.window); processwin.window = (WINDOW *) NULL; processwin.active = false; cdw_main_ui_main_window_wrefresh_part(processwin.n_rows, processwin.n_cols, processwin.begin_y, processwin.begin_x); return; } bool cdw_processwin_is_active(void) { return processwin.active; } void cdw_processwin_add_progress_bar(void) { /* build progress bar */ /* 27 = 25 + 2: 2 chars for borders and 25 chars for progress bar (4% per char) */ int n_cols = 27; int n_rows = 3; /* upper border + progress bar strip + lower border */ int begin_y = PROCESSWIN_PROGRESSBAR_CENTRAL_ROW - 1; int begin_x = (processwin.n_cols - n_cols) / 2; processwin.progressbar_sub = derwin(processwin.window, n_rows, n_cols, begin_y, begin_x); box(processwin.progressbar_sub, 0, 0); /* this puts "0% done" so that user knows that some process will start in few seconds - it looks better than no information at all */ cdw_processwin_display_progress(0, 100, ""); cdw_processwin_wrefresh(); return; } void cdw_processwin_delete_progress_bar(void) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } if (processwin.progressbar_sub == (WINDOW *) NULL) { cdw_vdm ("ERROR: called the function for process window without progress bar\n"); return; } /* on some occasions cdw_processwin_delete_progress_bar() is called not because we want to destroy whole process window, but only because we want to erase its part showing progress; therefore we need to erase "amount" information, progress bar and ETA string; in case of progress bar window simple delete and refresh won't be enough */ mvwprintw(processwin.window, PROCESSWIN_AMOUNT_ROW, 1, "%s", processwin_empty_string); mvwprintw(processwin.window, PROCESSWIN_ETA_ROW, 1, "%s", processwin_empty_string); werase(processwin.progressbar_sub); delwin(processwin.progressbar_sub); processwin.progressbar_sub = (WINDOW *) NULL; return; } /** * \brief Display ETA string in progress window * * The function itself doesn't know anything about calculation of ETA, it just * knows if and where to display it. You can erase place where usually * ETA string is displayed by providing null string ((char *) NULL) as an argument. * * \param eta_string - string containing ETA information */ void cdw_processwin_display_eta(const char *eta_string) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } cdw_processwin_erase_eta(); if (! eta_string || (!strcmp(eta_string, ""))) { ; } else { int col = (processwin.n_cols / 2) - ((int) strlen(eta_string) / 2); mvwprintw(processwin.window, PROCESSWIN_ETA_ROW, col, "%s", eta_string); } wrefresh(processwin.window); return; } void cdw_processwin_erase_eta(void) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); } else { mvwprintw(processwin.window, PROCESSWIN_ETA_ROW, 1, "%s", processwin_empty_string); } return; } /** * \brief Draw progress bar strip in processwin * * Draw progress bar strip (not the borders, those should be created * when processwin itself is created) of length=value. Maximal value of * variable 'value' should be normalized by caller to width of processwin. * * \param value - current length of progress bar to draw * \param color1 - color name used for drawing a progress bar * \param color2 - name of normal color of process window * \param c - character to be used to draw bar */ void cdw_processwin_draw_progress_bar(int value, cdw_colors_t color1, cdw_colors_t color2, chtype c) { cdw_assert (processwin.progressbar_sub != (WINDOW *) NULL, "ERROR: called %s() for processwin without progressbar\n", __func__); const int start_col = 1; (void) wattrset(processwin.progressbar_sub, COLOR_PAIR(color1)); for (int i = 0; i <= value; i++) { mvwaddch(processwin.progressbar_sub, 1, start_col + i, c); } (void) wattrset(processwin.progressbar_sub, COLOR_PAIR(color2)); wrefresh(processwin.progressbar_sub); return; } /** * Show (in processwin window) information about progress of process. Do this only if necessary. * * Check if value describing current status (in terms of percentage of task * done) has changed. If yes, then update processwin with new information * (which requires call of ncurses wrefresh()). If not then do nothing. * * \param current - current status of task - this is value of arbitrary unit, * reflecting current amount of work done * \param total - total size of task - this is value of arbitrary unit (but * the same as of 'current'), reflecting maximal amount of * work that has to be done * \param description - string containing data or information * prepared by caller (can be NULL or empty) */ void cdw_processwin_display_progress_conditional(long current, long total, const char *description) { /* assertion may fail if caller botched calculations of current or total, causing overflows */ cdw_assert (current >= 0 && total >= 0, "ERROR: value of \"current\" or \"total\" is negative: %ld / %ld\n", current, total); /* new_static_percent reflects current amount of work done at given specific call to this function */ float new_static_percent = 0.0; if (total != 0) { /* FIXME: don't allow passing total == 0, improve interface of the function */ new_static_percent = (float) current / (float) total; } /* static_percent reflects amount of work done at previous call to this function */ if (new_static_percent - static_percent > 0.0001) { /* if they differ then information in processwin should be updated */ static_percent = new_static_percent; cdw_processwin_display_progress(current, total, description); } return; } /** * \brief Show (in processwin window) information about progress of process. * * Show to user updated information about progress of current process. This * can be done in two ways: by displaying text line prepared by caller or by * showing percentage information. * * Third argument can have any character, even descriptive, but since this * function is called cdw_processwin_display_progress(), it would be nice if * this argument hold some sort of numerical information, perhaps with units * of measure. * * First and second argument should be provided without any preprocessing, * because they will be recalculated to percents like this: * percentage_info = (current_amount * 100) / total_amount. * * Percentage information is shown both in form of "x% done" text and in form * of progress bar. * * All information is displayed in one line, in following format: * "xx% done (current_value_string)". Both parts ('xx%done' and * 'current_value_string') can be omitted (set to 0 or (char *) NULL). * * \p description should be no longer than (PROCESSWIN_COLS - 2) chars, * including ending '\0'. It should be even shorter to make place for * numeric data displayed in the same line as \p description. * * \param current_amount - value representing current state (stage) of process * \param total_amount - value representing final, expected state (stage) of process * \param description - string containing details on data or other information */ void cdw_processwin_display_progress(long current_amount, long total_amount, const char *description) { bool has_descr = false; /* is description string non-empty? */ char progress_string[PROCESSWIN_MAX_RTEXT_LEN + 1]; /* first check for NULLness, so strlen arg will be safe */ if (description && (strlen(description)) ) { has_descr = true; } memset(progress_string, ' ', PROCESSWIN_MAX_RTEXT_LEN + 1); progress_string[PROCESSWIN_MAX_RTEXT_LEN] = '\0'; mvwprintw(processwin.window, PROCESSWIN_AMOUNT_ROW, 1, "%s", progress_string); if (total_amount) { /* we are able to calculate percentage and display progress bar */ int percent_done = (int) ((current_amount * 100) / total_amount); if (has_descr) { snprintf(progress_string, PROCESSWIN_MAX_RTEXT_LEN + 1, /* 2TRANS: status message displayed in progress window: %d%% is percent amount of task finished, %s is previously prepared string displaying some additional information about %d, e.g. units */ _("%d%% done (%s)"), percent_done, description); } else { snprintf(progress_string, PROCESSWIN_MAX_RTEXT_LEN + 1, /* 2TRANS: status message displayed in progress window: %d%% is percent amount of task finished */ _("%d%% done"), percent_done); } cdw_processwin_draw_progress_bar((percent_done / 4) - 1, CDW_COLORS_DIALOG, CDW_COLORS_DIALOG, ACS_BLOCK); } else { /* total_amount == 0, so there is no way we can show percentage information */ if (has_descr) { strncpy(progress_string, description, PROCESSWIN_MAX_RTEXT_LEN); progress_string[PROCESSWIN_MAX_RTEXT_LEN] = '\0'; } else { progress_string[0] = '\0'; } } int col = (processwin.n_cols / 2) - ((int) strlen(progress_string) / 2); mvwprintw(processwin.window, PROCESSWIN_AMOUNT_ROW, col, "%s", progress_string); wrefresh(processwin.window); return; } void cdw_processwin_display_main_info(const char *string) { cdw_processwin_display_text_info(1, string); return; } void cdw_processwin_display_sub_info(const char *string) { cdw_processwin_display_text_info(2, string); return; } /** * \brief Show (in processwin window) text information about status of process * * Display string with information, or erase (blank) it. The string is * displayed in first or second topmost row, depending on value of * first argument. Accepted values of \p row are 1 or 2. * * Set second argument to (char *) NULL if you want to erase it, or set * it to pointer to a valid string if you want to display the string. * * \param row - index of row that you want to update * \param string - string displayed in processwin */ void cdw_processwin_display_text_info(int row, const char *string) { cdw_assert (row == 1 || row == 2, "ERROR: incorrect id of row to print in (%d), should be 1 or 2\n", row); if (!processwin.active) { /* warning, not error/assert; on some rare occasions calling this function for null window may be ok */ cdw_vdm ("WARNING: called the function for inactive process window\n"); return; } WINDOW *window = (WINDOW *) NULL; if (row == 1) { window = processwin.subwindow_txt1; } else { window = processwin.subwindow_txt2; } cdw_assert (window != (WINDOW *) NULL, "ERROR: attempting to print to NULL window\n"); werase(window); if (string != (char *) NULL && (strcmp(string, ""))) { cdw_window_print_message(window, string, CDW_ALIGN_CENTER); } else { /* user may pass null pointer or empty string ("") to show that given text area should be erased */ } wrefresh(window); return; } /** * \brief Display fifo buffer information * * This function displays test string in form of "Fifo: %d%%" in * process window. It is useful when writing data to a disc. * If fifo value is lower than 25, the text background is highlighted. * * \param fifo_level - FIFO buffer usage value (0 - 100) */ void cdw_processwin_display_fifo_and_speed(int fifo_level, int speed_decimal, int speed_fract) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } mvwprintw(processwin.window, PROCESSWIN_FIFO_ROW, 1, "%s", processwin_empty_string); if (fifo_level >= 0) { /* display fifo */ char fifo_string[PROCESSWIN_MAX_RTEXT_LEN + 1]; /* FIXME: digits disappear when fifo_level == 0; probably a problem with format string */ /* 2TRANS: this is message displayed in progress window, describing FIFO buffer usage (in percents) during some resources-consuming tasks */ snprintf(fifo_string, PROCESSWIN_MAX_RTEXT_LEN + 1, _("FIFO: %3.d%%"), fifo_level); /* http://howto-pages.org/cdwriting/07.php "If the level keeps dropping below half full then either the FIFO is too small or you're trying to write too fast." */ if (fifo_level <= 25) { wattrset(processwin.window, COLOR_PAIR(CDW_COLORS_ERROR)); } else if (fifo_level <= 50) { wattrset(processwin.window, COLOR_PAIR(CDW_COLORS_WARNING)); } else { ; } int col = 0; if (speed_decimal < 0) { /* speed information won't be displayed, there is more room for FIFO string */ col = (processwin.n_cols / 2) - ((int) strlen(fifo_string) / 2); } else { /* FIFO string should be moved to left side of process window */ col = (processwin.n_cols / 4) - ((int) strlen(fifo_string) / 2); } mvwprintw(processwin.window, PROCESSWIN_FIFO_ROW, col, "%s", fifo_string); wattrset(processwin.window, COLOR_PAIR(CDW_COLORS_DIALOG)); } if (speed_decimal >= 0) { /* display speed (in the same line as FIFO) */ char speed_string[PROCESSWIN_MAX_RTEXT_LEN + 1]; /* 2TRANS: this is message displayed in process progress window; "Speed" is writing speed, %d and %d are decimal and fractional parts of writing speed, e.g. "Speed: 2.5x" */ sprintf(speed_string, _("Speed: %2d.%dx"), speed_decimal, speed_fract); cdw_vdm ("INFO: speed: decimal = %d, fract = %d -> string = \"%s\"\n", speed_decimal, speed_fract, speed_string); int col = 0; if (fifo_level < 0) { /* FIFO information won't be displayed, there is more room for speed string */ col = (processwin.n_cols / 2) - ((int) strlen(speed_string) / 2); } else { /* speed string should be moved to right side of process window */ col = (3 * processwin.n_cols / 4) - ((int) strlen(speed_string) / 2); } mvwprintw(processwin.window, PROCESSWIN_FIFO_ROW, col, "%s", speed_string); } wrefresh(processwin.window); return; } void cdw_processwin_erase_fifo_and_speed(void) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } mvwprintw(processwin.window, PROCESSWIN_FIFO_ROW, 1, "%s", processwin_empty_string); return; } void cdw_processwin_wrefresh(void) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); } else { redrawwin(processwin.window); wrefresh(processwin.window); } return; } void cdw_processwin_wgetch(void) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } /* sometimes the process window closes without proper user key, I still don't know why; I think that there is an error with wgetch() checking if read is blocking or not (or if there is a delay or not); I'm using loop + usleep() to simulate blocking read */ int rv = wgetch(processwin.window); while (rv == ERR) { usleep(100000); rv = wgetch(processwin.window); } return; } /** * \brief Very simple wrapper for functions refreshing processwin window * * First the window is touchwin()ed and then it is wrefresh()ed. */ void cdw_processwin_force_refresh(void) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } touchwin(processwin.window); wrefresh(processwin.window); return; } /** * \brief Reset any information about progress accumulated so far in progress window */ void cdw_processwin_reset_progress(void) { if (!processwin.active) { cdw_vdm ("ERROR: called the function for inactive process window\n"); return; } cdw_assert (processwin.progressbar_sub, "ERROR: calling %s() for processwin without progressbar\n", __func__); static_percent = 0.0; char progress_string[PROCESSWIN_MAX_RTEXT_LEN + 1]; memset(progress_string, ' ', PROCESSWIN_MAX_RTEXT_LEN + 1); progress_string[PROCESSWIN_MAX_RTEXT_LEN] = '\0'; mvwprintw(processwin.window, PROCESSWIN_AMOUNT_ROW, 1, "%s", progress_string); int ncols = getmaxx(processwin.progressbar_sub); for (int i = 1; i < ncols - 1; i++) { mvwprintw(processwin.progressbar_sub, 1, i, " "); } wrefresh(processwin.progressbar_sub); wrefresh(processwin.window); return; } cdw-0.7.1/src/user_interface/cdw_colors.c0000644000175000017500000005054611734412122015313 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _BSD_SOURCE /* PATH_MAX */ #include #include #include // #include /* PATH_MAX */ #include "cdw_ncurses.h" #include "cdw_config.h" #include "cdw_colors.h" #include "cdw_string.h" #include "cdw_fs.h" #include "cdw_debug.h" #include "cdw_utils.h" /** \file cdw_colors.c This file implements: \li reading color scheme (pairs of color attributes for fore- and background color) from cdw colors configuration file \li passing those pairs to ncurses function init_pair() to initialize 'curses pair' (pair in strict, ncurses-related sense, see 'man init_pair' for reference) \li a mechanism of referring to these 'curses pairs' by symbolic names in form of CDW_COLORS_MAIN or CDW_COLORS_MENU etc. Conventions used in this file: \li 'color attribute' is variable with name of form CONF_COLOR_MAIN_FORE or CONF_COLOR_DIALOG_BACK - an int value describing color of foreground or background of some class of UI elements (1 is class of elements used in main window, 2 is class of elements used to build dialog windows, see list below) \li 'pair' is used to call two color attributes describing fore- and background of the same class of UI elements. Values of pair of the attributes are used as 2nd and 3rd arguments to init_pair() function call. First argument of this function call is a 'ncurses pair' - pair in strict sense. Such pairs are referred to in code in other files by symbolic names such as CDW_COLORS_WARNING \li 'line' is one line read from cdw color configuration file CDW uses following pairs of foreground-background colors (values of type cdw_colors_t): 1 -> CDW_COLORS_MAIN - main window 2 -> CDW_COLORS_DIALOG - dialog windows of various kinds 3 -> CDW_COLORS_TITLE - application title in main window 4 -> CDW_COLORS_MENU - menus (including main application menu) 5 -> CDW_COLORS_PROGRESS - progress bar 6 -> CDW_COLORS_INPUT - input fields 7 -> CDW_COLORS_WARNING - warning, may be used in dialogs 8 -> CDW_COLORS_SIZE_INFO - (unused, kept for compatibility) 9 -> CDW_COLORS_DISABLED - disabled items 10 -> CDW_COLORS_UNUSED - unused 11 -> CDW_COLORS_TOOLTIPS - tooltips at the bottom of main window 12 -> CDW_COLORS_TEXTAREA - text areas, like window displaying license 13 -> CDW_COLORS_ERROR - error - may be used in dialogs These values should be used when passing color argument to cdw widgets, e.g. cdw_dialogbox("Message", "This is how you should use values of type cdw_colors_t", DIALOG_OK, CDW_COLORS_DIALOG); When setting colors of bare ncurses widgets you should use COLORS_PAIR() macro, like this: wbkgd(my_window, COLORS_PAIR(CDW_COLORS_DIALOG)); */ enum { CONF_EMPTY = -3, /* empty line */ CONF_INVALID = -2, /* invalid entry */ CONF_COMMENT = -1, /* comment, line starting with '#' */ CONF_COLOR_MAIN_FORE = 0, CONF_COLOR_MAIN_BG, CONF_COLOR_DIALOG_FORE, CONF_COLOR_DIALOG_BG, CONF_COLOR_TITLE_FORE, CONF_COLOR_TITLE_BG, CONF_COLOR_MENU_FORE, CONF_COLOR_MENU_BG, CONF_COLOR_PROGRESS_FORE, CONF_COLOR_PROGRESS_BG, CONF_COLOR_INPUT_FORE, CONF_COLOR_INPUT_BG, CONF_COLOR_WARNING_FORE, CONF_COLOR_WARNING_BG, CONF_COLOR_SIZE_INFO_FORE, CONF_COLOR_SIZE_INFO_BG, CONF_COLOR_DISABLED_FORE, CONF_COLOR_DISABLED_BG, CONF_COLOR_UNUSED_FORE, CONF_COLOR_UNUSED_BG, CONF_COLOR_TOOLTIPS_FORE, CONF_COLOR_TOOLTIPS_BG, CONF_COLOR_TEXTAREA_FORE, CONF_COLOR_TEXTAREA_BG, CONF_COLOR_ERROR_FORE, CONF_COLOR_ERROR_BG }; enum { CDW_COLOR_MAIN = 0, CDW_COLOR_DIALOG, CDW_COLOR_TITLE, CDW_COLOR_MENU, CDW_COLOR_PROGRESS, CDW_COLOR_INPUT, CDW_COLOR_WARNING, CDW_COLOR_SIZE_INFO, CDW_COLOR_DISABLED, CDW_COLOR_UNUSED, CDW_COLOR_TOOLTIPS, CDW_COLOR_TEXTAREA, CDW_COLOR_ERROR, CDW_COLOR_INIT, /* initialization value */ CDW_COLOR_EMPTY, /* empty line */ CDW_COLOR_INVALID, /* invalid entry */ CDW_COLOR_COMMENT, /* comment, line starting with '#' */ CDW_COLOR_FINAL, /* guard */ }; //#define CDW_COLORS_NEW #ifdef CDW_COLORS_NEW cdw_id_clabel_t cdw_color_schemes[] = { { CDW_COLOR_MAIN, "MAIN" }, { CDW_COLOR_DIALOG, "DIALOG" }, { CDW_COLOR_TITLE, "TITLE" }, { CDW_COLOR_MENU, "MENU" }, { CDW_COLOR_PROGRESS, "PROGRESS" }, { CDW_COLOR_INPUT, "INPUT" }, { CDW_COLOR_WARNING, "WARNING" }, { CDW_COLOR_SIZE_INFO, "SIZE_INFO" }, { CDW_COLOR_DISABLED, "DISABLED" }, { CDW_COLOR_UNUSED, "UNUSED" }, { CDW_COLOR_TOOLTIPS, "TOOLTIPS" }, { CDW_COLOR_TEXTAREA, "TEXTAREA" }, { CDW_COLOR_ERROR, "ERROR" }, { CDW_COLOR_INIT, "INIT" }, /* initialization value */ { CDW_COLOR_EMPTY, "EMPTY" }, /* empty line */ { CDW_COLOR_INVALID, "INVALID" }, /* invalid entry */ { CDW_COLOR_COMMENT, "COMMENT" }, /* comment, line starting with '#' */ { CDW_COLOR_FINAL, "FINAL" }, { -1, (char *) NULL } }; cdw_id_clabel_t cdw_color_names[] = { { COLOR_BLACK, "BLACK" }, { COLOR_RED, "RED" }, { COLOR_GREEN, "GREEN" }, { COLOR_YELLOW, "YELLOW" }, { COLOR_BLUE, "BLUE" }, { COLOR_MAGENTA, "MAGENTA" }, { COLOR_CYAN, "CYAN" }, { COLOR_WHITE, "WHITE" }, { COLOR_BLACK | A_BOLD, "BOLD_BLACK" }, { COLOR_RED | A_BOLD, "BOLD_RED" }, { COLOR_GREEN | A_BOLD, "BOLD_GREEN" }, { COLOR_YELLOW | A_BOLD, "BOLD_YELLOW" }, { COLOR_BLUE | A_BOLD, "BOLD_BLUE" }, { COLOR_MAGENTA | A_BOLD, "BOLD_MAGENTA" }, { COLOR_CYAN | A_BOLD, "BOLD_CYAN" }, { COLOR_WHITE | A_BOLD, "BOLD_WHITE" }, { -1, (char *) NULL } }; #endif struct { cdw_id_t fore; cdw_id_t back; } cdw_colors_table[CDW_COLOR_FINAL]; #define CDW_COLORS_BUFFER_SIZE 999 #ifdef CDW_COLORS_NEW static int cdw_colors_new_get_and_init_color(const char *line, cdw_id_t scheme); #endif static short int cdw_colors_get_attribute_name(char *line); static int cdw_colors_get_attribute_value(const char *source); static void cdw_colors_read_config_file(FILE *file); static void cdw_colors_read_and_init_color(const char *line, int i); static const char *config_file_name = "cdw.colors"; /** \brief Set up defaut (hardwired) color schemes \date Function's top-level comment reviewed on 2012-02-05 \date Function's body reviewed on 2012-02-05 Use this function right after setting up basic curses to provide colors for some widgets. It is required to have some colors defined when fs module is not set up yet, because you might have to display dialog or input widgets when configuring file system module. */ void cdw_colors_init_phase1(void) { for (int i = 0; i < CDW_COLOR_FINAL; i++) { cdw_colors_table[i].fore = CDW_COLOR_INIT; cdw_colors_table[i].back = CDW_COLOR_INIT; } /* first set default values: foreground - background */ init_pair(CDW_COLORS_MAIN, COLOR_WHITE, COLOR_BLACK); init_pair(CDW_COLORS_DIALOG, COLOR_WHITE, COLOR_BLUE); init_pair(CDW_COLORS_TITLE, COLOR_RED, COLOR_BLACK); init_pair(CDW_COLORS_MENU, COLOR_WHITE, COLOR_BLACK); init_pair(CDW_COLORS_PROGRESS, COLOR_YELLOW, COLOR_BLACK); init_pair(CDW_COLORS_INPUT, COLOR_WHITE, COLOR_BLACK); init_pair(CDW_COLORS_WARNING, COLOR_BLUE, COLOR_YELLOW); init_pair(CDW_COLORS_SIZE_INFO, COLOR_WHITE, COLOR_YELLOW); init_pair(CDW_COLORS_DISABLED, COLOR_BLACK, COLOR_WHITE); init_pair(CDW_COLORS_UNUSED, COLOR_WHITE, COLOR_RED); init_pair(CDW_COLORS_TOOLTIPS, COLOR_YELLOW, COLOR_BLACK); init_pair(CDW_COLORS_TEXTAREA, COLOR_WHITE, COLOR_BLACK); /* FIXME: black letters on red background aren't too readable, fix this by using other color scheme for error dialogs */ init_pair(CDW_COLORS_ERROR, COLOR_BLACK, COLOR_RED); return; } /** \brief Read custom colors from config file, use them to set up color schemes \date Function's top-level comment reviewed on 2012-01-12 \date Function's body reviewed on 2012-01-12 Call this function when file system module is set up. \return CDW_ERROR on errors \return CDW_OK on success */ cdw_rv_t cdw_colors_init_phase2(void) { const char *dir = cdw_config_get_config_dir(); if (!dir) { cdw_vdm ("ERROR: can't get config dir\n"); return CDW_ERROR; } char *path = cdw_string_concat(dir, config_file_name, (char *) NULL); if (!path) { cdw_vdm ("ERROR: concatenation failed\n"); return CDW_ERROR; } size_t len = strlen(path); /* PATH_MAX includes ending null */ if (len > PATH_MAX - 1) { free(path); path = (char *) NULL; return CDW_ERROR; } FILE *f = fopen(path, "r"); if (!f) { cdw_vdm ("WARNING: can't open color file \"%s\"\n", path); free(path); path = (char *) NULL; return CDW_ERROR; } else { cdw_colors_read_config_file(f); fclose(f); free(path); path = (char *) NULL; cdw_vdm ("INFO: color file read properly\n"); return CDW_OK; } } /** \brief Read cdw colors configuration file, redefine default colors \date Function's top-level comment reviewed on 2012-02-05 \date Function's body reviewed on 2012-02-05 Read configuration file with definitions of color schemes. If a color is defined in the config file, redefine the default color definition (using init_pair() calls) for this ncurses application. \param file - color configuration file, it has to be already open */ void cdw_colors_read_config_file(FILE *file) { cdw_assert (file, "ERROR: you forgot to open file\n"); /* this function is called when there is some color config file, let's change default values */ char buffer[CDW_COLORS_BUFFER_SIZE]; int old_style = 0; //int new_style = 0; while (fgets(buffer, CDW_COLORS_BUFFER_SIZE, file)) { buffer[CDW_COLORS_BUFFER_SIZE - 1] = '\0'; char *line = cdw_string_ltrim(buffer); int i = 0; switch (i = cdw_colors_get_attribute_name(line)) { case CONF_COMMENT: case CONF_EMPTY: break; case CONF_INVALID: cdw_vdm ("ERROR: invalid line in colors config file:\n"); cdw_vdm ("ERROR: \"%s\n", line); break; default: old_style++; i /= 2; cdw_colors_read_and_init_color(line, i); break; } #ifdef CDW_COLORS_NEW cdw_option_t option; if (cdw_config_split_options_line_new(&option, line)) { cdw_id_t scheme = cdw_utils_id_label_table_get_id(cdw_color_schemes, option.name, CDW_COLOR_INVALID); switch (scheme) { case CDW_COLOR_COMMENT: case CDW_COLOR_EMPTY: break; case CDW_COLOR_INVALID: cdw_vdm ("ERROR: invalid line in colors config file: \"%s\n", line); break; default: new_style++; cdw_colors_new_get_and_init_color(option.value, scheme); break; } } else { cdw_vdm ("WARNING: failed to get option's name and value from line \"%s\"\n", line); } cdw_config_option_free_new(&option); #endif } #ifdef CDW_COLORS_NEW for (int i = 0; i <= CDW_COLOR_ERROR; i++) { cdw_vdm ("INFO: scheme = \"%10s\", fore = \"%10s\", back = \"%8s\", %lld, %lld\n", cdw_utils_id_label_table_get_label(cdw_color_schemes, i), cdw_utils_id_label_table_get_label(cdw_color_names, cdw_colors_table[i].fore), cdw_utils_id_label_table_get_label(cdw_color_names, cdw_colors_table[i].back), cdw_colors_table[i].fore, cdw_colors_table[i].back); } #endif return; } /** \brief Recognize color definition values and save them \date Function's top-level comment reviewed on 2012-02-05 \date Function's body reviewed on 2012-02-05 Function recognizes definition of color \i stored in \p line, saves it in temporary variable, and uses it to redefine color \p i \param line - line from color config file \param i - color index */ void cdw_colors_read_and_init_color(const char *line, int i) { static int fb = 0; /* indicates which value was read in: fore- or background; even values are for fore */ static int fore = CONF_INVALID; /* foreground color read from file */ static int back = CONF_INVALID; /* background color read from file */ /* code in 'default' branch checks if both foreground and background colors were read in properly, and if so, then places them in color attributes table; if one or both of values are invalid, they are discarded, and default values are used (are not overwritten) */ if (fb % 2 == 0) { /* this is line with foreground */ fore = cdw_colors_get_attribute_value(line); cdw_vdm ("INFO: fb = %d, fore = %d, line = '%s'\n", fb, fore, line); fb++; cdw_colors_table[i].fore = fore; } else { /* this is line with background */ back = cdw_colors_get_attribute_value(line); cdw_vdm ("INFO: fb = %d, back = %d, line = '%s'\n", fb, back, line); fb++; cdw_colors_table[i].back = back; } if (fb % 2 == 0) { /* fb is even -> fore and back possibly store parameters of a new color definition -> use them to redefine color i */ if (fore != CONF_INVALID && back != CONF_INVALID) { /* init_pair(short pair, short fore, short back) */ init_pair((short) (i + 1), (short) fore, (short) back); } } } /** \brief Check what variable is described by given line \date Function's top-level comment reviewed on 2012-01-12 \date Function's body reviewed on 2012-01-12 Check which one of all possible color scheme attributes is described by given line. The line should be read from cdw color configuration file. This function can recognize empty or invalid line (is not empty and is not a comment) and discard it (return some error value). Lines containing only white chars are treated as empty lines. Lines starting with comment char ('#') are also signalled. \param line - line from configuration file to be parsed \return CONF_COMMENT if given line has only comment (starts with comment char) \return CONF_EMPTY if given line is empty \return CONF_INVALID if line is invalid \return CONF_COLOR_* - value corresponding to particular color scheme attribute. */ short int cdw_colors_get_attribute_name(char *line) { const char *tline = cdw_string_ltrim(line); if (tline[0] == '#') { return CONF_COMMENT; } else if ((strlen(tline) == 0) || tline[0] == '\n') { return CONF_EMPTY; } else { /* strings passed as second arguments of starts_with_ci() are left unchanged for compatibility with existing cdw color configuration files, although it would be nice to have variable names in more readable form of Conf_color_main_fore */ if (cdw_string_starts_with_ci(tline, "Color1_fore")) return CONF_COLOR_MAIN_FORE; if (cdw_string_starts_with_ci(tline, "Color1_bg")) return CONF_COLOR_MAIN_BG; if (cdw_string_starts_with_ci(tline, "Color2_fore")) return CONF_COLOR_DIALOG_FORE; if (cdw_string_starts_with_ci(tline, "Color2_bg")) return CONF_COLOR_DIALOG_BG; if (cdw_string_starts_with_ci(tline, "Color3_fore")) return CONF_COLOR_TITLE_FORE; if (cdw_string_starts_with_ci(tline, "Color3_bg")) return CONF_COLOR_TITLE_BG; if (cdw_string_starts_with_ci(tline, "Color4_fore")) return CONF_COLOR_MENU_FORE; if (cdw_string_starts_with_ci(tline, "Color4_bg")) return CONF_COLOR_MENU_BG; if (cdw_string_starts_with_ci(tline, "Color5_fore")) return CONF_COLOR_PROGRESS_FORE; if (cdw_string_starts_with_ci(tline, "Color5_bg")) return CONF_COLOR_PROGRESS_BG; if (cdw_string_starts_with_ci(tline, "Color6_fore")) return CONF_COLOR_INPUT_FORE; if (cdw_string_starts_with_ci(tline, "Color6_bg")) return CONF_COLOR_INPUT_BG; if (cdw_string_starts_with_ci(tline, "Color7_fore")) return CONF_COLOR_WARNING_FORE; if (cdw_string_starts_with_ci(tline, "Color7_bg")) return CONF_COLOR_WARNING_BG; if (cdw_string_starts_with_ci(tline, "Color8_fore")) return CONF_COLOR_SIZE_INFO_FORE; if (cdw_string_starts_with_ci(tline, "Color8_bg")) return CONF_COLOR_SIZE_INFO_BG; if (cdw_string_starts_with_ci(tline, "Color9_fore")) return CONF_COLOR_DISABLED_FORE; if (cdw_string_starts_with_ci(tline, "Color9_bg")) return CONF_COLOR_DISABLED_BG; if (cdw_string_starts_with_ci(tline, "Color10_fore")) return CONF_COLOR_UNUSED_FORE; if (cdw_string_starts_with_ci(tline, "Color10_bg")) return CONF_COLOR_UNUSED_BG; if (cdw_string_starts_with_ci(tline, "Color11_fore")) return CONF_COLOR_TOOLTIPS_FORE; if (cdw_string_starts_with_ci(tline, "Color11_bg")) return CONF_COLOR_TOOLTIPS_BG; if (cdw_string_starts_with_ci(tline, "Color12_fore")) return CONF_COLOR_TEXTAREA_FORE; if (cdw_string_starts_with_ci(tline, "Color12_bg")) return CONF_COLOR_TEXTAREA_BG; if (cdw_string_starts_with_ci(tline, "Color13_fore")) return CONF_COLOR_ERROR_FORE; if (cdw_string_starts_with_ci(tline, "Color13_bg")) return CONF_COLOR_ERROR_BG; } return CONF_INVALID; } /** \brief Extract color value from line read from color config file \date Function's top-level comment reviewed on 2012-01-12 \date Function's body reviewed on 2012-01-12 Extract name of color (e.g. BLACK, BOLD_YELLOW etc.) from given string that comes from configuration file. Sample argument is like "Color10_bg = BLACK". We have to extract right-hand value after '=' char. Spurious white chars are stripped by this function. \param line - line read from color config file \return curses color attribute corresponding to value extracted from line \return -1 if line does not have any color attribute value */ int cdw_colors_get_attribute_value(const char *line) { char *eq = strstr(line, "="); if (!eq) { return -1; } const char *value = cdw_string_ltrim(eq + 1); if (cdw_string_starts_with_ci(value, "BLACK")) return COLOR_BLACK; if (cdw_string_starts_with_ci(value, "RED")) return COLOR_RED; if (cdw_string_starts_with_ci(value, "GREEN")) return COLOR_GREEN; if (cdw_string_starts_with_ci(value, "YELLOW")) return COLOR_YELLOW; if (cdw_string_starts_with_ci(value, "BLUE")) return COLOR_BLUE; if (cdw_string_starts_with_ci(value, "MAGENTA")) return COLOR_MAGENTA; if (cdw_string_starts_with_ci(value, "CYAN")) return COLOR_CYAN; if (cdw_string_starts_with_ci(value, "WHITE")) return COLOR_WHITE; if (cdw_string_starts_with_ci(value, "BOLD_BLACK")) return COLOR_BLACK | A_BOLD; if (cdw_string_starts_with_ci(value, "BOLD_RED")) return COLOR_RED | A_BOLD; if (cdw_string_starts_with_ci(value, "BOLD_GREEN")) return COLOR_GREEN | A_BOLD; if (cdw_string_starts_with_ci(value, "BOLD_YELLOW")) return COLOR_YELLOW | A_BOLD; if (cdw_string_starts_with_ci(value, "BOLD_BLUE")) return COLOR_BLUE | A_BOLD; if (cdw_string_starts_with_ci(value, "BOLD_MAGENTA")) return COLOR_MAGENTA | A_BOLD; if (cdw_string_starts_with_ci(value, "BOLD_CYAN")) return COLOR_CYAN | A_BOLD; if (cdw_string_starts_with_ci(value, "BOLD_WHITE")) return COLOR_WHITE | A_BOLD; return -1; } #ifdef CDW_COLORS_NEW int cdw_colors_new_get_and_init_color(const char *names, cdw_id_t scheme) { cdw_vdm ("INFO: ooo: scheme = %lld, names = \"%s\"\n", scheme, names); /* we expect that 'names' should have this form: " / "; */ char *slash = strstr(names, "/"); if (!slash) { return -1; } *slash = '\0'; char *fore_name = cdw_string_trim(names); char *back_name = cdw_string_trim(slash + 1); if (fore_name && back_name) { cdw_id_t fore = cdw_utils_id_label_table_get_id(cdw_color_names, fore_name, -1); cdw_id_t back = cdw_utils_id_label_table_get_id(cdw_color_names, back_name, -1); if (fore != -1 && back != -1) { /* init_pair(short pair, short fore, short back) */ init_pair((short) (scheme + 1), (short) fore, (short) back); cdw_colors_table[scheme].fore = fore; cdw_colors_table[scheme].back = back; } } if (fore_name) { free(fore_name); fore_name = (char *) NULL; } if (back_name) { free(back_name); back_name = (char *) NULL; } return 0; } #endif cdw-0.7.1/src/user_interface/cdw_erase_wizard.c0000644000175000017500000005600211734657354016504 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _BSD_SOURCE /* strdup() */ #include #include #include #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "cdw_main_window.h" #include "cdw_string.h" #include "cdw_erase_wizard.h" #include "cdw_debug.h" #include "gettext.h" #include "cdw_erase_disc.h" #include "cdw_ext_tools.h" #include "cdw_form.h" /** \file blank_wizard.c Simple, one page wizard: a dialog window with dropdowns and buttons in which user can set up basic options for current operation of erasing and / or formatting optical disc. */ static void cdw_erase_wizard_init(void); static cdw_rv_t cdw_erase_wizard_build(cdw_task_t *task, cdw_disc_t *disc); static cdw_rv_t cdw_erase_wizard_driver(void); static void cdw_erase_wizard_destroy(void); static cdw_rv_t cdw_erase_wizard_build_fields(cdw_task_t *task); static CDW_DROPDOWN *cdw_erase_wizard_make_erase_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width); static CDW_DROPDOWN *cdw_erase_wizard_make_speed_dropdown(WINDOW *window, int begin_y, int begin_x, int width); static CDW_DROPDOWN *cdw_erase_wizard_make_format_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width); static cdw_rv_t cdw_erase_wizard_initial_warning(cdw_disc_type_t disc_type); static void cdw_erase_wizard_print_debug_info(cdw_task_t *task, bool format_mode_visible); static int cdw_erase_wizard_on_enter_on_cancel(cdw_form_t *cdw_form, void *dummy); static int cdw_erase_wizard_on_enter_on_erase(cdw_form_t *cdw_form, void *dummy); static struct { cdw_form_t *cdw_form; /* dropdown showing possible formatting modes for DVD-RW: 'don't change format' (default), 'format to sequential', 'format to restricted' */ bool format_mode_dropdown_visible; } wizard; static cdw_form_dropdown_maker_t dropdown_makers[] = { cdw_erase_wizard_make_erase_mode_dropdown, cdw_erase_wizard_make_speed_dropdown, cdw_erase_wizard_make_format_mode_dropdown }; static cdw_disc_t *local_disc = (cdw_disc_t *) NULL; static cdw_task_t *local_task = (cdw_task_t *) NULL; /* constants for layout of elements in wizard window */ #define first_col 2 /* main message and some labels start in leftmost column */ #define second_col 40 #define top_label_row 2 /* main message is displayed on top of window */ #define erase_mode_row 2 #define erase_speed_row 5 #define format_mode_row 8 /* label above of button invoking configuration window */ #define eject_row 11 #define buttons_row 13 /* Erase and Cancel buttons are at the bottom of window */ #define window_n_cols 52 #define window_n_lines 20 #define subwindow_n_cols (window_n_cols - 2) #define subwindow_n_lines (window_n_lines - 4) #define label_n_cols (subwindow_n_cols - 2) #define wide_dropdown_n_cols (subwindow_n_cols - 6) #define narrow_dropdown_n_cols 8 #define CDW_ERASE_WIZARD_N_FIELDS 10 /* does not include ending NULL element */ static FIELD *wizard_fields[CDW_ERASE_WIZARD_N_FIELDS + 1]; enum { f_erase_mode_l = 0, /* all/fast */ f_erase_mode_dd, f_erase_speed_l, f_erase_speed_dd, f_format_mode_l, f_format_mode_dd, f_eject_cb, f_eject_l, f_erase_button_i, f_cancel_button_i }; /** \brief Window displayed just before erasing is performed Wizard window displayed before actual erasing. User can select here some erasing / formatting options. In case of erasing a CD user can select erasing mode and erasing speed. In case of erasing a DVD user can select erasing mode, formatting mode and erasing / formatting speed. In case of erasing of DVD+/-RW user is also warned that multiple erasing of DVD can quickly render it unusable. \param task - variable describing current task \param disc - variable describing current disc \return CDW_OK if user pressed accepts erasing \return CDW_CANCEL if user cancels erasing \return CDW_GEN_ERROR on errors */ cdw_rv_t cdw_erase_wizard(cdw_task_t *task, cdw_disc_t *disc) { cdw_assert (task->id == CDW_TASK_ERASE_DISC, "ERROR: incorrect task id, should be %d, is %lld\n", CDW_TASK_ERASE_DISC, task->id); cdw_assert (disc->type_erasable == CDW_TRUE, "ERROR: disc is not erasable\n"); local_disc = disc; local_task = task; if (disc->type_erasable != CDW_TRUE) { cdw_vdm ("ERROR: disc is not erasable\n"); return CDW_ERROR; } cdw_rv_t crv = cdw_erase_wizard_initial_warning(disc->type); if (crv == CDW_CANCEL) { return CDW_CANCEL; } cdw_main_ui_main_window_wrefresh(); /* TODO: there is a problem with implicit initialization of dropdowns in the wizard: dropdowns are initialized with some deeply hidden values in functions creating dropdown, and then (below) states of the dropdowns are explicitly used to set values of fields in task variable; this mix of implicit/explicit assignments is confusing */ cdw_erase_wizard_init(); crv = cdw_erase_wizard_build(task, disc); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create wizard\n"); cdw_erase_wizard_destroy(); /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("ERROR"), /* 2TRANS: this is message in dialog window */ _("Failed to create erasing wizard. Please restart cdw and try again."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); return CDW_ERROR; } crv = cdw_erase_wizard_driver(); if (crv == CDW_OK) { /* save values set in wizard; this works both when uses made any changes in wizard, or when only accepts current settings */ CDW_DROPDOWN *dd = (CDW_DROPDOWN *) NULL; if (wizard.format_mode_dropdown_visible) { dd = cdw_form_get_dropdown(wizard.cdw_form, f_format_mode_dd); task->erase.format_mode = cdw_dropdown_get_current_item_id(dd); } dd = cdw_form_get_dropdown(wizard.cdw_form, f_erase_speed_dd); task->erase.speed_id = cdw_dropdown_get_current_item_id(dd); dd = cdw_form_get_dropdown(wizard.cdw_form, f_erase_mode_dd); task->erase.erase_mode = cdw_dropdown_get_current_item_id(dd); task->erase.eject = cdw_form_get_checkbox_state(wizard.cdw_form, f_eject_cb); cdw_erase_wizard_print_debug_info(task, wizard.format_mode_dropdown_visible); } else { cdw_vdm ("INFO: not attempting erasing, not displaying settings\n"); } cdw_erase_wizard_destroy(); /* redraw parent */ cdw_main_ui_main_window_wrefresh(); return crv; } cdw_rv_t cdw_erase_wizard_driver(void) { int fi = f_cancel_button_i; /* initial focus on "cancel" button */ int key = 'a'; /* safe initial value */ while (key != CDW_KEY_ESCAPE && key != 'q' && key != 'Q') { key = cdw_form_driver(wizard.cdw_form, fi); /* in this wizard driver we are interested only in ENTER being pressed on either "erase" or "cancel" buttons */ if (key == CDW_KEY_ENTER) { fi = field_index(current_field(wizard.cdw_form->form)); if (fi == f_erase_button_i) { /* flush */ form_driver(wizard.cdw_form->form, REQ_VALIDATION); return CDW_OK; } else if (fi == f_cancel_button_i) { return CDW_CANCEL; } else { ; } } else { ; } } return CDW_CANCEL; } /** \brief Initialize wizard data structures */ void cdw_erase_wizard_init(void) { cdw_assert (LINES > window_n_lines, "ERROR: LINES is too small: %d\n", LINES); cdw_assert (COLS > window_n_cols, "ERROR: COLS is too small: %d\n", COLS); wizard.format_mode_dropdown_visible = false; wizard.format_mode_dropdown_visible = false; return; } /** \brief Cleanup function for erase wizard Function deallocates all resources used by wizard window. Call this function when you close wizard in normal mode or when you want to clean up after unsuccessful creation of wizard. */ void cdw_erase_wizard_destroy(void) { if (wizard.cdw_form->subwindow != (WINDOW *) NULL) { delwin(wizard.cdw_form->subwindow); wizard.cdw_form->subwindow = (WINDOW *) NULL; } if (wizard.cdw_form->window != (WINDOW *) NULL) { delwin(wizard.cdw_form->window); wizard.cdw_form->window = (WINDOW *) NULL; } if (wizard.cdw_form != (cdw_form_t *) NULL) { cdw_form_delete_form_objects(wizard.cdw_form); cdw_form_delete(&(wizard.cdw_form)); } return; } /** \brief Show information about possible problems with erasing of some disc types Function warns user about probability of problems that may occur when erasing of certain types of disc is about to be performed. User can cancel erasing procedure. \param disc_type - variable describing exact disc type \return CDW_OK either when disc type isn't problematic or when user agrees to continue with problematic disc \return CDW_CANCEL when user don't want to continue */ cdw_rv_t cdw_erase_wizard_initial_warning(cdw_disc_type_t disc_type) { if (disc_type == CDW_DVD_RWP || disc_type == CDW_DVD_RW_RES) { /* it is important to warn user at this point */ /* 2TRANS: this is title of dialog window */ cdw_rv_t w = cdw_buttons_dialog(_("Attempting to erase a DVD+/-RW disc"), /* 2TRANS: this is warning message in dialog window. User can press OK or Cancel button. */ _("This will (partially) erase information from disc making it unreadable. The process may take some time. You don't have to erase DVD+RW or DVD-RW Restricted Overwrite disc to create new compilation - just choose \"Start new, appendable disc\" in Write wizard. Do you want to continue with erasing?"), CDW_BUTTONS_OK_CANCEL, CDW_COLORS_WARNING); if (w != CDW_OK) { return CDW_CANCEL; } } else if (disc_type == CDW_DVD_RW || disc_type == CDW_DVD_RW_SEQ) { /* it is important to warn user at this point */ /* 2TRANS: this is title of dialog window */ cdw_rv_t w = cdw_buttons_dialog(_("Attempting to erase a DVD-RW disc"), /* 2TRANS: this is warning message in dialog window. User can press OK or Cancel button. */ _("This will (partially) erase information from disc making it unreadable. The process may take some time. Excessive erasing of DVD may limit lifetime of media. Do you want to continue with erasing?"), CDW_BUTTONS_OK_CANCEL, CDW_COLORS_WARNING); if (w != CDW_OK) { return CDW_CANCEL; } } else { return CDW_OK; } return CDW_OK; } /** \brief Create all UI elements in wizard window \param task - variable describing current task \param disc - variable describing disc currently in drive \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_erase_wizard_build(cdw_task_t *task, cdw_disc_t *disc) { if (disc->type == CDW_DVD_RW_RES || disc->type == CDW_DVD_RW_SEQ || disc->type == CDW_DVD_RW) { if (task->erase.tool.id == CDW_TOOL_DVD_RW_FORMAT) { wizard.format_mode_dropdown_visible = true; } } wizard.cdw_form = cdw_form_new(CDW_ERASE_WIZARD_N_FIELDS); if (wizard.cdw_form == (cdw_form_t *) NULL) { cdw_vdm ("ERROR: failed to create cdw form\n"); return CDW_ERROR; } int begin_y = ((LINES - window_n_lines) / 2) - 2; int begin_x = (COLS - window_n_cols) / 2; wizard.cdw_form->window = cdw_window_new((WINDOW *) NULL, window_n_lines, window_n_cols, begin_y, begin_x, CDW_COLORS_DIALOG, /* 2TRANS: this is title of wizard window; "erase" as in "Erasing an optical disc" */ _("Erase wizard"), /* 2TRANS: this is tip at the bottom of window - user can switch between window elements using tab key */ _("Use 'Tab' key to move")); if (wizard.cdw_form->window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create window\n"); return CDW_ERROR; } wizard.cdw_form->subwindow = cdw_window_new(wizard.cdw_form->window, subwindow_n_lines, subwindow_n_cols, 3, 1, CDW_COLORS_DIALOG, (char *) NULL, (char *) NULL); if (wizard.cdw_form->subwindow == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create subwindow\n"); return CDW_ERROR; } /* *** main message in wizard window *** */ mvwprintw(wizard.cdw_form->window, top_label_row, first_col, /* 2TRANS: this is message to user: current action will be erasing "%s" disc, where "%s" is DVD or CD */ _("Select parameters for erasing %s disc"), disc->cdio->simple_type_label); cdw_erase_wizard_build_fields(task); wizard.cdw_form->form = cdw_ncurses_new_form(wizard.cdw_form->window, wizard.cdw_form->subwindow, wizard.cdw_form->fields); if (wizard.cdw_form->form == (FORM *) NULL) { cdw_vdm ("ERROR: failed to create form\n"); return CDW_ERROR; } /* current items are set in functions creating respective dropdowns; now just display them */ if (!wizard.format_mode_dropdown_visible) { CDW_DROPDOWN *dd = cdw_form_get_dropdown(wizard.cdw_form, f_format_mode_dd); cdw_dropdown_make_invisible(dd); field_opts_off(wizard.cdw_form->fields[f_format_mode_dd], O_VISIBLE); field_opts_off(wizard.cdw_form->fields[f_format_mode_l], O_VISIBLE); } cdw_form_redraw_widgets(wizard.cdw_form); cdw_form_add_return_chars(wizard.cdw_form, CDW_KEY_ENTER, CDW_KEY_ESCAPE, 'q', 'Q', 0); cdw_form_set_function(wizard.cdw_form, f_erase_button_i, cdw_erase_wizard_on_enter_on_erase); cdw_form_set_function(wizard.cdw_form, f_cancel_button_i, cdw_erase_wizard_on_enter_on_cancel); wrefresh(wizard.cdw_form->subwindow); wrefresh(wizard.cdw_form->window); return CDW_OK; } cdw_rv_t cdw_erase_wizard_build_fields(cdw_task_t *task) { cdw_form_descr_t descr[] = { /* widget type begin_y begin_x n_cols n_lines field enum data1 data2 */ /* 2TRANS: this is label in erase wizard */ { CDW_WIDGET_LABEL, erase_mode_row, first_col, label_n_cols, 1, f_erase_mode_l, _("Mode of erasing:"), 0 }, { CDW_WIDGET_DROPDOWN, erase_mode_row + 1, first_col + 1, wide_dropdown_n_cols - 2, 1, f_erase_mode_dd, dropdown_makers, 0 }, /* 2TRANS: this is label in erase wizard */ { CDW_WIDGET_LABEL, erase_speed_row, first_col, label_n_cols, 1, f_erase_speed_l, _("Speed of erasing:") , 0 }, { CDW_WIDGET_DROPDOWN, erase_speed_row + 1, first_col + 1, narrow_dropdown_n_cols - 2, 1, f_erase_speed_dd, dropdown_makers, 1 }, /* 2TRANS: this is label in erase wizard, it's about target format for a DVD-RW disc */ { CDW_WIDGET_LABEL, format_mode_row, first_col, label_n_cols, 1, f_format_mode_l, _("Format of DVD-RW:"), 0 }, { CDW_WIDGET_DROPDOWN, format_mode_row + 1, first_col + 1, wide_dropdown_n_cols - 2, 1, f_format_mode_dd, dropdown_makers, 2 }, { CDW_WIDGET_CHECKBOX, eject_row, first_col + 2, 1, 1, f_eject_cb, (void *) NULL, task->erase.eject ? 1 : 0 }, /* 2TRANS: this is label of checkbox; "tray" is a tray of CD burner; "erasing" refers to blanking of optical disc */ { CDW_WIDGET_LABEL, eject_row, first_col + 5, label_n_cols - 5, 1, f_eject_l, _("Eject tray after erasing") , 0 }, /* 2TRANS: button label, it refers to erasing optical disc */ { CDW_WIDGET_BUTTON, buttons_row, 3, 2, 1, f_erase_button_i, _("Erase"), CDW_COLORS_DIALOG }, /* 2TRANS: button label */ { CDW_WIDGET_BUTTON, buttons_row, 15, 2, 1, f_cancel_button_i, _("Cancel"), CDW_COLORS_DIALOG }, /* guard */ { -1, 0, 0, 0, 0, 0, (void *) NULL, 0 }}; wizard.cdw_form->n_fields = CDW_ERASE_WIZARD_N_FIELDS; wizard.cdw_form->fields = wizard_fields; /* the function adds guard at the end of fields */ cdw_rv_t crv = cdw_form_description_to_fields(descr, wizard.cdw_form); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to convert form description to form\n"); return CDW_ERROR; } else { return CDW_OK; } } CDW_DROPDOWN *cdw_erase_wizard_make_erase_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width) { CDW_DROPDOWN *dropdown = cdw_dropdown_new(window, begin_y, begin_x, width, 2, /* n_items_max */ CDW_COLORS_DIALOG); if (dropdown == (CDW_DROPDOWN *) NULL) { cdw_vdm ("ERROR: failed to create new dropdown\n"); return (CDW_DROPDOWN *) NULL; } if (local_disc->type == CDW_DVD_RWP) { /* 2TRANS: this string means "perform erasing in fast mode" */ cdw_rv_t crv = cdw_dropdown_add_item(dropdown, CDW_ERASE_MODE_FAST, _("Erase in fast mode")); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create erase mode dropdown label 0\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } } else { /* 2TRANS: this string means "perform erasing in fast mode" */ cdw_rv_t crv1 = cdw_dropdown_add_item(dropdown, CDW_ERASE_MODE_FAST, _("Erase in fast mode")); /* 2TRANS: this string means "erase all data from disc" */ cdw_rv_t crv2 = cdw_dropdown_add_item(dropdown, CDW_ERASE_MODE_ALL, _("Erase all content (long time)")); if (crv1 != CDW_OK || crv2 != CDW_OK) { cdw_vdm ("ERROR: failed to create erase mode dropdown label 0 or 1\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } } cdw_rv_t crv = cdw_dropdown_finalize(dropdown); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to finalize dropdown\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } else { cdw_dropdown_set_current_item_by_id(dropdown, local_task->erase.erase_mode); return dropdown; } } CDW_DROPDOWN *cdw_erase_wizard_make_speed_dropdown(WINDOW *window, int begin_y, int begin_x, int width) { CDW_DROPDOWN *dropdown = cdw_dropdown_new(window, begin_y, begin_x, width, local_disc->write_speeds.n_speeds, /* n_items_max */ CDW_COLORS_DIALOG); if (dropdown == (CDW_DROPDOWN *) NULL) { cdw_vdm ("ERROR: failed to create new dropdown\n"); return (CDW_DROPDOWN *) NULL; } char label[5]; for (int i = 0; i < local_disc->write_speeds.n_speeds; i++) { snprintf(label, 4 + 1, "%d", local_disc->write_speeds.speeds[i]); cdw_rv_t crv = cdw_dropdown_add_item(dropdown, local_disc->write_speeds.speeds[i], label); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to create dropdown label #%d of value %d\n", i, local_disc->write_speeds.speeds[i]); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } } cdw_rv_t crv = cdw_dropdown_finalize(dropdown); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to finalize dropdown\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } else { cdw_dropdown_set_current_item_by_id(dropdown, local_task->erase.speed_id); return dropdown; } } CDW_DROPDOWN *cdw_erase_wizard_make_format_mode_dropdown(WINDOW *window, int begin_y, int begin_x, int width) { /* remember that gettext() result strings must not be free()d */ /* 2TRANS: this is label in dropdown: it means "don't change format of DVD-RW during process of erasing disc" */ char *dont_change = _("Don't change format of DVD-RW"); /* 2TRANS: this is label in dropdown: 'Sequential' is one of two possible formats of DVD-RW */ char *seq = _("Change format to Sequential"); /* 2TRANS: this is label in dropdown: 'Restricted' is one of two possible formats of DVD-RW */ char *res = _("Change format to Restricted"); if (seq == (char *) NULL || res == (char *) NULL || dont_change == (char *) NULL) { cdw_vdm ("ERROR: failed to create initial labels for format mode dropdown\n"); return (CDW_DROPDOWN *) NULL; } CDW_DROPDOWN *dropdown = cdw_dropdown_new(window, begin_y, begin_x, width, 3, /* n_items_max */ CDW_COLORS_DIALOG); if (dropdown == (CDW_DROPDOWN *) NULL) { cdw_vdm ("ERROR: failed to create new dropdown\n"); return (CDW_DROPDOWN *) NULL; } cdw_rv_t crv1 = CDW_ERROR; cdw_rv_t crv2 = CDW_ERROR; if (local_disc->type == CDW_DVD_RW_SEQ) { crv1 = cdw_dropdown_add_item(dropdown, CDW_ERASE_DVD_RW_FORMAT_SEQ, dont_change); crv2 = cdw_dropdown_add_item(dropdown, CDW_ERASE_DVD_RW_FORMAT_RES, res); } else if (local_disc->type == CDW_DVD_RW_RES) { crv1 = cdw_dropdown_add_item(dropdown, CDW_ERASE_DVD_RW_FORMAT_RES, dont_change); crv2 = cdw_dropdown_add_item(dropdown, CDW_ERASE_DVD_RW_FORMAT_SEQ, seq); } else { /* we don't know if current disc is in Sequential or Restricted format */ crv1 = cdw_dropdown_add_item(dropdown, CDW_ERASE_DVD_RW_FORMAT_RES, res); crv2 = cdw_dropdown_add_item(dropdown, CDW_ERASE_DVD_RW_FORMAT_SEQ, seq); } if (crv1 != CDW_OK || crv2 != CDW_OK) { cdw_vdm ("ERROR: failed to initialize format mode dropdown label 0 or 1\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } cdw_rv_t crv = cdw_dropdown_finalize(dropdown); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to finalize dropdown\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } else { /* 0 - first item on list will be default, regardless of what the ID of this item is */ cdw_dropdown_set_current_item_by_ind(dropdown, 0); return dropdown; } } void cdw_erase_wizard_print_debug_info(cdw_task_t *task, bool format_mode_dropdown_visible) { /* for printing debug information we use values saved in "task" variable, not in "wizard" struct, because we want to check what really was saved in "task" */ cdw_vdm ("INFO: selected speed = \"%lld\"\n", task->erase.speed_id); cdw_vdm ("INFO: selected erase mode = \"%s\"\n", task->erase.erase_mode == CDW_ERASE_MODE_FAST ? "fast" : "all"); cdw_vdm ("INFO: eject tray after erasing = \"%s\"\n", task->erase.eject ? "true" : "false"); if (format_mode_dropdown_visible) { if (task->erase.format_mode == CDW_ERASE_DVD_RW_FORMAT_SEQ) { cdw_vdm ("INFO: selected DVD-RW format mode = \"Sequential\"\n"); } else if (task->erase.format_mode == CDW_ERASE_DVD_RW_FORMAT_RES) { cdw_vdm ("INFO: selected DVD-RW format mode = \"Restricted overwrite\"\n"); } else { cdw_vdm ("ERROR: incorrect format mode = %lld\n", task->erase.format_mode); } } else { cdw_vdm ("INFO: DVD-RW format mode dropdown is NOT visible\n"); } return; } int cdw_erase_wizard_on_enter_on_cancel(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ESCAPE; } int cdw_erase_wizard_on_enter_on_erase(__attribute__((unused)) cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { return CDW_KEY_ENTER; } cdw-0.7.1/src/user_interface/cdw_tabs_window.c0000644000175000017500000003511011722441362016325 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _GNU_SOURCE /* asprintf() */ #include #include #include #include #include "gettext.h" #include "cdw_string.h" #include "cdw_main_window.h" #include "cdw_widgets.h" #include "cdw_ncurses.h" #include "cdw_window.h" #include "cdw_debug.h" #include "cdw_tabs_window.h" /** \file cdw_tabs_file.c File implements "tabbed window" widget: a window with N separate overlapping (stacked) areas, i.e. tabs or panels. Each tab provides a window and subwindow. Code using this widget can add any content to the tab using the window and subwindow. */ static bool cdw_tabs_window_is_hotkey(cdw_tabs_window_t *twindow, int key, int *ti); static bool cdw_tabs_window_is_return_key(cdw_tabs_window_t *twindow, int key); static void cdw_tabs_window_refresh_current_tab(cdw_tabs_window_t *twindow); /** \brief Initialize data structure for tabbed window The function returns a pointer to data structure representing tabbed window, to which you can append (attach) tabs. After attaching all tabs you still need to finalize the window, and then you are ready to call driver function for this window. Number of tabs attached to the window must exactly match value of \p n_tabs at the time you finalize the tabbed window. You can't append more tabs than \p n_tabs, and you can't leave adding some tabs "for later". \param n_tabs - number of tabs that will be visible in the window \param title - title of the window, common for all tabs \param subtitle - string displayed at the bottom of the window, common for all tabs \return pointer to initial tabbed window on success \return NULL pointer on failure */ cdw_tabs_window_t *cdw_tabs_window_init(int n_tabs, const char *title, const char *subtitle) { cdw_tabs_window_t *twindow = (cdw_tabs_window_t *) malloc(sizeof (cdw_tabs_window_t)); if (twindow == (cdw_tabs_window_t *) NULL) { cdw_vdm ("ERROR: failed to create tabs window\n"); return (cdw_tabs_window_t *) NULL; } twindow->tabs = (cdw_tab_t *) NULL; twindow->n_tabs = 0; twindow->current_tab = 0; twindow->title = (char *) NULL; twindow->subtitle = (char *) NULL; twindow->user_data = (void *) NULL; twindow->geometry.n_lines = 0; twindow->geometry.n_cols = 0; twindow->geometry.begin_y = 0; twindow->geometry.begin_x = 0; twindow->geometry.tabs_width = 0; twindow->tabs = (cdw_tab_t *) malloc((long unsigned int) n_tabs * sizeof (cdw_tab_t)); if (twindow->tabs == (cdw_tab_t *) NULL) { cdw_vdm ("ERROR: failed to create tabs in twindow\n"); free(twindow); twindow = (cdw_tabs_window_t *) NULL; return (cdw_tabs_window_t *) NULL; } twindow->title = strdup(title); twindow->subtitle = strdup(subtitle); if (twindow->title == (char *) NULL || twindow->subtitle == (char *) NULL) { cdw_vdm ("ERROR: failed to strdup window title \"%s\" or subtitle \"%s\"\n", title, subtitle); cdw_tabs_window_delete(&twindow); return (cdw_tabs_window_t *) NULL; } twindow->n_tabs = n_tabs; for (int i = 0; i < twindow->n_tabs; i++) { twindow->tabs[i].label = (char *) NULL; twindow->tabs[i].id = 0; twindow->tabs[i].hotkey = 0; twindow->tabs[i].panel = (PANEL *) NULL; twindow->tabs[i].window = (WINDOW *) NULL; twindow->tabs[i].subwindow = (WINDOW *) NULL; } twindow->n_return_keys = 0; for (int i = 0; i < N_RETURN_KEYS_MAX; i++) { twindow->return_keys[i] = 0; } return twindow;; } cdw_rv_t cdw_tabs_window_append_tab(cdw_tabs_window_t *twindow, cdw_id_t id, int hotkey, const char *label) { cdw_assert (twindow != (cdw_tabs_window_t *) NULL, "ERROR: twindow is NULL\n"); cdw_assert (label != (char *) NULL, "ERROR: tab label is NULL\n"); /* search for first free slot and "insert" a new tab there */ for (int i = 0; i < twindow->n_tabs; i++) { if (twindow->tabs[i].label == (char *) NULL) { twindow->tabs[i].id = id; asprintf(&(twindow->tabs[i].label), "<%s>%s", cdw_ncurses_key_label(hotkey), label); cdw_vdm ("INFO: added label #%d: \"%s\"\n", i, twindow->tabs[i].label); twindow->tabs[i].hotkey = hotkey; return CDW_OK; } } cdw_vdm ("ERROR: trying to append tab, but no space left\n"); return CDW_ERROR; } /** \brief Set geometry constraints of given tabbed window \param twindow - window for which to set geometry constraints \param n_lines - number of lines (rows) of window \param n_cols - number of columns in window \param begin_y - Y coordinate of window (relative to 0,0 point of screen) \param begin_x - X coordinate of window (relative to 0,0 point of screen) \param tabs_width - number of columns occupied by tabs with labels on right side of window */ void cdw_tabs_window_set_geometry(cdw_tabs_window_t *twindow, int n_lines, int n_cols, int begin_y, int begin_x, int tabs_width) { twindow->geometry.n_lines = n_lines; twindow->geometry.n_cols = n_cols; twindow->geometry.begin_y = begin_y; twindow->geometry.begin_x = begin_x; twindow->geometry.tabs_width = tabs_width; return; } /** \brief Draw tabs that are visible on right side of tabbed window Function draws tabs (with labels) visible on right side of window, that make it easier to navigate tabbed window. \param twindow - tabbed window to draw in */ void cdw_tabs_window_draw_tabs(cdw_tabs_window_t *twindow) { for (int i = 0; i < twindow->n_tabs; i++) { WINDOW *window = twindow->tabs[i].subwindow; /* this may happen if there are less tabs attached than n_tabs */ cdw_assert (window != (WINDOW *) NULL, "ERROR: subwindow #%d is NULL\n", i); int start_col = twindow->geometry.n_cols - twindow->geometry.tabs_width; mvwvline(window, 0, start_col, ACS_VLINE, twindow->geometry.n_cols); /* draw horizontal lines and tab labels */ for (int j = 0; j < twindow->n_tabs; j++) { mvwprintw(window, 2 * j, start_col + 1, "%s", twindow->tabs[j].label); mvwhline(window, 2 * j + 1, start_col + 1, ACS_HLINE, twindow->geometry.n_cols); } /* draw corners, specific for values of tab_number */ if (i == 0) { mvwaddch(window, 0, start_col, ' '); mvwaddch(window, 1, start_col, ACS_ULCORNER); } else { mvwaddch(window, (i * 2) - 1, start_col, ACS_LLCORNER); mvwaddch(window, (i * 2), start_col, ' '); mvwaddch(window, (i * 2) + 1, start_col, ACS_ULCORNER); } wrefresh(window); } return; } /** \brief Finish creating and setting up all data necessary to run a tabbed window Call this function after calling these functions: - cdw_tabs_window_init() - cdw_tabs_window_set_geometry() - cdw_tabs_window_append_tab() (all necessary calls) and before adding any content to windows in tabbed window. \param twindow - tabbed window which should be finalized \return CDW_OK on success \return CDW_ERROR on errors */ cdw_rv_t cdw_tabs_window_finalize(cdw_tabs_window_t *twindow) { for (int i = 0; i < twindow->n_tabs; i++) { twindow->tabs[i].window = cdw_window_new((WINDOW *) NULL, twindow->geometry.n_lines, twindow->geometry.n_cols, (LINES - twindow->geometry.n_lines) / 2, (COLS - twindow->geometry.n_cols) / 2, CDW_COLORS_DIALOG, twindow->title, twindow->subtitle); if (twindow->tabs[i].window == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create window #%d\n", i); return CDW_ERROR; } twindow->tabs[i].subwindow = cdw_window_new(twindow->tabs[i].window, twindow->geometry.n_lines - 2, twindow->geometry.n_cols - 2, 1, 1, CDW_COLORS_DIALOG, (char *) NULL, (char *) NULL); if (twindow->tabs[i].subwindow == (WINDOW *) NULL) { cdw_vdm ("ERROR: failed to create subwindow #%d\n", i); return CDW_ERROR; } twindow->tabs[i].panel = new_panel(twindow->tabs[i].window); if (twindow->tabs[i].panel == (PANEL *) NULL) { cdw_vdm ("ERROR: failed to create panel #%d with new_panel()\n", i); return CDW_ERROR; } keypad(twindow->tabs[i].subwindow, TRUE); nodelay(twindow->tabs[i].subwindow, FALSE); keypad(twindow->tabs[i].window, TRUE); nodelay(twindow->tabs[i].window, FALSE); redrawwin(twindow->tabs[i].subwindow); wrefresh(twindow->tabs[i].subwindow); redrawwin(twindow->tabs[i].window); wrefresh(twindow->tabs[i].window); } cdw_tabs_window_draw_tabs(twindow); return CDW_OK; } /** \brief Driver function for tabbed window widget The function handles switching between the tabs in tabbed window, and then passes control to tab-specific driver function. If the driver returns a return key (i.e. key configured with cdw_tabs_window_add_return_key()), the function returns the key value. \param twindow - tabbed window to be controlled \return last key pressed in tabbed window */ int cdw_tabs_window_driver(cdw_tabs_window_t *twindow) { int key = twindow->tabs[twindow->current_tab].hotkey; /* safe default - switch to first tab */ do { if (cdw_tabs_window_is_hotkey(twindow, key, &(twindow->current_tab))) { show_panel(twindow->tabs[twindow->current_tab].panel); update_panels(); cdw_main_ui_main_window_wrefresh(); cdw_tabs_window_refresh_current_tab(twindow); } else if (cdw_tabs_window_is_return_key(twindow, key)) { return key; } else { /* loop */ } /* wgetch() may be replaced by tab-related driver; in the most simple model (tabs contain only pure windows) wgetch() is sufficient */ } while ((key = twindow->driver_reader(twindow))); return CDW_CANCEL; } /** \brief Look up given key on list of hotkeys in given tabbed window \param twindow - tabbed window to examine \param key - key to look up on list of hotkeys for given twindow \param ti - place for index of tab, for which given key is a hotkey \return true if \p key is a hotkey for one of tabs in tabbed window \return false if \p key is not a hotkey for any of tabs in tabbed window */ bool cdw_tabs_window_is_hotkey(cdw_tabs_window_t *twindow, int key, int *ti) { for (int i = 0; i < twindow->n_tabs; i++) { if (key == twindow->tabs[i].hotkey) { *ti = i; return true; } } return false; } void cdw_tabs_window_delete(cdw_tabs_window_t **twindow) { if (*twindow == (cdw_tabs_window_t *) NULL) { cdw_vdm ("WARNING: passed NULL twindow to the function\n"); return; } if ((*twindow)->title != (char *) NULL) { free((*twindow)->title); (*twindow)->title = (char *) NULL; } if ((*twindow)->subtitle != (char *) NULL) { free((*twindow)->subtitle); (*twindow)->subtitle = (char *) NULL; } if ((*twindow)->tabs != (cdw_tab_t *) NULL) { for (int i = 0; i < (*twindow)->n_tabs; i++) { if ((*twindow)->tabs[i].panel != (PANEL *) NULL) { del_panel((*twindow)->tabs[i].panel); (*twindow)->tabs[i].panel = (PANEL *) NULL; } if ((*twindow)->tabs[i].subwindow != (WINDOW *) NULL) { delwin((*twindow)->tabs[i].subwindow); (*twindow)->tabs[i].subwindow = (WINDOW *) NULL; } if ((*twindow)->tabs[i].window != (WINDOW *) NULL) { delwin((*twindow)->tabs[i].window); (*twindow)->tabs[i].window = (WINDOW *) NULL; } if ((*twindow)->tabs[i].label != (char *) NULL) { free((*twindow)->tabs[i].label); (*twindow)->tabs[i].label = (char *) NULL; } } free((*twindow)->tabs); (*twindow)->tabs = (cdw_tab_t *) NULL; } free(*twindow); *twindow = (cdw_tabs_window_t *) NULL; return; } void cdw_tabs_window_refresh_current_tab(cdw_tabs_window_t *twindow) { redrawwin(twindow->tabs[twindow->current_tab].window); wrefresh(twindow->tabs[twindow->current_tab].window); return; } void cdw_tabs_window_add_return_key(cdw_tabs_window_t *twindow, int key) { cdw_assert (twindow != (cdw_tabs_window_t *) NULL, "ERROR: \"twindow\" argument is NULL\n"); cdw_assert (twindow->n_return_keys < N_RETURN_KEYS_MAX, "ERROR: there are already %d / %d return keys in the window, can't add another one\n", twindow->n_return_keys, N_RETURN_KEYS_MAX); cdw_assert (key != 0, "ERROR: trying to add key == 0, but 0 is an initializer value\n"); if (cdw_tabs_window_is_return_key(twindow, key)) { cdw_vdm ("WARNING: attempting to add key %d / \"%s\", but it is already on the list of return keys\n", key, cdw_ncurses_key_label(key)); } else { twindow->return_keys[twindow->n_return_keys++] = key; } return; } void cdw_tabs_window_add_return_keys(cdw_tabs_window_t *twindow, ...) { cdw_assert (twindow, "ERROR: twindow is NULL\n"); cdw_assert (twindow->n_return_keys < N_RETURN_KEYS_MAX, "ERROR: there are already %d / %d return keys in the window, can't add another one\n", twindow->n_return_keys, N_RETURN_KEYS_MAX); va_list ap; va_start(ap, twindow); int key = 'a'; while ((key = va_arg(ap, int)) != 0) { cdw_tabs_window_add_return_key(twindow, key); } va_end(ap); return; } /** \brief Check if given key is one of configured "return" key Function checks if given \p key was earlier added to given \p twindow as "return control after pressing the key" key. \param twindow - tabbed window that you want to query \param key - key you want to check if it is added to tabbed window \return true if given key was added to given \p twindow \return false if given key was not added to given \p twindow */ bool cdw_tabs_window_is_return_key(cdw_tabs_window_t *twindow, int key) { cdw_assert (twindow != (cdw_tabs_window_t *) NULL, "ERROR: \"twindow\" argument is NULL\n"); cdw_assert (key != 0, "ERROR: asking for key = 0, which is an initialization value\n"); for (int i = 0; i < twindow->n_return_keys; i++) { if (twindow->return_keys[i] == key) { return true; } } return false; } cdw_rv_t cdw_tabs_window_show_tab_by_id(cdw_tabs_window_t *twindow, cdw_id_t id) { for (int i = 0; i < twindow->n_tabs; i++) { if (twindow->tabs[i].id == id) { twindow->current_tab = i; show_panel(twindow->tabs[twindow->current_tab].panel); update_panels(); cdw_main_ui_main_window_wrefresh(); cdw_tabs_window_refresh_current_tab(twindow); return CDW_OK; } } cdw_vdm ("ERROR: failed to switch to tab with id = %lld\n", id); return CDW_ERROR; } cdw-0.7.1/src/user_interface/widgets/0000755000175000017500000000000011736031302014524 500000000000000cdw-0.7.1/src/user_interface/widgets/Makefile.in0000644000175000017500000007101611722443565016533 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.cdw.am subdir = src/user_interface/widgets ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libcdwwidgets_a_AR = $(AR) $(ARFLAGS) libcdwwidgets_a_LIBADD = am__objects_1 = cdw_dropdown.$(OBJEXT) cdw_button.$(OBJEXT) \ cdw_checkbox.$(OBJEXT) cdw_dialog.$(OBJEXT) \ cdw_input_line.$(OBJEXT) am_libcdwwidgets_a_OBJECTS = $(am__objects_1) libcdwwidgets_a_OBJECTS = $(am_libcdwwidgets_a_OBJECTS) libcdwwidgets_check_a_AR = $(AR) $(ARFLAGS) libcdwwidgets_check_a_LIBADD = am__objects_2 = libcdwwidgets_check_a-cdw_dropdown.$(OBJEXT) \ libcdwwidgets_check_a-cdw_button.$(OBJEXT) \ libcdwwidgets_check_a-cdw_checkbox.$(OBJEXT) \ libcdwwidgets_check_a-cdw_dialog.$(OBJEXT) \ libcdwwidgets_check_a-cdw_input_line.$(OBJEXT) am_libcdwwidgets_check_a_OBJECTS = $(am__objects_2) libcdwwidgets_check_a_OBJECTS = $(am_libcdwwidgets_check_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libcdwwidgets_a_SOURCES) $(libcdwwidgets_check_a_SOURCES) DIST_SOURCES = $(libcdwwidgets_a_SOURCES) \ $(libcdwwidgets_check_a_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ METASOURCES = AUTO sources = cdw_dropdown.c cdw_dropdown.h \ cdw_button.c cdw_button.h \ cdw_checkbox.c cdw_checkbox.h \ cdw_dialog.c cdw_dialog.h \ cdw_input_line.c cdw_input_line.h # _FILE_OFFSET_BITS=64 - large file support (>2GB on 32-bit systems); # this is unnecessary on 64-bit systems, but I had to add this # after doing some basic tests on i386 machine; see sourceforge # #2545568 defect for details; # # This is aso required by libburn - see information on top of # /usr/include/libburn/libburn.h # "include" files of convenience libraries # don't use $(top_builddir), it fails during "make distcheck" CDW_BUILD_CPPFLAGS = -D _FILE_OFFSET_BITS=64 -I$(top_srcdir)/src/ \ -I$(top_srcdir)/src/external_tools/ -I$(top_srcdir)/src/tasks/ \ -I$(top_srcdir)/src/utilities/ \ -I$(top_srcdir)/src/user_interface/widgets/ \ -I$(top_srcdir)/src/user_interface/ \ -I$(top_srcdir)/src/configuration/ \ -I$(top_srcdir)/src/native_file_system/ \ -I$(top_srcdir)/src/optical_file_systems/ \ -I$(top_srcdir)/src/disc_and_drive/ \ -I$(top_srcdir)/gnulib/lib/ # quoted descriptions of flags come from # http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html # using C99 standard + gnu extensions; I don't use pure c99, because # it may trigger problems caused by asm/byteorder.h, which is included # by linux/cdrom.h header, which in turn is included by cdw_drive.h CDW_BUILD_CFLAGS_C_STD = -std=gnu99 CDW_BUILD_CFLAGS_PEDANTIC = -pedantic # "Check calls to printf and scanf, etc., to make sure that the arguments # supplied have types appropriate to the format string specified..." # "If -Wformat is specified, also warn about uses of format functions that # represent possible security problems..." # "If -Wformat is specified, also warn if the format string is not # a string literal..." # "These warnings will help you find at compile time code that can try # to write into a string constant..." # "Warn about anything that depends on the “size of” a function type or # of void...." # "Warn whenever a switch statement does not have a default case" # sometimes gcc can complain about unreachable code when using constant # strings like that: strcmp(some_string, "some string"); # "Warn whenever a pointer is cast such that the required alignment of # the target is increased..." # "Warn whenever a pointer is cast so as to remove a type qualifier from # the target type..." # "Warn whenever a function call is cast to a non-matching type..." CDW_BUILD_CFLAGS_WARNINGS = -Wformat -Wformat-security \ -Wformat-nonliteral -Wwrite-strings -Wpointer-arith \ -Wswitch-default -Wunreachable-code -Wcast-align -Wcast-qual \ -Wbad-function-cast -Wall -Wshadow -Wextra -Wswitch-enum \ -Wfloat-equal -Wchar-subscripts -Winline -Wsign-compare \ -Wnested-externs -Wredundant-decls -Wconversion -Wlogical-op \ -Wno-declaration-after-statement -Wmissing-prototypes \ -Wmissing-declarations -Wstrict-prototypes @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) -DNDEBUG @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -O2 @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -g -O0 $(CDW_BUILD_CFLAGS_WARNINGS) $(CDW_BUILD_CFLAGS_PEDANTIC) # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake # don't use $(top_builddir), it fails during "make distcheck" # static convenience library; "noinst" means: "build, but # don't install in user's system" noinst_LIBRARIES = libcdwwidgets.a libcdwwidgets_a_SOURCES = $(sources) # library built only for purposes of testing (checking) check_LIBRARIES = libcdwwidgets_check.a libcdwwidgets_check_a_SOURCES = $(sources) libcdwwidgets_check_a_CPPFLAGS = -DCDW_UNIT_TEST_CODE $(AM_CPPFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.cdw.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/user_interface/widgets/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/user_interface/widgets/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.cdw.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkLIBRARIES: -test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES) clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libcdwwidgets.a: $(libcdwwidgets_a_OBJECTS) $(libcdwwidgets_a_DEPENDENCIES) $(EXTRA_libcdwwidgets_a_DEPENDENCIES) -rm -f libcdwwidgets.a $(libcdwwidgets_a_AR) libcdwwidgets.a $(libcdwwidgets_a_OBJECTS) $(libcdwwidgets_a_LIBADD) $(RANLIB) libcdwwidgets.a libcdwwidgets_check.a: $(libcdwwidgets_check_a_OBJECTS) $(libcdwwidgets_check_a_DEPENDENCIES) $(EXTRA_libcdwwidgets_check_a_DEPENDENCIES) -rm -f libcdwwidgets_check.a $(libcdwwidgets_check_a_AR) libcdwwidgets_check.a $(libcdwwidgets_check_a_OBJECTS) $(libcdwwidgets_check_a_LIBADD) $(RANLIB) libcdwwidgets_check.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_button.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_checkbox.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_dialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_dropdown.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_input_line.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwwidgets_check_a-cdw_button.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwwidgets_check_a-cdw_checkbox.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwwidgets_check_a-cdw_dialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwwidgets_check_a-cdw_dropdown.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwwidgets_check_a-cdw_input_line.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` libcdwwidgets_check_a-cdw_dropdown.o: cdw_dropdown.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_dropdown.o -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_dropdown.Tpo -c -o libcdwwidgets_check_a-cdw_dropdown.o `test -f 'cdw_dropdown.c' || echo '$(srcdir)/'`cdw_dropdown.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_dropdown.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_dropdown.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_dropdown.c' object='libcdwwidgets_check_a-cdw_dropdown.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_dropdown.o `test -f 'cdw_dropdown.c' || echo '$(srcdir)/'`cdw_dropdown.c libcdwwidgets_check_a-cdw_dropdown.obj: cdw_dropdown.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_dropdown.obj -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_dropdown.Tpo -c -o libcdwwidgets_check_a-cdw_dropdown.obj `if test -f 'cdw_dropdown.c'; then $(CYGPATH_W) 'cdw_dropdown.c'; else $(CYGPATH_W) '$(srcdir)/cdw_dropdown.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_dropdown.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_dropdown.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_dropdown.c' object='libcdwwidgets_check_a-cdw_dropdown.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_dropdown.obj `if test -f 'cdw_dropdown.c'; then $(CYGPATH_W) 'cdw_dropdown.c'; else $(CYGPATH_W) '$(srcdir)/cdw_dropdown.c'; fi` libcdwwidgets_check_a-cdw_button.o: cdw_button.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_button.o -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_button.Tpo -c -o libcdwwidgets_check_a-cdw_button.o `test -f 'cdw_button.c' || echo '$(srcdir)/'`cdw_button.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_button.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_button.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_button.c' object='libcdwwidgets_check_a-cdw_button.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_button.o `test -f 'cdw_button.c' || echo '$(srcdir)/'`cdw_button.c libcdwwidgets_check_a-cdw_button.obj: cdw_button.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_button.obj -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_button.Tpo -c -o libcdwwidgets_check_a-cdw_button.obj `if test -f 'cdw_button.c'; then $(CYGPATH_W) 'cdw_button.c'; else $(CYGPATH_W) '$(srcdir)/cdw_button.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_button.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_button.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_button.c' object='libcdwwidgets_check_a-cdw_button.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_button.obj `if test -f 'cdw_button.c'; then $(CYGPATH_W) 'cdw_button.c'; else $(CYGPATH_W) '$(srcdir)/cdw_button.c'; fi` libcdwwidgets_check_a-cdw_checkbox.o: cdw_checkbox.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_checkbox.o -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_checkbox.Tpo -c -o libcdwwidgets_check_a-cdw_checkbox.o `test -f 'cdw_checkbox.c' || echo '$(srcdir)/'`cdw_checkbox.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_checkbox.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_checkbox.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_checkbox.c' object='libcdwwidgets_check_a-cdw_checkbox.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_checkbox.o `test -f 'cdw_checkbox.c' || echo '$(srcdir)/'`cdw_checkbox.c libcdwwidgets_check_a-cdw_checkbox.obj: cdw_checkbox.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_checkbox.obj -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_checkbox.Tpo -c -o libcdwwidgets_check_a-cdw_checkbox.obj `if test -f 'cdw_checkbox.c'; then $(CYGPATH_W) 'cdw_checkbox.c'; else $(CYGPATH_W) '$(srcdir)/cdw_checkbox.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_checkbox.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_checkbox.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_checkbox.c' object='libcdwwidgets_check_a-cdw_checkbox.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_checkbox.obj `if test -f 'cdw_checkbox.c'; then $(CYGPATH_W) 'cdw_checkbox.c'; else $(CYGPATH_W) '$(srcdir)/cdw_checkbox.c'; fi` libcdwwidgets_check_a-cdw_dialog.o: cdw_dialog.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_dialog.o -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_dialog.Tpo -c -o libcdwwidgets_check_a-cdw_dialog.o `test -f 'cdw_dialog.c' || echo '$(srcdir)/'`cdw_dialog.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_dialog.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_dialog.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_dialog.c' object='libcdwwidgets_check_a-cdw_dialog.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_dialog.o `test -f 'cdw_dialog.c' || echo '$(srcdir)/'`cdw_dialog.c libcdwwidgets_check_a-cdw_dialog.obj: cdw_dialog.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_dialog.obj -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_dialog.Tpo -c -o libcdwwidgets_check_a-cdw_dialog.obj `if test -f 'cdw_dialog.c'; then $(CYGPATH_W) 'cdw_dialog.c'; else $(CYGPATH_W) '$(srcdir)/cdw_dialog.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_dialog.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_dialog.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_dialog.c' object='libcdwwidgets_check_a-cdw_dialog.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_dialog.obj `if test -f 'cdw_dialog.c'; then $(CYGPATH_W) 'cdw_dialog.c'; else $(CYGPATH_W) '$(srcdir)/cdw_dialog.c'; fi` libcdwwidgets_check_a-cdw_input_line.o: cdw_input_line.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_input_line.o -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_input_line.Tpo -c -o libcdwwidgets_check_a-cdw_input_line.o `test -f 'cdw_input_line.c' || echo '$(srcdir)/'`cdw_input_line.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_input_line.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_input_line.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_input_line.c' object='libcdwwidgets_check_a-cdw_input_line.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_input_line.o `test -f 'cdw_input_line.c' || echo '$(srcdir)/'`cdw_input_line.c libcdwwidgets_check_a-cdw_input_line.obj: cdw_input_line.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwwidgets_check_a-cdw_input_line.obj -MD -MP -MF $(DEPDIR)/libcdwwidgets_check_a-cdw_input_line.Tpo -c -o libcdwwidgets_check_a-cdw_input_line.obj `if test -f 'cdw_input_line.c'; then $(CYGPATH_W) 'cdw_input_line.c'; else $(CYGPATH_W) '$(srcdir)/cdw_input_line.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwwidgets_check_a-cdw_input_line.Tpo $(DEPDIR)/libcdwwidgets_check_a-cdw_input_line.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_input_line.c' object='libcdwwidgets_check_a-cdw_input_line.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwwidgets_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwwidgets_check_a-cdw_input_line.obj `if test -f 'cdw_input_line.c'; then $(CYGPATH_W) 'cdw_input_line.c'; else $(CYGPATH_W) '$(srcdir)/cdw_input_line.c'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkLIBRARIES clean-generic clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean \ clean-checkLIBRARIES clean-generic clean-noinstLIBRARIES ctags \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am # used by flymake check-syntax: $(CC) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(AM_CFLAGS) -fsyntax-only $(CHK_SOURCES) .PHONY: check-syntax # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/src/user_interface/widgets/cdw_button.h0000644000175000017500000000127211676440030016774 00000000000000#ifndef H_CDW_BUTTON #define H_CDW_BUTTON #include "main.h" #include "cdw_ncurses.h" typedef struct { WINDOW *parent; /* parent window of the widget */ WINDOW *strip; /* a private window in which the widget displays its content */ cdw_form_widget_function_t on_click; /* callback */ int begin_x; int begin_y; char *label; cdw_colors_t colors; } CDW_BUTTON; CDW_BUTTON *cdw_button_new(WINDOW *parent, int begin_y, int begin_x, const char *label, cdw_colors_t colors); void cdw_button_delete(CDW_BUTTON **button); void cdw_button_free(CDW_BUTTON *button); void cdw_button_focus(CDW_BUTTON *button); void cdw_button_unfocus(CDW_BUTTON *button); #endif /* ifndef H_CDW_BUTTON */ cdw-0.7.1/src/user_interface/widgets/cdw_button.c0000644000175000017500000001250211724475155016777 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_button.c Implementation of "button" widget that can be embedded e.g. in dialog windows. */ #include #include #include "cdw_button.h" #include "cdw_debug.h" /** \brief Create new CDW_BUTTON widget \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Remember to assign value to CDW_BUTTON->on_click \param parent - parent window, in which the button will be displayed \param begin_y - number of row of parent window, in which will be displayed upper border of button \param begin_x - number of column of parent window, in which will be displayed left border of button \param label - string that will be displayed as button label \param colors - color scheme of button \return pointer to new button widget on success \return NULL pointer if creating widget fails */ CDW_BUTTON *cdw_button_new(WINDOW *parent, int begin_y, int begin_x, const char *label, cdw_colors_t colors) { cdw_assert (parent, "ERROR: parent window is null\n"); CDW_BUTTON *button = (CDW_BUTTON *) malloc(sizeof(CDW_BUTTON)); if (!button) { cdw_vdm ("ERROR: malloc()\n"); return (CDW_BUTTON *) NULL; } button->strip = (WINDOW *) NULL; button->label = (char *) NULL; button->label = strdup(label); if (!(button->label)) { free(button); button = (CDW_BUTTON *) NULL; cdw_vdm ("ERROR: strdup()\n"); return (CDW_BUTTON *) NULL; } button->begin_x = begin_x; button->begin_y = begin_y; button->colors = colors; button->on_click = (cdw_form_widget_function_t) NULL; button->parent = parent; int label_len = (int) strlen(button->label); /* "[ label ]" = 2 + len + 2 */ button->strip = derwin(parent, 1, 2 + label_len + 2, button->begin_y, button->begin_x); if (button->strip) { (void) wattrset(button->strip, COLOR_PAIR(button->colors)); mvwprintw(button->strip, 0, 0, "[ %s ]", button->label); wrefresh(button->strip); return button; } else { cdw_button_delete(&button); cdw_vdm ("ERROR: can't create new button: derwin\n"); return (CDW_BUTTON *) NULL; } } /** \brief Destroy CDW_BUTTON widget \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Deallocate all resources used by CDW_BUTTON widget. The function accepts NULL pointer. \p button is set to NULL on return. \param button - button to destroy */ void cdw_button_delete(CDW_BUTTON **button) { cdw_assert (button, "ERROR: passed to the function a NULL pointer to the widget\n"); if (!*button) { cdw_vdm ("WARNING: NULL button\n"); return; } cdw_button_free(*button); *button = (CDW_BUTTON *) NULL; return; } /** \brief Free CDW_BUTTON widget \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Deallocate all resources used by CDW_BUTTON widget. The function accepts NULL pointer, but does not set its argument to NULL. \param button - button to free */ void cdw_button_free(CDW_BUTTON *button) { if (!button) { cdw_vdm ("WARNING: NULL button\n"); return; } if (button->strip) { delwin(button->strip); button->strip = (WINDOW *) NULL; } if (button->label) { free(button->label); button->label = (char *) NULL; } free(button); return; } /** \brief Highlight given button \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Redraw given button using its reversed 'colors' scheme. It will look as if the button has changed its state to 'has focus'. \param button - button to highlight */ void cdw_button_focus(CDW_BUTTON *button) { cdw_assert (button, "ERROR: cannot focus NULL button\n"); /* wattrset(button->strip, COLOR_PAIR(button->focus_color)); */ (void) wattrset(button->strip, COLOR_PAIR(button->colors) | A_REVERSE); mvwprintw(button->strip, 0, 0, "[ %s ]", button->label); wrefresh(button->strip); return; } /** \brief Display given button as it is in its normal state \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Redraw given button using its normal color scheme. It will look as if the button has changed its state to 'has no focus'. \param button - button to unfocus */ void cdw_button_unfocus(CDW_BUTTON *button) { cdw_assert (button, "ERROR: cannot unfocus NULL button\n"); (void) wattrset(button->strip, COLOR_PAIR(button->colors)); mvwprintw(button->strip, 0, 0, "[ %s ]", button->label); wrefresh(button->strip); return; } cdw-0.7.1/src/user_interface/widgets/cdw_input_line.h0000644000175000017500000000175211703120142017620 00000000000000#ifndef H_CDW_INPUT_LINE #define H_CDW_INPUT_LINE #include "cdw_ncurses.h" typedef struct { WINDOW *parent; WINDOW *win; int n_cols; /* width - number of columns of input field */ /* no height field, it is always equal 1 */ cdw_colors_t colors; int begin_y; int begin_x; int chars_max; /* maximum number of chars that user can enter into input line */ int input_type; FIELD *field[2]; FORM *form; /* a hack: should input line driver save data from field buffer to data buffer? */ bool save_on_tab; } CDW_INPUT_LINE; CDW_INPUT_LINE *cdw_input_line_new(WINDOW *parent, int begin_y, int begin_x, int n_cols, const char *initial_string, int input_type, int chars_max); void cdw_input_line_delete(CDW_INPUT_LINE **input_line); int cdw_input_line_driver(CDW_INPUT_LINE *input_line, char **buffer, int attempts_max); void cdw_input_line_refresh_with_string(CDW_INPUT_LINE *input_line, const char *string); #endif /* #ifndef H_CDW_INPUT_LINE */ cdw-0.7.1/src/user_interface/widgets/cdw_dialog.c0000644000175000017500000006676311724475145016744 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_dialog.c File with implementation of simple dialog window of two types: dialog window with one or more buttons, and dialog window with one-line text input. Both types of dialog window display a message/prompt. */ #include #include #include "cdw_dialog.h" #include "cdw_button.h" #include "gettext.h" #include "cdw_debug.h" #include "cdw_window.h" #include "cdw_string.h" /* 4 buttons should be enough for everyone */ #define CDW_DIALOG_N_BUTTONS 4 /* basic building block for creating more advanced dialogs */ typedef struct { /* type of dialog window: CDW_DIALOG_BUTTONS or CDW_DIALOG_INPUT, but always with text on top */ int dialog_type; cdw_colors_t colors; WINDOW *window; int begin_y; int begin_x; /* space between dialog window borders and content of the window: the text area and buttons/input field; pad_x may be 0 if more space is needed to display text without truncations */ int pad_y; int pad_x; /* size of content (txt area + (buttons or input field)) of dialog window, sum this with pad_x and pad_y to get total dialog window size */ int n_rows_internal; int n_cols_internal; /* text area in upper part of dialog; it can be one-line prompt, but it can be multi-line text too */ struct { WINDOW *subwindow; int n_rows; int n_cols; } txt; /* area where buttons or input field is displayed */ struct { int n_cols; int n_rows; /* will be always (?) equal one, see comment below for explanation */ /* buttons dialog: all buttons are in one row, the row's number is begin_y; input line dialog: input line occupies one row in dialog window, the row's number is begin_y */ int begin_y; /* empty line between text area and entry (input) area below */ int spacer_y; } input; /* if dialog->type is CDW_DIALOG_BUTTONS, then this struct stores buttons visible below text area (in "input" area) */ struct { CDW_BUTTON *button; char *label; int label_len; bool used; } button[CDW_DIALOG_N_BUTTONS]; /* currently selected button, used e.g. in driver */ int button_current; /* how many buttons and of which kind */ int button_types; } CDW_DIALOG_BASE; /* symbolic names to control buttons in cdw_buttons_dialog() (e.g. to index buttons table) */ enum { BUTTON_OK = 0, BUTTON_YES = 1, BUTTON_NO = 2, BUTTON_CANCEL = 3 }; static CDW_DIALOG_BASE *cdw_dialog_base_new(int dialog_type); static void cdw_dialog_base_delete(CDW_DIALOG_BASE **dialog); static cdw_rv_t cdw_dialog_base_sizes(CDW_DIALOG_BASE *dialog, const char *message); static cdw_rv_t cdw_dialog_base_input_sizes(CDW_DIALOG_BASE *dialog); static int cdw_dialog_base_input_sizes_max(CDW_DIALOG_BASE *dialog); static cdw_rv_t cdw_dialog_base_txt_sizes(CDW_DIALOG_BASE *dialog, const char *message); static int cdw_dialog_base_txt_sizes_rows(CDW_DIALOG_BASE *dialog, const char *message); static void cdw_dialog_base_display_basics(CDW_DIALOG_BASE *dialog, const char *title, const char *message, int align); static void cdw_dialog_create_button_labels(CDW_DIALOG_BASE *dialog); static cdw_rv_t cdw_buttons_dialog_driver(CDW_DIALOG_BASE *dialog); static void cdw_dialog_display_buttons(CDW_DIALOG_BASE *dialog); /** \brief Create basis of new dialog widget \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 \param dialog_type - CDW_DIALOG_BUTTONS or CDW_DIALOG_INPUT \return pointer to new widget on success \return NULL on error */ CDW_DIALOG_BASE *cdw_dialog_base_new(int dialog_type) { CDW_DIALOG_BASE *base = (CDW_DIALOG_BASE *) malloc(sizeof (CDW_DIALOG_BASE)); if (!base) { cdw_vdm ("ERROR: failed to allocate memory for dialog base\n"); return (CDW_DIALOG_BASE *) NULL; } for (int i = 0; i < CDW_DIALOG_N_BUTTONS; i++) { base->button[i].button = (CDW_BUTTON *) NULL; base->button[i].label = (char *) NULL; base->button[i].used = false; base->button[i].label_len = 0; } /* These symbolic constants are used as loop indexes and boundaries, make sure that they weren't modified */ cdw_assert (BUTTON_OK == 0 && BUTTON_YES == 1 && BUTTON_NO == 2 && BUTTON_CANCEL == 3, "ERROR: values of button names have been modified"); /* currently selected button, set by cdw_dialogbox_display_buttons(), based on dialog_type */ base->button_current = BUTTON_OK; base->window = (WINDOW *) NULL; base->begin_y = 0; base->begin_x = 0; /* keep some space between dialog window borders and everything inside the window */ base->pad_y = 1; base->pad_x = 1; /* keep space between text window and input area below the window */ base->input.spacer_y = 1; base->input.n_cols = 0; base->txt.subwindow = (WINDOW *) NULL; /* initial text area size */ base->txt.n_rows = 0; /* 40 is half of minimal supported terminal width, seems ok */ base->txt.n_cols = 40; base->colors = CDW_COLORS_DIALOG; base->dialog_type = dialog_type; base->button_types = 0; return base; } /** \brief Deallocate resources allocated by cdw_dialog_base_new() \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Wrapper for few calls to free(). Also frees variable pointed to by argument and sets it to NULL. \param dialog - pointer to widget created by cdw_dialog_base_new() */ void cdw_dialog_base_delete(CDW_DIALOG_BASE **dialog) { for (int i = 0; i < CDW_DIALOG_N_BUTTONS; i++) { if ((*dialog)->button[i].button) { cdw_assert ((*dialog)->dialog_type == CDW_DIALOG_BUTTONS, "ERROR: button #%d is not null, but dialog type != CDW_DIALOG_BUTTONS\n", i); cdw_button_delete(&((*dialog)->button[i].button)); cdw_assert (!(*dialog)->button[i].button, "ERROR: delete didn't set button pointer to NULL\n"); } } if ((*dialog)->txt.subwindow) { delwin((*dialog)->txt.subwindow); (*dialog)->txt.subwindow = (WINDOW *) NULL; } if ((*dialog)->window) { delwin((*dialog)->window); (*dialog)->window = (WINDOW *) NULL; } free(*dialog); *dialog = (CDW_DIALOG_BASE *) NULL; return; } /** \brief Calculate size of dialog's "input" area \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Function calculates size of area in which buttons or input widget will be put. The exact size is not known at the beginning, so it has to be calculated using this function. \param dialog - dialog window for which to calculate input area \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_dialog_base_input_sizes(CDW_DIALOG_BASE *dialog) { /* FIXME: magic number, arbitrary */ const int nice_input_width = 50; /* maximal width of input field or buttons area, -2 is for window borders */ const int max_cols = COLS - 2 - 2 * dialog->pad_x; if (dialog->dialog_type == CDW_DIALOG_BUTTONS) { for (int i = BUTTON_OK; i <= BUTTON_CANCEL; i++) { if (dialog->button[i].used) { dialog->input.n_cols += dialog->button[i].label_len; } } } else if (dialog->dialog_type == CDW_DIALOG_INPUT) { /* input from user may have any length, but in order to not to have input field as wide as main app window, or very narrow in case of small limit, let's set it's width to sth that will make the input field look "nicely" */ dialog->input.n_cols = nice_input_width; } else { cdw_assert (0, "ERROR: unknown dialog type %d\n", dialog->dialog_type); } cdw_sdm ("INFO: initial required width of dialog base is %zd\n", dialog->input.n_cols); /* we have some expected, ideal number of columns to display given set of buttons, or to display input field that would fit whole input; now let's deal with limitations imposed by current screen */ dialog->input.n_rows = 1; /* buttons have to fit in one row, input field always takes one row */ bool buttons_crammed = false; if (dialog->input.n_cols > max_cols) { dialog->input.n_cols = max_cols; if (dialog->dialog_type == CDW_DIALOG_BUTTONS) { buttons_crammed = true; /* in case of buttons dialog the button labels may overlap */ cdw_vdm ("ERROR: buttons in a dialog will overlap\n"); } else { /* in case of input dialog the input field won't display whole content at once, nothing wrong with that */ } } cdw_sdm ("INFO: final required width of dialog input area is %zd\n", dialog->input.n_cols); if (buttons_crammed) { return CDW_ERROR; } else { return CDW_OK; } } /** \brief Calculate all internal sizes of dialog box \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Function calls cdw_dialog_base_input_sizes() and cdw_dialog_base_txt_sizes(), and does some other calculations in order to get x/y size of dialog window that will be presented to user. Function returns CDW_ERROR on failure, but it may still be possible to display a dialog, but its content will be displayed at least partially incorrectly. \param dialog - dialog base for which the size will be calculated \param message - message that will be displayed in dialog window \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_dialog_base_sizes(CDW_DIALOG_BASE *dialog, const char *message) { cdw_rv_t crv1 = cdw_dialog_base_input_sizes(dialog); if (crv1 != CDW_OK) { cdw_vdm ("ERROR: failed to calculate satisfactory size of input area, buttons may be crammed\n"); } cdw_rv_t crv2 = cdw_dialog_base_txt_sizes(dialog, message); if (crv2 != CDW_OK) { cdw_vdm ("ERROR: failed to calculate satisfactory sizes of txt subwindow, text may be clipped\n"); } /* at this moment functions calculating sizes for input area and textarea have specified their size requirements and have set following fields in dialog data structure: dialog->n_rows_input dialog->n_cols_input dialog->n_rows_txt dialog->n_cols_txt now we must resolve n_rows_internal and n_cols_internal */ if (dialog->input.n_cols > dialog->txt.n_cols) { dialog->n_cols_internal = dialog->input.n_cols; } else { dialog->n_cols_internal = dialog->txt.n_cols; } int max = cdw_dialog_base_input_sizes_max(dialog); if (max < dialog->txt.n_rows) { dialog->pad_y = 0; max = cdw_dialog_base_input_sizes_max(dialog); if (max < dialog->txt.n_rows) { dialog->input.spacer_y = 0; max = cdw_dialog_base_input_sizes_max(dialog); if (max < dialog->txt.n_rows) { dialog->txt.n_rows = max; } } } dialog->n_rows_internal = dialog->txt.n_rows + dialog->input.spacer_y + dialog->input.n_rows; dialog->input.begin_y = 1 + dialog->pad_y + dialog->txt.n_rows + dialog->input.spacer_y; if (crv1 != CDW_OK || crv2 != CDW_OK) { cdw_vdm ("ERROR: something went wrong when calculating sizes in dialogbox, expect layout problems\n"); return CDW_ERROR; } else { return CDW_OK; } } /** \brief Wrapper for a common simple calculation \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 \param dialog - dialog widget for which a function calculates x/y sizes \return number of lines that can be used for a specific part of dialog window */ int cdw_dialog_base_input_sizes_max(CDW_DIALOG_BASE *dialog) { return LINES - 2 /* -2 for window borders */ - 2 * dialog->pad_y /* may be already set to 0 by calculate_subwindow_txt_size() */ - dialog->input.n_rows /* this is not to be changed anymore */ - dialog->input.spacer_y; /* additional row above and below input area */ } /** \brief Calculate sizes of text area of a dialog \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Calculate x/y sizes of text area in dialog widget. Adjust spacing of dialog's layout to fit given \p message if necessary. If the message is too long (or the dialog window too small), the function may be unable to recalculate size of text area and to adjust layout of elements in the dialog. The result may be truncation of text in dialog window. The text will be visible, but only partially. Function returns CDW_ERROR in such situation. \param dialog - dialog widget for which a function calculates x/y sizes \param message - message that will be displayed in the text area of a widget \return CDW_OK on success (i.e. whole text will fit into dialog window) \return CDW_ERROR on problems (i.e. some text may be invisible in dialog window) */ cdw_rv_t cdw_dialog_base_txt_sizes(CDW_DIALOG_BASE *dialog, const char *message) { /* FIXME: magic number, arbitrary value */ dialog->txt.n_cols = 40; int n_rows = cdw_dialog_base_txt_sizes_rows(dialog, message); if (n_rows > LINES) { /* message won't fit into dialog window of current width, stretch the width .. */ /* first -2 is for window borders */ dialog->txt.n_cols = COLS - 2 - 2 * dialog->pad_x; n_rows = cdw_dialog_base_txt_sizes_rows(dialog, message); if (n_rows > LINES) { /* get rid of non-critical space... */ dialog->pad_x = 0; dialog->txt.n_cols = COLS - 2 - 2 * dialog->pad_x; n_rows = cdw_dialog_base_txt_sizes_rows(dialog, message); if (n_rows > LINES) { /* last try, get rid of more non-critical space */ dialog->pad_y = 0; n_rows = cdw_dialog_base_txt_sizes_rows(dialog, message); } } } if (n_rows > LINES) { cdw_vdm ("ERROR: failed to calculate satisfactory sizes of text area, text may be clipped\n"); return CDW_ERROR; } else { return CDW_OK; } } /** \brief Wrapper for a common simple calculation \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Function calculates one specific value: number of rows of text area in a dialog window. The value returned by the function includes spaces above and below text area. \param dialog - dialog widget for which to perform calculations \param message - message that will be displayed in text area of the dialog \return number of lines that will be used by text area */ int cdw_dialog_base_txt_sizes_rows(CDW_DIALOG_BASE *dialog, const char *message) { dialog->txt.n_rows = (int) cdw_string_count_lines(message, (size_t) dialog->txt.n_cols); int n_rows = dialog->txt.n_rows + 2 * dialog->pad_y + dialog->input.spacer_y + dialog->input.n_rows; return n_rows; } /** \brief Create and display minimum content of dialog widget \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Create and display dialog's window, window's border, and message/prompt in the window. Use \p dialog as a basis of the widget. Don't display input line or buttons, leave it to other functions. \param dialog - dialog widget to display \param title - title of the dialog window \param message - prompt/message to be displayed in the window \param align - align of message text */ void cdw_dialog_base_display_basics(CDW_DIALOG_BASE *dialog, const char *title, const char *message, int align) { /* +2 is for borders */ int n_rows = dialog->n_rows_internal + 2 * dialog->pad_y + 2; int n_cols = dialog->n_cols_internal + 2 * dialog->pad_x + 2; dialog->begin_y = (LINES - n_rows) / 2; dialog->begin_x = (COLS - n_cols) / 2; dialog->window = cdw_window_new((WINDOW *) NULL, n_rows, n_cols, dialog->begin_y, dialog->begin_x, dialog->colors, title, (char *) NULL); dialog->txt.subwindow = cdw_window_new(dialog->window, dialog->txt.n_rows, dialog->txt.n_cols, 1 + dialog->pad_y, 1 + dialog->pad_x, dialog->colors, (char *) NULL, (char *) NULL); cdw_window_print_message(dialog->txt.subwindow, message, align); wrefresh(dialog->txt.subwindow); return; } /** \brief Initialize labels of buttons \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Initialize labels of all buttons. The labels are hardwired, there is no way for code using this widget to provide custom labels. \param dialog - dialog base for which to initialize labels */ void cdw_dialog_create_button_labels(CDW_DIALOG_BASE *dialog) { /* 2TRANS: button label, please keep as short as possible */ dialog->button[BUTTON_OK].label = _("OK"); /* 2TRANS: button label, please keep as short as possible */ dialog->button[BUTTON_YES].label = _("Yes"); /* 2TRANS: button label, please keep as short as possible */ dialog->button[BUTTON_NO].label = _("No"); /* 2TRANS: button label, please keep as short as possible */ dialog->button[BUTTON_CANCEL].label = _("Cancel"); dialog->button[BUTTON_OK].label_len = (int) strlen(dialog->button[BUTTON_OK].label); dialog->button[BUTTON_YES].label_len = (int) strlen(dialog->button[BUTTON_YES].label); dialog->button[BUTTON_NO].label_len = (int) strlen(dialog->button[BUTTON_NO].label); dialog->button[BUTTON_CANCEL].label_len = (int) strlen(dialog->button[BUTTON_CANCEL].label); return; } /** \brief Driver function reacting to keys pressed in buttons dialog window \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Function reads keys pressed by user when a dialog box with buttons is displayed, and reacts appropriately: moving focus from one key to another, and returning appropriate value when user hits ENTER, ESCAPE, or other specific key. \param dialog - dialog to be controlled \return CDW_OK if user selected 'OK' or 'Yes' button \return CDW_CANCEL if user selected 'Cancel' button or pressed ESCAPE/'q'/'Q' key \return CDW_NO if user selected 'No' button */ cdw_rv_t cdw_buttons_dialog_driver(CDW_DIALOG_BASE *dialog) { cdw_assert (dialog, "ERROR: cannot operate on NULL dialog\n"); cdw_assert (dialog->window, "ERROR: cannot operate on NULL window\n"); int key = 0; /* handle cursor keys - highlight selected button */ while ((key = wgetch(dialog->window)) != ERR) { if (key == 'q' || key == 'Q') { key = CDW_KEY_ESCAPE; break; } if (key == CDW_KEY_ESCAPE || key == CDW_KEY_ENTER) { break; } cdw_button_unfocus(dialog->button[dialog->button_current].button); /* There are four possible buttons in a dialog window. Some of them may be passive/invisible/inactive. Search for active one, going left or right. */ /* 10 is probably an overkill; ~4 will be enough */ for (int i = 0; i < 10; i++) { if (key == KEY_LEFT) { dialog->button_current--; if (dialog->button_current < BUTTON_OK) { dialog->button_current = BUTTON_CANCEL; } } else if (key == KEY_RIGHT || key == CDW_KEY_TAB) { dialog->button_current++; if (dialog->button_current > BUTTON_CANCEL) { dialog->button_current = BUTTON_OK; } } else { ; } if (dialog->button[dialog->button_current].used) { /* found an existing/initialized/visible button; stop searching and focus on it */ break; } } cdw_button_focus(dialog->button[dialog->button_current].button); } if (key == CDW_KEY_ENTER) { if (dialog->button_current == BUTTON_OK || dialog->button_current == BUTTON_YES) { return CDW_OK; } else if (dialog->button_current == BUTTON_NO) { return CDW_NO; } else { return CDW_CANCEL; } } else { /* CDW_KEY_ESCAPE */ return CDW_CANCEL; } } /** \brief Build buttons and display them in proper places of dialog window \date Function's top-level comment reviewed on 2012-01-08 \date Function's body reviewed on 2012-01-08 The function initializes button labels and buttons, calculates position of buttons and displays puts them in proper order and position - all that depending on type of dialog. \p dialog_type can be one of those: DIALOG_OK, DIALOG_OK_CANCEL, DIALOG_YES_NO_CANCEL \p colors is usually symbolic value passed to function by parent widget. \p current_button will be initialized by the function \param window - window in which you want to put buttons (dialog window) \param current_button - button that will have initial focus \param dialog_type - type of dialog in which caller wants to draw buttons \param colors - color scheme of the button */ void cdw_dialog_display_buttons(CDW_DIALOG_BASE *dialog) { cdw_assert (dialog->window, "ERROR: cannot display buttons in NULL window\n"); /* Placing buttons is a bit tricky if you consider that translations may have widths different than original strings. Width of whole dialog window is divided into one, two or three equal slots, depending on number of buttons. Then position of start of button in each slot is calculated. */ int n_cols = getmaxx(dialog->window) - 2; /* how many columns at most can be occupied by a button and a space around the button; for N buttons: n_cols / N */ int button_cols = 0; /* draw initial dialog box */ if (dialog->button_types == CDW_BUTTONS_OK) { dialog->button_current = BUTTON_OK; dialog->button[BUTTON_OK].used = true; button_cols = n_cols/1; } else if (dialog->button_types == CDW_BUTTONS_OK_CANCEL) { dialog->button_current = BUTTON_OK; dialog->button[BUTTON_OK].used = true; dialog->button[BUTTON_CANCEL].used = true; button_cols = n_cols/2; } else if (dialog->button_types == CDW_BUTTONS_YES_NO_CANCEL) { dialog->button_current = BUTTON_YES; dialog->button[BUTTON_YES].used = true; dialog->button[BUTTON_NO].used = true; dialog->button[BUTTON_CANCEL].used = true; button_cols = n_cols/3; } else { ; } int a = 0; for (int i = BUTTON_OK; i <= BUTTON_CANCEL; i++) { /* check if i-th button should be created */ if (dialog->button[i].used) { int col = (a++ * button_cols) + ((button_cols - (dialog->button[i].label_len + 2)) / 2); dialog->button[i].button = cdw_button_new(dialog->window, dialog->input.begin_y, col, dialog->button[i].label, dialog->colors); } } cdw_button_focus(dialog->button[dialog->button_current].button); return; } /** \brief Create and display dialog window with text input \date Function's top-level comment reviewed on 2012-01-08 \date Function's body reviewed on 2012-01-08 Create and display dialog window with input field. Display prompt in the dialog window, accept data entered in the window, return proper value after user ends interaction with the dialog. Function's argument is this big data structure which isn't most sophisticated solution, but it shortens function's argument list significantly :) Data entered in the dialog is returned by data->buffer. The buffer must be managed by caller code. \param data - data structure defining dialog's appearance \return CDW_ERROR on failure \return CDW_OK if user pressed Enter in the dialog \return CDW_CANCEL if user pressed Escape in the dialog */ cdw_rv_t cdw_input_dialog(cdw_input_data_t *data) { CDW_DIALOG_BASE *dialog = cdw_dialog_base_new(CDW_DIALOG_INPUT); if (!dialog) { cdw_vdm ("ERROR: failed to get new dialog base\n"); return CDW_ERROR; } cdw_dialog_base_sizes(dialog, data->prompt_message); cdw_dialog_base_display_basics(dialog, data->window_title, data->prompt_message, CDW_ALIGN_LEFT); if (data->chars_max) { if (dialog->input.n_cols > data->chars_max) { /* input subwindow must be no wider than limit, otherwise setting size limit for input buffer will fail */ dialog->input.n_cols = data->chars_max; } } int begin_x = (getmaxx(dialog->window) - dialog->input.n_cols) / 2; CDW_INPUT_LINE *input_line = cdw_input_line_new(dialog->window, dialog->input.begin_y, begin_x, dialog->input.n_cols, *(data->buffer), data->input_type, data->chars_max); if (!input_line) { cdw_vdm ("ERROR: failed to create input line\n"); return CDW_ERROR; } cdw_rv_t retval = CDW_CANCEL; int key = cdw_input_line_driver(input_line, data->buffer, data->attempts_max); if (key == CDW_KEY_ENTER || key == CDW_KEY_TAB) { /* user entered correct value, do noting */ retval = CDW_OK; } else if (key == CDW_KEY_ESCAPE) { /* user cancelled entering string, do nothing */ retval = CDW_CANCEL; } else { cdw_buttons_dialog(data->window_title, data->error_message, CDW_BUTTONS_OK, CDW_COLORS_WARNING); retval = CDW_ERROR; } cdw_input_line_delete(&input_line); cdw_dialog_base_delete(&dialog); return retval; } /** \brief Show dialog window with title, message and buttons \date Function's top-level comment reviewed on 2012-01-08 \date Function's body reviewed on 2012-01-08 Show dialog window with \p title and \p message. Depending on type of dialog (\p button_types) user is presented with one, two or three buttons. Function returns value of selected button. If user pressed Enter then it is: CDW_OK for 'Yes' or 'OK', CDW_CANCEL for 'Cancel', CDW_NO for 'No'. If user pressed Escape then function returns CDW_CANCEL. Background color depends on \p colors value. \param title - dialog window title \param message - message displayed in dialog window \param button_types - number and type of buttons, one of CDW_BUTTONS_* values \param colors - color scheme of dialog \return value of type cdw_rv_t, corresponding to selected button \return CDW_ERROR on errors */ cdw_rv_t cdw_buttons_dialog(const char *title, const char *message, int button_types, cdw_colors_t colors) { cdw_assert (button_types == CDW_BUTTONS_OK || button_types == CDW_BUTTONS_OK_CANCEL || button_types == CDW_BUTTONS_YES_NO_CANCEL, "ERROR: using wrong dialog button types %d\n", button_types); CDW_DIALOG_BASE *dialog = cdw_dialog_base_new(CDW_DIALOG_BUTTONS); if (!dialog) { cdw_vdm ("ERROR: failed to get new dialog base\n"); return CDW_ERROR; } dialog->colors = colors; dialog->button_types = button_types; cdw_dialog_create_button_labels(dialog); /* debug code */ /* char *message = "\n a \n b \n c \n d \n e \n f \n g \n h \n i \n j \n k \n l \n m \n n \n o \n p \n q \n r \n s \n t \n u \n w"; */ /* char *message = "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"; */ cdw_dialog_base_sizes(dialog, message); cdw_dialog_base_display_basics(dialog, title, message, CDW_ALIGN_CENTER); cdw_dialog_display_buttons(dialog); redrawwin(dialog->window); wrefresh(dialog->window); cdw_rv_t retval = cdw_buttons_dialog_driver(dialog); cdw_dialog_base_delete(&dialog); return retval; } cdw-0.7.1/src/user_interface/widgets/cdw_dropdown.h0000644000175000017500000000535411677424072017333 00000000000000#ifndef H_CDW_DROPDOWN #define H_CDW_DROPDOWN #include "cdw_ncurses.h" typedef struct { WINDOW *parent; /* parent window, in which a dropdown will be displayed */ int begin_x; /* x-coordinate of a dropdown in parent window */ int begin_y; /* y-coordinate of a dropdown in parent window */ int width; /* width of collapsed dropdown, including delimiting '[' and ']' chars */ /* the difference between n_items_max and n_items is this: when you initially create "new style" dropdown you may not know exact number of items in the dropdown (which may depend on some conditions), but you are sure that the number will be no larger than some value. This maximal value is n_items_max, and the actual number of items added to dropdown is n_items. n_items_max must be specified when you call cdw_dropdown_new(), and value of n_items is known when you add all necessary dropdown items */ int n_items_max; int n_items; int current_item_ind; /* 0-based index, non-sparse */ cdw_colors_t colors; /* colors scheme */ bool visible; /* is widget visible and visitable? */ cdw_id_label_t **items; /* the content of the widget */ /* internal details of implementation */ MENU *menu; ITEM **menu_items; WINDOW *menu_window; WINDOW *menu_window_sub; } CDW_DROPDOWN; CDW_DROPDOWN *cdw_dropdown_new(WINDOW *parent, int begin_y, int begin_x, int width, int n_items_max, cdw_colors_t colors); CDW_DROPDOWN *cdw_dropdown_maker_wrapper(WINDOW *parent, int begin_y, int begin_x, int width, int n_items, cdw_id_clabel_t *items); cdw_rv_t cdw_dropdown_add_item(CDW_DROPDOWN *dropdown, cdw_id_t id, const char *label); cdw_rv_t cdw_dropdown_finalize(CDW_DROPDOWN *dropdown); cdw_rv_t cdw_dropdown_delete(CDW_DROPDOWN **dropdown); void cdw_dropdown_free(CDW_DROPDOWN *dropdown); int cdw_dropdown_driver(CDW_DROPDOWN *dropdown); void cdw_dropdown_display_current_item(CDW_DROPDOWN *dropdown); void cdw_dropdown_focus(CDW_DROPDOWN *dropdown); void cdw_dropdown_unfocus(CDW_DROPDOWN *dropdown); void cdw_dropdown_make_visible(CDW_DROPDOWN *dropdown); void cdw_dropdown_make_invisible(CDW_DROPDOWN *dropdown); cdw_rv_t cdw_dropdown_set_current_item_by_id(CDW_DROPDOWN *dropdown, cdw_id_t id); cdw_rv_t cdw_dropdown_set_current_item_by_ind(CDW_DROPDOWN *dropdown, int ind); int cdw_dropdown_get_current_item_ind(CDW_DROPDOWN *dropdown); cdw_id_t cdw_dropdown_get_current_item_id(CDW_DROPDOWN *dropdown); const char *cdw_dropdown_get_current_item_label(CDW_DROPDOWN *dropdown); const char *cdw_dropdown_get_label_by_ind(CDW_DROPDOWN *dropdown, int ind); const char *cdw_dropdown_get_label_by_id(CDW_DROPDOWN *dropdown, cdw_id_t id); #endif /* #ifndef H_CDW_DROPDOWN */ cdw-0.7.1/src/user_interface/widgets/cdw_dialog.h0000644000175000017500000000254611702271730016724 00000000000000#ifndef H_CDW_DIALOG #define H_CDW_DIALOG #include "cdw_ncurses.h" #include "cdw_widgets.h" /* a dialog can be either dialog with input field, or dialog with buttons; in future it may be possible that the two will be possible at the same time */ enum { CDW_DIALOG_BUTTONS = 1, CDW_DIALOG_INPUT = 2 }; /* number and type of buttons in dialog with buttons */ enum { CDW_BUTTONS_OK = 0, CDW_BUTTONS_OK_CANCEL = 3, CDW_BUTTONS_YES_NO_CANCEL = 4, }; typedef struct { const char *window_title; /* title of input window and error dialog windows */ const char *prompt_message; /* message in input window */ char *error_message; /* error message displayed in separate dialog at the end in case of failure */ int attempts_max; /* how many times should the widget ask for correct (i.e. without unsafe chars) string? */ int input_type; /* CDW_NCURSES_INPUT_{NONE | HIDDEN | INTEGER | NUMERIC } */ int chars_max; /* maximal allowed length of entered string, zero for no limit */ char **buffer; /* pointer to data buffer, the buffer must be provided by code using input dialog */ } cdw_input_data_t; cdw_rv_t cdw_buttons_dialog(const char *title, const char *message, int button_types, cdw_colors_t colors); cdw_rv_t cdw_input_dialog(cdw_input_data_t *data); #endif /* #ifndef CDW_DIALOG_BASE */ cdw-0.7.1/src/user_interface/widgets/cdw_checkbox.h0000644000175000017500000000160711676437514017266 00000000000000#ifndef H_CDW_CHECKBOX #define H_CDW_CHECKBOX #include "cdw_ncurses.h" typedef struct { WINDOW *parent; /* parent window of the widget */ int begin_y; int begin_x; bool checked; /* state of the checkbox */ bool visible; /* widget may be present, but invisible to the user, and "not-visitable" */ cdw_form_widget_function_t on_toggle; /* callback */ } CDW_CHECKBOX; CDW_CHECKBOX *cdw_checkbox_new(WINDOW *parent, int begin_y, int begin_x, bool checked); void cdw_checkbox_delete(CDW_CHECKBOX **checkbox); void cdw_checkbox_free(CDW_CHECKBOX *checkbox); bool cdw_checkbox_toggle(CDW_CHECKBOX *checkbox); bool cdw_checkbox_get_state(CDW_CHECKBOX *checkbox); bool cdw_checkbox_set_state(CDW_CHECKBOX *checkbox, bool checked); void cdw_checkbox_set_visibility(CDW_CHECKBOX *checkbox, bool visible); void cdw_checkbox_draw(CDW_CHECKBOX *checkbox); #endif /* #ifndef H_CDW_CHECKBOX */ cdw-0.7.1/src/user_interface/widgets/Makefile.am0000644000175000017500000000135011701124703016477 00000000000000METASOURCES = AUTO sources = cdw_dropdown.c cdw_dropdown.h \ cdw_button.c cdw_button.h \ cdw_checkbox.c cdw_checkbox.h \ cdw_dialog.c cdw_dialog.h \ cdw_input_line.c cdw_input_line.h # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake # don't use $(top_builddir), it fails during "make distcheck" include $(top_srcdir)/Makefile.cdw.am # static convenience library; "noinst" means: "build, but # don't install in user's system" noinst_LIBRARIES = libcdwwidgets.a libcdwwidgets_a_SOURCES = $(sources) # library built only for purposes of testing (checking) check_LIBRARIES = libcdwwidgets_check.a libcdwwidgets_check_a_SOURCES = $(sources) libcdwwidgets_check_a_CPPFLAGS = -DCDW_UNIT_TEST_CODE $(AM_CPPFLAGS) cdw-0.7.1/src/user_interface/widgets/cdw_input_line.c0000644000175000017500000004547311703120041017621 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_input_line.c File implements widget that allows entering string values into single line input field. The widget also sports a message area where an error message is printed. The message is printed whenever entered string contains insecure characters. The widget doesn't accept string with insecure characters, as defined in cdw_string.h -> CDW_STRING_UNSAFE_CHARS_STRING. */ #include #include #include #include "cdw_input_line.h" #include "gettext.h" #include "cdw_string.h" #include "cdw_debug.h" static void cdw_input_line_driver_message(CDW_INPUT_LINE *input_line, char *insecure); static cdw_rv_t cdw_input_line_new_form_setup(CDW_INPUT_LINE *input_line, const char *initial_string); static int cdw_input_line_form_driver(CDW_INPUT_LINE *input_line); static cdw_rv_t cdw_input_line_get_content(CDW_INPUT_LINE *input_line, char **output_buffer); /** \brief Create new input line widget \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Create widget that consists of a single line entry field, and single line message field. User enters data in entry field, and input line displays error message in message field (if necessary). Both fields have the same width (\p n_cols). The entry field has width \p n_cols, and is positioned in \p parent window in place specified by \p begin_y and \p begin_x. The field may be pre-filled with \p initial_string. You may put a restriction on number of characters that can be entered into the field by setting \p chars_max to value > 0. Input behavior may be tuned by \p input_type: none/hidden/integer/numeric, see cdw_ncurses.h for specifics. This widget is just two lines (entry + message), you have to add prompt and other elements separately. \param parent - window in which to display the widget \param begin_y - y coordinate of beginning of the widget in parent window \param begin_x - x coordinate of beginning of the widget in parent window \param n_cols - width of the input line \param initial_string - initial data displayed in input line \param input_type - type of input \param chars_max - limit on number of chars that can be entered by user \return NULL pointer on errors \return pointer to new widget on success */ CDW_INPUT_LINE *cdw_input_line_new(WINDOW *parent, int begin_y, int begin_x, int n_cols, const char *initial_string, int input_type, int chars_max) { CDW_INPUT_LINE *input_line = (CDW_INPUT_LINE *) malloc(sizeof(CDW_INPUT_LINE)); if (!input_line) { cdw_vdm ("ERROR: failed to allocate memory for input line widget\n"); return (CDW_INPUT_LINE *) NULL; } input_line->parent = parent; input_line->input_type = input_type; input_line->chars_max = chars_max; input_line->n_cols = n_cols; input_line->save_on_tab = false; int n_lines = 2; /* one line for input window, second line for message area */ input_line->win = derwin(input_line->parent, n_lines, n_cols, begin_y, begin_x); if (!(input_line->win)) { cdw_vdm ("ERROR: failed to create input line subwindow\n"); cdw_input_line_delete(&input_line); return (CDW_INPUT_LINE *) NULL; } cdw_rv_t crv = cdw_input_line_new_form_setup(input_line, initial_string); if (crv != CDW_OK) { cdw_input_line_delete(&input_line); return (CDW_INPUT_LINE *) NULL; } else { wrefresh(input_line->win); return input_line; } } /** \brief Wrapper for code creating field of input line \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Input line is basically a form with one field (+ line for messages, but this is irrelevant in description of this function). This function calls several other functions that create and configure a form field. This is just a convenient wrapper. Call this function in cdw_input_line_new(). \param input_line - allocated input line, to be configured further by this function \param initial_string - string to be put initially in the input line \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_input_line_new_form_setup(CDW_INPUT_LINE *input_line, const char *initial_string) { input_line->field[1] = (FIELD *) NULL; /* obligatory ending element */ input_line->field[0] = cdw_ncurses_new_input_field(1, input_line->n_cols, /* 1 - one line */ 0, 0, /* begin_y, begin_x */ initial_string, (size_t) input_line->chars_max, input_line->input_type, CDW_COLORS_INPUT); if (!(input_line->field[0])) { cdw_vdm ("ERROR: failed to create form field\n"); return CDW_ERROR; } input_line->form = cdw_ncurses_new_form(input_line->parent, input_line->win, input_line->field); if (!(input_line->form)) { cdw_vdm ("ERROR: failed to create form with new_form()\n"); return CDW_ERROR; } int r = set_current_field(input_line->form, input_line->field[0]); if (r != E_OK) { cdw_vdm ("ERROR: failed to set_current_field with set_current_field(), error code is %s\n", cdw_ncurses_error_string(r)); return CDW_ERROR; } r = form_driver(input_line->form, REQ_END_LINE); if (r != E_OK) { cdw_vdm ("ERROR: failed in form_driver(), the function returns %s\n", cdw_ncurses_error_string(r)); return CDW_ERROR; } return CDW_OK; } /** \brief Delete an input line widget \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Deallocate all memory associated with \p input_line, free the \p input_line itself, set the widget to NULL. \param input_line - pointer to input line widget */ void cdw_input_line_delete(CDW_INPUT_LINE **input_line) { cdw_assert (input_line, "ERROR: passing NULL pointer to the function\n"); if (!(*input_line)) { cdw_vdm ("WARNING: passed NULL widget to the function\n"); return; } /* IMPORTANT: for some reason you have first free fields and then unpost and free form */ if ((*input_line)->field[0]) { free_field((*input_line)->field[0]); unpost_form((*input_line)->form); (*input_line)->field[0] = (FIELD *) NULL; } if ((*input_line)->form) { int e = free_form((*input_line)->form); (*input_line)->form = (FORM *) NULL; if (e != E_OK) { cdw_vdm ("ERROR: free_form() returns \"%s\"\n", cdw_ncurses_error_string(e)); } } if ((*input_line)->win) { delwin(((*input_line)->win)); (*input_line)->win = (WINDOW *) NULL; } free(*input_line); *input_line = (CDW_INPUT_LINE *) NULL; return; } /** \brief Top-level driver for input line widget \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Driver for input line widget - accepts regular keys, handles special keys (Enter, Escape, Tab). Handling of Tab key depends on value of CDW_INPUT_LINE->save_on_tab. If the value is true then Tab key is treated just as Enter key. Pressing Enter or Tab keys is treated as: \li confirmation of entered data, and \li attempt to leave input line, with \li intent to save entered data in \p buffer. \param input_line - widget to be controlled \param buffer - pointer to buffer in which to store result data \param attempts_max - how many times prompt for valid data \return CDW_KEY_ENTER or CDW_KEY_TAB if user pressed Enter or Tab key \return CDW_KEY_ESCAPE if user pressed Escape key \return KEY_EXIT on errors */ int cdw_input_line_driver(CDW_INPUT_LINE *input_line, char **buffer, int attempts_max) { int key = 'a'; for (int i = 0; i < attempts_max; i++) { curs_set(1); /* FIXME: add validation */ key = cdw_input_line_form_driver(input_line); curs_set(0); if (key == CDW_KEY_ENTER || (key == CDW_KEY_TAB && input_line->save_on_tab)) { cdw_rv_t crv = cdw_input_line_get_content(input_line, buffer); if (crv == CDW_OK) { return key; } else { if (i == attempts_max - 1) { /* too many attempts to enter correct string; break loop to avoid printing "try again" error message and to go straight to final error message */ key = CDW_KEY_ESCAPE; break; } else { ; /* key = key */ } } } else if (key == KEY_EXIT) { /* invalid form content */ cdw_vdm ("ERROR: failed to get field buffer\n"); key = KEY_EXIT; } else if (key == CDW_KEY_ESCAPE) { break; } else if (key == CDW_KEY_TAB) { break; } else { cdw_assert (0, "ERROR: incorrect key from one line form driver: %d\n", key); key = KEY_EXIT; break; } } return key; } /** \brief Print (in line's message field) message about insecure character \date Function's top-level comment reviewed on 2012-01-10 \date Function's body reviewed on 2012-01-10 If user enters insecure character into input field, the input line widget won't accept entered string. The widget has to inform user why string hasn't been accepted, and it does it by printing "insecure character X" message in message field. \param input_line - input line in which to print a message \param insecure - string representing insecure character */ void cdw_input_line_driver_message(CDW_INPUT_LINE *input_line, char *insecure) { /* error message can't be longer than input line's width */ int len_max = input_line->n_cols; char *message = (char *) malloc((size_t) len_max + 1); if (!message) { cdw_vdm ("ERROR: failed to malloc() message buffer\n"); return; } /* let's have N variants of error message: the same meaning, but decreasing lengths; let's also hope that at least one of them will be no longer than width of message field; */ #define N_SAFETY_MESSAGES 3 char *messages[N_SAFETY_MESSAGES] = { /* 2TRANS: this is error message in dialog window, "%s" is string with single insecure character; keep short */ _("ERROR: insecure char %s "), /* 2TRANS: this is error message in dialog window, "%s" is string with single insecure character; keep short */ _("Insecure char %s "), /* 2TRANS: this is error message in dialog window, "%s" is string with single insecure character; keep short */ _("Insec. char %s")}; for (int i = 0; i < N_SAFETY_MESSAGES; i++) { /* +1 for ending '\0'; no format string, so will result in COMPILER WARNING */ int n = snprintf(message, (size_t) len_max + 1, messages[i], insecure); if (n < 0) { cdw_vdm ("ERROR: snprintf() returns negative value for string #%d = \"%s\"\n", i, messages[i]); } else if (n >= 0 && n <= len_max) { /* snprintf() printed at most len_max chars (excluding ending '\0'); message #i was short enough, accept it */ break; } else { cdw_vdm ("ERROR: snprintf() truncates message; limit of printable chars = %d, would print %d chars\n", len_max, n); cdw_vdm ("ERROR: attempted to print string \"%s\"\n", messages[i]); cdw_vdm ("ERROR: printed string \"%s\"\n", message); } } /* at this point we have in "message" one of three messages[] string without truncations, or - as last resort - last of messages[] string with truncation */ (void) wattrset(input_line->win, COLOR_PAIR(CDW_COLORS_WARNING)); mvwprintw(input_line->win, 1, 0, message); free(message); message = (char *) NULL; wrefresh(input_line->win); /* error message about insecure character is displayed under input field only for X seconds; during this time input from user is blocked */ sleep(2); /* TODO: it would seem that COLOR_PAIR(input_line->colors) would work, but it doesn't */ (void) wattrset(input_line->win, COLOR_PAIR(CDW_COLORS_DIALOG)); mvwhline(input_line->win, 1, 0, ' ', len_max); wrefresh(input_line->win); return; } /** \brief Put a string into input line \date Function's top-level comment reviewed on 2012-01-10 \date Function's body reviewed on 2012-01-10 You can pass initial string to widget's constructor, but it is sometimes also necessary to update the widget with a string after the widget has been created. The function does just that - enters new content into given input line. \param input_line - widget to update \param string - string to put into input line */ void cdw_input_line_refresh_with_string(CDW_INPUT_LINE *input_line, const char *string) { cdw_assert (string, "ERROR: string passed to function is NULL\n"); int rv = set_field_buffer(input_line->field[0], 0, string); #ifndef NDEBUG cdw_assert (rv == E_OK, "ERROR: failed to set buffer of input line, error = %s\n", cdw_ncurses_error_string(rv)); char *buffer_string = cdw_string_rtrim(field_buffer(input_line->field[0], 0)); cdw_assert(!strcmp(buffer_string, string), "ERROR: buffer string and input string are different:\nbuffer string: \"%s\"\ninput string: \"%s\"\n", buffer_string, string); #endif rv = form_driver(input_line->form, REQ_END_LINE); if (rv != E_OK) { cdw_vdm ("ERROR: failed call to form_driver(), error = %s\n", cdw_ncurses_error_string(rv)); assert (0); } wrefresh(input_line->win); return; } /** \brief Low-level input line driver \date Function's top-level comment reviewed on 2012-01-10 \date Function's body reviewed on 2012-01-10 Low level driver used by cdw_input_line_driver(). It deals directly with ncurses form that is the heart of input line. Function returns when user presses Enter, Tab or Escape. Enter key is usually considered as "save value from input line, and exit the widget". Escape key is considered to mean "don't save value from input line, and exit the widget". Default reaction to Tab key is "exit the widget" - this is because input line may be embedded in a form or multi-widget window. Tab is then necessary to switch focus, and input line must recognize the key. In some applications it may be useful to treat Tab key the same way as Enter key: "save value from input line and exit the widget". Set CDW_INPUT_LINE->save_on_tab to true to achieve this. Function returns CDW_KEY_ESCAPE if user pressed Escape key. Function returns CDW_KEY_TAB if user pressed Tab key, and save_on_tab is not set. Function returns CDW_KEY_TAB if user pressed Tab key, and save_on_tab is set (but see note below). Function returns CDW_KEY_ENTER if user pressed Enter key (but see note below). Note: Function returns CDW_KEY_EXIT if user pressed Enter or Tab, but value entered in form was invalid (value contained unsafe characters). \param input_line - widget to be controlled \return CDW_KEY_ESCAPE \return CDW_KEY_ENTER \return CDW_KEY_TAB \return KEY_EXIT */ int cdw_input_line_form_driver(CDW_INPUT_LINE *input_line) { cdw_assert (input_line->form, "ERROR: can't operate on NULL form"); WINDOW *window = form_win(input_line->form); cdw_assert (window, "ERROR: can't get window of a form with form_win()\n"); bool loop = true; int key = 0; do { int r = E_OK; key = wgetch(window); switch (key) { case KEY_LEFT: r = form_driver(input_line->form, REQ_PREV_CHAR); break; case KEY_RIGHT: r = form_driver(input_line->form, REQ_NEXT_CHAR); break; case KEY_BACKSPACE: r = form_driver(input_line->form, REQ_DEL_PREV); break; case KEY_DC: r = form_driver(input_line->form, REQ_DEL_CHAR); break; case KEY_HOME: r = form_driver(input_line->form, REQ_BEG_LINE); break; case KEY_END: r = form_driver(input_line->form, REQ_END_LINE); break; case CDW_KEY_ESCAPE: case CDW_KEY_ENTER: case CDW_KEY_TAB: loop = false; break; default: /* push user input to form */ r = form_driver(input_line->form, key); if (r != E_OK) { cdw_vdm ("WARNING: form_driver(..., key) returns %s for key %s\n", cdw_ncurses_error_string(r), cdw_ncurses_key_label(key)); } wrefresh(window); break; } /* switch () */ } while (loop); if (key == CDW_KEY_ESCAPE) { return key; } if (key == CDW_KEY_TAB && !(input_line->save_on_tab)) { return key; } /* key treated as "exit form and save value" */ /* flush form buffer */ int r = form_driver(input_line->form, REQ_VALIDATION); if (r != E_OK) { cdw_vdm ("WARNING: form_driver(..., REQ_VALIDATION) returns %s for key %s\n", cdw_ncurses_error_string(r), cdw_ncurses_key_label(key)); return KEY_EXIT; } else { /* return Enter or Tab, letting caller decide how to handle Tab+save_on_tab */ return key; } } /** \brief Try to get string from input line, with security check \date Function's top-level comment reviewed on 2012-01-10 \date Function's body reviewed on 2012-01-10 Try to get string entered into \p input_line, check if content of the string is safe, and save it into \p output_buffer. Print error message in \p input_line if string in the widget is unsafe, and return CDW_ERROR. Return CDW_OK if string is safe. \param input_line - line to get a string from \param output_buffer - pointer to buffer, in which to store the string \return CDW_OK on success \return CDW_ERROR on problems */ cdw_rv_t cdw_input_line_get_content(CDW_INPUT_LINE *input_line, char **output_buffer) { char *local_buffer = (char *) NULL; /* all that can go wrong at this point is malloc() failure - return value will be CDW_ERROR */ cdw_rv_t crv = cdw_ncurses_get_field_buffer(input_line->field[0], &local_buffer, (size_t) input_line->chars_max); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to get field buffer with cdw_ncurses_get_field_buffer()\n"); return CDW_ERROR; } /* TODO: placing security check here makes input line less versatile, as I can imagine places where security checking may be unwanted, or may need different implementation; I have to update implementation of input line so that it is more configurable and universal; */ char insecure[2]; cdw_rv_t sec = cdw_string_security_parser(local_buffer, insecure); if (sec == CDW_OK) { cdw_vdm ("INFO: \"%s\" is secure\n", local_buffer); crv = cdw_string_set(output_buffer, local_buffer); cdw_assert (crv == CDW_OK, "ERROR: failed to save final string \"%s\"\n", local_buffer); /* key = key */ return CDW_OK; } else { cdw_vdm ("ERROR: insecure char in \"%s\"\n", local_buffer); cdw_input_line_driver_message(input_line, insecure); return CDW_ERROR; } } cdw-0.7.1/src/user_interface/widgets/cdw_dropdown.c0000644000175000017500000006660211724475162017330 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_dropdown.c Implementation of dropdown widget - expandable list of items, each item comprised of label and id. */ #include #include #include #include "cdw_dropdown.h" #include "gettext.h" #include "cdw_debug.h" static int cdw_dropdown_expanded_driver(CDW_DROPDOWN *dropdown); static cdw_rv_t cdw_dropdown_expand(CDW_DROPDOWN *dropdown); static cdw_rv_t cdw_dropdown_collapse(CDW_DROPDOWN *dropdown); static void cdw_dropdown_display_current_item_reverse(CDW_DROPDOWN *dropdown, bool reverse); /** \brief Create basis for new dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Create basic data structure representing a dropdown, that can be filled with dropdown items. You have to call cdw_dropdown_add_item() to add items to the dropdown. The dropdown is placed in given \p parent window, with geometry specified by \p begin_y, \p begin_x and \p width. You have to specify maximal number of items in advance, using \p n_items_max argument. Don't forget to call cdw_dropdown_finalize() after adding all items. \param parent - parent window \param begin_y - y coordinate of a dropdown in parent window \param begin_x - x coordinate of a dropdown in parent window \param width - width of a dropdown \param n_items_max - expected maximal number of items in the dropdown \param colors - color scheme for the dropdown \return pointer to new dropdown base structure on success \return NULL on failure */ CDW_DROPDOWN *cdw_dropdown_new(WINDOW *parent, int begin_y, int begin_x, int width, int n_items_max, cdw_colors_t colors) { cdw_assert (parent, "ERROR: parent window is NULL\n"); CDW_DROPDOWN *dropdown = (CDW_DROPDOWN *) malloc(sizeof(CDW_DROPDOWN)); if (!dropdown) { cdw_vdm ("ERROR: failed to allocate memory for dropdown\n"); return (CDW_DROPDOWN *) NULL; } dropdown->n_items_max = n_items_max; dropdown->n_items = 0; dropdown->items = (cdw_id_label_t **) malloc((size_t) (dropdown->n_items_max + 1) * sizeof (cdw_id_label_t *)); if (!dropdown->items) { cdw_vdm ("ERROR: failed to allocate memory for dropdown items\n"); free(dropdown); dropdown = (CDW_DROPDOWN *) NULL; return (CDW_DROPDOWN *) NULL; } else { for (int i = 0; i < dropdown->n_items_max; i++) { dropdown->items[i] = (cdw_id_label_t *) NULL; } } dropdown->parent = parent; dropdown->begin_y = begin_y; dropdown->begin_x = begin_x; dropdown->width = width; dropdown->colors = colors; dropdown->visible = true; return dropdown; } /** \brief Add new item to a dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 1. allocate space for new item and attach it to a dropdown, and 2. copy label and id into new item, and 3. increase counter of items in dropdown \param dropdown - dropdown to which you want to add an item \param id - "id" field of a new item \param label - "label" field of a new item \return CDW_OK on success \return CDW_ERROR on error */ cdw_rv_t cdw_dropdown_add_item(CDW_DROPDOWN *dropdown, cdw_id_t id, const char *label) { cdw_assert (dropdown, "ERROR: passing null dropdown to function\n"); cdw_assert (dropdown->items, "ERROR: dropdown items is null\n"); cdw_assert (dropdown->n_items < dropdown->n_items_max, "ERROR: trying to create item #%d while maximum is #%d\n", dropdown->n_items, dropdown->n_items_max); dropdown->items[dropdown->n_items] = (cdw_id_label_t *) malloc(sizeof (cdw_id_label_t)); if (!dropdown->items[dropdown->n_items]) { cdw_vdm ("ERROR: failed to malloc memory for item #%d\n", dropdown->n_items); return CDW_ERROR; } dropdown->items[dropdown->n_items]->label = strndup(label, (size_t) dropdown->width); if (!dropdown->items[dropdown->n_items]->label) { cdw_vdm ("ERROR: failed to strndup label #%d: \"%s\"\n", dropdown->n_items, label); free(dropdown->items[dropdown->n_items]); dropdown->items[dropdown->n_items] = (cdw_id_label_t *) NULL; return CDW_ERROR; } dropdown->items[dropdown->n_items]->id = id; dropdown->n_items++; return CDW_OK; } /** \brief Do final calls to few functions to finalize creating a dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Call few ncurses functions to set/initialize some fields of a \p dropdown. This prepares the \p dropdown to be usable. This should be the last function called during creation of a dropdown. \param dropdown - dropdown to be finalized \return CDW_OK on success \return CDW_ERROR on failure */ cdw_rv_t cdw_dropdown_finalize(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: passing null dropdown to function\n"); /* standard code creating ITEM elements */ dropdown->menu_items = (ITEM **) calloc((size_t) dropdown->n_items + 1, sizeof(ITEM *)); if (!dropdown->menu_items) { cdw_vdm ("ERROR: calloc()\n"); return CDW_ERROR; } for (int i = 0; i < dropdown->n_items; i++) { dropdown->menu_items[i] = new_item(dropdown->items[i]->label, ""); if (!dropdown->menu_items[i]) { int e = errno; cdw_vdm ("ERROR: failed to create menu item for item #%d with label \"%s\", errno = \"%s\"\n", i, dropdown->items[i]->label, strerror(e)); return CDW_ERROR; } } /* obligatory ending element */ dropdown->menu_items[dropdown->n_items] = (ITEM *) NULL; /* standard code creating MENU element */ dropdown->menu = new_menu(dropdown->menu_items); if (!dropdown->menu) { int e = errno; cdw_vdm ("ERROR: failed to create menu, errno = \"%s\"\n", strerror(e)); return CDW_ERROR; } int parent_x = getbegx(dropdown->parent); int parent_y = getbegy(dropdown->parent); /* menu should be displayed between opening and closing bracket, so it should be narrower than 'width' and moved a bit right, hence -2 */ dropdown->menu_window = newwin(dropdown->n_items, dropdown->width - 2, parent_y + dropdown->begin_y, parent_x + dropdown->begin_x + 1); if (!dropdown->menu_window) { int e = errno; cdw_vdm ("ERROR: failed to create dropdown window, errno = \"%s\"\n", cdw_ncurses_error_string(e)); return CDW_ERROR; } int rv = set_menu_win(dropdown->menu, dropdown->menu_window); if (rv != E_OK) { cdw_vdm ("ERROR: failed to set menu window, errno = \"%s\"\n", cdw_ncurses_error_string(rv)); return CDW_ERROR; } dropdown->menu_window_sub = derwin(dropdown->menu_window, dropdown->n_items, dropdown->width - 2, 0, 0); if (!dropdown->menu_window_sub) { cdw_vdm ("ERROR: failed to create menu subwindow\n"); return CDW_ERROR; } rv = set_menu_sub(dropdown->menu, dropdown->menu_window_sub); if (rv != E_OK) { cdw_vdm ("ERROR: failed to set menu subwindow, errno = \"%s\"\n", cdw_ncurses_error_string(rv)); return CDW_ERROR; } /* remember that post_menu() displays menu in its subwindow, not on the screen - you have to call refresh() to make menu visible to user */ rv = post_menu(dropdown->menu); if (rv != E_OK) { cdw_vdm ("ERROR: failed to post menu, errno = \"%s\"\n", cdw_ncurses_error_string(rv)); return CDW_ERROR; } dropdown->visible = true; return CDW_OK; } /** \brief Redraw window in which a dropdown is displayed \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 'Show' a dropdown simply by (re)drawing and refreshing window, in which dropdown is displayed (not the parent window, but the window used in implementation of the widget). Such dropdown now displays all items available. TODO: this is not the best way to "show" dropdown. \param dropdown - dropdown to show \return CDW_OK */ cdw_rv_t cdw_dropdown_expand(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot show NULL dropdown\n"); cdw_assert (dropdown->menu_window, "ERROR: cannot show dropdown with NULL window\n"); cdw_assert (dropdown->menu_window_sub, "ERROR: cannot show dropdown with NULL subwindow\n"); /* move highlight to current item */ menu_driver(dropdown->menu, REQ_FIRST_ITEM); for (int i = 0; i < dropdown->current_item_ind && i < dropdown->n_items; i++) { menu_driver(dropdown->menu, REQ_DOWN_ITEM); } redrawwin(dropdown->menu_window); redrawwin(dropdown->menu_window_sub); wrefresh(dropdown->menu_window); wrefresh(dropdown->menu_window_sub); return CDW_OK; } /** \brief Collapse given dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Collapse expanded \p dropdown simply by (re)drawing and refreshing its parent window. "Minimized" dropdown with hidden list is still visible, but it only displays selected item. TODO: This may not be the best way to collapse a dropdown. This function does not display currently selected item in place where dropdown is displayed. \param dropdown - dropdown to collapse \return CDW_OK */ cdw_rv_t cdw_dropdown_collapse(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot hide NULL dropdown\n"); cdw_assert (dropdown->parent, "ERROR: cannot hide dropdown with NULL parent\n"); redrawwin(dropdown->parent); wrefresh(dropdown->parent); return CDW_OK; } /** \brief Change visibility of a dropdown to 'invisible' \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Make a \p dropdown invisible. The \p dropdown won't be seen in user interface, and won't be accessible through TAB key. \param dropdown - dropdown to make invisible. */ void cdw_dropdown_make_invisible(CDW_DROPDOWN *dropdown) { mvwhline(dropdown->parent, dropdown->begin_y, dropdown->begin_x, ' ', dropdown->width + 1); wrefresh(dropdown->parent); dropdown->visible = false; return; } /** \brief Change visibility of a dropdown to 'visible' \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Make a \p dropdown visible. The \p dropdown will be seen in user interface, and will be accessible through TAB key. \param dropdown - dropdown to make visible. */ void cdw_dropdown_make_visible(CDW_DROPDOWN *dropdown) { dropdown->visible = true; cdw_dropdown_display_current_item_reverse(dropdown, false); return; } /** \brief Control keyboard input when focus is on dropdown - top level function \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 This function calls cdw_dropdown_expanded_driver() to control keyboard input in expanded \p dropdown. \param dropdown - dropdown that has focus \return CDW_KEY_ENTER if user pressed ENTER in expanded dropdown \return CDW_KEY_ESCAPE if user pressed ESCAPE, Q or q in expanded dropdown */ int cdw_dropdown_driver(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot control NULL dropdown\n"); cdw_assert (dropdown->parent, "ERROR: cannot control dropdown with NULL parent\n"); cdw_dropdown_expand(dropdown); int key = cdw_dropdown_expanded_driver(dropdown); cdw_dropdown_collapse(dropdown); if (key == CDW_KEY_ENTER) { /* when dropdown is closed (hidden), it should remain highlighted, so second parameter is true */ cdw_dropdown_display_current_item_reverse(dropdown, true); } redrawwin(dropdown->parent); wrefresh(dropdown->parent); return key; } /** \brief React to keys pressed by user when given dropdown is expanded (active) \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 React to following keys: HOME, END, DOWN, UP, ENTER, ESCAPE, Q, q, when given dropdown is active/focused. Caller of this function must make sure that \p dropdown is valid. \param dropdown - active dropdown, on which user operates \return CDW_KEY_ENTER if user pressed ENTER, \return CDW_KEY_ESCAPE if user pressed ESCAPE, Q or q */ int cdw_dropdown_expanded_driver(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot control NULL dropdown\n"); /* a bit customized, but otherwise standard ncurses menu driver code */ int key = 'a'; while ((key = wgetch(dropdown->parent)) != ERR) { switch (key) { case CDW_KEY_ESCAPE: /* including 'q' and 'Q', as suggested by RogerX */ case 'q': case 'Q': return CDW_KEY_ESCAPE; case KEY_HOME: menu_driver(dropdown->menu, REQ_FIRST_ITEM); break; case KEY_END: menu_driver(dropdown->menu, REQ_LAST_ITEM); break; case KEY_DOWN: menu_driver(dropdown->menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(dropdown->menu, REQ_UP_ITEM); break; case CDW_KEY_ENTER: { ITEM *item = current_item(dropdown->menu); cdw_assert (item, "ERROR: current item is NULL\n"); /* remember index of selected item */ dropdown->current_item_ind = item_index(item); return CDW_KEY_ENTER; } default: /* other (meaningless in this context) keys */ break; } redrawwin(dropdown->menu_window_sub); wrefresh(dropdown->menu_window_sub); } return CDW_KEY_ESCAPE; } /** \brief Destroy given dropdown, deallocate its resources \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 The function sets *dropdown to NULL. \param dropdown - pointer to dropdown that you want to destroy \return CDW_OK */ cdw_rv_t cdw_dropdown_delete(CDW_DROPDOWN **dropdown) { cdw_assert (dropdown, "ERROR: you passed NULL pointer to function\n"); if (!dropdown) { /* probably called the function when other function that creates dropdown failed to allocate initial memory for dropdown - hence null pointer */ cdw_vdm ("WARNING: you passed NULL dropdown to function\n"); } else { cdw_dropdown_free(*dropdown); *dropdown = (CDW_DROPDOWN *) NULL; } return CDW_OK; } /** \brief Free given dropdown, with all its resources \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Function de-allocates memory pointed to by \p dropdown, but does not set \p dropdown pointer to NULL. The function is usually called by cdw_dropdown_delete(). \param dropdown - dropdown that you want to free */ void cdw_dropdown_free(CDW_DROPDOWN *dropdown) { if (!dropdown) { /* probably called the function when other function that creates dropdown failed to allocate initial memory for dropdown - hence null pointer */ cdw_vdm ("WARNING: you passed NULL dropdown to function\n"); return; } if (dropdown->menu) { unpost_menu(dropdown->menu); free_menu(dropdown->menu); dropdown->menu = (MENU *) NULL; for (int j = 0; j < dropdown->n_items; j++){ free_item(dropdown->menu_items[j]); dropdown->menu_items[j] = (ITEM *) NULL; } free(dropdown->menu_items); dropdown->menu_items = (ITEM **) NULL; } for (int i = 0; i < dropdown->n_items; i++) { if (dropdown->items[i]) { if (dropdown->items[i]->label) { free(dropdown->items[i]->label); dropdown->items[i]->label = (char *) NULL; } else { cdw_vdm ("WARNING: menu item label #%d is null\n", i); } free(dropdown->items[i]); dropdown->items[i] = (cdw_id_label_t *) NULL; } else { cdw_vdm ("WARNING: menu item #%d is null\n", i); } } free(dropdown->items); dropdown->items = (cdw_id_label_t **) NULL; delwin(dropdown->menu_window_sub); dropdown->menu_window_sub = (WINDOW *) NULL; delwin(dropdown->menu_window); dropdown->menu_window = (WINDOW *) NULL; free(dropdown); return; } /** \brief Return index of currently selected (active) dropdown item \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 \param dropdown - dropdown from which caller wants to get index of current item \return index of currently selected item */ int cdw_dropdown_get_current_item_ind(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot get index of item in NULL dropdown\n"); return dropdown->current_item_ind; } /** \brief Display item currently selected in dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Force displaying in parent window current item of given \p dropdown. The item is displayed in its regular color scheme. \param dropdown - dropdown for which you want to display current item */ void cdw_dropdown_display_current_item(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot display current item in NULL dropdown\n"); if (dropdown->visible) { cdw_dropdown_display_current_item_reverse(dropdown, false); } return; } /** \brief Display current item of a dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Force displaying dropdown's current item. You can control mode of displaying through \p reverse argument. When the argument is true, the item is displayed in reverse colors, so the dropdown looks like (but does not behave like!) it has focus. \param dropdown - dropdown for which you want to display current item \param reverse - mode of display */ void cdw_dropdown_display_current_item_reverse(CDW_DROPDOWN *dropdown, bool reverse) { cdw_assert (dropdown, "ERROR: cannot display item in NULL dropdown\n"); if (!dropdown->visible) { return; } cdw_assert (dropdown, "ERROR: cannot show current item of NULL dropdown\n"); cdw_assert (dropdown->parent, "ERROR: cannot show current item of dropdown with NULL parent\n"); /* first erase old content */ if (reverse) { (void) wattrset(dropdown->parent, COLOR_PAIR(dropdown->colors) | A_REVERSE); } else { (void) wattrset(dropdown->parent, COLOR_PAIR(dropdown->colors)); } mvwhline(dropdown->parent, dropdown->begin_y, dropdown->begin_x, ' ', dropdown->width); /* then opening and closing bracket */ mvwprintw(dropdown->parent, dropdown->begin_y, dropdown->begin_x, "["); mvwprintw(dropdown->parent, dropdown->begin_y, dropdown->begin_x + dropdown->width - 1, "]"); /* 'real' content */ mvwprintw(dropdown->parent, dropdown->begin_y, dropdown->begin_x + 1, dropdown->items[dropdown->current_item_ind]->label); /* and now fancy, bolded arrow by the dropdown */ if (reverse) { (void) wattrset(dropdown->parent, COLOR_PAIR(dropdown->colors) | A_REVERSE | A_BOLD); } else { (void) wattrset(dropdown->parent, COLOR_PAIR(dropdown->colors) | A_BOLD); } mvwprintw(dropdown->parent, dropdown->begin_y, dropdown->begin_x + dropdown->width - 2, "v"); (void) wattrset(dropdown->parent, A_NORMAL | COLOR_PAIR(dropdown->colors)); wrefresh(dropdown->parent); return; } /** \brief Highlight given dropdown to mark that it has focus \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Use this function to change appearance of a non-expanded \p dropdown to make it look like it has now focus. After that the \p dropdown may be expanded with appropriate keyboard key. \param dropdown - dropdown that you want to focus on */ void cdw_dropdown_focus(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot focus NULL dropdown\n"); if (dropdown->visible) { cdw_dropdown_display_current_item_reverse(dropdown, true); } else { cdw_vdm ("ERROR: called the function for invisible dropdown\n"); } return; } /** \brief Un-highlight given dropdown to mark that it has lost focus \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Use this function to undo changes of appearance of a non-expanded \p dropdown made by cdw_dropdown_focus() - to make it look like it has lost focus. After that the \p dropdown cannot be expanded with appropriate keyboard key - until it gets focus again. \param dropdown - dropdown that you want to unfocus */ void cdw_dropdown_unfocus(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot unfocus NULL dropdown\n"); if (dropdown->visible) { cdw_dropdown_display_current_item_reverse(dropdown, false); } else { cdw_vdm ("WARNING: called the function for invisible dropdown\n"); } return; } /** \brief Set one of items of dropdown as selected/current value \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Use item's index \p ind to select one of dropdown's item and set it as currently selected/highlighted. \param dropdown - dropdown from which you want to select item \param ind - index of item that you want to select \return CDW_OK on success \return CDW_ERROR on errors (e.g. when there is no item with given index) */ cdw_rv_t cdw_dropdown_set_current_item_by_ind(CDW_DROPDOWN *dropdown, int ind) { cdw_assert (dropdown, "ERROR: cannot set current item for NULL dropdown\n"); if (ind < dropdown->n_items) { dropdown->current_item_ind = ind; cdw_dropdown_display_current_item(dropdown); return CDW_OK; } else { cdw_vdm ("ERROR: index (%d) is larger than number of items (%d)\n", ind, dropdown->n_items); return CDW_ERROR; } } /** \brief Set one of items in dropdown as selected/current value \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Use item's \p id to select one of dropdown's item and set it as currently selected/highlighted. \param dropdown - dropdown from which you want to select item \param id - id of item that you want to select \return CDW_OK on success \return CDW_ERROR on errors (e.g. when there is no item with given id) */ cdw_rv_t cdw_dropdown_set_current_item_by_id(CDW_DROPDOWN *dropdown, cdw_id_t id) { cdw_assert (dropdown, "ERROR: passing null dropdown to function\n"); for (int i = 0; i < dropdown->n_items; i++) { if (dropdown->items[i]->id == id) { dropdown->current_item_ind = i; return CDW_OK; } } cdw_vdm ("ERROR: failed to set current item index by id, id = %lld\n", id); return CDW_ERROR; } /** \brief Get id associated with current item in a dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Get id of item currently selected/highlighted in given \p dropdown. \param dropdown - dropdown that you want to query \return id of current item */ cdw_id_t cdw_dropdown_get_current_item_id(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot set current item id from NULL dropdown\n"); return dropdown->items[dropdown->current_item_ind]->id; } /** \brief Get label associated with current item in a dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Get label of item currently selected/highlighted in given \p dropdown. Returned pointer is owned by a dropdown, as long as the dropdown exists. \param dropdown - dropdown that you want to query \return label of current item */ const char *cdw_dropdown_get_current_item_label(CDW_DROPDOWN *dropdown) { cdw_assert (dropdown, "ERROR: cannot set current item id from NULL dropdown\n"); const char *label = dropdown->items[dropdown->current_item_ind]->label; cdw_assert (label, "ERROR: current label is NULL\n"); return label; } /** \brief Get label of dropdown item specified by index \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Get label of item pointed to by specified index \p ind. Returned pointer is owned by a dropdown, as long as the dropdown exists. \param dropdown - dropdown that you want to query \param ind - index of an item \return label of item specified by index */ const char *cdw_dropdown_get_label_by_ind(CDW_DROPDOWN *dropdown, int ind) { cdw_assert (dropdown, "ERROR: cannot set current item id from NULL dropdown\n"); cdw_assert (ind < dropdown->n_items, "ERROR: index (%d) larger than number of items (%d)\n", ind, dropdown->n_items); char *label = dropdown->items[ind]->label; cdw_assert (label, "ERROR: label #%d is NULL\n", ind); return label; } /** \brief Get label of dropdown item specified by id \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Get label of item indicated by \p id. Returned pointer is owned by a dropdown, as long as the dropdown exists. \param dropdown - dropdown that you want to query \param id - id of an item \return label of item specified by id on success \return NULL on failure (e.g. when there is no such id in given dropdown) */ const char *cdw_dropdown_get_label_by_id(CDW_DROPDOWN *dropdown, cdw_id_t id) { cdw_assert (dropdown, "ERROR: cannot set current item id from NULL dropdown\n"); for (int i = 0; i < dropdown->n_items; i++) { if (dropdown->items[i]->id == id) { char *label = dropdown->items[i]->label; cdw_assert (label, "ERROR: item with id %lld has null label\n", id); return label; } } cdw_vdm ("ERROR: can't find item for id %lld\n", id); return (char *) NULL; } /** \brief Wrapper function for creating a dropdown \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Wrapper for a set of functions creating a dropdown. Useful when you already have a table of 'label-id' pairs - you don't have to explicitly call cdw_dropdown_add_item() for every new item. You don't have to explicitly call cdw_dropdown_finalize() either. Color scheme of the dropdown is hardwired as CDW_COLORS_DIALOG. \param parent - parent window \param begin_y - y coordinate of a dropdown in parent window \param begin_x - x coordinate of a dropdown in parent window \param width - width of a dropdown \param n_items - number of items in 'items' table \param items - table of 'label-id' pairs, with size specified by 'n_items' parameter \return pointer to new and finalized dropdown on success \return NULL pointer on failure */ CDW_DROPDOWN *cdw_dropdown_maker_wrapper(WINDOW *parent, int begin_y, int begin_x, int width, int n_items, cdw_id_clabel_t *items) { CDW_DROPDOWN *dropdown = cdw_dropdown_new(parent, begin_y, begin_x, width, n_items, CDW_COLORS_DIALOG); if (!dropdown) { cdw_vdm ("ERROR: failed to create new dropdown\n"); return (CDW_DROPDOWN *) NULL; } for (int i = 0; i < n_items; i++) { cdw_rv_t crv = cdw_dropdown_add_item(dropdown, items[i].id, _(items[i].label)); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to add item #%d (id = %lld, label = \"%s\"\n", i, items[i].id, items[i].label); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } } cdw_rv_t crv = cdw_dropdown_finalize(dropdown); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to finalize dropdown\n"); cdw_dropdown_delete(&dropdown); return (CDW_DROPDOWN *) NULL; } return dropdown; } cdw-0.7.1/src/user_interface/widgets/cdw_checkbox.c0000644000175000017500000002006411703120446017237 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_checkbox.c Implementation of "checkbox" widget. A checkbox looks like this: [ ] - unchecked checkbox [X] - checked checkbox. A checkbox is placed in given parent window in given place. Can be checked on or off. It provides a pointer to which client code can assign a callback. The callback will be called when state of the checkbox changes. A checkbox can be visible (and visitable by use of TAB key) or not. Checkbox is visible by default. */ #include #include "cdw_checkbox.h" #include "cdw_debug.h" /* Definitions made so that there is no possibility of using "x" and "X" in different places */ #define CDW_CHECKBOX_CHECKED "X" #define CDW_CHECKBOX_UNCHECKED " " /** \brief Create new check box \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Create new checkbox widget, place it in given position of given parent window. Set its initial state. Remember to assign value to CDW_CHECKBOX->on_toggle. \param parent - parent window, in which the checkbox will be displayed \param begin_y - y coordinate of the checkbox \param begin_x - x coordinate of the checkbox \param checked - initial state of the checkbox \return pointer to the widget on success \return NULL on failure */ CDW_CHECKBOX *cdw_checkbox_new(WINDOW *parent, int begin_y, int begin_x, bool checked) { cdw_assert (parent, "ERROR: parent window can't be NULL\n"); CDW_CHECKBOX *checkbox = (CDW_CHECKBOX *) malloc(sizeof (CDW_CHECKBOX)); if (!checkbox) { cdw_vdm ("ERROR: failed to malloc checkbox\n"); return (CDW_CHECKBOX *) NULL; } checkbox->parent = parent; checkbox->begin_y = begin_y; checkbox->begin_x = begin_x; checkbox->checked = checked; checkbox->visible = true; checkbox->on_toggle = (cdw_form_widget_function_t) NULL; return checkbox; } /** \brief Change state of the checkbox \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Change state of the checkbox from checked to unchecked, or the other way around. Return state of a checkbox after the change. \param checkbox - checkbox to toggle. \return true if checkbox has been toggled on \return false if checkbox has been toggled off */ bool cdw_checkbox_toggle(CDW_CHECKBOX *checkbox) { if (checkbox->visible) { if (checkbox->checked) { mvwprintw(checkbox->parent, checkbox->begin_y, checkbox->begin_x, CDW_CHECKBOX_UNCHECKED); checkbox->checked = false; } else { mvwprintw(checkbox->parent, checkbox->begin_y, checkbox->begin_x, CDW_CHECKBOX_CHECKED); checkbox->checked = true; } /* why the cursor moves? why? why? */ wmove(checkbox->parent, checkbox->begin_y, checkbox->begin_x); } else { cdw_vdm ("WARNING: called the function for invisible checkbox\n"); } return checkbox->checked; } /** \brief Get current state of a checkbox \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Get current state of a checkbox widget. Return true if checkbox is checked (marked), return false otherwise. \param checkbox - checkbox to query \return true if checkbox is checked \return false if checkbox is not checked */ bool cdw_checkbox_get_state(CDW_CHECKBOX *checkbox) { cdw_assert (checkbox, "ERROR: checkbox is NULL\n"); return checkbox->checked; } /** \brief Set checkbox to a specified state \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Set given \p checkbox to state \p checked. The \p checked argument may be true - the checkbox will become checked, or it can be false - the checkbox will become unchecked. If state of a checkbox before function call is the same as value of \p checked, no change is made to the state of a checkbox. Function returns state of a checkbox after the new state has been set. \param checkbox - checkbox to be altered \param checked - intended state of a checkbox, true or false \return true if checkbox has been set to "checked" \return false if checkbox has been set to "unchecked" */ bool cdw_checkbox_set_state(CDW_CHECKBOX *checkbox, bool checked) { cdw_assert (checkbox, "ERROR: checkbox is NULL\n"); if (checkbox->visible) { checkbox->checked = checked; if (checkbox->checked) { mvwprintw(checkbox->parent, checkbox->begin_y, checkbox->begin_x, CDW_CHECKBOX_CHECKED); } else { mvwprintw(checkbox->parent, checkbox->begin_y, checkbox->begin_x, CDW_CHECKBOX_UNCHECKED); } wrefresh(checkbox->parent); } else { cdw_vdm ("WARNING: called the function for invisible checkbox\n"); } return checkbox->checked; } /** \brief Set visibility of a checkbox \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Turn checkbox visible or invisible. Invisible checkbox is not visible in UI (obvious), and can't be visited with key movement (e.g. TAB key). Value of \p visible should be true if checkbox should be visible, and false otherwise. \param checkbox - checkbox to be modified \param visible - intended visibility of the checkbox */ void cdw_checkbox_set_visibility(CDW_CHECKBOX *checkbox, bool visible) { cdw_assert (checkbox, "ERROR: checkbox is NULL\n"); checkbox->visible = visible; return; } /** \brief Delete a checkbox \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Deallocate all resources associated with given \p checkbox. Set \p *checkbox pointer to NULL. Function accepts NULL argument. \param checkbox - pointer to checkbox to be deleted. */ void cdw_checkbox_delete(CDW_CHECKBOX **checkbox) { cdw_assert(checkbox, "ERROR: passing to the function a NULL pointer to a widget\n"); if (!*checkbox) { cdw_vdm ("WARNING: passing NULL checkbox to the function\n"); return; } free(*checkbox); *checkbox = (CDW_CHECKBOX *) NULL; return; } /** \brief Free resources related to checkbox \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Free all memory related to given \p checkbox. Function does not set \p checkbox to NULL. \param checkbox - checkbox to be freed */ void cdw_checkbox_free(CDW_CHECKBOX *checkbox) { if (!checkbox) { cdw_vdm ("WARNING: passing NULL checkbox to the function\n"); return; } free(checkbox); return; } /** \brief Draw a checkbox - if it is visible \date Function's top-level comment reviewed on 2012-01-09 \date Function's body reviewed on 2012-01-09 Draw borders of a checkbox, and draw an 'X' representing its state (if the checkbox is checked). Do this only if a checkbox is visible. Draw the checkbox in its parent window. \param checkbox - checkbox to be drawn */ void cdw_checkbox_draw(CDW_CHECKBOX *checkbox) { cdw_assert (checkbox, "ERROR: checkbox is NULL\n"); if (!checkbox->visible) { cdw_vdm ("WARNING: calling the function for invisible checkbox\n"); return; } mvwprintw(checkbox->parent, checkbox->begin_y, checkbox->begin_x - 1, "[%s]", checkbox->checked? CDW_CHECKBOX_CHECKED : CDW_CHECKBOX_UNCHECKED); redrawwin(checkbox->parent); wrefresh(checkbox->parent); return; } cdw-0.7.1/src/Makefile.in0000644000175000017500000011241311722443565012064 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/Makefile.cdw.am ChangeLog bin_PROGRAMS = cdw$(EXEEXT) check_PROGRAMS = cdw_tests$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = cdw-cddb.$(OBJEXT) cdw-main.$(OBJEXT) am_cdw_OBJECTS = $(am__objects_1) cdw_OBJECTS = $(am_cdw_OBJECTS) cdw_DEPENDENCIES = \ $(top_builddir)/src/external_tools/libcdwexternaltools.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets.a \ $(top_builddir)/src/disc_and_drive/libcdwdiscanddrive.a \ $(top_builddir)/src/tasks/libcdwtasks.a \ $(top_builddir)/src/external_tools/libcdwexternaltools.a \ $(top_builddir)/src/user_interface/libcdwuserinterface.a \ $(top_builddir)/src/utilities/libcdwutilities.a \ $(top_builddir)/src/native_file_system/libcdwnativefilesystem.a \ $(top_builddir)/src/optical_file_systems/libcdwopticalfilesystems.a \ $(top_builddir)/src/configuration/libcdwconfiguration.a \ $(top_builddir)/src/user_interface/libcdwuserinterface.a \ $(top_builddir)/gnulib/lib/libgnulib.a \ $(top_builddir)/src/external_tools/libcdwexternaltools.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets.a \ $(top_builddir)/src/tasks/libcdwtasks.a am__objects_2 = cdw_tests-cddb.$(OBJEXT) cdw_tests-main.$(OBJEXT) am_cdw_tests_OBJECTS = $(am__objects_2) cdw_tests_OBJECTS = $(am_cdw_tests_OBJECTS) cdw_tests_DEPENDENCIES = \ $(top_builddir)/src/utilities/libcdwutilities_check.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets_check.a \ $(top_builddir)/src/user_interface/libcdwuserinterface_check.a \ $(top_builddir)/src/disc_and_drive/libcdwdiscanddrive_check.a \ $(top_builddir)/src/external_tools/libcdwexternaltools_check.a \ $(top_builddir)/src/tasks/libcdwtasks_check.a \ $(top_builddir)/src/utilities/libcdwutilities_check.a \ $(top_builddir)/src/native_file_system/libcdwnativefilesystem_check.a \ $(top_builddir)/src/optical_file_systems/libcdwopticalfilesystems_check.a \ $(top_builddir)/src/configuration/libcdwconfiguration_check.a \ $(top_builddir)/src/user_interface/libcdwuserinterface_check.a \ $(top_builddir)/gnulib/lib/libgnulib.a \ $(top_builddir)/src/external_tools/libcdwexternaltools_check.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets_check.a \ $(top_builddir)/src/tasks/libcdwtasks_check.a DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(cdw_SOURCES) $(cdw_tests_SOURCES) DIST_SOURCES = $(cdw_SOURCES) $(cdw_tests_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive HEADERS = $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # list subdirs, into which "make" should recurse during build process; # convenience libraries will be built in these directories SUBDIRS = tasks external_tools user_interface utilities configuration native_file_system optical_file_systems disc_and_drive # _FILE_OFFSET_BITS=64 - large file support (>2GB on 32-bit systems); # this is unnecessary on 64-bit systems, but I had to add this # after doing some basic tests on i386 machine; see sourceforge # #2545568 defect for details; # # This is aso required by libburn - see information on top of # /usr/include/libburn/libburn.h # "include" files of convenience libraries # don't use $(top_builddir), it fails during "make distcheck" CDW_BUILD_CPPFLAGS = -D _FILE_OFFSET_BITS=64 -I$(top_srcdir)/src/ \ -I$(top_srcdir)/src/external_tools/ -I$(top_srcdir)/src/tasks/ \ -I$(top_srcdir)/src/utilities/ \ -I$(top_srcdir)/src/user_interface/widgets/ \ -I$(top_srcdir)/src/user_interface/ \ -I$(top_srcdir)/src/configuration/ \ -I$(top_srcdir)/src/native_file_system/ \ -I$(top_srcdir)/src/optical_file_systems/ \ -I$(top_srcdir)/src/disc_and_drive/ \ -I$(top_srcdir)/gnulib/lib/ # quoted descriptions of flags come from # http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html # using C99 standard + gnu extensions; I don't use pure c99, because # it may trigger problems caused by asm/byteorder.h, which is included # by linux/cdrom.h header, which in turn is included by cdw_drive.h CDW_BUILD_CFLAGS_C_STD = -std=gnu99 CDW_BUILD_CFLAGS_PEDANTIC = -pedantic # "Check calls to printf and scanf, etc., to make sure that the arguments # supplied have types appropriate to the format string specified..." # "If -Wformat is specified, also warn about uses of format functions that # represent possible security problems..." # "If -Wformat is specified, also warn if the format string is not # a string literal..." # "These warnings will help you find at compile time code that can try # to write into a string constant..." # "Warn about anything that depends on the “size of” a function type or # of void...." # "Warn whenever a switch statement does not have a default case" # sometimes gcc can complain about unreachable code when using constant # strings like that: strcmp(some_string, "some string"); # "Warn whenever a pointer is cast such that the required alignment of # the target is increased..." # "Warn whenever a pointer is cast so as to remove a type qualifier from # the target type..." # "Warn whenever a function call is cast to a non-matching type..." CDW_BUILD_CFLAGS_WARNINGS = -Wformat -Wformat-security \ -Wformat-nonliteral -Wwrite-strings -Wpointer-arith \ -Wswitch-default -Wunreachable-code -Wcast-align -Wcast-qual \ -Wbad-function-cast -Wall -Wshadow -Wextra -Wswitch-enum \ -Wfloat-equal -Wchar-subscripts -Winline -Wsign-compare \ -Wnested-externs -Wredundant-decls -Wconversion -Wlogical-op \ -Wno-declaration-after-statement -Wmissing-prototypes \ -Wmissing-declarations -Wstrict-prototypes @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) -DNDEBUG @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -O2 @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -g -O0 $(CDW_BUILD_CFLAGS_WARNINGS) $(CDW_BUILD_CFLAGS_PEDANTIC) # define common AM_CPPFLAGS and AM_CFLAGS # define common target used by flymake # use $(top_srcdir); $(top_builddir) would fail during "make distcheck" # define common linker flags AM_LDFLAGS = -lmenuw -lformw -lpanelw -lncursesw -lpthread -lcdio -liso9660 -lm -lburn # list source files cdw_source_files = cddb.c main.c noinst_HEADERS = cddb.h main.h cdw_CPPFLAGS = $(AM_CPPFLAGS) # I'm listing some libs twice to help linker resolve # some possible cyclic dependencies cdw_LDADD = $(top_builddir)/src/external_tools/libcdwexternaltools.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets.a \ $(top_builddir)/src/disc_and_drive/libcdwdiscanddrive.a \ $(top_builddir)/src/tasks/libcdwtasks.a \ $(top_builddir)/src/external_tools/libcdwexternaltools.a \ $(top_builddir)/src/user_interface/libcdwuserinterface.a \ $(top_builddir)/src/utilities/libcdwutilities.a \ $(top_builddir)/src/native_file_system/libcdwnativefilesystem.a \ $(top_builddir)/src/optical_file_systems/libcdwopticalfilesystems.a \ $(top_builddir)/src/configuration/libcdwconfiguration.a \ $(top_builddir)/src/user_interface/libcdwuserinterface.a \ $(top_builddir)/gnulib/lib/libgnulib.a \ $(top_builddir)/src/external_tools/libcdwexternaltools.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets.a \ $(top_builddir)/src/tasks/libcdwtasks.a cdw_SOURCES = $(cdw_source_files) cdw_tests_CPPFLAGS = -DCDW_UNIT_TEST_CODE $(AM_CPPFLAGS) # I'm listing some libs twice to help linker resolve # some possible cyclic dependencies cdw_tests_LDADD = $(top_builddir)/src/utilities/libcdwutilities_check.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets_check.a \ $(top_builddir)/src/user_interface/libcdwuserinterface_check.a \ $(top_builddir)/src/disc_and_drive/libcdwdiscanddrive_check.a \ $(top_builddir)/src/external_tools/libcdwexternaltools_check.a \ $(top_builddir)/src/tasks/libcdwtasks_check.a \ $(top_builddir)/src/utilities/libcdwutilities_check.a \ $(top_builddir)/src/native_file_system/libcdwnativefilesystem_check.a \ $(top_builddir)/src/optical_file_systems/libcdwopticalfilesystems_check.a \ $(top_builddir)/src/configuration/libcdwconfiguration_check.a \ $(top_builddir)/src/user_interface/libcdwuserinterface_check.a \ $(top_builddir)/gnulib/lib/libgnulib.a \ $(top_builddir)/src/external_tools/libcdwexternaltools_check.a \ $(top_builddir)/src/user_interface/widgets/libcdwwidgets_check.a \ $(top_builddir)/src/tasks/libcdwtasks_check.a cdw_tests_SOURCES = $(cdw_source_files) # something related to cdw_tests check_SCRIPTS = greptest.sh # CLEANFILES extends list of files that need to be removed when # calling "make clean" CLEANFILES = greptest.sh TESTS = $(check_SCRIPTS) all: all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.cdw.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.cdw.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) cdw$(EXEEXT): $(cdw_OBJECTS) $(cdw_DEPENDENCIES) $(EXTRA_cdw_DEPENDENCIES) @rm -f cdw$(EXEEXT) $(LINK) $(cdw_OBJECTS) $(cdw_LDADD) $(LIBS) cdw_tests$(EXEEXT): $(cdw_tests_OBJECTS) $(cdw_tests_DEPENDENCIES) $(EXTRA_cdw_tests_DEPENDENCIES) @rm -f cdw_tests$(EXEEXT) $(LINK) $(cdw_tests_OBJECTS) $(cdw_tests_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw-cddb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_tests-cddb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_tests-main.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` cdw-cddb.o: cddb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw-cddb.o -MD -MP -MF $(DEPDIR)/cdw-cddb.Tpo -c -o cdw-cddb.o `test -f 'cddb.c' || echo '$(srcdir)/'`cddb.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw-cddb.Tpo $(DEPDIR)/cdw-cddb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cddb.c' object='cdw-cddb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw-cddb.o `test -f 'cddb.c' || echo '$(srcdir)/'`cddb.c cdw-cddb.obj: cddb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw-cddb.obj -MD -MP -MF $(DEPDIR)/cdw-cddb.Tpo -c -o cdw-cddb.obj `if test -f 'cddb.c'; then $(CYGPATH_W) 'cddb.c'; else $(CYGPATH_W) '$(srcdir)/cddb.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw-cddb.Tpo $(DEPDIR)/cdw-cddb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cddb.c' object='cdw-cddb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw-cddb.obj `if test -f 'cddb.c'; then $(CYGPATH_W) 'cddb.c'; else $(CYGPATH_W) '$(srcdir)/cddb.c'; fi` cdw-main.o: main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw-main.o -MD -MP -MF $(DEPDIR)/cdw-main.Tpo -c -o cdw-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw-main.Tpo $(DEPDIR)/cdw-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='cdw-main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c cdw-main.obj: main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw-main.obj -MD -MP -MF $(DEPDIR)/cdw-main.Tpo -c -o cdw-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw-main.Tpo $(DEPDIR)/cdw-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='cdw-main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` cdw_tests-cddb.o: cddb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw_tests-cddb.o -MD -MP -MF $(DEPDIR)/cdw_tests-cddb.Tpo -c -o cdw_tests-cddb.o `test -f 'cddb.c' || echo '$(srcdir)/'`cddb.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw_tests-cddb.Tpo $(DEPDIR)/cdw_tests-cddb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cddb.c' object='cdw_tests-cddb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw_tests-cddb.o `test -f 'cddb.c' || echo '$(srcdir)/'`cddb.c cdw_tests-cddb.obj: cddb.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw_tests-cddb.obj -MD -MP -MF $(DEPDIR)/cdw_tests-cddb.Tpo -c -o cdw_tests-cddb.obj `if test -f 'cddb.c'; then $(CYGPATH_W) 'cddb.c'; else $(CYGPATH_W) '$(srcdir)/cddb.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw_tests-cddb.Tpo $(DEPDIR)/cdw_tests-cddb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cddb.c' object='cdw_tests-cddb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw_tests-cddb.obj `if test -f 'cddb.c'; then $(CYGPATH_W) 'cddb.c'; else $(CYGPATH_W) '$(srcdir)/cddb.c'; fi` cdw_tests-main.o: main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw_tests-main.o -MD -MP -MF $(DEPDIR)/cdw_tests-main.Tpo -c -o cdw_tests-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw_tests-main.Tpo $(DEPDIR)/cdw_tests-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='cdw_tests-main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw_tests-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c cdw_tests-main.obj: main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdw_tests-main.obj -MD -MP -MF $(DEPDIR)/cdw_tests-main.Tpo -c -o cdw_tests-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cdw_tests-main.Tpo $(DEPDIR)/cdw_tests-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='cdw_tests-main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdw_tests_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdw_tests-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$${col}$$dashes$${std}"; \ echo "$${col}$$banner$${std}"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \ echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-recursive all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-TESTS check-am clean clean-binPROGRAMS \ clean-checkPROGRAMS clean-generic ctags ctags-recursive \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-binPROGRAMS install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-binPROGRAMS # used by flymake check-syntax: $(CC) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(AM_CFLAGS) -fsyntax-only $(CHK_SOURCES) .PHONY: check-syntax greptest.sh: echo './cdw_tests | grep "test result: success"' > greptest.sh chmod +x greptest.sh # sources, references # # source of snippet related to "check_SCRIPTS" and greptests.sh: # http://www.freesoftwaremagazine.com/books/agaal/automatically_writing_makefiles_with_autotools # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/src/utilities/0000755000175000017500000000000011736031302012073 500000000000000cdw-0.7.1/src/utilities/cdw_cdll.h0000644000175000017500000000153711400035162013741 00000000000000#ifndef H_CDW_CDLL #define H_CDW_CDLL #include /* size_t */ #include #include "main.h" #include "cdw_cdll.h" /** \brief Type of variables that are elements of list * * Should not be used outside of filelist.c and filelist_tests.c */ typedef struct _cdw_cdll_t cdw_cdll_t; struct _cdw_cdll_t { cdw_cdll_t *prev; cdw_cdll_t *next; void *data; }; /* public */ cdw_rv_t cdw_cdll_init(cdw_cdll_t **head); cdw_rv_t cdw_cdll_destroy(cdw_cdll_t *head); cdw_rv_t cdw_cdll_append(cdw_cdll_t *head, void *data); cdw_rv_t cdw_cdll_remove(cdw_cdll_t **head, size_t i); // void *cdw_cdll_get_ith(cdw_cdll_t *head, size_t i); void *cdw_cdll_ith_data(cdw_cdll_t *head, size_t i); size_t cdw_cdll_length(cdw_cdll_t *head); bool cdw_cdll_is_empty(cdw_cdll_t *head); /* unit tests */ void cdw_cdll_run_tests(void); #endif /* H_CDW_CDLL */ cdw-0.7.1/src/utilities/cdw_dll.c0000644000175000017500000011440711722437532013610 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cdw_dll.c \brief Bug-ridden implementation of doubly linked list */ #include #include #include #include "cdw_dll.h" #include "cdw_debug.h" /** \brief Create first item of list Call this function when user wants to add batch of data. This is not too elegant solution and probably will be put in a wrapper of some kind in future. \param head - pointer to beginning of list \param data - initial data to be put into list \return CDW_ERROR if some malloc error occurs \return CDW_NO if list is already initialized \return CDW_OK if success */ cdw_rv_t cdw_dll_init(cdw_dll_item_t **head, void *data) { cdw_assert (*head == (cdw_dll_item_t *) NULL, "list already initialized\n"); cdw_assert (data != (void *) NULL, "data should not be null\n"); if (*head != (cdw_dll_item_t *) NULL) { return CDW_NO; } *head = (cdw_dll_item_t *) cdw_dll_new_item(data); if (*head == (cdw_dll_item_t *) NULL) { return CDW_ERROR; } else { return CDW_OK; } } /** * \brief Returns last item of list * * Useful when you want to append new file at the end of list * * \return NULL if list is empty * \return pointer to last item on list if list is not empty */ cdw_dll_item_t *cdw_dll_last_item(cdw_dll_item_t *head) { cdw_assert (head != (cdw_dll_item_t *) NULL, "trying to get last item from uninitialized list\n"); cdw_dll_item_t *i; for (i = head; i->next != (cdw_dll_item_t *) NULL; i = i->next) ; return i; } /** * \brief Allocate new list item, initialize it with given file * * This function creates its own copy of file. * Pointers to previous and next list item are initialized to * (cdw_dll_item_t *) NULL. cdw_file must have non-empty, non-NULL * fullpath field, otherwise the file is treated as invalid. Other * fields of cdw_file are not checked. * * \param cdw_file - file that you want to store in given list item * * \return Pointer to freshly allocated list item * \return NULL if malloc fails * \return NULL if 'fullpath' field of file is NULL or empty string */ cdw_dll_item_t *cdw_dll_new_item(void *data) { if (data == (void *) NULL) { return (cdw_dll_item_t *) NULL; } cdw_dll_item_t *i = (cdw_dll_item_t *) malloc(sizeof(cdw_dll_item_t)); if (i == (cdw_dll_item_t *) NULL) { return (cdw_dll_item_t *) NULL; } i->data = data; i->next = (cdw_dll_item_t *) NULL; i->prev = (cdw_dll_item_t *) NULL; return i; } /** * \brief Append file at the end of list * * The function does not check if given file already exists on list. * In order to avoid duplicates on list you have to search for given * file on the list first. * * The function will initialize list if list is empty. * * \param cdw_file - file that you want to append to list * * \return CDW_GEN_ERROR if malloc fails * \return CDW_OK if success */ cdw_rv_t cdw_dll_append_non_unique(cdw_dll_item_t **head, void *data) { cdw_assert (data != (void *) NULL, "data can't be null\n"); if (cdw_dll_is_empty(*head)) { return cdw_dll_init(head, data); } else { cdw_dll_item_t *last = cdw_dll_last_item(*head); if (last == (cdw_dll_item_t *) NULL) { return CDW_ERROR; } else { cdw_dll_item_t *f = cdw_dll_new_item(data); if (f == (cdw_dll_item_t *) NULL) { return CDW_ERROR; } else { last->next = f; f->prev = last; f->next = (cdw_dll_item_t *) NULL; return CDW_OK; } } } } /** * \brief Append file at the end of list * * The function checks if given file already exists on list. File * that would be duplicate on the list is not appended and CDW_NO is returned. * * \param cdw_file - file that you want to store on list * * \return CDW_ERROR if malloc fails * \return CDW_NO if file is already on list * \return CDW_OK if success */ cdw_rv_t cdw_dll_append(cdw_dll_item_t **head, void *data, bool (*pred)(const void *, const void *)) { cdw_assert (data != (void *) NULL, "can't append null data\n"); cdw_assert (pred != NULL, "predicate function is null\n"); if (cdw_dll_is_member(*head, data, pred)) { return CDW_NO; } else { /* will init list if necessary */ return cdw_dll_append_non_unique(head, data); } } /** * \brief Return pointer to i-th item on list * * \param i - index of item that you want to obtain (0-based) * * \return Pointer to i-th item of list * \return NULL if index is too large or list is empty */ cdw_dll_item_t *cdw_dll_ith_item(cdw_dll_item_t *head, size_t i) { cdw_assert (head != (cdw_dll_item_t *) NULL, "trying to get element from uninitialized list\n"); cdw_dll_item_t *item = (cdw_dll_item_t *) NULL; size_t j = 0; for (item = head, j = 0; item != (cdw_dll_item_t *) NULL && j <= i; item = item->next, j++) { if (j == i) { return item; } } return (cdw_dll_item_t *) NULL; } /** * \brief Remove i-th file from list * * \param i - index of file that should be removed (zero-based) * * \return CDW_ERROR if list is empty or other error occurred * \return CDW_OK if success */ cdw_rv_t cdw_dll_remove_ith_item(cdw_dll_item_t **head, size_t i) { if (*head == (cdw_dll_item_t *) NULL) { return CDW_ERROR; } cdw_dll_item_t *f = cdw_dll_ith_item(*head, i); if (f == (cdw_dll_item_t *) NULL) { return CDW_ERROR; } /* works even if j is first or last node, NULLs are preserved */ if (f->next != (cdw_dll_item_t *) NULL) { f->next->prev = f->prev; } if (f->prev != (cdw_dll_item_t *) NULL) { f->prev->next = f->next; } f->data = (void *) NULL; if (f == *head) { /* we have to create new list's head */ *head = f->next; } free(f); f = (cdw_dll_item_t *) NULL; return CDW_OK; } /** * \brief Count files on list * * \return Number of files on list (0 if no files) */ size_t cdw_dll_length(cdw_dll_item_t *head) { if (head == (cdw_dll_item_t *) NULL) { cdw_sdm ("called length with head == NULL\n"); } cdw_dll_item_t *f; size_t i = 0; for (f = head; f; f = f->next) { i++; } return i; } /** \brief Remove all links of a list \date Function's top-level comment reviewed on 2012-02-16 \date Function's body reviewed on 2012-02-16 Function deallocates all links of a list, but does not deallocate payload of the list. \param head - beginning of a list \return CDW_OK */ cdw_rv_t cdw_dll_clean(cdw_dll_t *head) { if (!head) { cdw_vdm ("WARNING: passed null list to the function\n"); return CDW_OK; } for (cdw_dll_t *f = head; f; ) { cdw_dll_t *tmp = f->next; f->data = (void *) NULL; free(f); f = tmp; } return CDW_OK; } /** \brief Deallocate a list (links and payload) \date Function's top-level comment reviewed on 2012-02-16 \date Function's body reviewed on 2012-02-16 Function deallocates all links of a list, and all payload of the list. Deallocation of the payload is made using \p dealloc function. All pointers are set to NULL, including \p head. \param head - beginning of a list \param dealloc - deallocator function, freeing payload memory \return CDW_OK */ cdw_rv_t cdw_dll_delete(cdw_dll_t **head, cdw_deallocator_t dealloc) { cdw_assert (head, "ERROR: passed NULL pointer to a list\n"); if (!*head) { cdw_vdm ("WARNING: passed null list to the function\n"); return CDW_OK; } for (cdw_dll_t *f = *head; f; ) { cdw_dll_t *tmp = f->next; dealloc(f->data); f->data = (void *) NULL; f->next = (cdw_dll_t *) NULL; f->prev = (cdw_dll_t *) NULL; free(f); f = tmp; } *head = (cdw_dll_t *) NULL; return CDW_OK; } /** * \brief Check if list is empty * * You could use cdw_dll_items() and check if its return value is * zero, but cdw_dll_is_empty() is faster when calling it for long, * non-empty lists. * * \return true if list is empty * \return false if list is not empty */ bool cdw_dll_is_empty(cdw_dll_item_t *head) { if (head == (cdw_dll_item_t *) NULL) { return true; } else { return false; } } /** * \brief Check if given file is already on the list * * Search for given file on the list. Return true if * the file is on the list, return false if the file is not on * the list. * * The function also works for empty list: it returns false. * * This piece of code is used in only one place, but I put it in * function so that I can test it more easily. Additionally caller * code looks cleaner. * * \param cdw_file - file which you want to look for on the list * * \return true if given file is on the list * \return false if given file is not on the list (or the list is empty) */ bool cdw_dll_is_member(cdw_dll_item_t *head, void *data, bool (*pred)(const void *, const void *)) { cdw_assert (data != (void *) NULL, "data is null\n"); cdw_assert (pred != NULL, "predicate function is null\n"); if (head == (cdw_dll_item_t *) NULL) { return false; } cdw_dll_item_t *f; for (f = head; f != (cdw_dll_item_t *) NULL; f = f->next) { if (pred(data, f->data)) { return true; } } return false; } #ifdef CDW_UNIT_TEST_CODE /* *********************** */ /* *** unit tests code *** */ /* *********************** */ /* I want to test if this dll implementation can correctly store and retrieve data of type a bit more complicated than simple int. I could use cdw_file_t, but in order to keep this unit tests module independent of other cdw modules, I'm creating new data type solely for purpose of testing dll module: cdw_dll_test_data_t. */ #define TEST_STRING_LEN 30+1 typedef struct { char string[TEST_STRING_LEN]; char c; int i; bool boolean; } cdw_dll_test_data_t; #define N_TEST_ITEMS 7 cdw_dll_test_data_t test_data[N_TEST_ITEMS] = { { "name_zero", 'a', 1, true}, { "name_one", 'b', 22, false }, { "name_two", 'c', 333, true }, { "name_three", 'd', 4444, false }, { "name_four", 'e', 5, true }, { "name_six", 'f', 66, false }}; bool cdw_dll_test_data_equal(const void *data1, const void *data2); static void test_cdw_dll_init(void); static void test_cdw_dll_new_item(void); static void test_cdw_dll_is_member(void); static void test_cdw_dll_is_empty(void); static void test_cdw_dll_append(void); static void test_cdw_dll_ith_item(void); void cdw_dll_run_tests(void) { fprintf(stderr, "testing cdw_dll.c\n"); test_cdw_dll_new_item(); test_cdw_dll_init(); test_cdw_dll_is_member(); test_cdw_dll_is_empty(); test_cdw_dll_append(); test_cdw_dll_ith_item(); fprintf(stderr, "done\n\n"); return; } void test_cdw_dll_init(void) { fprintf(stderr, "\ttesting cdw_dll_init()... "); cdw_dll_item_t *head = (cdw_dll_item_t *) NULL; cdw_rv_t crv = CDW_OK; cdw_dll_test_data_t *in = test_data; size_t len = 0; bool test; /* test length of empty list */ len = cdw_dll_length(head); cdw_assert_test (len == 0, "ERROR: invalid length of empty list: %d\n", (int) len); /* test function checking empty list */ test = cdw_dll_is_empty(head); cdw_assert_test (test == true, "ERROR: empty list recognized as non-empty"); /* test initialization of list */ crv = cdw_dll_init(&head, (void *) in); cdw_assert_test (crv == CDW_OK, "ERROR: failed to initialize\n"); cdw_assert_test (head->data == in, "ERROR: head is invalid\n"); /* test correctness of first element */ cdw_dll_test_data_t *out = (cdw_dll_test_data_t *) head->data; cdw_assert_test (in == out, "ERROR: in and out are different\n"); cdw_assert_test (cdw_dll_test_data_equal(in, out), "ERROR: in and out are different (2)\n"); /* this test will trigger assertion in cdw_dll_init() in debug builds, and will return CDW_NO when assertions are disabled */ /* cdw_test_data_t *in2 = test_data + 1; crv = cdw_dll_init(&head, (void *) NULL); cdw_assert_test (crv == CDW_NO, "function tries to initialize initialized list\n"); */ /* we won't test attempting to append second element to list by init(), because the function isn't designed to do so */ /* test that size of freshly initialized list is equal 1 */ len = cdw_dll_length(head); cdw_assert_test (len == 1, "ERROR: invalid length of list with one element: %d\n", (int) len); /* test that list with one element is not empty */ test = cdw_dll_is_empty(head); cdw_assert_test (test == false, "ERROR: empty list recognized as non-empty"); crv = cdw_dll_clean(head); cdw_assert_test (crv == CDW_OK, "ERROR: list not cleaned properly\n"); head = (cdw_dll_item_t *) NULL; fprintf(stderr, "OK\n"); } void test_cdw_dll_new_item(void) { fprintf(stderr, "\ttesting cdw_dll_new_item()... "); cdw_dll_item_t *item; /* test calling creator with null argument */ item = cdw_dll_new_item((void *) NULL); cdw_assert_test (item == (cdw_dll_item_t *) NULL, "ERROR: function didn't recognize null argument\n"); /* test creating new element from correct data/argument */ cdw_dll_test_data_t *in = test_data; item = cdw_dll_new_item((void *) in); cdw_assert_test (item != (cdw_dll_item_t *) NULL, "ERROR: function didn't create non-null item\n"); cdw_assert_test (item->next == (cdw_dll_item_t *) NULL, "ERROR: function didn't create proper ->next link\n"); cdw_assert_test (item->prev == (cdw_dll_item_t *) NULL, "ERROR: function didn't create proper ->prev link\n"); /* test that data was correctly stored in new element */ cdw_dll_test_data_t *out = (cdw_dll_test_data_t *) item->data; cdw_assert_test (cdw_dll_test_data_equal(in, out), "ERROR: in and out data are not equal\n"); /* test that single-element list has length equal to 1 */ size_t len = cdw_dll_length(item); cdw_assert_test (len == 1, "ERROR: incorrect length of 1-elem list: %d\n", (int) len); /* test removing element from one-element list */ cdw_rv_t crv = cdw_dll_remove_ith_item(&item, 0); cdw_assert_test (crv == CDW_OK, "ERROR: head of 1-elem list not removed properly\n"); cdw_assert_test (item == (cdw_dll_item_t *) NULL, "ERROR: head of 1-elem list not null-ed properly\n"); /* test that list with all elements removed has length equal to zero */ len = cdw_dll_length(item); cdw_assert_test (len == 0, "ERROR: incorrect length of empty list: %d\n", (int) len); fprintf(stderr, "OK\n"); return; } void test_cdw_dll_is_member(void) { fprintf(stderr, "\ttesting cdw_dll_is_member() and cdw_dll_length()... "); size_t len = 0; bool test; cdw_dll_test_data_t *data1 = &(test_data[0]); cdw_dll_test_data_t *data2 = &(test_data[1]); cdw_dll_test_data_t *data3 = &(test_data[2]); cdw_dll_test_data_t *data4 = &(test_data[3]); cdw_dll_test_data_t *data5 = &(test_data[4]); cdw_dll_test_data_t *data6 = &(test_data[5]); cdw_dll_test_data_t *never_added_data7 = &(test_data[6]); /* 0-elem list */ cdw_dll_item_t *item1 = (cdw_dll_item_t *) NULL; len = cdw_dll_length(item1); cdw_assert_test (len == 0, "ERROR: incorrect length of 0-elem list: %d\n", (int) len); test = cdw_dll_is_member(item1, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: input data1 found on empty list\n"); /* 1-elem list */ item1 = cdw_dll_new_item((void *) data1); cdw_assert_test (item1 != (cdw_dll_item_t *) NULL, "ERROR: failed to create 1st item\n"); cdw_dll_item_t *head = item1; len = cdw_dll_length(head); cdw_assert_test (len == 1, "ERROR: incorrect length of 1-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data0 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == false, "data2 found on list before adding the data\n"); /* 2-elem list */ cdw_dll_item_t *item2 = cdw_dll_new_item((void *) data2); cdw_assert_test (item2 != (cdw_dll_item_t *) NULL, "ERROR: failed to create 2nd item\n"); item1->next = item2; item2->prev = item1; len = cdw_dll_length(head); cdw_assert_test (len == 2, "ERROR: incorrect length of 2-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data0 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data1 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data2 found on list before adding the data\n"); /* 3-elem list */ cdw_dll_item_t *item3 = cdw_dll_new_item((void *) data3); cdw_assert_test (item3 != (cdw_dll_item_t *) NULL, "ERROR: failed to create 3rd item\n"); item2->next = item3; item3->prev = item2; len = cdw_dll_length(head); cdw_assert_test (len == 3, "ERROR: incorrect length of 3-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data1 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data3 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data4 found on list before adding the data\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never_added_data7 found on list\n"); /* 4-elem list */ cdw_dll_item_t *item4 = cdw_dll_new_item((void *) data4); cdw_assert_test (item4 != (cdw_dll_item_t *) NULL, "ERROR: failed to create 4th item\n"); item3->next = item4; item4->prev = item3; len = cdw_dll_length(head); cdw_assert_test (len == 4, "ERROR: incorrect length of 4-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data1 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data3 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data4 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data5 found on list before adding the data\n"); /* 5-elem list */ cdw_dll_item_t *item5 = cdw_dll_new_item((void *) data5); cdw_assert_test (item5 != (cdw_dll_item_t *) NULL, "ERROR: failed to create 5th item\n"); item4->next = item5; item5->prev = item4; len = cdw_dll_length(head); cdw_assert_test (len == 5, "ERROR: incorrect length of 5-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data1 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data3 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data4 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data5 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data6 found on list before adding the data\n"); /* 6-elem list */ cdw_dll_item_t *item6 = cdw_dll_new_item((void *) data6); cdw_assert_test (item6 != (cdw_dll_item_t *) NULL, "ERROR: failed to create 6th item\n"); item5->next = item6; item6->prev = item5; len = cdw_dll_length(head); cdw_assert_test (len == 6, "ERROR: incorrect length of 6-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data1 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data3 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data4 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data5 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data6 not found after adding it\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never added data7 found on list\n"); /* we have 6-elem list: removing element 3 */ item3->prev->next = item3->next; item3->next->prev = item3->prev; free(item3); item3 = (cdw_dll_item_t *) NULL; len = cdw_dll_length(head); cdw_assert_test (len == 5, "ERROR: incorrect length of 5-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data1 not found\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data3 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data4 not found\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data5 not found\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data6 not found\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never added data7 found on list\n"); /* we have 5-elem list: removed element 3, removing element 5 */ item5->prev->next = item5->next; item5->next->prev = item5->prev; free(item5); item5 = (cdw_dll_item_t *) NULL; len = cdw_dll_length(head); cdw_assert_test (len == 4, "ERROR: incorrect length of 4-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data1 not found\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data3 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data4 not found\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data5 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data6 not found\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never added data7 found on list\n"); /* we have 4-elem list: removed elements 3 and 5, removing element 1 */ item1->next->prev = item1->prev; head = item1->next; free(item1); item1 = (cdw_dll_item_t *) NULL; len = cdw_dll_length(head); cdw_assert_test (len == 3, "ERROR: incorrect length of 3-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data1 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data3 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data4 not found\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data5 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data6 not found\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never added data7 found on list\n"); /* we have 3-elem list: removed elements 3, 5 and 1, removing element 4 */ item4->prev->next = item4->next; item4->next->prev = item4->prev; free(item4); item4 = (cdw_dll_item_t *) NULL; len = cdw_dll_length(head); cdw_assert_test (len == 2, "ERROR: incorrect length of 2-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data1 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data3 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data4 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data5 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data6 not found\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never added data7 found on list\n"); /* we have 2-elem list: removed elements 3, 5, 1 and 4, removing element 6 */ item6->prev->next = item6->next; //item6->next->prev = item6->prev; /* item 6 is last on list */ free(item6); item6 = (cdw_dll_item_t *) NULL; len = cdw_dll_length(head); cdw_assert_test (len == 1, "ERROR: incorrect length of 1-elem list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data1 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == true, "ERROR: data2 not found\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data3 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data4 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data5 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data6 found after removing it\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never added data7 found on list\n"); /* we have 1-elem list: removed elements 3, 5, 1, 4 and 6, removing element 2 */ /* this is the last elem on list, any references to fields of previous or next element are illegal item2->prev->next = item2->next; item2->next->prev = item2->prev; */ free(item2); item2 = (cdw_dll_item_t *) NULL; head = (cdw_dll_item_t *) NULL; len = cdw_dll_length(head); cdw_assert_test (len == 0, "ERROR: incorrect length of empty list: %d\n", (int) len); test = cdw_dll_is_member(head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data1 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data2 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data3 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data4, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data4 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data5, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data5 found after removing it\n"); test = cdw_dll_is_member(head, (void *) data6, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: data6 found after removing it\n"); test = cdw_dll_is_member(head, (void *) never_added_data7, cdw_dll_test_data_equal); cdw_assert_test (test == false, "ERROR: never added data7 found on list\n"); fprintf(stderr, "OK\n"); return; } void test_cdw_dll_is_empty(void) { fprintf(stderr, "\ttesting cdw_dll_is_empty()... "); cdw_dll_item_t *head = (cdw_dll_item_t *) NULL; bool test = cdw_dll_is_empty(head); cdw_assert_test (test == true, "ERROR: failed to recognize empty list\n"); int var; head = (cdw_dll_item_t *) &var; test = cdw_dll_is_empty(head); cdw_assert_test (test == false, "ERROR: failed to recognize non-empty list\n"); head = cdw_dll_new_item(&var); cdw_assert_test (test == false, "ERROR: failed to recognize non-empty list (2)\n"); cdw_rv_t crv = cdw_dll_clean(head); cdw_assert_test (crv == CDW_OK, "ERROR: list not cleaned properly\n"); head = (cdw_dll_item_t *) NULL; fprintf(stderr, "OK\n"); return; } void test_cdw_dll_append(void) { fprintf(stderr, "\ttesting cdw_dll_append()... "); cdw_dll_test_data_t *data1 = &(test_data[0]); cdw_dll_test_data_t *data2 = &(test_data[1]); cdw_dll_test_data_t *data3 = &(test_data[2]); cdw_dll_test_data_t *retrieved = (cdw_dll_test_data_t *) NULL; cdw_dll_item_t *head = (cdw_dll_item_t *) NULL; /* *** append first item *** */ cdw_rv_t crv = cdw_dll_append(&head, (void *) data1, cdw_dll_test_data_equal); cdw_assert_test (crv == CDW_OK, "ERROR: data1 not appended correctly\n"); /* appending data to empty list should not modify links */ cdw_assert_test (head->next == (cdw_dll_item_t *) NULL, "invalid next (1)"); cdw_assert_test (head->prev == (cdw_dll_item_t *) NULL, "invalid prev (1)"); /* check data from head */ cdw_assert_test (head->data != (void *) NULL, "ERROR: data of first item is null\n"); retrieved = (cdw_dll_test_data_t *) head->data; cdw_assert_test (retrieved == data1, "ERROR: incorrect data pointer in first appended item\n"); cdw_assert_test (cdw_dll_test_data_equal(retrieved, data1), "ERROR: incorrect data in first appended item\n"); /* *** append second item *** */ crv = cdw_dll_append(&head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (crv == CDW_OK, "ERROR: data2 not appended correctly\n"); /* first check links */ cdw_assert_test (head->prev == (cdw_dll_item_t *) NULL, "ERROR: head's prev is not null\n"); cdw_assert_test (head->next->prev == head, "ERROR: second element doesn't link to first\n"); cdw_assert_test (head->next->next == (cdw_dll_item_t *) NULL, "ERROR: last element's next is not null\n"); /* check data from head */ cdw_assert_test (head->data != (void *) NULL, "ERROR: data of first item is null\n"); retrieved = (cdw_dll_test_data_t *) head->data; cdw_assert_test (retrieved == data1, "ERROR: incorrect data pointer in first appended item\n"); cdw_assert_test (cdw_dll_test_data_equal(retrieved, data1), "ERROR: incorrect data in first appended item\n"); /* check data from second element of list */ cdw_assert_test (head->next->data != (void *) NULL, "ERROR: data of second item is null\n"); retrieved = (cdw_dll_test_data_t *) head->next->data; cdw_assert_test (retrieved == data2, "ERROR: incorrect data pointer in second appended item\n"); cdw_assert_test (cdw_dll_test_data_equal(retrieved, data2), "ERROR: incorrect data in second appended item\n"); /* *** append third item *** */ crv = cdw_dll_append(&head, (void *) data3, cdw_dll_test_data_equal); cdw_assert_test (crv == CDW_OK, "ERROR: data3 not appended correctly\n"); /* first check links */ cdw_assert_test (head->prev == (cdw_dll_item_t *) NULL, "ERROR: head's prev is not null\n"); cdw_assert_test (head->next->prev == head, "ERROR: second element doesn't link to first\n"); cdw_assert_test (head->next->next != (cdw_dll_item_t *) NULL, "ERROR: second element's next is null\n"); cdw_assert_test (head->next->next->prev == head->next, "ERROR: last element's prev is invalid\n"); cdw_assert_test (head->next->next->next == (cdw_dll_item_t *) NULL, "ERROR: last elemeent's next is not null\n"); /* check data from head */ cdw_assert_test (head->data != (void *) NULL, "ERROR: data of first item is null\n"); retrieved = (cdw_dll_test_data_t *) head->data; cdw_assert_test (retrieved == data1, "ERROR: incorrect data pointer in first appended item\n"); cdw_assert_test (cdw_dll_test_data_equal(retrieved, data1), "ERROR: incorrect data in first appended item\n"); /* check data from second element of list */ cdw_assert_test (head->next->data != (void *) NULL, "ERROR: data of second item is null\n"); retrieved = (cdw_dll_test_data_t *) head->next->data; cdw_assert_test (retrieved == data2, "ERROR: incorrect data pointer in second appended item\n"); cdw_assert_test (cdw_dll_test_data_equal(retrieved, data2), "ERROR: incorrect data in second appended item\n"); /* check data from third element of list */ cdw_assert_test (head->next->next->data != (void *) NULL, "ERROR: data of third item is null\n"); retrieved = (cdw_dll_test_data_t *) head->next->next->data; cdw_assert_test (retrieved == data3, "ERROR: incorrect data pointer in third appended item\n"); cdw_assert_test (cdw_dll_test_data_equal(retrieved, data3), "ERROR: incorrect data in third appended item\n"); /* *** attempt to append append data2 for a second time *** */ size_t len1 = cdw_dll_length(head); crv = cdw_dll_append(&head, (void *) data2, cdw_dll_test_data_equal); cdw_assert_test (crv == CDW_NO, "ERROR: data2 was not recognized as being on list\n"); size_t len2 = cdw_dll_length(head); cdw_assert_test (len1 == len2, "ERROR: length mismatch\n"); cdw_assert_test (len2 == 3, "ERROR: incorrect length"); /* check data in all three elements */ retrieved = (cdw_dll_test_data_t *) head->data; cdw_assert_test (retrieved == data1, "ERROR: incorrect data pointer in first appended item\n"); retrieved = (cdw_dll_test_data_t *) head->next->data; cdw_assert_test (retrieved == data2, "ERROR: incorrect data pointer in second appended item\n"); retrieved = (cdw_dll_test_data_t *) head->next->next->data; cdw_assert_test (retrieved == data3, "ERROR: incorrect data pointer in third appended item\n"); /* check links in last element */ cdw_assert_test (head->next->next->next == (cdw_dll_item_t *) NULL, "ERROR: last element's next is incorrect\n"); cdw_assert_test (head->next->next->prev->prev == head, "ERROR: incorrect chain\n"); crv = cdw_dll_clean(head); cdw_assert_test (crv == CDW_OK, "ERROR: list not cleaned properly\n"); head = (cdw_dll_item_t *) NULL; fprintf(stderr, "OK\n"); return; } void test_cdw_dll_ith_item(void) { fprintf(stderr, "\ttesting cdw_dll_ith_item() and cdw_dll_last_item()... "); cdw_dll_item_t *head = (cdw_dll_item_t *) NULL; for (int i = 0; i < N_TEST_ITEMS; i++) { cdw_rv_t crv = cdw_dll_append(&head, &(test_data[i]), cdw_dll_test_data_equal); cdw_assert_test (crv == CDW_OK, "ERROR: data%d not appended correctly\n", i + 1); cdw_dll_item_t *item = cdw_dll_last_item(head); cdw_dll_test_data_t *data = (cdw_dll_test_data_t *) item->data; cdw_assert_test (data == &(test_data[i]), "ERROR: failed to get correct last item\n"); cdw_assert_test (cdw_dll_test_data_equal(data, (&test_data[i])), "ERROR: retrieved last data doesn't match original\n"); } for (int i = 0; i < N_TEST_ITEMS; i++) { cdw_dll_item_t *item = cdw_dll_ith_item(head, (size_t) i); cdw_dll_test_data_t *data = (cdw_dll_test_data_t *) item->data; cdw_assert_test (data == &(test_data[i]), "ERROR: retrieved data%d pointer doesn't match original\n", i + 1); cdw_assert_test (cdw_dll_test_data_equal(data, (&test_data[i])), "ERROR: retrieved data%d doesn't match original\n", i + 1); } /* index larger than number of items on list */ cdw_dll_item_t *item = cdw_dll_ith_item(head, N_TEST_ITEMS); cdw_assert_test (item == (cdw_dll_item_t *) NULL, "ERROR: function can't handle index larger than number of items\n"); item = cdw_dll_ith_item(head, 100); cdw_assert_test (item == (cdw_dll_item_t *) NULL, "ERROR: function can't handle index larger than number of items (2)\n"); cdw_rv_t crv = cdw_dll_clean(head); cdw_assert_test (crv == CDW_OK, "ERROR: list not cleaned properly\n"); head = (cdw_dll_item_t *) NULL; fprintf(stderr, "OK\n"); return; } bool cdw_dll_test_data_equal(const void *data1, const void *data2) { const cdw_dll_test_data_t *d1 = (const cdw_dll_test_data_t *) data1; const cdw_dll_test_data_t *d2 = (const cdw_dll_test_data_t *) data2; if (strcmp(d1->string, d2->string)) { cdw_sdm ("INFO: string1 != string2: \"%s\" != \"%s\"\n", d1->string, d2->string); return false; } if (d1->c != d2->c) { cdw_sdm ("INFO: char1 != char2: \"%c\" != \"%c\"\n", d1->c, d2->c); return false; } if (d1->i != d2->i) { cdw_sdm ("INFO: int1 != int2: \"%d\" != \"%d\"\n", d1->i, d2->i); return false; } if (d1->boolean != d2->boolean) { cdw_sdm ("INFO: bool1 != bool2: \"%s\" != \"%s\"\n", d1->boolean ? "true" : "false", d2->boolean ? "true" : "false"); return false; } return true; } #endif /* CDW_UNIT_TEST_CODE */ cdw-0.7.1/src/utilities/cdw_sys.h0000644000175000017500000000044011717547040013647 00000000000000#ifndef H_CDW_SYS #define H_CDW_SYS #include #include /* cdio_fs_t */ #include "main.h" cdw_rv_t cdw_sys_check_file_system_support(cdio_fs_t cdio_fs); int cdw_sys_signal_handlers_init(void); char *cdw_sys_env_path(void); #endif /* H_CDW_SYS */ cdw-0.7.1/src/utilities/Makefile.in0000644000175000017500000010145111722443565014077 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.cdw.am subdir = src/utilities ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libcdwutilities_a_AR = $(AR) $(ARFLAGS) libcdwutilities_a_LIBADD = am__objects_1 = cdw_sys.$(OBJEXT) cdw_cdll.$(OBJEXT) cdw_dll.$(OBJEXT) \ cdw_string.$(OBJEXT) cdw_utils.$(OBJEXT) cdw_logging.$(OBJEXT) \ cdw_regex.$(OBJEXT) am_libcdwutilities_a_OBJECTS = $(am__objects_1) libcdwutilities_a_OBJECTS = $(am_libcdwutilities_a_OBJECTS) libcdwutilities_check_a_AR = $(AR) $(ARFLAGS) libcdwutilities_check_a_LIBADD = am__objects_2 = libcdwutilities_check_a-cdw_sys.$(OBJEXT) \ libcdwutilities_check_a-cdw_cdll.$(OBJEXT) \ libcdwutilities_check_a-cdw_dll.$(OBJEXT) \ libcdwutilities_check_a-cdw_string.$(OBJEXT) \ libcdwutilities_check_a-cdw_utils.$(OBJEXT) \ libcdwutilities_check_a-cdw_logging.$(OBJEXT) \ libcdwutilities_check_a-cdw_regex.$(OBJEXT) am_libcdwutilities_check_a_OBJECTS = $(am__objects_2) libcdwutilities_check_a_OBJECTS = \ $(am_libcdwutilities_check_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libcdwutilities_a_SOURCES) \ $(libcdwutilities_check_a_SOURCES) DIST_SOURCES = $(libcdwutilities_a_SOURCES) \ $(libcdwutilities_check_a_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TXT2TAGS = @TXT2TAGS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ METASOURCES = AUTO sources = cdw_sys.c cdw_sys.h \ cdw_cdll.c cdw_cdll.h \ cdw_dll.c cdw_dll.h \ cdw_string.c cdw_string.h \ cdw_utils.c cdw_utils.h \ cdw_logging.c cdw_logging.h \ cdw_regex.c cdw_regex.h \ cdw_debug.h gettext.h # _FILE_OFFSET_BITS=64 - large file support (>2GB on 32-bit systems); # this is unnecessary on 64-bit systems, but I had to add this # after doing some basic tests on i386 machine; see sourceforge # #2545568 defect for details; # # This is aso required by libburn - see information on top of # /usr/include/libburn/libburn.h # "include" files of convenience libraries # don't use $(top_builddir), it fails during "make distcheck" CDW_BUILD_CPPFLAGS = -D _FILE_OFFSET_BITS=64 -I$(top_srcdir)/src/ \ -I$(top_srcdir)/src/external_tools/ -I$(top_srcdir)/src/tasks/ \ -I$(top_srcdir)/src/utilities/ \ -I$(top_srcdir)/src/user_interface/widgets/ \ -I$(top_srcdir)/src/user_interface/ \ -I$(top_srcdir)/src/configuration/ \ -I$(top_srcdir)/src/native_file_system/ \ -I$(top_srcdir)/src/optical_file_systems/ \ -I$(top_srcdir)/src/disc_and_drive/ \ -I$(top_srcdir)/gnulib/lib/ # quoted descriptions of flags come from # http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html # using C99 standard + gnu extensions; I don't use pure c99, because # it may trigger problems caused by asm/byteorder.h, which is included # by linux/cdrom.h header, which in turn is included by cdw_drive.h CDW_BUILD_CFLAGS_C_STD = -std=gnu99 CDW_BUILD_CFLAGS_PEDANTIC = -pedantic # "Check calls to printf and scanf, etc., to make sure that the arguments # supplied have types appropriate to the format string specified..." # "If -Wformat is specified, also warn about uses of format functions that # represent possible security problems..." # "If -Wformat is specified, also warn if the format string is not # a string literal..." # "These warnings will help you find at compile time code that can try # to write into a string constant..." # "Warn about anything that depends on the “size of” a function type or # of void...." # "Warn whenever a switch statement does not have a default case" # sometimes gcc can complain about unreachable code when using constant # strings like that: strcmp(some_string, "some string"); # "Warn whenever a pointer is cast such that the required alignment of # the target is increased..." # "Warn whenever a pointer is cast so as to remove a type qualifier from # the target type..." # "Warn whenever a function call is cast to a non-matching type..." CDW_BUILD_CFLAGS_WARNINGS = -Wformat -Wformat-security \ -Wformat-nonliteral -Wwrite-strings -Wpointer-arith \ -Wswitch-default -Wunreachable-code -Wcast-align -Wcast-qual \ -Wbad-function-cast -Wall -Wshadow -Wextra -Wswitch-enum \ -Wfloat-equal -Wchar-subscripts -Winline -Wsign-compare \ -Wnested-externs -Wredundant-decls -Wconversion -Wlogical-op \ -Wno-declaration-after-statement -Wmissing-prototypes \ -Wmissing-declarations -Wstrict-prototypes @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) -DNDEBUG @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CPPFLAGS = $(CDW_BUILD_CPPFLAGS) @CDW_BUILD_DEBUG_ENABLED_FALSE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -O2 @CDW_BUILD_DEBUG_ENABLED_TRUE@AM_CFLAGS = $(CDW_BUILD_CFLAGS_C_STD) -g -O0 $(CDW_BUILD_CFLAGS_WARNINGS) $(CDW_BUILD_CFLAGS_PEDANTIC) # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake # don't use $(top_builddir), it fails during "make distcheck" # static convenience library; "noinst" means: "build, but # don't install in user's system" noinst_LIBRARIES = libcdwutilities.a libcdwutilities_a_SOURCES = $(sources) # library built only for purposes of testing (checking) check_LIBRARIES = libcdwutilities_check.a libcdwutilities_check_a_SOURCES = $(sources) libcdwutilities_check_a_CPPFLAGS = -DCDW_UNIT_TEST_CODE $(AM_CPPFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.cdw.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/utilities/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/utilities/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.cdw.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkLIBRARIES: -test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES) clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libcdwutilities.a: $(libcdwutilities_a_OBJECTS) $(libcdwutilities_a_DEPENDENCIES) $(EXTRA_libcdwutilities_a_DEPENDENCIES) -rm -f libcdwutilities.a $(libcdwutilities_a_AR) libcdwutilities.a $(libcdwutilities_a_OBJECTS) $(libcdwutilities_a_LIBADD) $(RANLIB) libcdwutilities.a libcdwutilities_check.a: $(libcdwutilities_check_a_OBJECTS) $(libcdwutilities_check_a_DEPENDENCIES) $(EXTRA_libcdwutilities_check_a_DEPENDENCIES) -rm -f libcdwutilities_check.a $(libcdwutilities_check_a_AR) libcdwutilities_check.a $(libcdwutilities_check_a_OBJECTS) $(libcdwutilities_check_a_LIBADD) $(RANLIB) libcdwutilities_check.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_cdll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_dll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_logging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_string.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_sys.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdw_utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwutilities_check_a-cdw_cdll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwutilities_check_a-cdw_dll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwutilities_check_a-cdw_logging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwutilities_check_a-cdw_regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwutilities_check_a-cdw_string.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwutilities_check_a-cdw_sys.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdwutilities_check_a-cdw_utils.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` libcdwutilities_check_a-cdw_sys.o: cdw_sys.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_sys.o -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_sys.Tpo -c -o libcdwutilities_check_a-cdw_sys.o `test -f 'cdw_sys.c' || echo '$(srcdir)/'`cdw_sys.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_sys.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_sys.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_sys.c' object='libcdwutilities_check_a-cdw_sys.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_sys.o `test -f 'cdw_sys.c' || echo '$(srcdir)/'`cdw_sys.c libcdwutilities_check_a-cdw_sys.obj: cdw_sys.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_sys.obj -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_sys.Tpo -c -o libcdwutilities_check_a-cdw_sys.obj `if test -f 'cdw_sys.c'; then $(CYGPATH_W) 'cdw_sys.c'; else $(CYGPATH_W) '$(srcdir)/cdw_sys.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_sys.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_sys.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_sys.c' object='libcdwutilities_check_a-cdw_sys.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_sys.obj `if test -f 'cdw_sys.c'; then $(CYGPATH_W) 'cdw_sys.c'; else $(CYGPATH_W) '$(srcdir)/cdw_sys.c'; fi` libcdwutilities_check_a-cdw_cdll.o: cdw_cdll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_cdll.o -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_cdll.Tpo -c -o libcdwutilities_check_a-cdw_cdll.o `test -f 'cdw_cdll.c' || echo '$(srcdir)/'`cdw_cdll.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_cdll.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_cdll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_cdll.c' object='libcdwutilities_check_a-cdw_cdll.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_cdll.o `test -f 'cdw_cdll.c' || echo '$(srcdir)/'`cdw_cdll.c libcdwutilities_check_a-cdw_cdll.obj: cdw_cdll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_cdll.obj -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_cdll.Tpo -c -o libcdwutilities_check_a-cdw_cdll.obj `if test -f 'cdw_cdll.c'; then $(CYGPATH_W) 'cdw_cdll.c'; else $(CYGPATH_W) '$(srcdir)/cdw_cdll.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_cdll.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_cdll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_cdll.c' object='libcdwutilities_check_a-cdw_cdll.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_cdll.obj `if test -f 'cdw_cdll.c'; then $(CYGPATH_W) 'cdw_cdll.c'; else $(CYGPATH_W) '$(srcdir)/cdw_cdll.c'; fi` libcdwutilities_check_a-cdw_dll.o: cdw_dll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_dll.o -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_dll.Tpo -c -o libcdwutilities_check_a-cdw_dll.o `test -f 'cdw_dll.c' || echo '$(srcdir)/'`cdw_dll.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_dll.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_dll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_dll.c' object='libcdwutilities_check_a-cdw_dll.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_dll.o `test -f 'cdw_dll.c' || echo '$(srcdir)/'`cdw_dll.c libcdwutilities_check_a-cdw_dll.obj: cdw_dll.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_dll.obj -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_dll.Tpo -c -o libcdwutilities_check_a-cdw_dll.obj `if test -f 'cdw_dll.c'; then $(CYGPATH_W) 'cdw_dll.c'; else $(CYGPATH_W) '$(srcdir)/cdw_dll.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_dll.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_dll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_dll.c' object='libcdwutilities_check_a-cdw_dll.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_dll.obj `if test -f 'cdw_dll.c'; then $(CYGPATH_W) 'cdw_dll.c'; else $(CYGPATH_W) '$(srcdir)/cdw_dll.c'; fi` libcdwutilities_check_a-cdw_string.o: cdw_string.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_string.o -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_string.Tpo -c -o libcdwutilities_check_a-cdw_string.o `test -f 'cdw_string.c' || echo '$(srcdir)/'`cdw_string.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_string.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_string.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_string.c' object='libcdwutilities_check_a-cdw_string.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_string.o `test -f 'cdw_string.c' || echo '$(srcdir)/'`cdw_string.c libcdwutilities_check_a-cdw_string.obj: cdw_string.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_string.obj -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_string.Tpo -c -o libcdwutilities_check_a-cdw_string.obj `if test -f 'cdw_string.c'; then $(CYGPATH_W) 'cdw_string.c'; else $(CYGPATH_W) '$(srcdir)/cdw_string.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_string.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_string.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_string.c' object='libcdwutilities_check_a-cdw_string.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_string.obj `if test -f 'cdw_string.c'; then $(CYGPATH_W) 'cdw_string.c'; else $(CYGPATH_W) '$(srcdir)/cdw_string.c'; fi` libcdwutilities_check_a-cdw_utils.o: cdw_utils.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_utils.o -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_utils.Tpo -c -o libcdwutilities_check_a-cdw_utils.o `test -f 'cdw_utils.c' || echo '$(srcdir)/'`cdw_utils.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_utils.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_utils.c' object='libcdwutilities_check_a-cdw_utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_utils.o `test -f 'cdw_utils.c' || echo '$(srcdir)/'`cdw_utils.c libcdwutilities_check_a-cdw_utils.obj: cdw_utils.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_utils.obj -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_utils.Tpo -c -o libcdwutilities_check_a-cdw_utils.obj `if test -f 'cdw_utils.c'; then $(CYGPATH_W) 'cdw_utils.c'; else $(CYGPATH_W) '$(srcdir)/cdw_utils.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_utils.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_utils.c' object='libcdwutilities_check_a-cdw_utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_utils.obj `if test -f 'cdw_utils.c'; then $(CYGPATH_W) 'cdw_utils.c'; else $(CYGPATH_W) '$(srcdir)/cdw_utils.c'; fi` libcdwutilities_check_a-cdw_logging.o: cdw_logging.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_logging.o -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_logging.Tpo -c -o libcdwutilities_check_a-cdw_logging.o `test -f 'cdw_logging.c' || echo '$(srcdir)/'`cdw_logging.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_logging.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_logging.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_logging.c' object='libcdwutilities_check_a-cdw_logging.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_logging.o `test -f 'cdw_logging.c' || echo '$(srcdir)/'`cdw_logging.c libcdwutilities_check_a-cdw_logging.obj: cdw_logging.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_logging.obj -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_logging.Tpo -c -o libcdwutilities_check_a-cdw_logging.obj `if test -f 'cdw_logging.c'; then $(CYGPATH_W) 'cdw_logging.c'; else $(CYGPATH_W) '$(srcdir)/cdw_logging.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_logging.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_logging.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_logging.c' object='libcdwutilities_check_a-cdw_logging.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_logging.obj `if test -f 'cdw_logging.c'; then $(CYGPATH_W) 'cdw_logging.c'; else $(CYGPATH_W) '$(srcdir)/cdw_logging.c'; fi` libcdwutilities_check_a-cdw_regex.o: cdw_regex.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_regex.o -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_regex.Tpo -c -o libcdwutilities_check_a-cdw_regex.o `test -f 'cdw_regex.c' || echo '$(srcdir)/'`cdw_regex.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_regex.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_regex.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_regex.c' object='libcdwutilities_check_a-cdw_regex.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_regex.o `test -f 'cdw_regex.c' || echo '$(srcdir)/'`cdw_regex.c libcdwutilities_check_a-cdw_regex.obj: cdw_regex.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdwutilities_check_a-cdw_regex.obj -MD -MP -MF $(DEPDIR)/libcdwutilities_check_a-cdw_regex.Tpo -c -o libcdwutilities_check_a-cdw_regex.obj `if test -f 'cdw_regex.c'; then $(CYGPATH_W) 'cdw_regex.c'; else $(CYGPATH_W) '$(srcdir)/cdw_regex.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcdwutilities_check_a-cdw_regex.Tpo $(DEPDIR)/libcdwutilities_check_a-cdw_regex.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdw_regex.c' object='libcdwutilities_check_a-cdw_regex.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdwutilities_check_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdwutilities_check_a-cdw_regex.obj `if test -f 'cdw_regex.c'; then $(CYGPATH_W) 'cdw_regex.c'; else $(CYGPATH_W) '$(srcdir)/cdw_regex.c'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkLIBRARIES clean-generic clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean \ clean-checkLIBRARIES clean-generic clean-noinstLIBRARIES ctags \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am # used by flymake check-syntax: $(CC) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(AM_CFLAGS) -fsyntax-only $(CHK_SOURCES) .PHONY: check-syntax # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cdw-0.7.1/src/utilities/cdw_logging.c0000644000175000017500000004231711722440006014451 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "config.h" #include "cdw_config.h" #include "gettext.h" #include "cdw_logging.h" #include "cdw_text_file_viewer.h" #include "cdw_widgets.h" #include "cdw_fs.h" #include "cdw_file_picker.h" #include "cdw_string.h" #include "cdw_debug.h" #include "cdw_utils.h" /** \file cdw_logging.c \brief Implementation of logging for cdw File implements logging module: function that perform initialization of log file when application is started, functions that can be used to write to log file when application runs, function that closes log file and does necessary clean up before application exits. */ extern cdw_config_t global_config; /** \brief Default name of application log file */ const char *cdw_log_file_name = "cdw.log"; /* *** definitions for logging module *** */ /** \brief Application's log file */ static FILE *log_file = (FILE *) NULL; static bool full_path_silently_modified = false; /* was the path cleared (free()d set to NULL) */ static void cdw_logging_display_problem(int problem); static cdw_rv_t cdw_logging_search_for_default_full_path(void); static cdw_rv_t cdw_logging_ask_for_dir_path(int problem); static cdw_rv_t cdw_logging_check_available_space(void); static void cdw_logging_path_reset_message(void); static void cdw_logging_handle_old_log_file(void); /* constants used when dealing with problems when log file is initialized */ #define INVALID_PATH 1 #define NO_SPACE 2 #define EMPTY_PATH 3 #define GEN_ERROR 4 /** \brief Initialize logging module: find and open log file Try to open log file using file path set in configuration. If opening file with path set in configuration fails then try opening file with some default path. If all of above fails then ask user for path to given file. When correct full path to log file is known to this function, the function opens the file for reading and writing. If there is no place left on device for writing to the file, function closes old file and asks user for new path to log file. If after calling the function learns that current path is empty or invalid, it tries to silently set path to some default value. It does so silently, but in case of success user is informed about the fact of (re)setting the path to new value. If log file already existed then file is truncated to zero at opening. Correct full path to log file is stored in config.log_full_path \return CDW_OK if path is set correctly \return CDW_NO if user cancels entering new path or user didn't enter correct path in n tries */ cdw_rv_t cdw_logging_init(void) { cdw_logging_handle_old_log_file(); /* loop if (path correct) { open if (open = success) check space if (check space = success) return CDW_OK; else ask user (no space, new disc); else ask user (path invalid) else ask user (path invalid) end loop */ full_path_silently_modified = false; int i = 0; int n = 5; for (i = 0; i < n; i++) { int problem = 0; cdw_rv_t crv; if ((global_config.log_full_path != (char *) NULL) && strlen(global_config.log_full_path)) { log_file = fopen(global_config.log_full_path, "w+"); if (log_file != (FILE *) NULL) { crv = cdw_logging_check_available_space(); if (crv == CDW_OK) { if (full_path_silently_modified) { cdw_logging_path_reset_message(); full_path_silently_modified = false; } rewind(log_file); return CDW_OK; } else { fclose(log_file); log_file = (FILE *) NULL; cdw_vdm ("no space available for this log file: \"%s\"\n", global_config.log_full_path); problem = NO_SPACE; } } else { cdw_vdm ("log file path is invalid: \"%s\"\n", global_config.log_full_path); problem = INVALID_PATH; } } else { cdw_vdm ("log file is null or empty: \"%s\"\n", global_config.log_full_path); problem = EMPTY_PATH; } if (i == n - 1) { cdw_logging_display_problem(problem); return CDW_ERROR; } if (problem == EMPTY_PATH || (i == 0 && problem == INVALID_PATH)) { /* returns CDW_OK, CDW_NO, CDW_ERROR */ crv = cdw_logging_search_for_default_full_path(); } else { /* returns CDW_OK, CDW_CANCEL, CDW_MEM_ERROR */ crv = cdw_logging_ask_for_dir_path(problem); } if (crv == CDW_OK) { full_path_silently_modified = true; } else if (crv == CDW_NO) { /* log_search_for_default_full_path() can't find default path, ask user for path */ problem = INVALID_PATH; } else if (crv == CDW_CANCEL) { /* user pressed Escape key when asked for path */ return CDW_NO; } else { /* crv == CDW_ERROR */ cdw_logging_display_problem(GEN_ERROR); return CDW_NO; } } return CDW_NO; } /** * \brief Deallocate all resources opened by logging module * * Close log file, clean up all other logging resources */ void cdw_logging_clean(void) { if (log_file != (FILE *) NULL) { fflush(log_file); fclose(log_file); log_file = (FILE *) NULL; } /* note that config.log_full_path is free()d somewhere else */ return; } /** * \brief Print message to log file * * printf()-like function that writes given format string and all * following arguments to log file. * * Function created to hide FILE *log_file from user and to provide * convenient way of writing to log. * * Function calls fflush() for file. * * \param format - format string of message that you want to print to log */ void cdw_logging_write(const char *format, ...) { cdw_assert (log_file != (FILE *) NULL, "log file is not open when trying to write to it\n"); va_list ap; va_start(ap, format); vfprintf(log_file, format, ap); fflush(log_file); va_end(ap); return; } /** * \brief Write some separator between parts of log file * * Current implementation of log file appends more and more data for * every task performed during one cdw session. This can make the log * file very long and hard to browse. Inserting some separator * between log file parts can make it easier to browse log file. */ void cdw_logging_write_separator(void) { cdw_assert (log_file != (FILE *) NULL, "log file is not open when trying to write to it\n"); fprintf(log_file, "\n\n"); /* 2TRANS: this is header printed in log file; first %s is program name, second %s is program version */ fprintf(log_file, _(" ::: Log file for %s %s ::: "), PACKAGE, VERSION); fprintf(log_file, "\n\n\n"); return; } /** \brief Search for valid full path to log file in some default locations Search for correct full path to log file in user's home directory, and if this fails, in tmp directory. The tmp directory is tmp_dir set in cdw_graftpoints.c. Therefore you have to call cdw_graftpoints_init() before initializing logging module. The function is non-interactive: user is not informed about new path to log file. Log file name is CDW_LOG_FILE_NAME ("cdw.log"). If function succeeds then full path to log file is copied to config.log_full_path. Otherwise config.log_full_path is set to NULL. The function does not try to open the file, it just tries to set config.log_full_path; \return CDW_ERROR if malloc() fails \return CDW_NO if function failed to set path to log file \return CDW_OK if path to file is set correctly. */ cdw_rv_t cdw_logging_search_for_default_full_path(void) { #if 0 /* log file should be in user home dir by default */ const char *dir_path = cdw_fs_get_home_dir_fullpath(); if (dir_path == (char *) NULL) { dir_path = cdw_fs_get_tmp_dir_fullpath(); /* log_init() should be called after tmp dir is set, but let's check just in case */ if (dir_path == (char *) NULL) { /* there was no HOME dir, and now it turned out that there is no tmp dir :( */ return CDW_NO; } else { ; /* pass to concatenating full path */ } } else { ; /* pass to concatenating full path */ } #endif const char *dir = cdw_config_get_config_dir(); char *tmp = cdw_string_concat(dir, cdw_log_file_name, (char *) NULL); if (tmp == (char *) NULL) { return CDW_ERROR; } else { if (global_config.log_full_path != (char *) NULL) { free(global_config.log_full_path); global_config.log_full_path = (char *) NULL; } global_config.log_full_path = tmp; return CDW_OK; } } /** * \brief Display information about resetting log file path * * This function displays dialog box informing about resetting full * path to log file in cdw configuration. It should be used when during * search for log file the log file path was reset from it's previous * to new value, or when the path was set form empty path to non-empty * path. * * Reason for using this function is that log file path is important * parameter and user must be informed about any changes. * * The function was created to avoid shifting code too much to the right side ;) */ void cdw_logging_path_reset_message(void) { /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Message"), /* 2TRANS: this is message in dialog window */ _("Path to CDW log file has been reset. You may want to check current path in Configuration -> Log."), CDW_BUTTONS_OK, CDW_COLORS_DIALOG); } /** * \brief Display dialog window in which user can enter path to * directory where log file will be put * * Display dialog box where user can enter new path to directory. * * If user entered new path, the function appends log file name to it * and puts result to config.log_full_path. * Otherwise config.log_full_path is not modified in any way. * * \param problem - identifier of problem, defined values are NO_SPACE, EMPTY_PATH, INVALID_PATH * * \return CDW_OK if user entered valid path * \return CDW_CANCEL if user canceled entering the path, or the path was invalid in n tries * \return CDW_ERROR on malloc errors */ cdw_rv_t cdw_logging_ask_for_dir_path(int problem) { char *message = (char *) NULL; if (problem == NO_SPACE) { /* 2TRANS: this is message in dialog window */ message = _("Enter path to directory on another device."); } else if (problem == EMPTY_PATH) { /* 2TRANS: this is message in dialog window */ message = _("Enter non-empty path to initial (e.g. Home) directory."); } else { /* problem == INVALID_PATH */ /* 2TRANS: this is message in dialog window */ message = _("Enter valid path to directory to store cdw log file."); } char *buffer = (char *) NULL; /* 2TRANS: this is title of dialog window */ cdw_rv_t crv = cdw_fs_ui_file_picker(_("Configuring cdw..."), message, &(buffer), CDW_FS_DIR, R_OK | W_OK, CDW_FS_EXISTING); if (crv == CDW_OK) { char *tmp = cdw_string_concat(buffer, cdw_log_file_name, (char *) NULL); free(buffer); buffer = (char *) NULL; if (tmp == (char *) NULL) { return CDW_ERROR; } else { if (global_config.log_full_path != (char *) NULL) { free(global_config.log_full_path); global_config.log_full_path = (char *) NULL; } global_config.log_full_path = tmp; return CDW_OK; } } else { /* cdw_fs_ui_file_picker() does not allocate path if user pressed ESCAPE, but it allocates memory for empty string when user clears input field */ if (buffer != (char *) NULL) { free(buffer); buffer = (char *) NULL; } return crv; } } /** * \brief Display message about current problem with initializing log path * * Display dialog box informing about specific problem with given path. * * \param problem - identifier of problem, defined values are NO_SPACE, EMPTY_PATH, INVALID_PATH */ void cdw_logging_display_problem(int problem) { if (problem == NO_SPACE) { /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("Too little space left on disc, can't write to log file."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); } else if (problem == EMPTY_PATH) { /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("Path to log file is empty, can't open file."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); } else if (problem == INVALID_PATH) { /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("Path to log file is invalid, can't open file"), CDW_BUTTONS_OK, CDW_COLORS_ERROR); } else { /* problem == GEN_ERROR */ /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("cdw can't configure its log file. Please restart the program."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); } } /** * \brief Check if there is enough space on a device to store log file * * Try to write to log file some amount of data. If writing fails then return * error - caller will interpret this as not enough space on device. * * Global variable log_file must be valid (FILE *) pointer referring to * file open for writing. * * The function clears open file before returning. * * Current size of test data is 50k chars. When creating 2GB iso image * log file grows to ~7kB. * * \return CDW_ERROR on errors * \return CDW_OK if there is some space left on a device and using the file as log file is probably safe */ cdw_rv_t cdw_logging_check_available_space(void) { bool failed = false; if (log_file == (FILE *) NULL) { return CDW_ERROR; } char buffer[1000]; int i = 0; for (i = 0; i < 1000; i++) { buffer[i] = 'a'; } buffer[i - 1] = '\0'; for (i = 0; i < 50; i++) { int a = fprintf(log_file, "%s\n", buffer); int b = fflush(log_file); if (a < 0) { failed = true; break; } if (b == EOF) { failed = true; break; } } freopen(global_config.log_full_path, "w+", log_file); /* reset file size to zero */ if (failed) { return CDW_ERROR; } else { return CDW_OK; } } /** * \brief Display log file * * Wrapper using file_display() and local FILE *log_file variable * to simplify displaying log file: callers don't have to use * config.log_full_path anymore. * * \p title may be empty string or NULL. * * \param title - title of window in which log file will be displayed */ cdw_rv_t cdw_logging_display_log(const char *title) { rewind(log_file); cdw_rv_t crv = cdw_text_file_viewer(log_file, title); fseek(log_file, 0L, SEEK_END); if (crv != CDW_OK) { /* 2TRANS: this is title of dialog window */ cdw_buttons_dialog(_("Error"), /* 2TRANS: this is message in dialog window */ _("Cannot show log file. Unknown error occurred."), CDW_BUTTONS_OK, CDW_COLORS_ERROR); return CDW_ERROR; } else { return CDW_OK; } } /** \brief Display log file if "show log after write" checkbox is checked Wrapper using file_display() and local FILE *log_file variable to simplify displaying log file: callers don't have to use config.log_full_path anymore. "conditional" means that the log is displayed only if "show log after write" checkbox in configuration window is checked. \p title may be empty string or NULL. \param title - title of window in which log file will be displayed */ cdw_rv_t cdw_logging_display_log_conditional(const char *title) { if (global_config.showlog) { return cdw_logging_display_log(title); } else { return CDW_OK; } } /** \brief Remove log file from old location cdw is migrating from log file in old location: ~/.cdw.log, into new location: ~/.cdw/cdw.log. This function removes the log file from old location. */ void cdw_logging_handle_old_log_file(void) { const char *dir = cdw_fs_get_home_dir_fullpath(); if (dir == (char *) NULL) { return; } char *fullpath = cdw_string_concat(dir, ".cdw.log", (char *) NULL); if (fullpath == (char *) NULL) { cdw_vdm ("ERROR: failed to concatenate path\n"); return; } if (access(fullpath, F_OK)) { free(fullpath); fullpath = (char *) NULL; return; } FILE *file = fopen(fullpath, "r"); if (file == (FILE *) NULL) { cdw_vdm ("ERROR: failed to open file \"%s\"\n", fullpath); free(fullpath); fullpath = (char *) NULL; return; } bool found = false; for (int i = 0; i < 100; i++) { char *line = my_readline_10k(file); if (line != (char *) NULL) { char *ptr = strstr(line, " ::: Log file for cdw"); free(line); if (ptr != (char *) NULL) { found = true; break; } } else { /* EOF ? */ break; } } fclose(file); file = (FILE *) NULL; if (!found) { ; /* the file doesn't appear to be cdw log file, despite its name */ } else { unlink(fullpath); } free(fullpath); fullpath = (char *) NULL; return; } cdw-0.7.1/src/utilities/cdw_sys.c0000644000175000017500000004550511724475127013661 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _POSIX_SOURCE /* struct sigaction */ #define _POSIX_C_SOURCE 200809L /* getline() */ #define _GNU_SOURCE /* getline() */ #include /* getline() */ #include #include #include #include /* access() */ #include /* wait() */ #include #include #include "cdw_sys.h" #include "gettext.h" #include "cdw_debug.h" #include "cdw_string.h" #include "cdw_cdio.h" #include "cdw_ofs.h" /** \file cdw/src/utilities/cdw_sys.c File with various functions interfacing operating system. Currently this file defines functions: \li accessing /proc file system, \li accessing /lib/modules/ directory, \li handling signals. */ #ifdef CDW_MAIN_WINDOW_CAN_RESIZE extern sig_atomic_t cdw_main_window_resize; #endif /* data structures and functions related to handling signals */ static void cdw_sys_exit_signal_handler(int signal_number); static void cdw_sys_exit_signal_message(void); static void cdw_sys_sigwinch_handler(int signal_number); static void cdw_sys_sigchild_handler(__attribute__((unused)) int signal_number); static sig_atomic_t child_exit_status; static sig_atomic_t cdw_sys_signal_number; static cdw_rv_t cdw_sys_check_file_system_support_via_proc_fs(cdio_fs_t cdio_fs); static cdw_rv_t cdw_sys_check_file_system_support_via_modules(cdio_fs_t cdio_fs); static char * cdw_sys_get_osrelease(void); static char * cdw_sys_get_kernel_modules_location(void); /* Generic type of signal handler, regardless of actions performed by specific implementation of a signal handler. */ typedef void (*cdw_sa_handler)(int); #define CDW_SYS_SIGNAL_LABEL_LEN 10 /* Signal information taken from signal(7) man page. */ struct { int id; const char label[CDW_SYS_SIGNAL_LABEL_LEN]; cdw_sa_handler handler; } cdw_sys_signals[] = { { SIGHUP, "SIGHUP", NULL }, /* 1 Term Hangup detected on controlling terminal or death of controlling process */ { SIGINT, "SIGINT", NULL }, /* 2 Term Interrupt from keyboard */ { SIGQUIT, "SIGQUIT", cdw_sys_exit_signal_handler }, /* 3 Core Quit from keyboard */ { SIGILL, "SIGILL", cdw_sys_exit_signal_handler }, /* 4 Core Illegal Instruction */ { SIGABRT, "SIGABRT", cdw_sys_exit_signal_handler }, /* 6 Core Abort signal from abort(3) */ { SIGFPE, "SIGFPE", cdw_sys_exit_signal_handler }, /* 8 Core Floating point exception */ { SIGKILL, "SIGKILL", NULL }, /* 9 Term Kill signal, can't be caught */ { SIGSEGV, "SIGSEGV", cdw_sys_exit_signal_handler }, /* 11 Core Invalid memory reference */ { SIGPIPE, "SIGPIPE", cdw_sys_exit_signal_handler }, /* 13 Term Broken pipe: write to pipe with no readers */ { SIGALRM, "SIGALRM", NULL }, /* 14 Term Timer signal from alarm(2) */ { SIGTERM, "SIGTERM", cdw_sys_exit_signal_handler }, /* 15 Term Termination signal */ { SIGUSR1, "SIGUSR1", NULL }, /* 30,10,16 Term User-defined signal 1 */ { SIGUSR2, "SIGUSR2", NULL }, /* 31,12,17 Term User-defined signal 2 */ { SIGCHLD, "SIGCHLD", cdw_sys_sigchild_handler }, /* 20,17,18 Ign Child stopped or terminated; to be handled by cdw separately */ { SIGCONT, "SIGCONT", NULL }, /* 19,18,25 Cont Continue if stopped */ { SIGSTOP, "SIGSTOP", NULL }, /* 17,19,23 Stop Stop process, can't be caught */ { SIGTSTP, "SIGTSTP", cdw_sys_exit_signal_handler }, /* 18,20,24 Stop Stop typed at tty */ { SIGTTIN, "SIGTTIN", NULL }, /* 21,21,26 Stop tty input for background process */ { SIGTTOU, "SIGTTOU", NULL }, /* 22,22,27 Stop tty output for background process */ #if _POSIX_VERSION == 200112L { SIGBUS, "SIGBUS", cdw_sys_exit_signal_handler }, /* 10,7,10 Core Bus error (bad memory access) */ { SIGPOLL, "SIGPOLL", NULL }, /* Term Pollable event (Sys V).; Synonym for SIGIO */ { SIGPROF, "SIGPROF", NULL }, /* 27,27,29 Term Profiling timer expired */ { SIGSYS, "SIGSYS", cdw_sys_exit_signal_handler }, /* 12,31,12 Core Bad argument to routine (SVr4) */ { SIGTRAP, "SIGTRAP", NULL }, /* 5 Core Trace/breakpoint trap */ { SIGURG, "SIGURG", NULL }, /* 16,23,21 Ign Urgent condition on socket (4.2BSD) */ { SIGVTALRM, "SIGVTALRM", NULL }, /* 26,26,28 Term Virtual alarm clock (4.2BSD) */ { SIGXCPU, "SIGXCPU", NULL }, /* 24,24,30 Core CPU time limit exceeded (4.2BSD) */ { SIGXFSZ, "SIGXFSZ", NULL }, /* 25,25,31 Core File size limit exceeded (4.2BSD) */ #endif #ifdef SIGIOT { SIGIOT, "SIGIOT", cdw_sys_exit_signal_handler }, /* 6 Core IOT trap. A synonym for SIGABRT */ #endif #ifdef SIGEMT { SIGEMT, "SIGEMT", NULL }, /* 7,-,7 Term */ #endif #ifdef SIGSTKFLT { SIGSTKFLT, "SIGSTKFLT", NULL }, /* -,16,- Term Stack fault on coprocessor (unused) */ #endif #ifdef SIGIO { SIGIO, "SIGIO", NULL }, /* 23,29,22 Term I/O now possible (4.2BSD) */ #endif #ifdef SIGCLD { SIGCLD, "SIGCLD", cdw_sys_sigchild_handler }, /* -,-,18 Ign A synonym for SIGCHLD */ #endif #ifdef SIGPWR { SIGPWR, "SIGPWR", NULL }, /* 29,30,19 Term Power failure (System V) */ #endif #ifdef SIGINFO { SIGINFO, "SIGINFO", NULL }, /* 29,-,- A synonym for SIGPWR */ #endif #ifdef SIGLOST { SIGLOST, "SIGLOST", NULL }, /* -,-,- Term File lock lost */ #endif #ifdef SIGWINCH { SIGWINCH, "SIGWINCH", cdw_sys_sigwinch_handler }, /* 28,28,20 Ign Window resize signal (4.3BSD, Sun) */ #endif #ifdef SIGUNUSED { SIGUNUSED, "SIGUNUSED", cdw_sys_exit_signal_handler }, /* -,31,- Core Synonymous with SIGSYS */ #endif { -1, "", NULL }}; /* guard */ /** \brief Remove zombie process created by run_command() \param signal_number - number of handled signal, unused */ void cdw_sys_sigchild_handler(__attribute__((unused)) int signal_number) { /* clean child process */ int status; wait(&status); child_exit_status = status; return; } void cdw_sys_exit_signal_handler(int signal_number) { cdw_sys_signal_number = signal_number; /* there was an 'exit' signal, so let's better leave now; exit() triggers functions registered with atexit(); these are _clean() functions */ exit(EXIT_FAILURE); } void cdw_sys_sigwinch_handler(int signal_number) { cdw_assert (signal_number == SIGWINCH, "ERROR: wrong signal to handle\n"); /* I've tried different things: - struct winsize size; - endwin(); - resize_term(), resizeterm(); - clearok(); and the conclusion is: there is no simple solution to the problem of resizing windows in ncurses app; 2012-02-20 The function is called in SIGWINCH signal. I've tested this by adding only call to exit() in signal handler. So perhaps my attempts didn't work because I was trying to put call to regular library function inside a signal handler. */ #ifdef CDW_MAIN_WINDOW_CAN_RESIZE /* code in main event loop should check this flag and act accordingly (resize main window and all widgets embedded in the window) */ cdw_main_window_resize = 1; #endif return; } void cdw_sys_exit_signal_message(void) { int i = 0; while (cdw_sys_signals[i].id != -1) { if (cdw_sys_signals[i].id == cdw_sys_signal_number) { char message[] = "cdw: "; write(2, message, sizeof (message)); write(2, cdw_sys_signals[i].label, sizeof (cdw_sys_signals[i].label)); /* yes, I know that I shouldn't call printf() in signal handlers, but since it will be called shortly before calling exit(), there shouldn't be much harm done */ /* 2TRANS: this is a message printed to console when cdw needs to close unexpectedly. "signal" is a signal from operating system; "%s" is a signal's name; keep leading and ending "\n"; use "\n" in the middle of message as needed to keep line lengths no more than 76 characters */ fprintf(stderr, _("\n\ncdw received %s signal and it needed to clean up after itself\nand leave. This may mean that there is a bug in cdw. Don't be mad...\n\n"), cdw_sys_signals[i].label); break; } i++; } return; } int cdw_sys_signal_handlers_init(void) { int i = 0; while (cdw_sys_signals[i].id != -1) { if (cdw_sys_signals[i].handler) { cdw_vdm ("INFO: setting %s handler\n", cdw_sys_signals[i].label); struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = cdw_sys_signals[i].handler; action.sa_flags = 0; int rv = sigaction(cdw_sys_signals[i].id, &action, (struct sigaction *) NULL); if (rv == -1) { cdw_vdm ("ERROR: failed call to sigaction(%s, ...)\n", cdw_sys_signals[i].label); return -1; } } i++; } /* signal_message isn't a module cleaner function, so I don't call atexit() in main(); this call is made to ensure that final error message is printed to stderr when cdw_sys_exit_signal_handler() calls exit() */ atexit(cdw_sys_exit_signal_message); return 0; } cdw_rv_t cdw_sys_check_file_system_support(cdio_fs_t cdio_fs) { cdw_assert (cdw_ofs_is_iso(cdio_fs) || cdio_fs == CDIO_FS_UDF, "ERROR: unrecognized fs: %d\n", cdio_fs); if (cdw_ofs_is_iso(cdio_fs)) { /* there may be few subtypes of ISO9660 fs, let's simplify this for code using cdio_fs; CDIO_FS_ISO_UDF also counts as ISO9660 */ cdio_fs = CDIO_FS_ISO_9660; } #if 0 /* force loading module for iso9660, so that it becomes visible in /proc/filesystems */ /* this works, but only if you are root */ int rv = mount("/dev/scd0", "/media/cdrom0", "iso9660", MS_MGC_VAL | MS_RDONLY | MS_NOSUID | MS_NOATIME, ""); #endif /* first let's try the polite way, searching /proc/filesystems; if support for some file system is provided via kernel module, and the module hasn't been loaded yet, it won't be present in /proc/filesystems; if it is compiled into kernel then it should be there */ cdw_rv_t crv1 = cdw_sys_check_file_system_support_via_proc_fs(cdio_fs); if (crv1 == CDW_OK) { /* operating system supports given file system type */ return CDW_OK; } else { /* either there is no information about given file system in /proc/filesystems file (crv == CDW_NO), there is no such file (crv == CDW_CANCEL), or ther was some error when trying to access /proc/filesystems (crv == CDW_GEN_ERROR); let's try different method */ cdw_rv_t crv2 = cdw_sys_check_file_system_support_via_modules(cdio_fs); if (crv2 == CDW_OK) { /* operating system supports given file system type (support is provided by kernel module) */ return CDW_OK; } else if (crv2 == CDW_NO) { /* operating system does not support given file system type */ return CDW_NO; } else if (crv2 == CDW_CANCEL) { /* cdw can't tell if there is a support for given file system type or not */ return CDW_CANCEL; } else { /* CDW_GEN_ERROR */ if (crv1 == CDW_CANCEL) { /* we got here because first method didn't give definitive answer, so there is still a chance that operating system supports given file system type; "cancel" means here "we don't know, but you may try" */ return CDW_CANCEL; } else { /* crv1 == CDW_ERROR */ /* two methods returned CDW_ERROR, there is something very wrong; assume that given file system is not supported */ return CDW_ERROR; } } } } cdw_rv_t cdw_sys_check_file_system_support_via_proc_fs(cdio_fs_t cdio_fs) { FILE *fp = fopen("/proc/filesystems", "r"); int e = errno; if (fp == (FILE *) NULL) { cdw_vdm ("ERROR: failed to open /proc/filesystems, error = \"%s\"\n", strerror(e)); if (e == ENOENT) { /* incorrect assumption that all GNU/Linux systems have similar proc file systems, with /proc/filesystems file present */ return CDW_CANCEL; } else { /* some other error */ return CDW_ERROR; } } char *line = (char *) NULL; size_t len = 0; ssize_t r = 0; cdw_rv_t retval = CDW_NO; /* "no" = "support for file system not found (yet)" */ while ((r = getline(&line, &len, fp)) != -1) { if (line[r - 1] == '\n') { line[r - 1] = '\0'; } cdw_sdm ("INFO: line = \"%s\"\n", line); /* only basic file system types: iso9660 and udf */ if (cdio_fs == CDIO_FS_ISO_9660 && strstr(line, "iso9660")) { cdw_vdm ("INFO: detected support for iso9660 in /proc/filesystems\n"); retval = CDW_OK; break; } else if (cdio_fs == CDIO_FS_UDF && strstr(line, "udf")) { cdw_vdm ("INFO: detected support for udf in /proc/filesystems\n"); retval = CDW_OK; break; } else { ; } #ifndef NDEBUG if (strstr(line, "ext3")) { cdw_vdm ("INFO: detected support for ext3 in /proc/filesystems\n"); } #endif } free(line); line = (char *) NULL; fclose(fp); fp = (FILE *) NULL; if (retval == CDW_OK) { /* support for given file system was found */ return CDW_OK; } else if (retval == CDW_NO) { /* procedure of checking went without problems, but no support for given file system was found */ return CDW_NO; } else { /* some error? */ return CDW_ERROR; } } cdw_rv_t cdw_sys_check_file_system_support_via_modules(cdio_fs_t cdio_fs) { /* support for some file systems may be provided by kernel modules, which (most of the time?) aren't loaded until they are needed; they should be available in a specific place, let's hope that it's the same place in all GNU/Linux distributions */ /* let's check if our assumption about all modules' location is correct */ char *modules_location = cdw_sys_get_kernel_modules_location(); if (modules_location == (char *) NULL) { cdw_vdm ("ERROR: can't get modules location path\n"); return CDW_ERROR; } /* at this point we know that "/lib/modules//kernel" location is valid, let's check if there are modules implementing support for specific file systems */ char *path = (char *) NULL; if (cdio_fs == CDIO_FS_ISO_9660) { path = cdw_string_concat(modules_location, "/fs/isofs/isofs.ko", (char *) NULL); } else if (cdio_fs == CDIO_FS_UDF) { path = cdw_string_concat(modules_location, "/fs/udf/udf.ko", (char *) NULL); } else { ; } free(modules_location); modules_location = (char *) NULL; if (path == (char *) NULL) { cdw_vdm ("ERROR: failed to concat path\n"); return CDW_ERROR; } cdw_vdm ("INFO: inspecting path \"%s\"\n", path); int rv = access(path, F_OK); int e = errno; free(path); path = (char *) NULL; if (rv == 0) { cdw_vdm ("INFO: found \"%s\" module\n", cdio_fs == CDIO_FS_ISO_9660 ? "isofs" : "udf"); return CDW_OK; } else { if (e == ENOENT) { /* no kernel module file, no support for given file system */ cdw_vdm ("INFO: can't find \"%s\" module, error = \"%s\"\n", cdio_fs == CDIO_FS_ISO_9660 ? "isofs" : "udf", strerror(e)); return CDW_NO; } else { cdw_vdm ("ERROR: can't access \"%s\" module, error = \"%s\"\n", cdio_fs == CDIO_FS_ISO_9660 ? "isofs" : "udf", strerror(e)); return CDW_ERROR; } } } char *cdw_sys_get_osrelease(void) { /* osrelease file stores string that is the same as result of "uname -r", e.g. "2.6.32F" */ FILE *fp = fopen("/proc/sys/kernel/osrelease", "r"); int e = errno; if (fp == (FILE *) NULL) { cdw_vdm ("ERROR: failed to open /proc/sys/kernel/osrelease, error = \"%s\"\n", strerror(e)); if (e == ENOENT) { /* incorrect assumption that all GNU/Linux systems have similar proc file systems, with /proc/osrelease file present */ return (char *) NULL; } else { /* some other error */ return (char *) NULL; } } size_t len = 0; char *line = (char *) NULL; ssize_t r = getline(&line, &len, fp); e = errno; fclose(fp); if (r <= 0) { cdw_vdm ("ERROR: failed to get line, r = %zd, error = \"%s\"\n", r, strerror(e)); return (char *) NULL; } else { if (line[r - 1] == '\n') { line[r - 1] = '\0'; } cdw_vdm ("INFO: osrelease = \"%s\"\n", line); return line; } } char *cdw_sys_get_kernel_modules_location(void) { char *osrelease = cdw_sys_get_osrelease(); if (osrelease == (char *) NULL) { cdw_vdm ("ERROR: can't get osrelease\n"); return (char *) NULL; } char *path = cdw_string_concat("/lib/modules/", osrelease, "/kernel/", (char *) NULL); free(osrelease); osrelease = (char *) NULL; if (path == (char *) NULL) { cdw_vdm ("ERROR: failed to concat modules release path\n"); return (char *) NULL; } else { int rv = access(path, F_OK); int e = errno; if (rv != 0) { cdw_vdm ("ERROR: can't access path \"%s\", error = \"%s\"\n", path, strerror(e)); free(path); path = (char *) NULL; /* even if the path exists, if we can't access it using access(), it is useless */ return (char *) NULL; } else { return path; } } } /** \brief Get copy of environment PATH variable \date Function's top-level comment reviewed on 2012-02-16 \date Function's body reviewed on 2012-02-16 Function returns a copy of environment PATH variable. Function may return NULL pointer if PATH environment variable is not defined on user's system. Returned pointer is owned by caller. \return valid pointer on success \return NULL pointer on failure */ char *cdw_sys_env_path(void) { const char *tmp = getenv("PATH"); if (!tmp) { cdw_vdm ("WARNING: getenv(\"PATH\") returns NULL\n"); return (char *) NULL; } #if 0 /* test data */ const char *test_string = ":/home/acerion/bin: :/usr/local/bin::/usr/bin:/bin:/usr/games:"; char *path = strdup(test_string); #else char *path = strdup(tmp); #endif if (!path) { cdw_vdm ("ERROR: failed to strdup() string \"%s\"\n", tmp); return (char *) NULL; } else { return path; } } cdw-0.7.1/src/utilities/cdw_logging.h0000644000175000017500000000056311264177267014474 00000000000000#ifndef H_CDW_LOGGING #define H_CDW_LOGGING #include "main.h" cdw_rv_t cdw_logging_init(void); void cdw_logging_clean(void); void cdw_logging_write(const char *format, ...); void cdw_logging_write_separator(void); cdw_rv_t cdw_logging_display_log(const char *title); cdw_rv_t cdw_logging_display_log_conditional(const char *title); #endif /* #ifndef H_CDW_LOGGING */ cdw-0.7.1/src/utilities/cdw_string.h0000644000175000017500000000253311717547067014355 00000000000000#ifndef H_CDW_STRING #define H_CDW_STRING #include #include /* size_t */ #include "main.h" #define CDW_STRING_UNSAFE_CHARS_STRING "&!*`'|^\\;\"$" char *cdw_string_rtrim(char *str); char *cdw_string_ltrim(char *str); char *cdw_string_trim(const char *string); bool cdw_string_is_all_spaces(const char *string); char *cdw_string_concat(const char *str, ...); cdw_rv_t cdw_string_append(char **head, const char *tail); cdw_rv_t cdw_string_set(char **target, const char *source); cdw_rv_t cdw_string_security_parser(const char *string, char *invalid); bool cdw_string_starts_with_ci(const char *field, const char *fieldname); bool cdw_string_equal(const void *string1, const void *string2); void cdw_string_free_table_of_strings(char *labels[], int n_max); cdw_rv_t cdw_string_ints2labels_3(char **labels, int ints[], size_t n); cdw_rv_t cdw_string_get_bool_value(const char *buffer, bool *value); /* align of text */ enum { CDW_ALIGN_LEFT, CDW_ALIGN_RIGHT, CDW_ALIGN_CENTER }; char *cdw_string_wrap(const char *string, size_t width_max, int align); size_t cdw_string_count_lines(const char *string, size_t width_max); size_t cdw_string_get_line_end(const char *string, size_t chars_max); char *cdw_string_get_printable_if_needed(const char *string); /* unit tests */ void cdw_string_run_tests(void); #endif /* H_CDW_STRING */ cdw-0.7.1/src/utilities/gettext.h0000644000175000017500000000053511246533565013671 00000000000000#ifndef H_CDW_GETTEXT #define H_CDW_GETTEXT #include //#include #include #ifndef _ #define _(string) (char *)gettext(string) #endif /* http://www.gnu.org/software/gettext/manual/gettext.html#Special-cases */ #ifndef gettext_noop #define gettext_noop(string) string #endif #endif /* #ifndef H_CDW_GETTEXT */ cdw-0.7.1/src/utilities/cdw_dll.h0000644000175000017500000000240711717547057013621 00000000000000#ifndef H_CDW_DLL #define H_CDW_DLL #include #include /* size_t */ #include "main.h" typedef struct cdw_dll_item cdw_dll_item_t; typedef struct cdw_dll_item cdw_dll_t; struct cdw_dll_item { cdw_dll_item_t *prev; cdw_dll_item_t *next; void *data; }; cdw_rv_t cdw_dll_append(cdw_dll_item_t **head, void *data, bool (*pred)(const void *, const void *)); /* tested */ cdw_rv_t cdw_dll_append_non_unique(cdw_dll_item_t **head, void *data); /* tested indirectly */ cdw_rv_t cdw_dll_init(cdw_dll_item_t **head, void *data); /* tested */ cdw_dll_item_t *cdw_dll_last_item(cdw_dll_item_t *head); /* tested */ cdw_dll_item_t *cdw_dll_new_item(void *data); /* tested */ cdw_dll_item_t *cdw_dll_ith_item(cdw_dll_item_t *head, size_t i); /* tested */ cdw_rv_t cdw_dll_remove_ith_item(cdw_dll_item_t **head, size_t i); /* partially tested */ size_t cdw_dll_length(cdw_dll_item_t *head); /* tested */ bool cdw_dll_is_empty(cdw_dll_item_t *head); /* partially tested */ bool cdw_dll_is_member(cdw_dll_item_t *head, void *data, bool (*pred)(const void *, const void *)); /* tested */ cdw_rv_t cdw_dll_clean(cdw_dll_item_t *head); cdw_rv_t cdw_dll_delete(cdw_dll_t **head, cdw_deallocator_t dealloc); /* unit tests */ void cdw_dll_run_tests(void); #endif /* H_CDW_DLL */ cdw-0.7.1/src/utilities/cdw_debug.h0000644000175000017500000000636211404755776014142 00000000000000#ifndef H_CDW_DEBUG #define H_CDW_DEBUG #include #include /** * \file cdw_debug.h * \brief Utilities used during development phase to print debug messages * * Some utilities that can replace calls to fprintf(stderr, ...). */ /** * \brief Print debug message - verbose version * * This macro behaves much like fprintf(stderr, ...) function, * caller only have to provide format string with converesion specifiers * and list of arguments for this format string. * * Each message is preceeded with name of function that called the macro. * * See "C: A Reference Manual", chapter 3.3.10 for more information * on variable argument lists in macros (it requires C99). */ #ifndef NDEBUG #define cdw_vdm(...) fprintf(stderr, "%s():%d: ", __func__, __LINE__); fprintf(stderr, __VA_ARGS__); #else #define cdw_vdm(...) #endif /** \brief Print debug message - silent version */ #define cdw_sdm(...) /** * \brief Print literal cdw return value - verbose version * * Print literal corresponding to integer value of given variable of type * cdw_rv_t. * * \param func - name of function that returns a cdw_rv_t value ('char *' string) * \param val - value of type cdw_rv_t that should be interpreted by this macro */ #ifndef NDEBUG #define cdw_vcrv(func, val) \ if (val == CDW_OK) { \ cdw_vdm("%s() returns CDW_OK\n", func); \ } else if (val == CDW_NO) { \ cdw_vdm("%s() returns CDW_NO\n", func); \ } else if (val == CDW_CANCEL) { \ cdw_vdm("%s() returns CDW_CANCEL\n", func); \ } else if (val == CDW_GEN_ERROR) { \ cdw_vdm("%s() returns CDW_GEN_ERROR\n", func); \ } else if (val == CDW_MEM_ERROR) { \ cdw_vdm("%s() returns CDW_MEM_ERROR\n", func); \ } else if (val == CDW_SYS_ERROR) { \ cdw_vdm("%s() returns CDW_SYS_ERROR\n", func); \ } else if (val == CDW_FILE_INVALID) { \ cdw_vdm("%s() returns CDW_FILE_INVALID\n", func); \ } else if (val == CDW_ARG_ERROR) { \ cdw_vdm("%s() returns CDW_ARG_ERROR\n", func); \ } else if (val == CDW_FAILSAFE_MODE) { \ cdw_vdm("%s() returns CDW_FAILSAFE_MODE\n", func); \ } else { \ cdw_vdm("%s() returns unknown crv value: %d\n", func, val); \ } #else #define cdw_vcrv(func, val) #endif /** \brief Print literal cdw return value - silent version of cdw_vcrv */ #define cdw_scrv(func, val) /** * \brief Assert macro with message */ #ifndef NDEBUG #define cdw_assert(expr, ...) \ if (! (expr)) { \ fprintf(stderr, "\n\nassertion failed in:\n"); \ fprintf(stderr, "file %s\n", __FILE__); \ fprintf(stderr, "line %d\n", __LINE__); \ cdw_vdm (__VA_ARGS__); \ fprintf(stderr, "\n\n"); \ assert (expr); \ } #else #define cdw_assert(expr, ...) #endif /** * \brief Assert macro with message - version for unit tests */ #ifdef CDW_UNIT_TEST_CODE #define cdw_assert_test(expr, ...) \ if (! (expr)) { \ fprintf(stderr, "\n\nassertion failed in:\n"); \ fprintf(stderr, "file %s\n", __FILE__); \ fprintf(stderr, "line %d\n", __LINE__); \ fprintf(stderr, "%s():%d: ", __func__, __LINE__); fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, "\n\n"); \ exit(0); \ } #else #define cdw_assert_test(expr, ...) #endif #endif /* H_CDW_DEBUG */ cdw-0.7.1/src/utilities/Makefile.am0000644000175000017500000000144111444433031014050 00000000000000METASOURCES = AUTO sources = cdw_sys.c cdw_sys.h \ cdw_cdll.c cdw_cdll.h \ cdw_dll.c cdw_dll.h \ cdw_string.c cdw_string.h \ cdw_utils.c cdw_utils.h \ cdw_logging.c cdw_logging.h \ cdw_regex.c cdw_regex.h \ cdw_debug.h gettext.h # defines values of AM_CPPFLAGS and AM_CFLAGS # defines target used by flymake # don't use $(top_builddir), it fails during "make distcheck" include $(top_srcdir)/Makefile.cdw.am # static convenience library; "noinst" means: "build, but # don't install in user's system" noinst_LIBRARIES = libcdwutilities.a libcdwutilities_a_SOURCES = $(sources) # library built only for purposes of testing (checking) check_LIBRARIES = libcdwutilities_check.a libcdwutilities_check_a_SOURCES = $(sources) libcdwutilities_check_a_CPPFLAGS = -DCDW_UNIT_TEST_CODE $(AM_CPPFLAGS)cdw-0.7.1/src/utilities/cdw_utils.c0000644000175000017500000006032211725463023014166 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _GNU_SOURCE /* getopt_long() */ #include #include #include #include /* setlocale() */ #include #include /* getopt_long() */ /* open */ #include #include #include #include "config.h" #include "cdw_logging.h" #include "gettext.h" #include "cdw_drive.h" #include "cdw_utils.h" #include "cdw_debug.h" static void cdw_utils_print_version(void); static void cdw_utils_print_help(const char *program_name); void after_event(const char *title, __attribute__((unused)) int adddic) { cdw_logging_display_log_conditional(title); #ifdef HAVE_LIBMYSQLCLIENT if ((strcmp(config.autodic, "1") == 0) && (adddic == 1)) add_to_dic(); #endif #ifdef HAVE_LIBSQLITE if ((strcmp(config.autodic, "1") == 0) && (adddic == 1)) add_to_dic(); #endif /* disabled in version 0.4.0, ejecting after write operation is handled by conditional_eject_after_write(); even if this eject is required by other operation, they are unsupported in 0.4.0 */ /* if (strcmp(config.eject, "1") == 0) { eject_tray(config.cdrw_device); } */ return; } cdw_arguments_t cdw_commandline_arguments; static struct option cdw_getopt_long_options[] = { { "version", no_argument, 0, 0}, { "enable-dvd-rp-dl", no_argument, 0, 0}, { "escdelay", required_argument, 0, 0}, { "help", no_argument, 0, 0}, { 0, 0, 0, 0} }; /** \brief Process main(argc, argv[]) arguments \return -1 on errors - cdw has to close returning -1 \return 0 on no errors - cdw has to close returning 0 \return 1 on no errors - cdw should continue running */ int cdw_utils_process_commandline_arguments(int argc, char *argv[]) { #ifdef HAVE_LIBMYSQLCLIENT if ((strcmp((char *) argv[1], "--catalog") == 0) || (strcmp((char *) argv[1], "-c") == 0)) { initscr(); start_color(); cbreak(); noecho(); keypad(stdscr, TRUE); /* colors */ init_curses_colors(); lines = LINES - 2; if ((LINES < 24) || (COLS < 79)) { /* 2TRANS: error message displayed when terminal requirements are not met */ fprintf(stderr, _("Needed min 80x25 terminal!")); exit(EXIT_FAILURE); } cddb_window(); exit(EXIT_SUCCESS); } #endif cdw_commandline_arguments.support_dvd_rp_dl = false; cdw_commandline_arguments.escdelay_ms = -1; while (1) { int option_index = 0; int c = getopt_long(argc, argv, "hv", cdw_getopt_long_options, &option_index); if (c == -1) break; switch (c) { case 0: cdw_sdm ("INFO: option %s\n", cdw_getopt_long_options[option_index].name); if (optarg) { cdw_sdm ("INFO: with arg %s\n", optarg); } if (option_index == 0) { cdw_utils_print_version(); return 0; /* close cdw without signalling errors */ } else if (option_index == 1) { cdw_commandline_arguments.support_dvd_rp_dl = true; } else if (option_index == 2) { char *rest = (char *) NULL; cdw_commandline_arguments.escdelay_ms = (int) strtol(optarg, &rest, 10); if (rest != (char *) NULL && strlen(rest)) { /* 2TRANS: this is error message printed to terminal, first '%s' is name of option expecting a valid value, second '%s' is invalid value of the option */ fprintf(stderr, _("ERROR: incorrect value of option %s: \"%s\"\n"), cdw_getopt_long_options[option_index].name, optarg); return -1; } if (cdw_commandline_arguments.escdelay_ms < 0) { /* 2TRANS: this is error message printed to terminal, "ESC delay" is number describing time between pressing ESC key, and reaction to the key */ fprintf(stderr, _("ERROR: ESC delay can't be negative\n")); return -1; } } else if (option_index == 3) { cdw_utils_print_help(argv[0]); return 0; /* close cdw without signalling errors */ } break; case 'h': cdw_utils_print_help(argv[0]); return 0; /* close cdw without signalling errors */ case 'v': cdw_utils_print_version(); return 0; /* close cdw without signalling errors */ case '?': /* 2TRANS: this is error message printed to terminal */ fprintf(stderr, _("ERROR: unknown option in command line\n")); /* 2TRANS: this is error message printed to terminal */ fprintf(stderr, _("use '-h' option for help message\n")); return -1; default: break; } } return 1; /* 1 = cdw can continue running */ } void cdw_utils_print_version(void) { /* 2TRANS: this is message printed in terminal, first %s is program name, second %s is program version */ printf(_("%s %s\n"), PACKAGE, VERSION); return; } void cdw_utils_print_help(const char *program_name) { /* 2TRANS: this is message printed in terminal, first %s is program name, second %s is program version */ printf(_("%s %s\n"), PACKAGE, VERSION); /* 2TRANS: this is message printed in terminal, first %s is program name, second %s is program version */ printf(_("Copyright (C) 2002 - 2003 Balazs Varkonyi\n")); /* 2TRANS: this is message printed in terminal, first %s is program name, second %s is program version */ printf(_("Copyright (C) 2007 - 2012 Kamil Ignacak\n\n")); /* 2TRANS: this is message printed in terminal, '2+' means "version 2, or later"; keep double newline character */ printf(_("License: GNU General Public License, version 2+\n\n")); /* 2TRANS: this is help text displayed in console; %s will be replaced by program name, don't change its position */ printf(_("Usage: %s [options]\n\n"), program_name); /* 2TRANS: this is help text displayed in console */ printf(_("Options:\n\n")); #ifdef HAVE_LIBMYSQLCLIENT /* 2TRANS: this is help text displayed in console; don't localize anything before colon */ printf(_(" -c | --catalog : start in Disk Catalog mode\n")); #endif /* 2TRANS: this is help text displayed in console; don't localize anything before colon */ printf(_(" -h | --help : show this message\n")); /* 2TRANS: this is help text displayed in console; don't localize anything before colon */ printf(_(" -v | --version : show version of this software\n")); /* 2TRANS: this is help text displayed in console; don't localize anything before colon */ printf(_(" --escdelay=X : modify ESC key delay period;\n")); /* 2TRANS: this is help text displayed in console */ printf(_(" 'X' is non-negative time in milliseconds\n")); /* 2TRANS: this is help text displayed in console; don't localize anything before colon */ printf(_(" --enable-dvd-rp-dl : enable support for DVD+R DL;\n")); /* 2TRANS: this is help text displayed in console; "buggy" refers to support of DVD+R DL discs */ printf(_(" (buggy, with dvd+rw-tools only)\n\n")); return; } /* * Simple wrapper for locale setting functions */ int cdw_locale_init(void) { setlocale(LC_ALL, ""); textdomain(PACKAGE); bindtextdomain(PACKAGE, LOCALEDIR); return 0; } #if 0 /* currently unused, disabling to suppress compiler warnings */ /** * Read raw CD sector using Linux ioctl(2) - just a non-portable tool * * \param sector - valid sector number of sector to be read * \param buffer - char table of size 2352 * * \return 0 */ int raw_read_sector(lsn_t sector, char *_buffer) { int fd = open(config.cdrw_device, O_RDONLY | O_NONBLOCK); if (fd == -1) { /* debug code */ /* fprintf(stderr, "\n\n raw_read failed\n\n\n"); */ return -1; } union { struct cdrom_msf msf; /* input WARNING: make sure which data structure is used as input, read comments for CDROMREAD* in ioctl.txt */ char buffer[2352]; /* return */ } arg; msf_t p_msf; cdio_lsn_to_msf(3000, &p_msf); arg.msf.cdmsf_min0 = p_msf.m; /* start minute */ arg.msf.cdmsf_sec0 = p_msf.s; /* start second */ arg.msf.cdmsf_frame0 = p_msf.f; /* start frame */ int rv0 = ioctl(fd, CDROMREADRAW, &arg); /* debug code */ /* perror("1 -- "); fprintf(stderr, "rv0 = %d\n", rv0); fprintf(stderr, ">>RAW1>>"); int i = 0; for (i = 0; i< 40; i++) { fprintf(stderr, " %x ", arg.buffer[i]); } fprintf(stderr, "<<\n"); */ /* ************************************* */ char internal_buffer[2352]; struct cdrom_read arg2; arg2.cdread_lba = 3000; /* FIXME: LBA != lsn */ arg2.cdread_bufaddr = (char *) malloc(2352); arg2.cdread_buflen = 2352; int rv = ioctl(fd, CDROMREADRAW, &arg2); /* debug code */ /* perror("2 -- "); fprintf(stderr, "rv = %d\n", rv); fprintf(stderr, ">>RAW2>>"); for (i = 0; i< 40; i++) { fprintf(stderr, " %x ", internal_buffer[i]); } fprintf(stderr, "<<\n"); */ close(fd); /* int disc_status = ioctl(fd, CDROM_DISC_STATUS, 0); */ /* debug code */ /* if (disc_status == CDS_NO_INFO) { fprintf(stderr, ">>>>>>>>> CDS_NO_INFO <<<<<<<<<<<\n"); } else if (disc_status == CDS_AUDIO) { fprintf(stderr, ">>>>>>>>> CDS_AUDIO <<<<<<<<<<<\n"); } else if (disc_status == CDS_MIXED) { fprintf(stderr, ">>>>>>>>> CDS_MIXED <<<<<<<<<<<\n"); } else if (disc_status == CDS_XA_2_2) { fprintf(stderr, ">>>>>>>>> CDS_XA_2_2 <<<<<<<<<<<\n"); } else if (disc_status == CDS_XA_2_1) { fprintf(stderr, ">>>>>>>>> CDS_XA_2_1 <<<<<<<<<<<\n"); } else if (disc_status == CDS_DATA_1) { fprintf(stderr, ">>>>>>>>> CDS_DATA_1 <<<<<<<<<<<\n"); } else { fprintf(stderr, ">>>>>>>>> ???? <<<<<<<<<<<\n"); } */ return 0; } int raw_read_sector2(lsn_t sector) { struct cdrom_msf msf; char buffer[2352]; msf_t p_msf; int fd = open(config.cdrw_device, O_RDWR | O_NONBLOCK); if (fd == -1) { /* debug code */ /* fprintf(stderr, "bledny desk. pliku\n"); */ return -1; } cdio_lsn_to_msf(sector, &p_msf); msf.cdmsf_min0 = p_msf.m; /* start minute */ msf.cdmsf_sec0 = p_msf.s; /* start second */ msf.cdmsf_frame0 = p_msf.f; /* start frame */ msf.cdmsf_min0 = 1; /* start minute */ msf.cdmsf_sec0 = 1; /* start second */ msf.cdmsf_frame0 = 1; /* start frame */ memcpy(buffer, &msf, sizeof(msf)); int rv = ioctl(fd, CDROMREADRAW, buffer); /* debug code */ /* perror("UNO: -- "); fprintf(stderr, ": %d\n", rv); */ close(fd); return 0; } #endif cdw_rv_t get_cds_mixed_with_ioctl(void) { const char *drive = cdw_drive_get_drive_fullpath(); int fd = open(drive, O_RDONLY); if (fd != -1) { int ioctl_mode = ioctl(fd, CDROM_DISC_STATUS, 0); close(fd); if (ioctl_mode != -1) { if (ioctl_mode == CDS_MIXED) { return CDW_OK; } else { return CDW_NO; } } else { return CDW_ERROR; } } else { return CDW_ERROR; } } /** \brief Read one line of text, but no longer than 10k of chars Function ends the line with '\0'; \param file - open file that you want to read from \return pointer to freshly allocated space with characters read \return NULL if reading failed */ char *my_readline_10k(FILE *file) { char *buffer = NULL; size_t total_len = 0; while(1) { char fgets_buffer[100]; int fgets_buffer_size = 100; /* reasonable initial value */ char *r = fgets(fgets_buffer, fgets_buffer_size, file); if (r == fgets_buffer) { /* some content was read to buffer */ size_t fgets_len = strlen(fgets_buffer); total_len += fgets_len; char *tmp = (char *) realloc(buffer, total_len + 1); if (tmp != buffer) { /* buffer was re-allocated AND moved */ buffer = tmp; } char *end = buffer + total_len - fgets_len; /* +1 for ending '\0' that is always added by fgets(); */ strncpy(end, fgets_buffer, fgets_len + 1); /* '\n' from file is also read by fgets() and put into string */ if (*(buffer + total_len - 1) == '\n') { // *(buffer + total_len - 1) = '\0'; /* this also means that last fragment of line was read */ break; } if (total_len >= 10000) { *(buffer + total_len) = '\0'; /* I can't imagine any option longer than 10k chars */ break; } } else { /* r == NULL: EOF or error */ break; } } return buffer; } /** \brief Function inspecting given table of id,label pairs and returning label matching given id. First argument is table of elements of cdw_id_label_t type. Last element of the table must be {-1, "unknown value"}, where -1 serves as guard and "unknown value" string that is displayed when there is no other match. Second argument is id / key of searched string. \param table - table of id,label pairs \param id - id to be matched against values in table \return pointer to const string that matches given id, \return fall back error string if no id matches */ const char *cdw_utils_id_label_table_get_label(cdw_id_clabel_t *table, cdw_id_t id) { cdw_assert (table != (cdw_id_clabel_t *) NULL, "ERROR: input table is NULL\n"); #ifndef NDEBUG int j = 0; /* this piece of code is used to detect potential incorrectly built tables without final guard string */ while (table[j].label != (char *) NULL) { __attribute__((unused)) size_t len = strlen(table[j].label); j++; } #endif int i = 0; /* it turns out that there may be valid IDs == -1, so I'm using (char *) NULL as guard */ while (table[i].label != (char *) NULL && table[i].id != id) { i++; } return table[i].label; /* may be (char *) NULL */ } cdw_id_t cdw_utils_id_label_table_get_id(cdw_id_clabel_t *table, const char *label, cdw_id_t guard) { cdw_assert (table, "ERROR: input table is NULL\n"); if (!label) { cdw_vdm ("WARNING: looking for id of NULL string, returning guard \n"); return guard; } int i = 0; while (table[i].id != guard) { if (!strcmp(table[i].label, label)) { return table[i].id; } i++; } return guard; } static cdw_id_clabel_t cdw_rv_t_table[] = { { CDW_OK, "CDW_OK" }, { CDW_CANCEL, "CDW_CANCEL" }, { CDW_NO, "CDW_NO" }, { CDW_ERROR, "CDW_ERROR" }, { -1, (char *) NULL }}; /* guard */ const char *cdw_utils_get_crv_label(cdw_rv_t crv) { return cdw_utils_id_label_table_get_label(cdw_rv_t_table, crv); } cdw_id_clabel_t cdw_bool_type_labels[] = { { CDW_UNKNOWN, "CDW_UNKNOWN" }, { CDW_TRUE, "CDW_TRUE" }, { CDW_FALSE, "CDW_FALSE" }, { 0, (char *) NULL }}; const char *cdw_utils_get_cdw_bool_type_label(int cdw_bool) { return cdw_utils_id_label_table_get_label(cdw_bool_type_labels, cdw_bool); } /* boolean, but with three values */ cdw_id_clabel_t cdw_bool_type_chars[] = { /* 2TRANS: this string means "unknown type or state"; no more than 2 chars */ { CDW_UNKNOWN, gettext_noop("?") }, /* also known as "init" */ /* 2TRANS: "N" like in "No, the disc doesn't have this attribute"; no more than 2 chars */ { CDW_FALSE, gettext_noop("N") }, /* 2TRANS: "Y" like in "Yes, the disc has this attribute"; no more than 2 chars */ { CDW_TRUE, gettext_noop("Y") }, { -1, (char *) NULL }}; /* guard */ const char *cdw_utils_get_cdw_bool_type_char(int cdw_bool) { cdw_assert (cdw_bool == CDW_UNKNOWN || cdw_bool == CDW_FALSE || cdw_bool == CDW_TRUE, "ERROR: invalid value of cdw_bool: %d\n", cdw_bool); return cdw_utils_id_label_table_get_label(cdw_bool_type_chars, cdw_bool); } /** \brief Helper function for qsort() - compare two integer values Function that is used as compar() argument to qsort() function. It returns -1, 0 or 1 if first argument is less than, equal or larger than second. Passing this function to qsort() results in table of ints sorted from lowest to highest. \param int1 - first integer to compare \param int2 - second integer to compare \return -1, 0 or 1 if first int is less than, equal or larger than second */ int cdw_utils_compare_ints(const void *int1, const void *int2) { const int *i1 = (const int *) int1; const int *i2 = (const int *) int2; if (*i1 < *i2) { return -1; } else if (*i1 > *i2) { return 1; } else { return 0; } } /** \brief Helper function for qsort() - compare two integer values Function that is used as compar() argument to qsort() function. It returns -1, 0 or 1 if first argument is less than, equal or larger than second. Passing this function to qsort() results in table of ints sorted from lowest to highest. \param int1 - first integer to compare \param int2 - second integer to compare \return -1, 0 or 1 if first int is less than, equal or larger than second */ int cdw_utils_compare_ints_reverse(const void *int1, const void *int2) { const int *i1 = (const int *) int1; const int *i2 = (const int *) int2; if (*i1 > *i2) { return -1; } else if (*i1 < *i2) { return 1; } else { return 0; } } /** \brief Calculate estimated time of accomplishment for a task, convert this time to string You can calculate \p eta like this: - eta = amount left / speed - speed = amount done / time from beginning of process - eta = (amount left / amount done) * time from beginning of process or: int eta = (int) (((1.0 * todo_size) / done_size) * time_from_start); \param eta_string - output string with ETA in hh:mm:ss format \param eta - input eta value (most probably in seconds ;) ) \param n - size of output buffer (does not include space for ending '\0') */ void cdw_utils_eta_calculations(char *eta_string, int eta, size_t n) { cdw_sdm ("ETA input value: %d\n", eta); if (eta < 0) { /* it may happen at the beginning of process */ /* 2TRANS: ETA is Expected Time of Arrival, time to finish a task; three "??" values are number of hours, minutes seconds left, "??" are used when the time cannot be calculated. The string will be displayed in progress dialog window. Keep short. */ snprintf(eta_string, n + 1, _("ETA: ??:??:??")); } else { /* C99 truncates result of division towards zero (C: A Reference manual, 5th ed., 7.6.1.) */ int eta_hour = (eta / 60) / 60; /* extract number of seconds in full hours from total number of seconds */ int eta_min = (eta - ((eta_hour * 60) * 60)) / 60; /* extract number of seconds in full hours and in full minutes from total number of seconds */ int eta_sec = eta - (((eta_hour * 60) * 60) + (eta_min * 60)); /* 2TRANS: ETA is Expected Time of Arrival, time to finish a task; three "%d" values are number of hours, minutes seconds left. The string will be displayed in progress dialog window. Keep short. */ snprintf(eta_string, n + 1, _("ETA: %d:%02d:%02d"), eta_hour, eta_min, eta_sec); } cdw_sdm ("ETA output value: %s\n", eta_string); return; } int cdw_utils_compress_table_of_ints(int *table, int n_max) { table[0] = table[0]; int j = 1; for (int i = 1; i < n_max; i++) { if (table[i] == table[j - 1]) { ; } else { table[j] = table[i]; j++; } } return j; } /* *********************** */ /* *** unit tests code *** */ /* *********************** */ //#define CDW_UNIT_TEST_CODE /* definition used during development of unit tests code */ #ifdef CDW_UNIT_TEST_CODE static void test_cdw_utils_eta_calculations(void); static void test_cdw_utils_compress_table_of_ints(void); static void test_cdw_utils_id_label_table_get_label(void); static void test_cdw_utils_id_label_table_get_id(void); void cdw_utils_run_tests(void) { fprintf(stderr, "testing cdw_utils.c\n"); test_cdw_utils_eta_calculations(); test_cdw_utils_compress_table_of_ints(); test_cdw_utils_id_label_table_get_label(); test_cdw_utils_id_label_table_get_id(); fprintf(stderr, "done\n\n"); return; } void test_cdw_utils_eta_calculations(void) { fprintf(stderr, "\ttesting cdw_utils_eta_calculations()... "); char buf[50 + 1]; struct { size_t buf_len; /* this test may use subbuffers of various lengths */ int input_eta; const char *expected_result; } test_data[] = { { 20, 0, "ETA: 0:00:00" }, { 20, 1, "ETA: 0:00:01" }, { 20, 2, "ETA: 0:00:02" }, { 20, 3, "ETA: 0:00:03" }, { 20, 10, "ETA: 0:00:10" }, { 20, 60, "ETA: 0:01:00" }, { 20, 61, "ETA: 0:01:01" }, { 20, 20 * 60 + 4, "ETA: 0:20:04" }, { 20, (17 * 60 * 60) + (21 * 60) + 4, "ETA: 17:21:04" }, { 10, (17 * 60 * 60) + (21 * 60) + 4, "ETA: 17:21" }, { 0, 0, (char *) NULL }}; int i = 0; while (test_data[i].expected_result != (char *) NULL) { cdw_utils_eta_calculations(buf, test_data[i].input_eta, test_data[i].buf_len); int rv = strcmp(test_data[i].expected_result, buf); cdw_assert_test (rv == 0, "ERROR: failed test #%d, eta = %d\n", i, test_data[i].input_eta); i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_utils_compress_table_of_ints(void) { fprintf(stderr, "\ttesting cdw_utils_compress_table_of_ints()... "); #define TABLE_SIZE 18 struct { int table_in[TABLE_SIZE]; int table_out[TABLE_SIZE]; int expected_n; } test_data[] = { { { 0, 1, 1, 2, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 9, 9, 9, 10 }, { 0, 1, 2, 3, 4, 6, 7, 9, 10, 6, 6, 6, 6, 7, 9, 9, 9, 10 }, 9 }, { { 0, 1, 2, 3, 3, 3, 4, 5, 5, 7, 8, 8, 8, 10, 10, 10, 11, 12 }, { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 8, 8, 10, 10, 10, 11, 12 }, 11 }, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 1 }, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, -1 /* guard */ } }; int i = 0; while (test_data[i].expected_n != -1) { int rv = cdw_utils_compress_table_of_ints(test_data[i].table_in, TABLE_SIZE); cdw_assert (rv == test_data[i].expected_n, "ERROR: data set #%d: expected number of unique elements = %d, result is %d\n", i, test_data[i].expected_n, rv); for (int j = 0; j < rv; j++) { cdw_assert (test_data[i].table_in[j] == test_data[i].table_out[j], "ERROR: data set #%d: elements #%d do not match (%d != %d)\n", i, j, test_data[i].table_in[j], test_data[i].table_out[j]); } i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_utils_id_label_table_get_label(void) { fprintf(stderr, "\ttesting cdw_utils_id_label_table_get_label()... "); cdw_id_clabel_t test_table[] = { { 23, "hello", }, { 76, "milky", }, { 111, "Tuesday", }, { 487, "robotic", }, { -5235, "normalized", }, { 385, "every day", }, { 244, " so called solution " }, { 444, " orange", }, { 98, (char *) NULL, }}; int i = 0; while (test_table[i].label) { const char *label = cdw_utils_id_label_table_get_label(test_table, test_table[i].id); cdw_assert (!strcmp(label, test_table[i].label), "ERROR: data set #%d: expected label \"%s\", got label \"%s\" (id = %lld)\n", i, test_table[i].label, label, test_table[i].id); i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_utils_id_label_table_get_id(void) { fprintf(stderr, "\ttesting cdw_utils_id_label_table_get_id()... "); cdw_id_t the_guard = 495; cdw_id_clabel_t test_table[] = { { 23, "hello", }, { 76, "milky", }, { 111, "Tuesday", }, { 487, "robotic", }, { -5235, "normalized", }, { 385, "every day", }, { 244, " so called solution " }, { 444, " orange", }, { 98, "swift ", }, { the_guard, "closed", }}; int i = 0; while (test_table[i].id != the_guard) { cdw_id_t id = cdw_utils_id_label_table_get_id(test_table, test_table[i].label, the_guard); cdw_assert (id == test_table[i].id, "ERROR: data set #%d: expected id = %lld, got id = %lld (label = \"%s\")\n", i, test_table[i].id, id, test_table[i].label); i++; } fprintf(stderr, "OK\n"); return; } #endif /* #ifdef CDW_UNIT_TEST_CODE */ cdw-0.7.1/src/utilities/cdw_utils.h0000644000175000017500000000263711713571522014201 00000000000000#ifndef H_CDW_UTILS #define H_CDW_UTILS #include #include /* lsn_t */ #include "cdw_cdio.h" #include "main.h" typedef struct { bool support_dvd_rp_dl; int escdelay_ms; } cdw_arguments_t; int cdw_utils_process_commandline_arguments(int argc, char *argv[]); int cdw_locale_init(void); cdw_rv_t get_cds_mixed_with_ioctl(void); void after_event(const char *title, int adddic); char *my_readline_10k(FILE *file); const char *cdw_utils_id_label_table_get_label(cdw_id_clabel_t *table, cdw_id_t id); cdw_id_t cdw_utils_id_label_table_get_id(cdw_id_clabel_t *table, const char *label, cdw_id_t guard); const char *cdw_utils_get_crv_label(cdw_rv_t crv); const char *cdw_utils_get_cdw_bool_type_label(int cdw_bool); const char *cdw_utils_get_cdw_bool_type_char(int cdw_bool); int cdw_utils_compare_ints(const void *int1, const void *int2); int cdw_utils_compare_ints_reverse(const void *int1, const void *int2); void cdw_utils_eta_calculations(char *eta_string, int eta, size_t n); int cdw_utils_compress_table_of_ints(int *table, int n_max); /* unit tests */ void cdw_utils_run_tests(void); #if 0 /* currently unused */ int raw_read_sector(lsn_t sector, char *buffer); /* just a debug tool, normally not used */ int raw_read_sector2(lsn_t sector); /* just a debug tool, normally not used */ int add_to_dic(); void clean_before_cdw_exit(void); #endif #endif /* H_CDW_UTILS */ cdw-0.7.1/src/utilities/cdw_regex.h0000644000175000017500000000273011532500625014140 00000000000000#ifndef H_CDW_REGEX #define H_CDW_REGEX #include #include "main.h" #include "cdw_debug.h" typedef int (* cdw_regex_handler_t)(regex_t *, regmatch_t *); typedef struct { const char *debug_label; /* used for debug purposes */ cdw_id_t debug_id; /* used for debug purposes */ const char *pattern; /* what we want to capture */ regex_t *regex; /* compiled pattern */ regmatch_t *matches; /* stores results of successful match */ int regcomp_opts; /* int args for regcomp() */ cdw_regex_handler_t handler; /* function processing information from 'matches' */ } cdw_regex_t; cdw_rv_t cdw_regex_prepare_regexes_table(cdw_regex_t table[]); void cdw_regex_execute_regexes_table(cdw_regex_t table[], const char *buffer); void cdw_regex_clean_up_regexes_table(cdw_regex_t table[]); /* utility functions used in (all) *_regex.c files */ void cdw_regex_regcomp_error_handler(const char *caller_name, int errcode, const regex_t *regex, cdw_id_t id); int cdw_regex_get_submatch(regmatch_t *matches, unsigned int sub, char *buffer, char *submatch); /* this will be reused quite a few times in *_regex.c files */ #define cdw_regex_assert_subex_number(is, should_be) \ cdw_assert (is == should_be, \ "ERROR: failed to catch proper number of subexpressions (is %zd, should be %d), something has changed in compiled regex\n", \ is, should_be); #endif /* H_CDW_REGEX */ cdw-0.7.1/src/utilities/cdw_cdll.c0000644000175000017500000005125611722437745013763 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "cdw_cdll.h" #include "cdw_debug.h" /** * \file cdw_cdll.c * \brief Bug-ridden implementation of doubly circularly linked list * */ static bool cdw_cdll_is_valid_head(cdw_cdll_t *head); static bool cdw_cdll_is_member(cdw_cdll_t *head, void *data); static cdw_rv_t cdw_cdll_append_non_unique(cdw_cdll_t *head, void *data); static cdw_cdll_t *cdw_cdll_last_element(cdw_cdll_t *head); static cdw_cdll_t *cdw_cdll_get_ith_element(cdw_cdll_t *head, size_t i); static cdw_cdll_t *cdw_cdll_new_element(void); /** * \brief Initialize a list * * Call this function when you create new list. 'head' parameter will be * used to reference the list and it is the only element of list that * needs to be initialized by this function. * * The function doesn't put any user data into this element - it just * initializes the list. * * \param head - first element of list * * \return CDW_ERROR if some malloc error occurs * \return CDW_NO if list is already initialized * \return CDW_OK if success */ cdw_rv_t cdw_cdll_init(cdw_cdll_t **head) { cdw_assert (*head == (cdw_cdll_t *) NULL, "passing non-null head to init()\n"); *head = cdw_cdll_new_element(); if (*head == NULL) { return CDW_ERROR; } else { (*head)->prev = *head; (*head)->next = *head; (*head)->data = (void *) NULL; return CDW_OK; } } /** * \brief Returns last element of list * * Useful when you want to append new data at the end of list. * "Last" in this implementation of doubly-linked list is defined as * "last one that you meet when starting from head, going forward, and * still not getting back to head" * * \return NULL if list is empty * \return pointer to last element on list if list is not empty */ cdw_cdll_t *cdw_cdll_last_element(cdw_cdll_t *head) { cdw_assert (cdw_cdll_is_valid_head(head), "head is invalid\n"); return head->prev; } /** * \brief Allocate new list element * * Pointers to previous and next list elements are initialized to * (cdw_cdll_t *) NULL. Pointer to data is initialized to (void *) NULL. * * \return Pointer to freshly allocated list element * \return NULL if malloc fails */ cdw_cdll_t *cdw_cdll_new_element(void) { cdw_cdll_t *e = (cdw_cdll_t *) malloc(sizeof(cdw_cdll_t)); if (e == NULL) { return (cdw_cdll_t *) NULL; } e->data = (void *) NULL; e->next = (cdw_cdll_t *) NULL; e->prev = (cdw_cdll_t *) NULL; return e; } /** * \brief Append data (in new list element) at the end of list * * The function does not check if given data already exists on list. * In order to avoid duplicates on list you have to search for given * data on the list first. * * The function will initialize list if list is empty. * * \param data - pointer to data that you want to append to list * * \return CDW_ERROR if malloc fails * \return CDW_OK if success */ cdw_rv_t cdw_cdll_append_non_unique(cdw_cdll_t *head, void *data) { cdw_assert (cdw_cdll_is_valid_head(head), "head of list is invalid\n"); if (cdw_cdll_is_empty(head)) { head->data = data; return CDW_OK; } else { cdw_cdll_t *last = cdw_cdll_last_element(head); if (last == (cdw_cdll_t *) NULL) { return CDW_ERROR; } else { cdw_cdll_t *e = cdw_cdll_new_element(); if (e == (cdw_cdll_t *) NULL) { return CDW_ERROR; } else { head->prev = e; e->next = head; last->next = e; e->prev = last; e->data = data; return CDW_OK; } } } } /** * \brief Append pointer to data (in new list element) at the end of list * * The function checks if given data already exists on list. Item * that would be duplicate on the list is not appended and CDW_NO is returned. * * \param data - pointer to data that you want to store on list * * \return CDW_ERROR if malloc fails * \return CDW_NO if data is already on list * \return CDW_OK if success */ cdw_rv_t cdw_cdll_append(cdw_cdll_t *head, void *data) { if (cdw_cdll_is_member(head, data)) { return CDW_NO; } else { /* will init list if necessary */ return cdw_cdll_append_non_unique(head, data); } } /** * \brief Return pointer to i-th element on filelist * * \param i - index of list element containing data that you want to obtain (0-based) * * \return Pointer to i-th element of list * \return NULL if index is too large or list is empty */ cdw_cdll_t *cdw_cdll_get_ith_element(cdw_cdll_t *head, size_t i) { if (head == (cdw_cdll_t *) NULL) { return NULL; } if (head->next == head) { return head; } cdw_cdll_t *elem = head; size_t j = 0; for (j = 0; j <= i; j++) { if (j == i) { return elem; } else { elem = elem->next; } } return NULL; } /** * \brief Return pointer to data in i-th element of list * * \param i - index of list element containing data that you want to obtain (0-based) * * \return Pointer to i-th element of list * \return NULL if index is too large or list is empty */ void *cdw_cdll_ith_data(cdw_cdll_t *head, size_t i) { if (head == (cdw_cdll_t *) NULL) { return NULL; } cdw_cdll_t *element = cdw_cdll_get_ith_element(head, i); if (element == NULL) { return NULL; } else { return element->data; } } /** * \brief Remove i-th element from list * * \param i - index of element that should be removed (zero-based) * * \return CDW_ERROR if list is empty or other error occurred * \return CDW_OK if success */ cdw_rv_t cdw_cdll_remove(cdw_cdll_t **head, size_t i) { if (*head == (cdw_cdll_t *) NULL) { return CDW_ERROR; } cdw_cdll_t *f = cdw_cdll_get_ith_element(*head, i); if (f == NULL) { return CDW_ERROR; } /* works even if j is first or last node, NULLs are preserved */ if (f->next != NULL) { f->next->prev = f->prev; } if (f->prev != NULL) { f->prev->next = f->next; } if (f == *head) { if (f->next == *head) { /* this was the only element on list; pointer to data can be NULLed, but otherwise head must be intact */ f->data = (void *) NULL; } else { /* we have to create new list's head */ *head = f->next; f->data = (void *) NULL; free(f); f = (cdw_cdll_t *) NULL; } } return CDW_OK; } /** * \brief Count files on list * * \return Number of files on filelist (0 if no files) */ size_t cdw_cdll_length(cdw_cdll_t *head) { if (cdw_cdll_is_empty(head)) { return 0; } else { cdw_cdll_t *f; size_t i = 1; for (f = head; f->next != head; f = f->next) { i++; } return i; } } /** * \brief Remove all elements from list * * \return CDW_OK */ cdw_rv_t cdw_cdll_destroy(cdw_cdll_t *head) { size_t len = cdw_cdll_length(head); for (size_t i = 0; i < len; i++) { cdw_cdll_t *tmp = head->next; cdw_sdm ("INFO: free %zd\n", i); free(head); head = tmp; } return CDW_OK; } /** * \brief Check if list is empty * * You could use cdw_cdll_elements() and check if its return value is * zero, but cdw_cdll_is_empty() is faster when calling it for long, * non-empty lists. * * List is treated as invalid (and thus as empty) if its first element is * invalid: when 'next' or 'prev' or 'data' pointer is NULL. * * * * \return true if list is empty or invalid * \return false if list is not empty */ bool cdw_cdll_is_empty(cdw_cdll_t *head) { cdw_assert (cdw_cdll_is_valid_head(head), "head of list is invalid\n"); if (head->data == (void *) NULL) { return true; } else { return false; } } bool cdw_cdll_is_valid_head(cdw_cdll_t *head) { if (head != (cdw_cdll_t *) NULL && head->next != (cdw_cdll_t *) NULL && head->prev != (cdw_cdll_t *) NULL) { return true; } else { return false; } } /** * \brief Check if given pointer to data is already on the list * * Search for given pointer to data on the list. Return true if * the pointer is on the list, return false if the pointer is not on * the list. * * The function also works for empty list: it returns false. * * \param data - pointer to data which you want to look for on the list * * \return true if given pointer is on the list * \return false if given pointer is not on the list (or the list is empty) */ bool cdw_cdll_is_member(cdw_cdll_t *head, void *data) { cdw_assert (cdw_cdll_is_valid_head(head), "head of list is invalid\n"); if (cdw_cdll_is_empty(head)) { return false; } if (data == (cdw_cdll_t *) NULL) { return false; } if (head->next == head) { if (head->data == data) { return true; } } cdw_cdll_t *e; for (e = head; e->next != head; e = e->next) { if (e->data == data) { return true; } } return false; } #ifdef CDW_UNIT_TEST_CODE /* *********************** */ /* *** unit tests code *** */ /* *********************** */ #include void test_cdw_cdll_new_element(void); void test_cdw_cdll_init(void); void test_cdw_cdll_append(void); void test_cdw_cdll_is_empty(void); void test_cdw_cdll_length(void); void test_cdw_cdll_remove(void); void cdw_cdll_run_tests(void) { fprintf(stderr, "testing cdw_cdll.c\n"); test_cdw_cdll_new_element(); test_cdw_cdll_init(); test_cdw_cdll_is_empty(); test_cdw_cdll_append(); test_cdw_cdll_length(); test_cdw_cdll_remove(); fprintf(stderr, "done\n\n"); return; } void test_cdw_cdll_new_element(void) { fprintf(stderr, "\ttesting cdw_cdll_new_element()... "); cdw_cdll_t *head = cdw_cdll_new_element(); cdw_assert_test (head != (cdw_cdll_t *) NULL, "head == NULL"); cdw_assert_test (head->next == (cdw_cdll_t *) NULL, "next != NULL"); cdw_assert_test (head->prev == (cdw_cdll_t *) NULL, "prev != NULL"); cdw_assert_test (head->data == (void *) NULL, "data != NULL"); free(head); fprintf(stderr, "OK\n"); return; } void test_cdw_cdll_init(void) { fprintf(stderr, "\ttesting cdw_cdll_init()... "); cdw_cdll_t *head = NULL; cdw_rv_t crv = cdw_cdll_init(&head); assert (crv == CDW_OK); assert(head->next == head); assert(head->prev == head); assert(head->data == (void *) NULL); crv = cdw_cdll_destroy(head); assert (crv == CDW_OK); fprintf(stderr, "OK\n"); return; } void test_cdw_cdll_is_empty(void) { fprintf(stderr, "\ttesting cdw_cdll_is_empty()... "); bool is_empty = false; /* cdw_cdll_is_empty() can only work for valid list head, so first make valid head, and then only modify data pointer */ cdw_cdll_t *head = (cdw_cdll_t *) NULL; cdw_cdll_init(&head); is_empty = cdw_cdll_is_empty(head); assert (is_empty); head->data = malloc(10); assert (head->data != (void *) NULL); is_empty = cdw_cdll_is_empty(head); assert (!is_empty); free(head->data); cdw_rv_t crv = cdw_cdll_destroy(head); assert(crv == CDW_OK); fprintf(stderr, "OK\n"); return; } void test_cdw_cdll_append(void) { fprintf(stderr, "\ttesting cdw_cdll_append()... "); cdw_cdll_t *head = (cdw_cdll_t *) NULL; cdw_cdll_init(&head); struct my_data_t { char string[15]; int number; }; struct my_data_t *retrieved = (struct my_data_t *) NULL; int l = 0; cdw_rv_t crv = CDW_NO; /* *** appending first item *** */ struct my_data_t my_data; strncpy(my_data.string, "hello world", 12); my_data.number = 11; crv = cdw_cdll_append(head, (void *) &my_data); assert (crv == CDW_OK); /* appending data to empty list should not modify links */ cdw_assert_test (head->next == head, "invalid next (1)"); cdw_assert_test (head->prev == head, "invalid prev (1)"); retrieved = head->data; l = strcmp(retrieved->string, my_data.string); cdw_assert_test (l == 0, "head string not appended (1)"); cdw_assert_test (retrieved->number == my_data.number, "head number not appended (1)"); /* *** append second item *** */ struct my_data_t my_data2; strncpy(my_data2.string, "asteroid", 10); my_data2.number = 22; crv = cdw_cdll_append(head, (void *) &my_data2); assert (crv == CDW_OK); /* first check links */ cdw_assert_test (head->next->next == head, "invalid next (2)"); cdw_assert_test (head->prev->prev == head, "invalid prev (2)"); cdw_assert_test (head->prev == head->next, "invalid circle (2)"); /* re-check data from head */ retrieved = head->data; l = strcmp(retrieved->string, my_data.string); cdw_assert_test (l == 0, "head string corrupted (2)"); cdw_assert_test (retrieved->number == my_data.number, "head number corrupted (2)"); /* check data from second element of list */ retrieved = head->next->data; l = strcmp(retrieved->string, my_data2.string); cdw_assert_test (l == 0, "second element string not appended (2)"); cdw_assert_test (retrieved->number == my_data2.number, "second element number not appended (2)"); /* *** append third item *** */ struct my_data_t my_data3; strncpy(my_data2.string, "melbourne", 10); my_data2.number = 33; crv = cdw_cdll_append(head, (void *) &my_data3); assert (crv == CDW_OK); /* first check links */ cdw_assert_test (head->next->next->next == head, "invalid next (3)"); cdw_assert_test (head->prev->prev->prev == head, "invalid prev (3)"); cdw_assert_test (head->prev->prev == head->next, "invalid circle (3a)"); cdw_assert_test (head->prev == head->next->next, "invalid circle (3b)"); /* re-check data from head */ retrieved = head->data; l = strcmp(retrieved->string, my_data.string); cdw_assert_test (l == 0, "head string corrupted (3)"); cdw_assert_test (retrieved->number == my_data.number, "head number corrupted (3)"); /* check data from second element of list */ retrieved = head->next->data; l = strcmp(retrieved->string, my_data2.string); cdw_assert_test (l == 0, "second element string not appended (3)"); cdw_assert_test (retrieved->number == my_data2.number, "second element number not appended (3)"); /* check data from third element of list */ retrieved = head->next->next->data; l = strcmp(retrieved->string, my_data3.string); cdw_assert_test (l == 0, "third element string not appended (3)"); cdw_assert_test (retrieved->number == my_data3.number, "third element number not appended (3)"); crv = cdw_cdll_destroy(head); assert(crv == CDW_OK); fprintf(stderr, "OK\n"); return; } void test_cdw_cdll_length(void) { fprintf(stderr, "\ttesting cdw_cdll_length()... "); cdw_cdll_t *head = (cdw_cdll_t *) NULL; cdw_cdll_init(&head); int data1 = 123456; int data2 = 886644; int data3 = 13579; int data4 = 24680; int data5 = 123612; int data6 = 98765; size_t len = cdw_cdll_length(head); cdw_assert_test (len == 0, "len is not 0\n"); cdw_rv_t crv = cdw_cdll_append(head, &data1); cdw_assert_test (crv == CDW_OK, "failed to append first element\n"); len = cdw_cdll_length(head); cdw_assert_test (len == 1, "len is not 1\n"); crv = cdw_cdll_append(head, &data2); cdw_assert_test (crv == CDW_OK, "failed to append second element\n"); len = cdw_cdll_length(head); cdw_assert_test (len == 2, "len is not 2\n"); crv = cdw_cdll_append(head, &data3); cdw_assert_test (crv == CDW_OK, "failed to append third element\n"); len = cdw_cdll_length(head); cdw_assert_test (len == 3, "len is not 3\n"); crv = cdw_cdll_append(head, &data4); cdw_assert_test (crv == CDW_OK, "failed to append fourth element\n"); len = cdw_cdll_length(head); cdw_assert_test (len == 4, "len is not 4\n"); crv = cdw_cdll_append(head, &data5); cdw_assert_test (crv == CDW_OK, "failed to append fifth element\n"); len = cdw_cdll_length(head); cdw_assert_test (len == 5, "len is not 5\n"); crv = cdw_cdll_append(head, &data6); cdw_assert_test (crv == CDW_OK, "failed to append sixth element\n"); len = cdw_cdll_length(head); cdw_assert_test (len == 6, "len is not 6\n"); fprintf(stderr, "OK\n"); return; } void test_cdw_cdll_remove(void) { fprintf(stderr, "\ttesting cdw_cdll_remove()... "); cdw_cdll_t *head = (cdw_cdll_t *) NULL; cdw_cdll_init(&head); int data0 = 123456; int data1 = 886644; int data2 = 13579; int data3 = 24680; int data4 = 123612; int data5 = 98765; int *retrieved; size_t len = cdw_cdll_length(head); cdw_assert_test (len == 0, "len is not 0\n"); cdw_rv_t crv = cdw_cdll_append(head, &data0); cdw_assert_test (crv == CDW_OK, "failed to append first element\n"); retrieved = head->data; cdw_assert_test (data0 == *retrieved, "incorrect data (0)\n"); crv = cdw_cdll_append(head, &data1); cdw_assert_test (crv == CDW_OK, "failed to append second element\n"); retrieved = head->next->data; cdw_assert_test (data1 == *retrieved, "incorrect data (1)\n"); crv = cdw_cdll_append(head, &data2); cdw_assert_test (crv == CDW_OK, "failed to append third element\n"); retrieved = head->next->next->data; cdw_assert_test (data2 == *retrieved, "incorrect data (2)\n"); crv = cdw_cdll_append(head, &data3); cdw_assert_test (crv == CDW_OK, "failed to append fourth element\n"); retrieved = head->next->next->next->data; cdw_assert_test (data3 == *retrieved, "incorrect data (3)\n"); crv = cdw_cdll_append(head, &data4); cdw_assert_test (crv == CDW_OK, "failed to append fifth element\n"); retrieved = head->next->next->next->next->data; cdw_assert_test (data4 == *retrieved, "incorrect data (4)\n"); crv = cdw_cdll_append(head, &data5); cdw_assert_test (crv == CDW_OK, "failed to append sixth element\n"); retrieved = head->next->next->next->next->next->data; cdw_assert_test (data5 == *retrieved, "incorrect data (5)\n"); len = cdw_cdll_length(head); cdw_assert_test (len == 6, "len is not 6\n"); /* at this point data is prepared and checked, ready for removing */ /* first remove - last element */ crv = cdw_cdll_remove(&head, 5); len = cdw_cdll_length(head); cdw_assert_test (len == 5, "len is not 5\n"); cdw_assert_test (head->next->next->next->next->next->data == head->data, "circle not closed\n"); cdw_assert_test (head->prev->prev->prev->prev->prev->data == head->data, "circle not closed (2)\n"); retrieved = head->data; cdw_assert_test (*retrieved == data0, "data 0 invalid after remove\n"); retrieved = head->prev->data; cdw_assert_test (*retrieved == data4, "data 4 invalid after remove\n"); /* second remove - element in middle */ crv = cdw_cdll_remove(&head, 2); len = cdw_cdll_length(head); cdw_assert_test (len == 4, "len is not 4\n"); cdw_assert_test (head->next->next->next->next->data == head->data, "circle not closed (3)\n"); cdw_assert_test (head->prev->prev->prev->prev->data == head->data, "circle not closed (4)\n"); retrieved = head->data; cdw_assert_test (*retrieved == data0, "data 0 invalid after remove\n"); retrieved = head->next->data; cdw_assert_test (*retrieved == data1, "data 1 invalid after remove\n"); retrieved = head->next->next->data; cdw_assert_test (*retrieved == data3, "data 3 invalid after remove\n"); retrieved = head->next->next->next->data; cdw_assert_test (*retrieved == data4, "data 4 invalid after remove\n"); retrieved = head->next->next->next->next->data; cdw_assert_test (*retrieved == data0, "data 0 invalid after remove\n"); retrieved = head->data; cdw_assert_test (*retrieved == data0, "data 0 invalid after remove\n"); retrieved = head->prev->data; cdw_assert_test (*retrieved == data4, "data 4 invalid after remove\n"); retrieved = head->prev->prev->data; cdw_assert_test (*retrieved == data3, "data 3 invalid after remove\n"); retrieved = head->prev->prev->prev->data; cdw_assert_test (*retrieved == data1, "data 1 invalid after remove\n"); retrieved = head->prev->prev->prev->prev->data; cdw_assert_test (*retrieved == data0, "data 0 invalid after remove\n"); /* third remove - removing first element of list - head will be updated */ crv = cdw_cdll_remove(&head, 0); len = cdw_cdll_length(head); cdw_assert_test (len == 3, "len is not 3\n"); cdw_assert_test (head->next->next->next->data == head->data, "circle not closed (3)\n"); cdw_assert_test (head->prev->prev->prev->data == head->data, "circle not closed (4)\n"); retrieved = head->data; cdw_assert_test (*retrieved == data1, "data 1 invalid after remove\n"); retrieved = head->next->data; cdw_assert_test (*retrieved == data3, "data 3 invalid after remove\n"); retrieved = head->next->next->data; cdw_assert_test (*retrieved == data4, "data 4 invalid after remove\n"); retrieved = head->prev->data; cdw_assert_test (*retrieved == data4, "data 4 invalid after remove\n"); retrieved = head->prev->prev->data; cdw_assert_test (*retrieved == data3, "data 3 invalid after remove\n"); fprintf(stderr, "OK\n"); return; } #endif /* #ifdef CDW_UNIT_TEST_CODE */ cdw-0.7.1/src/utilities/cdw_regex.c0000644000175000017500000001600111722440001014117 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "cdw_regex.h" #include "cdw_debug.h" #include "gettext.h" /** \file cdw_regex.c \brief Generic functions for extended regex type. The file defines functions that operate on cdw_regex_t type variables. The type combines several fields related to processing regular expressions, making dealing with regular expressions easier. */ /** \brief Allocate memory for regular expression data, compile regular expressions Allocate memory for all variables of type regex_t and regmatch_t that are part of cdw_regex_t type variables located in given \p table. Function calls cdw_regex_regcomp_error_handler() on errors. Call cdw_regex_clean_up_regexes_table() to deallocate all memory allocated by this function. \param table - table of variables of type cdw_regex_t to initialize. The table needs to have guard element with debug_id == -1 as a guard value. \return CDW_GEN_ERROR on errors \return CDW_OK on success */ cdw_rv_t cdw_regex_prepare_regexes_table(cdw_regex_t table[]) { int i = 0; while (table[i].debug_id != -1) { cdw_assert (table[i].handler != (cdw_regex_handler_t) NULL, "ERROR: regex handler #%d is NULL (id = %lld / \"%s\")\n", i, table[i].debug_id, table[i].debug_label); table[i].regex = (regex_t *) malloc(sizeof(regex_t)); if (table[i].regex == (regex_t *) NULL) { cdw_vdm ("ERROR: failed to allocate memory for regex #%d\n", i); return CDW_ERROR; } int rv = regcomp(table[i].regex, table[i].pattern, table[i].regcomp_opts); table[i].matches = (regmatch_t *) calloc(1, (table[i].regex->re_nsub + 1) * sizeof(regmatch_t)); if (rv) { cdw_regex_regcomp_error_handler(__func__, rv, table[i].regex, table[i].debug_id); } i++; } return CDW_OK; } /** \brief Compare data in buffer against regular expressions, call handler function This function calls regexec() to compare data from \p buffer against every regular expression from \p table. If there is a match, the function will call proper handler function associated with matched regular expression. \param table - table of variables of type cdw_regex_t to initialize. The table needs to have guard element with debug_id == -1 as a guard value. \param buffer - buffer with data to be compared against regular expressions from \p table. Data in buffer must have proper ending '\0' char. */ void cdw_regex_execute_regexes_table(cdw_regex_t table[], const char *buffer) { int i = 0; while (table[i].debug_id != -1) { int rv = regexec(table[i].regex, buffer, table[i].regex->re_nsub + 1, table[i].matches, 0); if (rv == 0) { table[i].handler(table[i].regex, table[i].matches); cdw_sdm (" MATCHED LINE \"%s\"\n", buffer); return; } i++; } cdw_sdm ("NOT MATCHED LINE \"%s\"\n", buffer); return; } /** \brief Free all memory used by regular expression variables in the table Function deallocates all memory associated with variables of type cdw_regex_t, stored in \p table. This function should be used to free memory that was allocated with cdw_regex_prepare_regexes_table(). \param table - table of variables of type cdw_regex_t to initialize. The table needs to have guard element with debug_id == -1 as a guard value. */ void cdw_regex_clean_up_regexes_table(cdw_regex_t table[]) { int i = 0; while (table[i].debug_id != -1) { if (table[i].regex != (regex_t *) NULL) { /* regfree() only frees memory allocated by regcomp(), you still have to free malloced() pointer, i.e. [i].regex */ regfree(table[i].regex); free(table[i].regex); table[i].regex = (regex_t *) NULL; } if (table[i].matches != (regmatch_t *) NULL) { free(table[i].matches); table[i].matches = (regmatch_t *) NULL; } i++; } return; } /** \brief Display information about error in regcomp() call and call exit(1) \param caller_name - name of function calling this handler \param errcode - error value returned by regcomp() \param regex - regex string for which regcomp() returned error \param id - unique int value, specific for given regex string */ void cdw_regex_regcomp_error_handler(const char *caller_name, int errcode, const regex_t *regex, cdw_id_t id) { /* buffer for explanation of regcomp failure; WARNING: arbitrary buffer size! */ const size_t e_size = 100; char errbuf[e_size]; regerror(errcode, regex, errbuf, e_size); /* 2TRANS: this is debug message displayed in console, regcomp is a function compiling regular expressions, used in cdw code */ fprintf(stderr, _("ERROR: REGCOMP ERROR in %s(): regular expression = \"%s\", id = %lld\n"), caller_name, errbuf, id); exit(EXIT_FAILURE); } /** \brief Get a substring (regular expression token) from given data buffer Function copies a token (a substring, subexpression) from \p buffer to \p submatch. Subexpression to copy is specified by \p sub index. Start and end of given subexpression in \p buffer is taken from \p matches. Data in \p buffer is the data that was successfully compared against a regular expression. The matching comparison results in \p matches with valid data. Size of \p submatch must be no smaller than size of \p buffer. TODO: this function probably should be inline function (or not). \param matches - result of successful call to regexec() \param sub - index of subexpression to extract from \p buffer \param buffer - buffer with data that was compared against regular expression \param submatch - buffer in which the function will put a submatch \return -1 on errors \return non-negative length of subexpression copied to \p submatch */ int cdw_regex_get_submatch(regmatch_t *matches, unsigned int sub, char *buffer, char *submatch) { cdw_assert (buffer != (char *) NULL, "ERROR: data buffer pointer is NULL\n"); cdw_assert (submatch != (char *) NULL, "ERROR: submatch buffer pointer is NULL\n"); int len = matches[sub].rm_eo - matches[sub].rm_so; if (len < 0) { cdw_vdm ("ERROR: len of subexpr #%d is negative: %d\n", sub, len); return -1; } else { strncpy(submatch, (char *) &buffer[matches[sub].rm_so], (size_t) len); submatch[len] = '\0'; return len; } } cdw-0.7.1/src/utilities/cdw_string.c0000644000175000017500000016022311734412222014330 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _GNU_SOURCE /* needed by isblank(), see 'man isblank' */ #include /* floor() */ #include #include #include #include #include #include "cdw_string.h" #include "cdw_debug.h" /** \file cdw_string.c \brief Simple string utilities Few utility functions that handle (char *) strings. You will probably find some of them in a modern C library that tries to implement something more than ANSI C90. */ static size_t cdw_string_wrap_start(size_t width, size_t len, int align); static size_t cdw_string_get_line_len(const char *string, size_t chars_max); static size_t cdw_string_count_lines_new(const char *string, size_t width_max); /** \brief Return pointer to first char in string not being space, "\t", "\r" or "\n" Returned pointer points to part of string given as an argument, so it cannot be free()d. Returned pointer may point to string of length = 0 - that means that original string consisted only of white characters. \p str has to be standard C string ended with "\0". \param str - string which should be trimmed from left side \return pointer to first char in argument string str, which is neither space, nor "\t", "\n" or "\r" character \return NULL if argument is NULL \return unchanged argument if argument is an empty string */ char *cdw_string_ltrim(char *str) { if (str == NULL) { return NULL; } if (*str == '\0') { return (char *) str; } /* The strspn() function calculates the length of the initial segment of first argument which consists entirely of characters in second argument. */ return str + strspn(str, " \t\r\n"); } /** \brief Remove all spaces, "\t", "\r" or "\n" from tail of string Function removes all spaces, "\t", "\n" and "\r" chars from tail of string by inserting "\0" char after last char that is not space nor tab character. \param str - string to be trimmed at the end, it has to be ended with "\0" \return pointer to string trimmed from the right side, \return NULL if argument is NULL \return unchanged argument if argument is an empty string */ char *cdw_string_rtrim(char *str) { if (str == NULL) { return NULL; } if (*str == '\0') { return str; } char *p; for (p = str; *p; p++) ; p--; while ( (*p == ' ') || (*p == '\t') || (*p == '\r') || (*p == '\n') ) { if (p == str) { p--; break; /* read note below */ } else { p--; } } /* (p == str) condition sooner or later becomes true in case of 'str' values being all blank characters; in a moment when this condition is met, 'p--' will move 'p' pointer too far left and will reach memory outside allocated space; checks of value of such memory cells performed in 'while' loop ( (*p == ' ') etc) are in fact invalid reads beyond 'our' memory; valgrind complains about them, so we 'break' the loop to avoid such reads and to avoid littering valgrind log; such reads seem to be harmless on my box, but just to be on a safe side... */ *++p = '\0'; return str; } char *cdw_string_trim(const char *string) { if (!string) { cdw_vdm ("WARNING: passed NULL string to the function\n"); return (char *) NULL; } size_t length = strlen(string); size_t len = length; /* walk white chars starting from the end */ int i = (int) len - 1; /* watch out for "" input strings, keep the 'i >= 0' condition below */ while (isspace(string[i]) && i >= 0) { i--; length--; } /* walk white chars at the beginning */ size_t start = 0; /* last part of a loop test is for 'length' value flipping through zero to MAX */ while (isspace(string[start]) && start < len && length <= len) { start++; length--; } length = length > len ? 0 : length; char *out = (char *) NULL; /* not sure how strndup() behaves with zero length */ if (length) { out = strndup(string + start, length); } else { out = strdup(""); } out[length] = '\0'; return out; } bool cdw_string_is_all_spaces(const char *string) { size_t len = strlen(string); for (size_t i = 0; i < len; i++) { if (!isspace(string[i])) { return false; } } return true; } /* GPL 2 (or later) code from gcc-2.95.2/gcc-core-2.95.2.tar.gz/gcc-2.95.2/libiberty/concat.c */ char *cdw_string_concat(const char *first, ...) { register size_t length; register char *newstr; register char *end; register const char *arg; va_list args; /* First compute the size of the result and get sufficient memory. */ va_start (args, first); if (first == NULL) { length = 0; } else { length = strlen (first); while ((arg = va_arg (args, const char *)) != NULL) { length += strlen (arg); } } newstr = (char *) malloc (length + 1); va_end (args); /* Now copy the individual pieces to the result string. */ if (newstr != NULL) { va_start (args, first); end = newstr; if (first != NULL) { arg = first; while (*arg) { *end++ = *arg++; } while ((arg = va_arg (args, const char *)) != NULL) { while (*arg) { *end++ = *arg++; } } } *end = '\0'; va_end (args); } return (newstr); } /** \brief Append one string to another Append 'tail' string to 'head' string. 'head' is reallocated, that is why you have to pass a pointer to a string as a first arg. Result is a new 'head': pointer to concatenated 'head' and 'tail'. Old 'head' is freed, so make sure that 'head is dynamically allocated before passing it to append(). \param head - the string that you want to append sth to \param tail - the string that you want to append to tail \return CDW_ERROR if some malloc/concat error occurred \return CDW_OK if success */ cdw_rv_t cdw_string_append(char **head, const char *tail) { char *tmp = cdw_string_concat(*head, tail, NULL); if (tmp == NULL) { return CDW_ERROR; } else { free(*head); *head = tmp; return CDW_OK; } } /** \brief Check if given string doesn't contain any strange characters Make sure that string entered by user can't be used to do sth bad to/with application. Invalid characters are specified in cdw_string.h (see definition of CDW_STRING_UNSAFE_CHARS_STRING). Function accepts NULL pointers but then it returns CDW_GEN_ERROR. Empty strings ("") are treated as valid strings. \p invalid should be a string of length 2. If \p input has any invalid chars, first of them will be put into first char of \p invalid. \p invalid may be NULL, then function will not produce any output. \param string - string to be checked \param invalid - place where function will place first unsafe char from input_string \return CDW_NO if string contains any char that is not valid \return CDW_OK if string contains only valid characters \return CDW_GEN_ERROR if input_string is NULL */ cdw_rv_t cdw_string_security_parser(const char *string, char *invalid) { if (string == (char *) NULL) { cdw_vdm ("ERROR: passing NULL string to the function\n"); return CDW_ERROR; } char *c = strpbrk(string, CDW_STRING_UNSAFE_CHARS_STRING); if (c == (char *) NULL) { /* no unsafe chars */ return CDW_OK; } else { if (invalid == (char *) NULL) { cdw_vdm ("WARNING: buffer for invalid char is NULL\n"); } else { strncpy(invalid, c, 1); invalid[1] = '\0'; } return CDW_NO; } #if 0 size_t l = strlen(string); for (size_t i = 0; i < l; i++) { int c = (int) string[i]; if (isalnum(c) || isblank(c) || string[i] == '-' || string[i] == '~' || string[i] == '.' || string[i] == ',' || string[i] == '_' || string[i] == '/' || string[i] == '=' || string[i] == '+' || string[i] == ':') { ; } else { return CDW_NO; } } return CDW_OK; #endif } /** \brief Replace content of target string with content of source string Copy string from source to target. If target space is not allocated, the function will do this. If target already points to some string, old target string will be overwritten, and target pointer may be modified. target pointer must be either empty pointer or pointer returned by malloc, realloc or calloc. *target is set to NULL if there are some (re)allocation errors. \param target - pointer to target string that you want to modify \param source - source string that you want to copy to target \return CDW_ERROR on errors \return CDW_OK on success */ cdw_rv_t cdw_string_set(char **target, const char *source) { if (source == NULL) { return CDW_ERROR; } size_t len = strlen(source); char *tmp = (char *) realloc(*target, len + 1); if (tmp == NULL) { cdw_vdm ("ERROR: failed to realloc target string \"%s\" (source string = \"%s\")\n", *target, source); return CDW_ERROR; } else { *target = tmp; } strncpy(*target, source, len + 1); return CDW_OK; } /** \brief Check if given string starts with another string Silly wrapper for function that compares two strings. To be more precise the function compares only first n=strlen(substring) chars of both strings to check if first argument starts with given string (second argument). I could use strncmp(), but I want to avoid putting call to strlen() every time I need to check what a string starts with. You can use this function to check lines read from color configuration file. Make sure that 'line' starts with non-white chars. The search is case-insensitive (hence 'ci' in name). \param line - string that you want to check (to check if it starts with given substring) \param substring - field name that you are looking for in given line \return true if given line starts with field name, \return false otherwise */ bool cdw_string_starts_with_ci(const char *line, const char *substring) { if (!strncasecmp(line, substring, strlen(substring))) { return true; } else { return false; } } /** \brief Free all strings in a given table Free list of strings that were malloc()ed. Free()d pointers are set to (char *) NULL. Table itself is not free()d. You can use this function e.g. to free labels of dropdowns. \param labels - table of labels that you want to free \param n_max - size of table (maximal number of strings to be free()d) */ void cdw_string_free_table_of_strings(char *labels[], int n_max) { if (labels != (char **) NULL) { for (int i = 0; i < n_max; i++) { if (labels[i] != (char *) NULL) { free(labels[i]); labels[i] = (char *) NULL; } } } return; } /** \brief Create table of labels that represent given numbers Using int values from table of ints create table of (char *) strings (lables) that represent these ints. Inst should be no longer than 3 digits. Last element of the list is set to (char *) NULL. \p labels is a pointer to already alocated table. Table size must be big enough to store all labels and one guard element at the end. \param labels - table where labels will be stored \param ints - input values (in a table) to be converted \param n - number of ints to convert, +1 for guard in result table \return CDW_ERROR on malloc() error \return CDW_OK on success */ cdw_rv_t cdw_string_ints2labels_3(char **labels, int ints[], size_t n) { cdw_assert (labels != (char **) NULL, "you should alloc labels table\n"); cdw_assert (n > 0, "incorect size of labels table: n = %d\n", (int) n); size_t i = 0; for (i = 0; i < n; i++) { labels[i] = (char *) malloc(3 + 1); /* 3 digits + 1 ending '\0' */ if (labels[i] == NULL) { return CDW_ERROR; } memset(labels[i], ' ', 4); snprintf(labels[i], 3 + 1, "%d", ints[i]); cdw_sdm ("input int = %d, constructed labels[%d] = \"%s\"\n", ints[i], i, labels[i]); } /* obligatory ending element (guard) */ labels[n] = (char *) NULL; return CDW_OK; } /** \brief Map several possible values of option to true/false values Function compares value in \p buffer with several defined strings to check if value in \p buffer should be treated as 'true' or 'false'. If string in \p buffer is recognized (either as having meaning of 'true' or 'false'), appropriate bool value is assigned to \p value and CDW_OK is returned. Otherwise value of \p value is not changed and CDW_ERROR is returned. There are several values of \p buffer that can be mapped into 'true', and several other values that can be mapped to 'false'. Case of string in \p buffer is not significant. If \p buffer is NULL function returns CDW_ERROR. Remember to remove leading and trailing white chars from \p buffer before passing it to the function. \param buffer - buffer that you want to check \param value - variable that you want to assign true/false to \return CDW_OK if value in first argument was recognized \return CDW_ERROR if value in first argument was not recognized or first argument is NULL */ cdw_rv_t cdw_string_get_bool_value(const char *buffer, bool *value) { if (buffer == (char *) NULL) { return CDW_ERROR; } if (!strcasecmp(buffer, "1") || !strcasecmp(buffer, "yes") || !strcasecmp(buffer, "true")) { *value = true; return CDW_OK; } else if (!strcasecmp(buffer, "0") || !strcasecmp(buffer, "no") || !strcasecmp(buffer, "false")) { *value = false; return CDW_OK; } else { return CDW_ERROR; } } /** \brief Check if given string can be printed by ncurses, if not then produce printable representation Function uses mbstowsc() to check if \p string can be safely printed in ncurses window (i.e. if it contains printable characters only). If there are any non-printable characters, a pointer to freshly alloced printable representation of \p string is returned. Caller is responsible for free()ing such string. If \p string contain only printable characters, NULL is returned. \param string - string to be checked \return NULL if input string can be correctly displayed \return pointer to printable representation of input string if input string can't be correctly displayed */ char *cdw_string_get_printable_if_needed(const char *string) { size_t len = strlen(string); wchar_t *wide_string = (wchar_t *) malloc((len + 1) * (sizeof(wchar_t))); /* mbstowcs() converts multibyte 'char *' strings into 'wchar_t' strings */ size_t conv = mbstowcs(wide_string, string, len); free(wide_string); wide_string = (wchar_t *) NULL; if (conv == (size_t) -1) { /* there is some non-printable character in "string" */ char *printable_string = strdup(string); if (printable_string == (char *) NULL) { cdw_assert (0, "ERROR: failed to strdup() string \"%s\"\n", string); return (char *) NULL; } for (size_t i = 0; i < len; i++) { if ((unsigned char) printable_string[i] > 127) { printable_string[i] = '?'; } } return printable_string; } else { return (char *) NULL; } } /** \brief Get last char in a last word, in specified range Search in given \p string for last non-white character in last word. Range of the search is specified by \p chars_max: area of search starts from the beginning of string to p_chars - 1. There are some corner cases, hopefully they will be explained by examples below (just remember that chars_max is counted from one, and return value is counted from 0). "test string"/3 -> 2 "test string"/6 -> 3 "test string"/11 -> 10 (special case: limit == string length) "test string"/12 -> 10 \param string - string to be searched \param chars_max - maximal number of characters to check for word's end \return index of last non-white character in a word, in given range */ size_t cdw_string_get_line_end(const char *string, size_t chars_max) { size_t len = strlen(string); /* first decide how many chars from the start of string are to be checked */ size_t range = 0; if (len == 0) { range = 0; return 0; } else if (len < chars_max) { range = len; } else if (len == chars_max) { range = len; } else { range = chars_max; } /* '\n' is considered an end of line, so we need to search for first occurrence of the char in string */ for (size_t j = 0; j < range; j++) { if (string[j] == '\n') { return j == 0 ? 0 : j - 1; } } /* few special cases */ if (range == 0) { return 0; } else if (len == chars_max) { return range - 1; } else if (len < chars_max) { return len - 1; } else { ; } /* what is left is simple case: searching for a white char from end till start of string */ size_t i; size_t last_space = 0; for (i = range - 1; ; i--) { if (isspace(string[i])) { last_space = i; } if (last_space != 0 && !isspace(string[i]) && string[i] != '\0') { /* a char preceding last space in string, this is what we are searching for */ return i; } if (i == 0) { break; } } /* most probably zero, but caller will have to deal with it himself */ return i == 0 ? range - 1 : i; } size_t cdw_string_get_line_len(const char *string, size_t chars_max) { size_t len = strlen(string); if (len == 0) { cdw_vdm ("INFO: returning 0 for empty string\n"); return 0; } /* first decide how many chars from the start of string are to be checked */ size_t range = 0; if (len <= chars_max) { range = len; } else { range = chars_max; } if (string[0] == '\n') { cdw_vdm ("INFO: returning 1 for '\n' string\n"); return 1; } /* '\n' is considered an end of line, so we need to search for first occurrence of the char in string */ for (size_t j = 0; j < range; j++) { if (string[j] == '\n') { cdw_vdm ("INFO: returning %zd on '\n' (\"%s\")\n", j, string); return j; } } /* few special cases */ if (range == 0) { cdw_vdm ("INFO: returning 0 on zero range\n"); return 0; } else if (len == chars_max) { cdw_vdm ("INFO: returning %zd on len == chars_max (\"%s\")\n", len, string); return len; } else if (len < chars_max) { cdw_vdm ("INFO: returning %zd on len < chars_max (\"%s\")\n", len, string); return len; } else { ; } if (len > chars_max && isspace(string[chars_max])) { cdw_vdm ("INFO: returning %zd on ending space (\"%s\")\n", chars_max, string); return chars_max; } /* searching for a white char from end towards start of string */ size_t i; for (i = range - 1; ; i--) { if (string[i] == '\0' || isspace(string[i])) { break; } if (i == 0) { i = range; break; } } cdw_vdm ("INFO len of string \"%s\" is %zd (chars max = %zd)\n", string, i, chars_max); return i; } /** \brief Wrap and align a string \date Function's top-level comment reviewed on 2012-01-07 \date Function's body reviewed on 2012-01-07 Function wraps given text using \p width_max as a constraint, and aligns it to the left, center or right. Wrapping occurs on word boundaries (if possible). Newline characters ("\n") embedded in input string are respected. Resulting string can be printed in a window or form field of given \p width_max. Text returned by this function will look like this (line breaks added for readability, location of NUL is approximate): "some text in first line " "in second " "and some more text in third\0" Text will be aligned according to \p align (left, center, right). See cdw_string.h for symbolic constants. Function doesn't modify \p string, it returns modified copy of it. \param string - text buffer with text to be wrapped \param width_max - maximal width (length) of lines \param align - align of text in lines. \return modified string on success \return NULL pointer on failure */ char *cdw_string_wrap(const char *string, size_t width_max, int align) { /* Input text buffer may have arbitrary length, but output text buffer's length must be a multiple of width_max. */ size_t n_lines = cdw_string_count_lines_new(string, width_max); size_t out_len = width_max * n_lines; char *retval = malloc(out_len + 1); memset(retval, ' ', out_len + 1); const char *input = string; char *output = retval; /* copy text from input to output */ while (1) { /* function returns zero-based index */ size_t line_len = cdw_string_get_line_len(input, width_max); if (line_len == 0) { break; } else if (line_len == 1 && input[0] == '\n') { input++; continue; } else { ; } size_t begin = cdw_string_wrap_start(width_max, line_len, align); snprintf(output + begin, line_len + 1, "%s", input); output[begin + line_len] = ' '; /* overwrite trailing NUL, we don't want to end the string just yet */ input = input + line_len; output = output + width_max; while (isspace(*input) && *input != '\0') { input++; } } retval[out_len] = '\0'; cdw_vdm ("INFO: returning %zd lines in \"%s\"\n", n_lines, retval); return retval; } /** \brief Calculate starting point of text aligned in a line \date Function's top-level comment reviewed on 2012-01-06 \date Function's body reviewed on 2012-01-06 Helper function for cdw_string_wrap(), calculating position of start of text in logical line. The position (for constant line width and constant text length) may vary depending on \p align (left, center, right). Returned value is rounded down, not up (if needed). Function returns index/position from which an aligned text should start. Example: line: " " -> width = 15; text: "moon river" -> len = 10 align = CDW_ALIGN_CENTER return value = 2 (rounded down; rounded up would be 3); \param width - width of a line in which an aligned text will be put \param len - length of text \param align - align requested (see cdw_string.h) for details \return starting position for aligned string */ size_t cdw_string_wrap_start(size_t width, size_t len, int align) { if (align == CDW_ALIGN_LEFT) { return 0; } else if (align == CDW_ALIGN_CENTER) { /* using intermediate variable to avoid compiler's warning */ double tmp = floor((double) (width - len) / 2); return (size_t) tmp; } else { /* align == CDW_ALIGN_RIGHT */ return width - len; } } /** \brief Count how many lines would be in a string if it was wrapped Count how many lines would there be in a \p string, if it was wrapped with \p width_max as a constraint on line width. In other words: how many lines would there be if the \p string was passed to cdw_string_wrap(). \param string - string in which to count lines \param width_max - intended maximal width of text after wrapping \return number of lines in text-to-be-wrapped */ size_t cdw_string_count_lines(const char *string, size_t width_max) { cdw_assert (width_max > 5, "ERROR: maximal width is far too small\n"); cdw_assert (string != (char *) NULL, "ERROR: text to wrap is NULL\n"); const char *start = string; size_t len = strlen(start); size_t n_lines = 0; for (size_t i = 0; i < len; ) { size_t n = cdw_string_get_line_end(start + i, width_max); for (size_t a = 0; a <= n; a++) { if (*(start + i + a) == '\n') { n = a; n_lines++; break; } } i += n + 1; n_lines++; /* there may be white char that followed word's end */ if (isspace(*(start + i)) && *(start + i) != '\0') { i++; } if (n == 0) { break; } } cdw_vdm ("INFO: returning %zd for \"%s\"\n", n_lines == 0 ? 1 : n_lines, string); /* there should be at least one line, always; but we shouldn't do here 'return ++n_lines' */ return n_lines == 0 ? 1 : n_lines; } size_t cdw_string_count_lines_new(const char *string, size_t width_max) { cdw_assert (width_max > 5, "ERROR: maximal width is far too small\n"); cdw_assert (string, "ERROR: text to wrap is NULL\n"); size_t n_lines = 0; size_t n = 0; size_t i = 0; while ((n = cdw_string_get_line_len(string + i, width_max))) { if (n == 1 && *(string + i) == '\n') { i++; continue; } i += n; n_lines++; } cdw_vdm ("INFO: returning %zd for \"%s\"\n", n_lines == 0 ? 1 : n_lines, string); return n_lines; } /** \brief Predicate function comparing two strings \date Function's top-level comment reviewed on 2012-02-16 \date Function's body reviewed on 2012-02-16 This is just a wrapper around strcmp(), suitable for passing as a predicate function to cdw_dll_append() and cdw_dll_is_member(). Don't pass NULL strings to the function. \param string1 - first string for comparison \param string2 - second string for comparison \return true if the two strings are equal \return false otherwise */ bool cdw_string_equal(const void *string1, const void *string2) { cdw_assert (string1, "ERROR: string1 is NULL\n"); cdw_assert (string2, "ERROR: string2 is NULL\n"); return !strcmp(string1, string2); } //#define CDW_UNIT_TEST_CODE #ifdef CDW_UNIT_TEST_CODE /* *********************** */ /* *** unit tests code *** */ /* *********************** */ static void test_cdw_string_set(void); static void test_cdw_string_security_parser(void); static void test_cdw_string_starts_with_ci(void); static void test_cdw_string_free_table_of_strings(void); static void test_cdw_string_rtrim(void); static void test_cdw_string_ltrim(void); static void test_cdw_string_trim(void); static void test_cdw_string_is_all_spaces(void); static void test_cdw_string_concat(void); static void test_cdw_string_append(void); static void test_cdw_string_get_bool_value(void); static void test_cdw_string_get_words_end(void); static void test_cdw_string_get_line_end(void); static void test_cdw_string_get_line_len(void); static void test_cdw_string_wrap(void); static void test_cdw_string_equal(void); static void test_cdw_string_count_lines_new(void); void cdw_string_run_tests(void) { fprintf(stderr, "testing cdw_string.c\n"); test_cdw_string_set(); test_cdw_string_security_parser(); test_cdw_string_starts_with_ci(); test_cdw_string_rtrim(); test_cdw_string_ltrim(); test_cdw_string_trim(); test_cdw_string_is_all_spaces(); test_cdw_string_free_table_of_strings(); test_cdw_string_concat(); test_cdw_string_append(); test_cdw_string_get_bool_value(); test_cdw_string_get_line_end(); test_cdw_string_get_line_len(); test_cdw_string_wrap(); test_cdw_string_equal(); test_cdw_string_count_lines_new(); fprintf(stderr, "done\n\n"); return; } void test_cdw_string_set(void) { fprintf(stderr, "\ttesting cdw_string_set()... "); int d = 0; /* initialization of data */ /* note that second string is longer than first, and third shorter than second */ const char *buffer1 = "my small test string, but not too short"; const char *buffer2 = "Beautiful world, isn't it? A beautiful world behind the firewall. I should go out more often. But not too far from my terminal."; const char *buffer3 = "short string"; char *test_string1 = strdup(buffer1); assert(test_string1 != (char *) NULL); char *test_string2 = NULL; cdw_rv_t crv = CDW_NO; /* first test with source string == NULL */ crv = cdw_string_set(&test_string1, (char *)NULL); assert(crv == CDW_ERROR); /* in this case first argument should be intact */ d = strcmp(test_string1, buffer1); assert(d == 0); /* test with target string already having some content */ crv = cdw_string_set(&test_string1, buffer2); assert(crv == CDW_OK); d = strcmp(test_string1, buffer2); assert(d == 0); /* test with the same target string, but this time set it to much shorter string */ crv = cdw_string_set(&test_string1, buffer3); assert(crv == CDW_OK); d = strcmp(test_string1, buffer3); assert(d == 0); /* set null target to some value */ crv = cdw_string_set(&test_string2, buffer1); assert(crv == CDW_OK); d = strcmp(test_string2, buffer1); assert(d == 0); free(test_string1); test_string1 = NULL; free(test_string2); test_string2 = NULL; fprintf(stderr, "OK\n"); return; } void test_cdw_string_security_parser(void) { fprintf(stderr, "\ttesting cdw_string_security_parser()... "); struct { const char *input; const char *output; cdw_rv_t crv; } test_data[] = { { (char *) NULL, (char *) NULL, CDW_ERROR }, { "test*test", "*", CDW_NO }, { "*testtest", "*", CDW_NO }, { "testtest*", "*", CDW_NO }, { "test&test", "&", CDW_NO }, { "&testtest", "&", CDW_NO }, { "testtest&", "&", CDW_NO }, { "test!test", "!", CDW_NO }, { "!testtest", "!", CDW_NO }, { "testtest!", "!", CDW_NO }, { "test;test", ";", CDW_NO }, { ";testtest", ";", CDW_NO }, { "testtest;", ";", CDW_NO }, { "test`test", "`", CDW_NO }, { "`testtest", "`", CDW_NO }, { "testtest`", "`", CDW_NO }, { "test\"test", "\"", CDW_NO }, { "\"testtest", "\"", CDW_NO }, { "testtest\"", "\"", CDW_NO }, { "test|test", "|", CDW_NO }, { "testtest|", "|", CDW_NO }, { "|testtest", "|", CDW_NO }, { "test$test", "$", CDW_NO }, { "testtest$", "$", CDW_NO }, { "$testtest", "$", CDW_NO }, /* many unusual chars, but this string is safe */ { "test tes t-.,_/ =:598,_/fduf98-. _/ no:", (char *) NULL, CDW_OK }, { (char *) NULL, (char *) NULL, CDW_CANCEL }}; int i = 0; while (test_data[i].crv != CDW_CANCEL) { char output[2]; cdw_rv_t crv = cdw_string_security_parser(test_data[i].input, output); cdw_assert(crv == test_data[i].crv, "ERROR: failed input test #%d\n", i); if (test_data[i].output != (char *) NULL) { cdw_assert (!strcmp(test_data[i].output, output), "ERROR: failed output test #%d\n", i); } i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_string_starts_with_ci(void) { fprintf(stderr, "\ttesting cdw_string_starts_with_ci()... "); bool result; result = cdw_string_starts_with_ci("test string one", "test"); assert(result == true); result = cdw_string_starts_with_ci("Test string one", "test"); assert(result == true); result = cdw_string_starts_with_ci("Test string one", "Test"); assert(result == true); result = cdw_string_starts_with_ci("test string one", "Test"); assert(result == true); result = cdw_string_starts_with_ci("ttest string one", "test"); assert(result == false); result = cdw_string_starts_with_ci(" test string one", "test"); assert(result == false); result = cdw_string_starts_with_ci("1test string one", "test"); assert(result == false); result = cdw_string_starts_with_ci("t est string one", "test"); assert(result == false); result = cdw_string_starts_with_ci("one string test", "test"); assert(result == false); fprintf(stderr, "OK\n"); return; } void test_cdw_string_rtrim(void) { fprintf(stderr, "\ttesting cdw_string_rtrim()... "); char *result; const char *test_strings[] = { "test string \t\r\n ", "test string \n\t\r ", "test string \r\n\t ", "test string \t\r\n", "test string \n\t\r", "test string \r\n\t", "test string \t\r \n ", "test string \n\t \r ", "test string \r\n \t ", "test string\t \r\n ", "test string\n \t\r ", "test string\r \n\t ", (char *) NULL }; char test_buffer[20]; int i = 0; while (test_strings[i] != (char *) NULL) { strcpy(test_buffer, test_strings[i]); result = cdw_string_rtrim(test_buffer); int r = strcmp(result, "test string"); assert(r == 0); size_t l = strlen(result); assert(l == 11); assert(*(result + 11) == '\0'); i++; } result = cdw_string_rtrim(NULL); assert(result == NULL); char empty[] = ""; result = cdw_string_rtrim(empty); assert(*result == '\0'); fprintf(stderr, "OK\n"); return; } void test_cdw_string_ltrim(void) { fprintf(stderr, "\ttesting cdw_string_ltrim()... "); char *result; const char *test_strings[] = { " \t\r\n test string", " \n\t\r test string", " \r\n\t test string", " \t\r\ntest string", " \n\t\rtest string", " \r\n\ttest string", " \t\r \n test string", " \n\t \r test string", " \r\n \t test string", "\t \r\n test string", "\n \t\r test string", "\r \n\t test string", (char *) NULL }; int i = 0; while (test_strings[i] != (char *) NULL) { result = cdw_string_ltrim(test_strings[i]); int r = strncmp(result, "test string", strlen("test string")); assert(r == 0); size_t l = strlen(result); assert(l == 11); assert(*(result + 11) == '\0'); i++; } result = cdw_string_ltrim(NULL); assert(result == NULL); char empty_string[] = ""; result = cdw_string_ltrim(empty_string); assert(*result == '\0'); fprintf(stderr, "OK\n"); return; } void test_cdw_string_trim(void) { fprintf(stderr, "\ttesting cdw_string_trim()... "); const char *test_strings[] = { " \t\r\n test string", " \n\t\r test string", " \r\n\t test string", "test string \t\r\n", "test string \n\t\r", "test string \r\n\t", " \t\r \n test string", " \n\t \r test string", " \r\n \t test string", "test string \t \r\n ", "test string \n \t\r ", "test string \r \n\t ", " \t\r \n \r \n test string \n \t ", (char *) NULL }; int i = 0; while (test_strings[i]) { char *result = cdw_string_trim(test_strings[i]); cdw_assert (!strcmp(result, "test string"), "ERROR: failed at test #%d / \"%s\"\n", i, test_strings[i]); free(result); result = (char *) NULL; i++; } char *result = cdw_string_trim((char *) NULL); cdw_assert (!result, "ERROR: failed at NULL test\n"); result = cdw_string_trim(""); cdw_assert (*result == '\0', "ERROR: failed at \"empty string\" test\n"); free(result); result = (char *) NULL; result = cdw_string_trim(" \t \t \n \t "); cdw_assert (!strcmp(result, ""), "ERROR: failed at \"empty string 3\" test\n"); free(result); result = (char *) NULL; fprintf(stderr, "OK\n"); return; } void test_cdw_string_is_all_spaces(void) { fprintf(stderr, "\ttesting cdw_string_is_all_spaces()... "); struct { const char *string; bool expected_result; } input_data[] = { { " test string \t \n ", false }, { "abcdefghijklmnopqrstuv", false }, { " ", true }, { " a ", false }, { "", true }, { " \t ", true }, { " \n", true }, { " \r \t", true }, { (char *) NULL, true }}; /* guard */ int i = 0; while (input_data[i].string) { bool result = cdw_string_is_all_spaces(input_data[i].string); cdw_assert (result == input_data[i].expected_result, "ERROR: failed at test #%d\n", i); i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_string_concat(void) { fprintf(stderr, "\ttesting cdw_string_concat()... "); const char *substring1 = "four \t\r\n "; char *result1 = cdw_string_concat("one ", "two ", "three ", substring1, "five", (char *) NULL); assert(result1 != NULL); int r1 = strcmp(result1, "one two three four \t\r\n five"); assert(r1 == 0); assert(*(result1 + 27) == '\0'); char *result2 = cdw_string_concat("one ", "", "three ", substring1, "five", (char *) NULL); assert(result2 != NULL); int r2 = strcmp(result2, "one three four \t\r\n five"); assert(r2 == 0); assert(*(result2 + 23) == '\0'); /* this testcase may not be supported by your compiler if it does not support strings longer than 509 chars */ const char *long_string1 = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"; const char *long_string2 = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; const char *long_string3 = "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; const char *sum_of_long_strings = "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; char *result3 = cdw_string_concat(long_string1, long_string2, long_string3, (char *) NULL); assert(result3 != NULL); int r3 = strcmp(result3, sum_of_long_strings); assert(r3 == 0); assert(*(result3 + strlen(sum_of_long_strings)) == '\0'); free(result1); free(result2); free(result3); fprintf(stderr, "OK\n"); return; } void test_cdw_string_append(void) { fprintf(stderr, "\ttesting cdw_string_append()... "); char *head = (char *) malloc(strlen("test_string_one") + 1); assert(head != NULL); strcpy(head, "test_string_one"); cdw_rv_t crv = cdw_string_append(&head, "I_LOVE_TESTING"); assert(crv == CDW_OK); int r = strcmp(head, "test_string_oneI_LOVE_TESTING"); assert(r == 0); crv = cdw_string_append(&head, ""); assert(crv == CDW_OK); r = strcmp(head, "test_string_oneI_LOVE_TESTING"); assert(r == 0); free(head); fprintf(stderr, "OK\n"); return; } void test_cdw_string_free_table_of_strings(void) { fprintf(stderr, "\ttesting cdw_string_free_table_of_strings()... "); #define N_STRINGS_MAX 9 const char *strings[N_STRINGS_MAX] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; char **table = (char **) malloc((N_STRINGS_MAX + 1) * sizeof (char *)); /* +1 for guard */ assert(table != (char **) NULL); table[N_STRINGS_MAX] = (char *) NULL; for (int i = 0; i < N_STRINGS_MAX; i++) { table[i] = (char *) NULL; table[i] = strdup(*(strings + i)); assert(table[i] != (char *) NULL); cdw_sdm ("INFO: table[%d] = \"%s\"\n", i, table[i]); } cdw_string_free_table_of_strings(table, N_STRINGS_MAX); for (int i = 0; i < N_STRINGS_MAX + 1; i++) { /* +1 - check guard too */ assert(table[i] == (char *) NULL); } free(table); table = (char **) NULL; fprintf(stderr, "OK\n"); return; } void test_cdw_string_get_bool_value(void) { fprintf(stderr, "\ttesting cdw_string_get_bool_value()... "); /* remember that cdw_string_get_bool_value() is called with values that are already trimmed */ /* also remember that value of second arg is not changed when value in first buffer is not recognized */ bool result = false; cdw_rv_t crv = cdw_string_get_bool_value((char *) NULL, &result); cdw_assert_test (crv == CDW_ERROR, "ERROR: failed crv test #-1\n"); cdw_assert_test (result == false, "ERROR: failed bool test #-1\n"); struct { const char *input_string; bool input_bool; bool expected_bool; cdw_rv_t expected_crv; } test_data[] = { /* tests with incorrect input */ { "0 ", true, true, CDW_ERROR }, { "foo", true, true, CDW_ERROR }, { "bar", false, false, CDW_ERROR }, { " true", false, false, CDW_ERROR }, { "", true, true, CDW_ERROR }, /* test with correct input meaning 'true' */ { "1", false, true, CDW_OK }, { "yes", false, true, CDW_OK }, { "YES", false, true, CDW_OK }, { "yEs", false, true, CDW_OK }, { "true", false, true, CDW_OK }, { "TrUe", false, true, CDW_OK }, { "TRUE", false, true, CDW_OK }, /* tests with correct input meaning 'false' */ { "0", true, false, CDW_OK }, { "no", true, false, CDW_OK }, { "NO", true, false, CDW_OK }, { "nO", true, false, CDW_OK }, { "false", true, false, CDW_OK }, { "FaLse", true, false, CDW_OK }, { "FALSE", true, false, CDW_OK }, { (char *) NULL, true, true, CDW_OK }}; int i = 0; while (test_data[i].input_string != (char *) NULL) { result = test_data[i].input_bool; crv = cdw_string_get_bool_value(test_data[i].input_string, &result); cdw_assert_test (crv == test_data[i].expected_crv, "ERROR: failed crv test #%d\n", i); cdw_assert_test (result == test_data[i].expected_bool, "ERROR: failed bool test #%d\n", i); i++; } fprintf(stderr, "OK\n"); return; } static void test_cdw_string_get_line_end(void) { fprintf(stderr, "\ttesting cdw_string_get_line_end()... "); struct { const char *string; size_t width_max; size_t expected_value; } test_data[] = { { "", 1, 0 }, { "", 10, 0 }, { "a", 1, 0 }, { "a", 10, 0 }, { "ab", 1, 0 }, { "ab", 10, 1 }, { "hello world", 1, 0 }, { "hello world", 5, 4 }, { "hello world", 6, 4 }, { "hello world", 7, 4 }, { "hello world", 11, 10 }, { "hello world", 12, 10 }, { "hello\nworld", 1, 0 }, { "hello\nworld", 5, 4 }, { "hello\nworld", 6, 4 }, { "hello\nworld", 7, 4 }, { "hello\nworld", 11, 4 }, { "hello\nworld, this is me ", 27, 4 }, { "12345678901234567890", 1, 0 }, { "12345678901234567890", 10, 9 }, { "12345678901234567890", 20, 19 }, { "12345678901234567890", 21, 19 }, { "12345678901234567890", 22, 19 }, { "12345678901234567890", 30, 19 }, { "12345678901234567890 12345678901234567890", 30, 19 }, { "12345678901234567890 12345678901234567890", 41, 40 }, { (char *) NULL, 0, 0 }, }; int i = 0; while (test_data[i].width_max != 0) { size_t result = cdw_string_get_line_end(test_data[i].string, test_data[i].width_max); cdw_assert (result == test_data[i].expected_value, "ERROR: test #%d: string = \"%s\", expected value = %zd, result = %zd\n", i, test_data[i].string, test_data[i].expected_value, result); i++; } fprintf(stderr, "OK\n"); return; } static void test_cdw_string_get_line_len(void) { fprintf(stderr, "\ttesting cdw_string_get_line_len()... "); struct { const char *string; size_t width_max; size_t expected_value; } test_data[] = { { "", 1, 0 }, { "", 10, 0 }, { "a", 1, 1 }, { "a", 10, 1 }, { "ab", 1, 1 }, { "ab", 10, 2 }, { "ab", 2, 2 }, { "hello world", 1, 1 }, { "hello world", 5, 5 }, { "hello world", 6, 5 }, { "hello world", 7, 5 }, { "hello world", 11, 11 }, { "hello world", 12, 11 }, { "hello\nworld", 1, 1 }, { "hello\nworld", 5, 5 }, { "hello\nworld", 6, 5 }, { "hello\nworld", 7, 5 }, { "hello\nworld", 11, 5 }, { "hello\nworld, this is me ", 27, 5 }, { "12345678901234567890", 1, 1 }, { "12345678901234567890", 10, 10 }, { "12345678901234567890", 20, 20 }, { "12345678901234567890", 21, 20 }, { "12345678901234567890", 22, 20 }, { "12345678901234567890", 30, 20 }, { "12345678901234567890 12345678901234567890", 30, 20 }, { "12345678901234567890 12345678901234567890", 41, 41 }, { (char *) NULL, 0, 0 }, }; int i = 0; while (test_data[i].width_max != 0) { size_t result = cdw_string_get_line_len(test_data[i].string, test_data[i].width_max); cdw_assert (result == test_data[i].expected_value, "ERROR: test #%d: string = \"%s\", expected value = %zd, result = %zd\n", i, test_data[i].string, test_data[i].expected_value, result); i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_string_wrap(void) { fprintf(stderr, "\ttesting cdw_string_wrap()... "); /* input data */ struct test_data { const char *string; /* string to be wrapped */ size_t max_width; /* maximal width of logical line, a given data */ const char *expected_result; /* expected return value */ } test_data[] = { { "this is a test string that is supposed to test cdw string wrap test function", 40, /* 1234567890123456789012345678901234567890 */ "this is a test string that is supposed " "to test cdw string wrap test function " }, #if 0 /* FIXME: this testcase would fail */ { "this is one test string that is supposed to test cdw string wrap test function", 40, /* 1234567890123456789012345678901234567890 */ "this is one test string that is supposed" "to test cdw string wrap test function " }, #endif { "Another test string\n" "but this time with some line breaks in the middle of\n" "the string", 40, /* 1234567890123456789012345678901234567890 */ "Another test string " "but this time with some line breaks in " "the middle of " "the string ", }, { "This is yet another string that serves\n" "as input data for unit tests\n" "of cdw string wrap function from cdw string module I feel that it's kind of hard to come up with text for this long string, you know,\n" "so...\n" "perhaps\n" "I will stop after this test line. Yeah, that's a good idea", 40, /* 1234567890123456789012345678901234567890 */ "This is yet another string that serves " "as input data for unit tests " "of cdw string wrap function from cdw " "string module I feel that it's kind of " "hard to come up with text for this long " "string, you know, " "so... " "perhaps " "I will stop after this test line. Yeah, " "that's a good idea " }, { /* guard */ (char *) NULL, 0, (char *) NULL } }; int i = 0; while (test_data[i].string) { char *output = cdw_string_wrap(test_data[i].string, test_data[i].max_width, CDW_ALIGN_LEFT); int rv = strcmp(output, test_data[i].expected_result); if (rv) { fprintf(stderr, "ERROR: failed at testcase #%d\n", i); for (int k = 0; k < test_data[i].max_width; k++) { fprintf(stderr, "o"); } fprintf(stderr, "\n"); bool run = true; for (size_t j = 0; run; j++) { for (size_t k = 0; k < test_data[i].max_width; k++) { if (output[(j * test_data[i].max_width) + k] == '\0') { run = false; break; } fprintf(stderr, "%c", output[(j * test_data[i].max_width) + k]); } fprintf(stderr, "\"\n"); for (size_t k = 0; k < test_data[i].max_width; k++) { if (test_data[i].expected_result[(j * test_data[i].max_width) + k] == '\0') { run = false; break; } fprintf(stderr, "%c", test_data[i].expected_result[(j * test_data[i].max_width) + k]); } fprintf(stderr, "\"\n"); } free(output); output = (char *) NULL; assert(0); } free(output); output = (char *) NULL; i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_string_equal(void) { fprintf(stderr, "\ttesting cdw_string_equal()... "); struct { const char *string1; const char *string2; bool expected_result; } test_data[] = { { "", "", true }, { "", "a", false }, { "a", "a", true }, { "test string", "test", false }, { "test string", "test string", true }, { (char *) NULL, (char *) NULL, false } }; /* guard */ int i = 0; while (test_data[i].string1) { bool rv = cdw_string_equal((const void *) test_data[i].string1, (const void *) test_data[i].string2); cdw_assert (rv == test_data[i].expected_result, "ERROR: failed in test #%d ('%s' - '%s')\n", i, test_data[i].string1, test_data[i].string2); i++; } fprintf(stderr, "OK\n"); return; } void test_cdw_string_count_lines_new(void) { fprintf(stderr, "\ttesting cdw_string_count_lines_new()... "); struct { const char *string; size_t width_max; size_t expected_value; } input_data[] = { { "", 10, 0 }, { "hello", 10, 1 }, { "1234567890", 10, 1 }, { "12345678901", 10, 2 }, /* "animated" " show with" " lots of" " images" */ { "animated show with lots of images", 10, 4 }, /* "animated" " show" "with lots" "of images" */ { "animated show\nwith lots of images", 10, 4 }, /* "animated" " show" "with lots" "of images" */ { "animated show\n\nwith lots of images", 10, 4 }, /* "naturalist" "ic show" " with lots" " of images" */ { "naturalistic show with lots of images", 10, 4 }, /* "naturalist" "ic show" " with" " loads of" " images" */ { "naturalistic show with loads of images", 10, 5 }, /* "naturalist" "ic" "show with" " loads of" " images" */ { "naturalistic\nshow with loads of images", 10, 5 }, { (char *) NULL, 10, 0 } }; /* guard */ int i = 0; while (input_data[i].string) { size_t rv = cdw_string_count_lines_new(input_data[i].string, input_data[i].width_max); cdw_assert (rv == input_data[i].expected_value, "ERROR: failed at test #%d (rv = %d, expected %d)\n", i, rv, input_data[i].expected_value); i++; } fprintf(stderr, "OK\n"); return; } #endif /* #ifdef CDW_UNIT_TEST_CODE */ /* unused code */ #if 0 char *cdw_string_wrap_old(const char *string, size_t width_max, int align) { /* Input text buffer may have arbitrary length, but output text buffer's length must be a multiple of width_max. */ size_t n_lines = cdw_string_count_lines(string, width_max); size_t out_len = width_max * n_lines; char *retval = malloc(out_len + 1); memset(retval, ' ', out_len + 1); const char *input = string; char *output = retval; /* copy text from input to output */ while (1) { /* function returns zero-based index */ size_t line_len = cdw_string_get_line_end(input, width_max); if (!line_len) { break; } line_len++; size_t begin = cdw_string_wrap_start(width_max, line_len, align); snprintf(output + begin, line_len + 1, "%s", input); output[begin + line_len] = ' '; /* overwrite trailing NUL, we don't want to end the string just yet */ input = input + line_len; output = output + width_max; if (isspace(*input)) { input++; } } retval[out_len] = '\0'; return retval; } #endif cdw-0.7.1/src/external_tools/0000755000175000017500000000000011736031302013122 500000000000000cdw-0.7.1/src/external_tools/cdw_xorrisorc.c0000644000175000017500000002515311734656241016120 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "gettext.h" #include "cdw_config.h" #include "cdw_xorrisorc.h" #include "cdw_fs.h" #include "cdw_string.h" #include "cdw_debug.h" #include "cdw_utils.h" #include "cdw_form.h" #include "cdw_logging.h" /* the value must be larger than any of CDW_ISO9660_*_LEN values defined in optical_file_systems/cdw_iso9660.h */ #define BUFFER_SIZE 200 static int cdw_xorrisorc_read_config_file(cdw_form_t *cdw_form, void *dummy); static char *cdw_xorrisorc_top_message(int n_cols); static void cdw_xorrisorc_get_option_from_line(const char *line, const char *option_name, cdw_form_t *cdw_form, int fi, size_t len); static const char *cdw_xorrisorc_get_option_value(char *buffer, char *ptr, size_t n_max); static cdw_form_text_maker_t text_makers[] = { cdw_xorrisorc_top_message, }; static cdw_task_t *local_task = (cdw_task_t *) NULL; enum { f_xorrisorc_top_message_l, f_xorrisorc_top_message_b, f_xorrisorc_publisher_l, f_xorrisorc_publisher_i, f_xorrisorc_volume_set_id_l, f_xorrisorc_volume_set_id_i, f_xorrisorc_system_id_l, f_xorrisorc_system_id_i }; static FIELD *xorrisorc_fields[CDW_XORRISORC_N_FIELDS + 1]; /* +1 for last field == NULL */ /** \brief Create fields that are shown on "Meta information" page in options \return CDW_OK when all fields were created (probably) without problems \return CDW_GEN_ERROR if one of fields was created incorrectly */ cdw_rv_t cdw_xorrisorc_form(cdw_form_t *cdw_form, void *cdw_task, int first_col, __attribute__((unused)) int second_col, int width_wide, __attribute__((unused)) int width_narrow) { cdw_task_t *task = (cdw_task_t *) cdw_task; local_task = task; cdw_form->fields = xorrisorc_fields; cdw_form_descr_t descr[] = { /* type begin_y begin_x n_cols n_lines field enum data1 data2 */ { CDW_WIDGET_TEXT, 1, 1, width_wide + 2, 7, f_xorrisorc_top_message_l, text_makers, 0 }, /* 2TRANS: this is button label; a verb: read data from config file */ { CDW_WIDGET_BUTTON, 10, 1, 1, 1, f_xorrisorc_top_message_b, _("Read"), CDW_COLORS_DIALOG }, /* 2TRANS: this is a label next to input field, in which user can enter information about publisher of ISO9660 volume */ { CDW_WIDGET_LABEL, 12, first_col, width_wide, 1, f_xorrisorc_publisher_l, _("Publisher"), 0 }, { CDW_WIDGET_INPUT, 13, first_col, width_wide, 1, f_xorrisorc_publisher_i, (char *) NULL, CDW_ISO9660_PUBL_LEN }, /* 2TRANS: this is a label next to input field, in which user can enter information about ID of ISO9660 volume set */ { CDW_WIDGET_LABEL, 14, first_col, width_wide, 1, f_xorrisorc_volume_set_id_l, _("Volume set ID"), 0 }, { CDW_WIDGET_INPUT, 15, first_col, width_wide, 1, f_xorrisorc_volume_set_id_i, (char *) NULL, CDW_ISO9660_VOLS_LEN }, /* 2TRANS: this is a label next to input field, in which user can enter information about system on which ISO9660 volume has been created */ { CDW_WIDGET_LABEL, 16, first_col, width_wide, 1, f_xorrisorc_system_id_l, _("System ID"), 0 }, { CDW_WIDGET_INPUT, 17, first_col, CDW_ISO9660_SYSI_LEN, 1, f_xorrisorc_system_id_i, (char *) NULL, CDW_ISO9660_SYSI_LEN }, /* guard */ { -1, 0, 0, 0, 0, 0, (void *) NULL, 0 }}; cdw_rv_t crv = cdw_form_description_to_fields(descr, cdw_form); if (crv != CDW_OK) { cdw_vdm ("ERROR: failed to convert form description to form\n"); return CDW_ERROR; } else { cdw_form_set_function(cdw_form, f_xorrisorc_top_message_b, cdw_xorrisorc_read_config_file); return CDW_OK; } } cdw_rv_t cdw_xorrisorc_validate(cdw_form_t *cdw_form, int *fi) { char *s = cdw_ncurses_get_field_string(*(cdw_form->fields + f_xorrisorc_publisher_i)); cdw_rv_t crv = cdw_string_security_parser(s, (char *) NULL); if (crv != CDW_OK) { *fi = f_xorrisorc_publisher_i; return CDW_NO; } s = cdw_ncurses_get_field_string(*(cdw_form->fields + f_xorrisorc_volume_set_id_i)); crv = cdw_string_security_parser(s, (char *) NULL); if (crv != CDW_OK) { *fi = f_xorrisorc_volume_set_id_i; return CDW_NO; } s = cdw_ncurses_get_field_string(*(cdw_form->fields + f_xorrisorc_system_id_i)); crv = cdw_string_security_parser(s, (char *) NULL); if (crv != CDW_OK) { *fi = f_xorrisorc_system_id_i; return CDW_NO; } return CDW_OK; } cdw_rv_t cdw_xorrisorc_save(cdw_form_t *cdw_form, cdw_task_t *task) { char *s = cdw_ncurses_get_field_string(*(cdw_form->fields + f_xorrisorc_volume_set_id_i)); strncpy(task->create_image.volume_set_id, s, CDW_ISO9660_VOLS_LEN); task->create_image.volume_set_id[CDW_ISO9660_VOLS_LEN] = '\0'; s = cdw_ncurses_get_field_string(*(cdw_form->fields + f_xorrisorc_publisher_i)); strncpy(task->create_image.publisher, s, CDW_ISO9660_PUBL_LEN); task->create_image.publisher[CDW_ISO9660_PUBL_LEN] = '\0'; s = cdw_ncurses_get_field_string(*(cdw_form->fields + f_xorrisorc_system_id_i)); strncpy(task->create_image.system_id, s, CDW_ISO9660_SYSI_LEN); task->create_image.system_id[CDW_ISO9660_SYSI_LEN] = '\0'; return CDW_OK; } char *cdw_xorrisorc_top_message(int n_cols) { /* 2TRANS: this is a message printed in configuration window; don't localize "$HOME/.xorrisorc" */ return cdw_string_wrap(_("These values won't be saved after closing cdw. Leave the fields empty (values from xorriso config file will be used) or enter custom values. You can populate the fields with values from $HOME/.xorrisorc using the button below."), (size_t) n_cols, CDW_ALIGN_CENTER); } static const char *file_name = ".xorrisorc"; static FILE *file = (FILE *) NULL; /* options in the ~/.xorrisorc file should (?) be all in one line, like this: -system_id mysystemid -publisher "my publisher string" -volset_id my_volset */ int cdw_xorrisorc_read_config_file(cdw_form_t *cdw_form, __attribute__((unused)) void *dummy) { const char *home_dir = cdw_fs_get_home_dir_fullpath(); char *path = cdw_string_concat(home_dir, file_name, (char *) NULL); file = fopen(path, "r"); free(path); path = (char *) NULL; if (file == (FILE *) NULL) { /* 2TRANS: this is message printed to log file; '%s' is configuration file name */ cdw_logging_write(_("WARNING: can't open %s file in home directory\n"), file_name); cdw_vdm ("WARNING: can't open xorrisorc file\n"); return -1; } char *line = (char *) NULL; while (1) { if (line != (char *) NULL) { free(line); line = (char *) NULL; } line = my_readline_10k(file); if (line == (char *) NULL) { break; } cdw_sdm ("INFO: processing line \"%s\"\n", line); cdw_xorrisorc_get_option_from_line(line, "-publisher ", cdw_form, f_xorrisorc_publisher_i, CDW_ISO9660_PUBL_LEN); cdw_xorrisorc_get_option_from_line(line, "-system_id ", cdw_form, f_xorrisorc_system_id_i, CDW_ISO9660_SYSI_LEN); cdw_xorrisorc_get_option_from_line(line, "-volset_id ", cdw_form, f_xorrisorc_volume_set_id_i, CDW_ISO9660_VOLS_LEN); } fclose(file); file = (FILE *) NULL; return 0; } /** \brief Copy option value to a buffer Search for a string in \p ptr that looks like an option value. Copy the value into \p buffer. Make sure that the option value has no more than \p n_max chars. Trim the string in buffer and remove trailing and ending quote chars. Return pointer to beginning of the option value. Because of the trimming and removing quotes, function may remove pointer that is inside of \p buffer, but is not at the very beginning of \p buffer. \return pointer to string representing option value on success \return NULL otherwise (this doesn't have to indicate an error) */ const char *cdw_xorrisorc_get_option_value(char *buffer, char *ptr, size_t n_max) { buffer[0] = '\0'; size_t len = strlen(ptr); for (size_t i = 0; i < len && i < n_max; i++) { if (ptr[i] == '-') { /* start of new option name */ break; } else { buffer[i] = ptr[i]; buffer[i + 1] = '\0'; /* +1 is always safe, as long as "for ( ;i < n_max; )" */ } } buffer[BUFFER_SIZE] = '\0'; if (!strlen(buffer)) { return (char *) NULL; } char *trimmed = cdw_string_ltrim(buffer); cdw_string_rtrim(trimmed); if (!strlen(trimmed)) { return (char *) NULL; } /* option may be quoted in file, the quotes are unwanted in fields, and may be harmful when building command line string for xorriso; remove the quotes */ if (trimmed[0] == '"') { trimmed++; } len = strlen(trimmed); if (trimmed[len - 1] == '"') { trimmed[len - 1] = '\0'; } cdw_rv_t crv = cdw_string_security_parser(trimmed, (char *) NULL); if (crv != CDW_OK) { cdw_vdm ("WARNING: option value \"%s\" from xorrisorc file rejected as insecure\n", trimmed); return (char *) NULL; } else { return trimmed; } } /** \brief Copy option value into form field Search for given \p option_name in given \p line. If the option is found, get value of the option, and put it in form field specified by field index \p fi. Copy to the field at most \p len chars. */ void cdw_xorrisorc_get_option_from_line(const char *line, const char *option_name, cdw_form_t *cdw_form, int fi, size_t len) { char buffer[BUFFER_SIZE + 1]; char *ptr = strstr(line, option_name); if (ptr != (char *) NULL) { ptr += strlen(option_name); /* b is a pointer inside of buffer */ const char *b = cdw_xorrisorc_get_option_value(buffer, ptr, BUFFER_SIZE); if (b != (char *) NULL) { char local_buffer[BUFFER_SIZE + 1]; strncpy(local_buffer, b, len); local_buffer[len] = '\0'; cdw_sdm ("INFO: %s = \"%s\"\n", option_name, local_buffer); set_field_buffer(cdw_form->fields[fi], 0, local_buffer); } } return; } cdw-0.7.1/src/external_tools/cdw_cdrecord_regex.c0000644000175000017500000015140611724475034017044 00000000000000/* cdw * Copyright (C) 2002 Varkonyi Balazs * Copyright (C) 2007 - 2012 Kamil Ignacak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "main.h" #include "cdw_processwin.h" #include "gettext.h" #include "cdw_thread.h" /* PIPE_BUFFER_SIZE */ #include "cdw_regex_dispatch.h" #include "cdw_cdrecord_regex.h" #include "cdw_disc.h" #include "cdw_task.h" #include "cdw_debug.h" #include "cdw_config.h" #include "cdw_drive.h" #include "cdw_utils.h" /* Output of "wodim -toc -vv dev=/dev/scd0 Profile: 0x0015 (DVD-R/DL sequential recording) Profile: 0x0016 (DVD-R/DL layer jump recording) Profile: 0x002B (DVD+R/DL) Profile: 0x001B (DVD+R) Profile: 0x001A (DVD+RW) Profile: 0x0014 (DVD-RW sequential recording) Profile: 0x0013 (DVD-RW restricted overwrite) Profile: 0x0012 (DVD-RAM) Profile: 0x0011 (DVD-R sequential recording) Profile: 0x0010 (DVD-ROM) Profile: 0x000A (CD-RW) (current) Profile: 0x0009 (CD-R) Profile: 0x0008 (CD-ROM) Profile: 0x0002 (Removable disk) */ struct { int wodim_id; cdw_disc_type_t cdw_id; } wodim_profiles[] = { { 0x00, CDW_DISC_TYPE_UNKNOWN }, { 0x01, CDW_DISC_TYPE_UNKNOWN }, { 0x02, CDW_DISC_TYPE_UNKNOWN }, /* Removable disk */ { 0x03, CDW_DISC_TYPE_UNKNOWN }, { 0x04, CDW_DISC_TYPE_UNKNOWN }, { 0x05, CDW_DISC_TYPE_UNKNOWN }, { 0x06, CDW_DISC_TYPE_UNKNOWN }, { 0x07, CDW_DISC_TYPE_UNKNOWN }, { 0x08, CDW_CD_ROM }, { 0x09, CDW_CD_R }, { 0x0A, CDW_CD_RW }, { 0x0B, CDW_DISC_TYPE_UNKNOWN }, { 0x0C, CDW_DISC_TYPE_UNKNOWN }, { 0x0D, CDW_DISC_TYPE_UNKNOWN }, { 0x0E, CDW_DISC_TYPE_UNKNOWN }, { 0x0F, CDW_DISC_TYPE_UNKNOWN }, { 0x10, CDW_DVD_ROM }, { 0x11, CDW_DVD_R }, /* DVD+R Seq */ { 0x12, CDW_DISC_TYPE_UNKNOWN }, /* DVD-RAM */ { 0x13, CDW_DVD_RW_RES }, { 0x14, CDW_DVD_RW_SEQ }, { 0x15, CDW_DISC_TYPE_UNKNOWN }, /* DVD-R/DL sequential recording */ { 0x16, CDW_DISC_TYPE_UNKNOWN }, /* DVD-R/DL layer jump recording */ { 0x17, CDW_DISC_TYPE_UNKNOWN }, { 0x18, CDW_DISC_TYPE_UNKNOWN }, { 0x19, CDW_DISC_TYPE_UNKNOWN }, { 0x1A, CDW_DVD_RWP }, { 0x1B, CDW_DVD_RP }, { 0x1C, CDW_DISC_TYPE_UNKNOWN }, { 0x1D, CDW_DISC_TYPE_UNKNOWN }, { 0x1E, CDW_DISC_TYPE_UNKNOWN }, { 0x1F, CDW_DISC_TYPE_UNKNOWN }, { 0x20, CDW_DISC_TYPE_UNKNOWN }, { 0x21, CDW_DISC_TYPE_UNKNOWN }, { 0x22, CDW_DISC_TYPE_UNKNOWN }, { 0x23, CDW_DISC_TYPE_UNKNOWN }, { 0x24, CDW_DISC_TYPE_UNKNOWN }, { 0x25, CDW_DISC_TYPE_UNKNOWN }, { 0x26, CDW_DISC_TYPE_UNKNOWN }, { 0x27, CDW_DISC_TYPE_UNKNOWN }, { 0x28, CDW_DISC_TYPE_UNKNOWN }, { 0x29, CDW_DISC_TYPE_UNKNOWN }, { 0x2A, CDW_DISC_TYPE_UNKNOWN }, { 0x2B, CDW_DVD_RP_DL }}; /* cdrecord can recognize following disc types (cdrtools-2.01.01, cdrecord/scsi_mmc.c): "Reserved" "Non -removable Disk" "Removable Disk" "MO Erasable" "MO Write Once" "AS-MO" "CD-ROM" "CD-R" "CD-RW" "DVD-ROM" "DVD-R sequential recording" "DVD-RAM" "DVD-RW restricted overwrite" "DVD-RW sequential recording" "DVD-R/DL sequential recording" "DVD-R/DL layer jump recording" "DVD-RW/DL" "DVD+RW" "DVD+R" "DDCD-ROM" "DDCD-R" "DDCD-RW" "DVD+RW/DL" "DVD+R/DL" "BD-ROM" "BD-R sequential recording" "BD-R random recording" "BD-RE" "HD DVD-ROM" "HD DVD-R" "HD DVD-RAM" "HD DVD-RW" "HD DVD-R/DL" "HD DVD-RW/DL" "No standard Profile" some of them are supported by cdw as well. Labels of supported discs are captured in cdw_cdrecord_handle_disc_type_{new|old}_style() */ extern char stdout_pipe_buffer[PIPE_BUFFER_SIZE + 1]; extern char stderr_pipe_buffer[PIPE_BUFFER_SIZE + 1]; /* time captured at the beginning of process */ extern time_t time0; extern cdw_config_t global_config; extern cdw_task_t *thread_task; static int previous_percent = 0; static bool cdw_cdrecord_burning_performed = false; /* functions used for stdout output handling */ static int cdw_cdrecord_handle_blanking_time(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_image_writing(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_direct_writing(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_fixating(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_blanking_not_supported(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_drive_max_speed(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_drive_default_speed(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_current_write_speed(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_msinfo_session_sectors(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_disc_type_old_style(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_disc_type_new_style(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_prcap_write_speed_table(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_reload_disk_and_hit_cr(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_toc_beginning(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_write_error_after(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_supported_disc_modes(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_phys_size(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_atip_start_of_lead_out(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_rzone_size(regex_t *regex, regmatch_t *matches); /* functions used for stderr output handling */ static int cdw_cdrecord_handle_msinfo_cannot_get_next_writable(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_msinfo_cannot_read_session_offset(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_device_or_resource_busy(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_cannot_read_toc(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_bad_option(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_cannot_open_device(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_no_such_file_or_dir(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_badly_placed_option(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_no_disk(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_cannot_send_cue_sheet(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_non_ricoh_based_drive(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_cannot_open_next_track(regex_t *regex, regmatch_t *matches); static int cdw_cdrecord_handle_data_may_not_fit(regex_t *regex, regmatch_t *matches); static cdw_regex_t stdout_regex[] = { { "direct writing", 1001, /* "Track 01: 190 of 257 MB written (fifo 100%) [buf 100%] 10.3x." */ "Track ([0-9]+): ([ ]*)([0-9]+) of ([ ]*)([0-9]+) MB written \\(fifo([ ]*)([0-9]+)%\\)([ ]+)\\[buf([ ]*)([0-9]+)%\\]([ ]+)([0-9]+)\\.([0-9]+)x", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_direct_writing }, { "image writing", 1002, /* "Track 02: 304 MB written (fifo 100%) [buf 100%] 4.2x." */ "Track ([0-9]+): ([ ]*)([0-9]+) MB written \\(fifo([ ]*)([0-9]+)\\)([ ]+)\\[buf([ ]*)([0-9]+)%\\][([ ]+)([0-9]+)\\.([0-9]+)x", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_image_writing }, { "blanking time", 1003, /* "Blanking time: 27.819s" - printed after successful blanking of CD (and DVD?) */ "Blanking time:([ ]+)([0-9]*).([0-9]*)s", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_blanking_time }, { "fixating", 1004, /* "Fixating..." */ "Fixating...", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_fixating }, { "disc type, old style", 1005, /* "Current: 0x000A (CD-RW)" - wodim reports type of disc currently in drive (for both CD and DVD); older versions of wodim (like 1.1.0) don't print anything after hex number, so we need to rely only on hex number; 0x00 is explicitly put into regex to make sure that format of information (new/old) is correctly recognized */ "Current:[ ]+0x00([0-9a-fA-F]+)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_disc_type_old_style }, { "disc type, new style", 1006, /* "Current: CD-RW" - cdrecord reports type of disc currently in drive (for both CD and DVD) */ /* "[a-z ]*" is for purposes of DVD-RW discs, like "Current: DVD-RW restricted overwrite" */ /* ([CDVRWOMDL+/\-]+) on purpose don't include '0x' to distinguish long format from short */ "Current:[ ]+([CDVRWOMDL+/-]+[a-z ]*)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_disc_type_new_style }, { "write speeds", 1007, /* "Write speed # 0: 1764 kB/s CLV/PCAV (CD 10x, DVD 1x, BD 0x)" */ "Write speed # ([0-9]+):([ a-zA-Z0-9/]+)([(])CD([ ]+)([0-9]*)x,[ ]+DVD([ ]+)([0-9]*)x", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_prcap_write_speed_table }, { "session info", 1008, /* "122176,129604" - information about last_sess_start and next_sess_start sectors, comma is significant; this is result of running cdrecord -msinfo */ "^([0-9]+),([0-9]+)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_msinfo_session_sectors }, { "drive default speed", 1009, /* "Drive default speed: xy" */ "Drive default speed([ ]*):([ ]*)([0-9]*)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_drive_default_speed }, { "current write speed", 1010, /* "Current write speed: 22160 kB/s (CD 125x, DVD 16x, BD 4x)" */ "Current write speed:([ ]+)([0-9]+)([ ]+)kB/s([ ]+)\\(CD([ ]+)([0-9]+)x,([ ]+)DVD([ ]+)([0-9]+)x,([ ]+)BD([ ]+)([0-9]+)x\\)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_current_write_speed }, { "drive max speed", 1011, /* "Drive max speed : xy" */ "Drive max speed([ ]*):([ ]*)([0-9]*)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_drive_max_speed }, { "does not support blanking", 1012, /* "this media does not support blanking" */ "this media does not support blanking", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_blanking_not_supported }, { "write error after X bytes", 1013, /* "write track data: error after X bytes" */ /* I've seen it when attempting to burn data to non-empty DVD+R */ "write track data: error after", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_write_error_after }, { "TOC first, last", 1014, /* "first: 1 last 3" */ /* part of information about TOC: TOC exists, the numbers are numbers of tracks */ "first: ([0-9]+) last ([0-9]+)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_toc_beginning }, { "reload disc and hit Enter", 1015, /* "Re-load disk and hit " */ /* may happen when cdrecord reloads tray, but the tray can't be closed, e.g. because this is a drive in notebook */ "load disk and hit", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_reload_disk_and_hit_cr }, { "supported modes", 1016, /* "Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R" */ /* information about disc modes supported by given drive; may be useful when selecting drive mode for burning */ "Supported modes: (.+)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_supported_disc_modes }, { "phys size", 1017, /* "phys size:... 2295104" Only for DVDs; Capacity of a disc in sectors - total numbers of sectors that can be stored on a disc; parameter not displayed by wodim 1.1.11 */ "phys size:... +([0-9]+)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_phys_size }, { "atip start of lead out", 1018, /* " ATIP start of lead out: 359849 (79:59/74)" let's consider start of lead out to be total disc capacity */ "ATIP start of lead out: ([0-9]+) ", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_atip_start_of_lead_out }, { "rzone size", 1019, /* "rzone size:... 2295104" Only for DVDs; RZone is something similar to a track on a CD. I didn't investigate it too much, so we are in a gray area here. */ "rzone size: +([0-9]+)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_rzone_size }, { "table guard", -1, /* guard: debug_id = -1 */ "", (regex_t *) NULL, (regmatch_t *) NULL, 0, (cdw_regex_handler_t) NULL } }; static cdw_regex_t stderr_regex[] = { { "device or resource busy", 2001, /* "Device or resource busy" - system message when cdrecord tries to access busy CD. */ "Device or resource busy", (regex_t *) NULL, (regmatch_t *) NULL, REG_NOSUB, cdw_cdrecord_handle_device_or_resource_busy }, { "incompatible format", 2002, /* cannot write medium - incompatible format */ "cannot write medium - incompatible format", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_blanking_not_supported }, { "cannot blank disc", 2003, /* Cannot blank disk */ "Cannot blank disk", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_blanking_not_supported }, { "cannot get next writable address", 2004, /* "Cannot get next writable address" - printed for 'complete' discs */ /* "read" and "first" were added during tests with dvd+r dl */ "(Cannot (get|read) (next|first) writable address)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_msinfo_cannot_get_next_writable }, { "cannot read session offset", 2005, /* "Cannot read session offset" - printed for blank discs */ "(Cannot read session offset)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_msinfo_cannot_read_session_offset }, { "permission denied", 2006, /* "cdrecord: Permission denied. Cannot open '/dev/sg0'. Cannot open or use SCSI driver." */ /* TODO: test this for wodim too */ "(cdrecord|wodim): Permission denied. Cannot open", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_cannot_open_device }, { "no such file or directory", 2007, /* "cdrecord: No such file or directory. Cannot open 'some'." */ /* this is similar to "No such file or directory. Invalid node" from mkisofs - probably incorrect entry in "other cdrecord options" */ /* TODO: test this for wodim too */ "(cdrecord|wodim): No such file or directory. Cannot open", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_no_such_file_or_dir }, { "cannot send CUE sheet", 2008, /* /home/acerion/bin/cdrecord: Cannot send CUE sheet. */ "annot send CUE sheet", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_cannot_send_cue_sheet }, { "non Ricoh based drive", 2009, /* "Cannot blank DVD+RW media with non Ricoh based drive" */ "Cannot blank DVD[+]RW media with non Ricoh based drive", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_non_ricoh_based_drive }, { "cannot open next track", 2010, /* "wodim: Cannot open new session" "cdrecord: Cannot open next track" */ /* printed e.g. when cdrecord is called for non-appendable medium */ "annot open (new|next) (session|track)", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_cannot_open_next_track }, { "cannot read TOC header", 2011, /* Cannot read TOC header */ /* printed for empty discs; may be useful when wodim can't recognize non-empty DVD disc */ "annot read TOC header", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_cannot_read_toc }, { "data may not fit", 2012, /* "WARNING: Data may not fit on current disk" */ /* Printed when size of selected files or iso image exceeds size space available on optical disc */ "WARNING: Data may not fit on current disk", (regex_t *) NULL, (regmatch_t *) NULL, REG_EXTENDED, cdw_cdrecord_handle_data_may_not_fit }, { "bad option", 2013, /* "cdrecord: Bad Option: