path: root/sh-i18n--envsubst.c
AgeCommit message (Collapse)Author
2011-06-30Merge branch 'js/i18n-windows'Junio C Hamano
* js/i18n-windows: Windows: teach getenv to do a case-sensitive search mingw.c: move definition of mingw_getenv down sh-i18n--envsubst: do not crash when no arguments are given
2011-06-17Merge branch 'ab/i18n-scripts-basic'Junio C Hamano
* ab/i18n-scripts-basic: sh-i18n--envsubst.c: do not #include getopt.h
2011-06-17sh-i18n--envsubst.c: do not #include getopt.hBrandon Casey
The getopt.h header file is not used. It's inclusion is left over from the original version of this source. Additionally, getopt.h does not exist on all platforms (SunOS 5.7) and will cause a compilation failure. So, let's remove it. Signed-off-by: Brandon Casey <> Signed-off-by: Junio C Hamano <>
2011-06-06sh-i18n--envsubst: do not crash when no arguments are givenJohannes Sixt
Signed-off-by: Johannes Sixt <> Signed-off-by: Junio C Hamano <>
2011-05-25sh-18n: quell "unused variable" warningMichael J Gruber
show_variables is set but never used. Comment it out rather than remove it so that the relation with upstream remains clear. Signed-off-by: Michael J Gruber <> Signed-off-by: Junio C Hamano <>
2011-05-15git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()Ævar Arnfjörð Bjarmason
Add a git-sh-i18n--envsubst program which is a stripped-down version of the GNU envsubst(1) program that comes with GNU gettext for use in the eval_gettext() fallback. We need a C helper program because implementing eval_gettext() purely in shell turned out to be unworkable. Digging through the Git mailing list archives will reveal two shell implementations of eval_gettext that are almost good enough, but fail on an edge case which is tested for in the tests which are part of this patch. These are the modifications I made to envsubst.c as I turned it into sh-i18n--envsubst.c: * Added our git-compat-util.h header for xrealloc() and friends. * Removed inclusion of gettext-specific headers. * Removed most of main() and replaced it with my own. The modified version only does option parsing for --variables. That's all it needs. * Modified error() invocations to use our error() instead of error(3). * Replaced the gettext XNMALLOC(n, size) macro with just xmalloc(n). Since XNMALLOC() only allocated char's. * Removed the string_list_destroy function. It's redundant (also in the upstream code). * Replaced the use of stdbool.h (a C99 header) by doing the following replacements on the code: * s/bool/unsigned short int/g * s/true/1/g * s/false/0/g Reported-by: Johannes Sixt <> Signed-off-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Junio C Hamano <>