Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master cauldron by flux (2b4a67aa8e30d613f0beb327d3f93e14dc5873b7)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: flux <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master cauldron by flux (2b4a67aa8e30d613f0beb327d3f93e14dc5873b7)
  • Date: Sun, 24 Aug 2008 10:48:51 -0500

GIT changes to master cauldron by flux <flux AT shaolin.homelinux.org>:

enchant/libenchant | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 2b4a67aa8e30d613f0beb327d3f93e14dc5873b7
Author: flux <flux AT shaolin.homelinux.org>
Commit: flux <flux AT shaolin.homelinux.org>

libenchant: improve/correct use of wc

commit aa574f9808e959e364e87a554038b5d7a6e86376
Author: flux <flux AT shaolin.homelinux.org>
Commit: flux <flux AT shaolin.homelinux.org>

libenchant: fix file editing functions

Erroneously used tail file > file which would not have worked. Now the
functions correctly use sed -i.

diff --git a/enchant/libenchant b/enchant/libenchant
index 8cde725..870f151 100755
--- a/enchant/libenchant
+++ b/enchant/libenchant
@@ -152,11 +152,11 @@ function enchant_setprev() {

#-------------------------------------------------------------------------------
function enchant_back() {
# if the forward history is empty, then we can't go forward
- [[ $(wc -l ${ENCHANT_BACK}) -eq 0 ]] && return $EERR_BACK
+ [[ $(wc -l < ${ENCHANT_BACK}) -eq 0 ]] && return $EERR_BACK

# if the max history size has been reached, then we drop the oldest item
- [[ $(wc -l ${ENCHANT_FORWARD}) -ge $ENCHANT_HISTORY ]] &&
- tail -n +2 ${ENCHANT_FORWARD} > ${ENCHANT_FORWARD}
+ [[ $(wc -l < ${ENCHANT_FORWARD}) -ge $ENCHANT_HISTORY ]] &&
+ sed -i "" 1d ${ENCHANT_FORWARD}

# copy the current status to the forward history, so we can go forward to
# where we are after we jump back
@@ -164,7 +164,7 @@ function enchant_back() {
# set the current step to be the one we are jumping to
tail -n 1 ${ENCHANT_BACK} > ${ENCHANT_STATUS}
# remove the step we jumped to from the back history
- head -n -1 ${ENCHANT_BACK} > ${ENCHANT_BACK}
+ sed -i "" $d ${ENCHANT_BACK}
}


#-------------------------------------------------------------------------------
@@ -175,11 +175,11 @@ function enchant_back() {

#-------------------------------------------------------------------------------
function enchant_forward() {
# if the forward history is empty, then we can't go forward
- [[ $(wc -l ${ENCHANT_FORWARD}) -eq 0 ]] && return $EERR_FORWARD
+ [[ $(wc -l < ${ENCHANT_FORWARD}) -eq 0 ]] && return $EERR_FORWARD

# if the max history size has been reached, then we drop the oldest item
- [[ $(wc -l ${ENCHANT_BACK}) -ge $ENCHANT_HISTORY ]] &&
- tail -n +2 ${ENCHANT_BACK} > ${ENCHANT_BACK}
+ [[ $(wc -l < ${ENCHANT_BACK}) -ge $ENCHANT_HISTORY ]] &&
+ sed -i "" 1d ${ENCHANT_BACK}

# copy the current status to the back history, so we can go back to where
we
# are after we jump forward
@@ -187,7 +187,7 @@ function enchant_forward() {
# set the current step to be the one we are jumping to
tail -n 1 ${ENCHANT_FORWARD} > ${ENCHANT_STATUS}
# remove the step we jumped to from the forward history
- head -n -1 ${ENCHANT_FORWARD} > ${ENCHANT_FORWARD}
+ sed -i "" $d ${ENCHANT_FORWARD}
}


#-------------------------------------------------------------------------------
@@ -208,7 +208,7 @@ function enchant_getnum() {
##

#-------------------------------------------------------------------------------
function enchant_gettotal() {
- cat $ENCHANT_DATA/steps | wc -l
+ wc -l < $ENCHANT_DATA/steps
}


#-------------------------------------------------------------------------------
@@ -241,8 +241,8 @@ function enchant_setstep() {
echo "$step" >$ENCHANT_STATUS
# Now we do some work for the back history
# if the max history size has been reached, then we drop the oldest
item
- [[ $(wc -l ${ENCHANT_BACK}) -ge $ENCHANT_HISTORY ]] &&
- tail -n +2 ${ENCHANT_BACK} > ${ENCHANT_BACK}
+ [[ $(wc -l < ${ENCHANT_BACK}) -ge $ENCHANT_HISTORY ]] &&
+ sed -i "" 1d ${ENCHANT_BACK}
# copy the current status to the back history, so we can go back to
where we
# are after we jump forward
cat < ${ENCHANT_STATUS} >> ${ENCHANT_BACK}



  • [SM-Commit] GIT changes to master cauldron by flux (2b4a67aa8e30d613f0beb327d3f93e14dc5873b7), flux, 08/24/2008

Archive powered by MHonArc 2.6.24.

Top of Page