pdflatex.sh:
#!/bin/sh usage(){ echo "Usage: pdflatex.sh filename" echo "Author: Yao Wu <wuyao721@163.com>" echo "Version: 0.1.0" echo "Build date: 2010/08/24" echo "Description: A Program convert LaTex document to PDF document for Simplified Chinese user" echo " Non-English user who use latex to convert LaTex document to PDF document may come across this problem: " echo " The bookmark of a PDF document become irregnizable code." echo " " echo " Convert the .out file to a special UNICODE format can fix this problem." echo " Why? Because AcroRead support it." echo " " echo " There is a program which is 'gbk2uni' can to convert GBK to the special UNICODE," echo " and this program use it convert a LaTex Document to PDF document." echo " " echo " If you just want to do something with the bookmark for a PDF document, please use 'utf2uni.sh'." echo " " echo " Make sure you have 'gbk2uni' which needed by this program." } if [ $# -ne 1 ]; then usage exit 1 fi if [ $1 = "-v" ] || [ $1 = "-h" ] || [ $1 = "-help" ] || [ $1 = "--help" ]; then usage exit 0 fi File=$1.tex OutFile=${1}.out gbk2uni > /dev/null if [ $? -eq 127 ]; then echo "Program gbk2uni no found, abort." exit 1 fi if [ ! -f ${File} ]; then echo "Maybe '${1}' contain suffix, remove it and try again." echo "${File} not found, abort." exit 1 fi if [ -z "`file ${File} |grep LaTeX`" ]; then echo "${File} not like LateX document, abort." exit 1 fi if [ -f ${OutFile} ]; then echo "${OutFile} exists, will rename it to '${OutFile}.backup'." mv ${OutFile} ${OutFile}.backup fi if ! pdflatex ${File} > /dev/null; then echo "Generate ${1}.pdf false for the first time." exit 1 fi if [ ! -z "`file ${OutFile} |grep UTF-8`" ]; then iconv -f utf-8 -t gbk -o ${OutFile} ${OutFile} gbk2uni ${OutFile} > /dev/null else gbk2uni ${OutFile} > /dev/null fi if ! pdflatex ${File} > /dev/null; then echo "Generate ${1}.pdf false for the second time." exit 1 fi #echo "Will delete dump file." rm -rf ${1}.out ${1}.log ${1}.out.bak ${1}.toc ${1}.aux echo "Done."
utf2uni.sh:
#!/bin/sh usage(){ echo "Usage: utf2uni.sh filename" echo "Author: Yao Wu <wuyao721@163.com>" echo "Version: 0.1.0" echo "Build date: 2010/08/23" echo "Description: A bookmark formatter about LaTex document and PDF document for Simplified Chinese user" echo " Non-English user who use latex to convert LaTex document to PDF document may come across this problem: " echo " The bookmark of a PDF document become irregnizable code." echo " " echo " Convert the .out file to a special UNICODE format can fix this problem." echo " Why? Because AcroRead support it." echo " " echo " There is a program which is 'gbk2uni' can to convert gbk to the special UNICODE," echo " and this program is used to convert UTF-8 format to the special UNICODE format." echo " " echo " If your .out's format is GBK, please just use 'gbk2uni'." echo " " echo " Make sure you have 'gbk2uni' which needed by this program." } if [ $# -ne 1 ]; then usage exit 1 fi if [ $1 = "-v" ] || [ $1 = "-h" ] || [ $1 = "-help" ] || [ $1 = "--help" ]; then usage exit 0 fi gbk2uni > /dev/null if [ $? -eq 127 ]; then echo "Program gbk2uni no found, abort." exit 1 fi if [ ! -f $1 ]; then echo "$1 not found, abort." exit 1 fi if [ -z "`file ${1} |grep UTF-8`" ]; then echo "${1} seem not a UTF-8 file, abort." exit 1 fi cp ${1} ${1}.backup iconv -f utf-8 -t gbk -o ${1} ${1} gbk2uni ${1} mv ${1}.backup ${1}.bak echo "Done. The original file is backed up to '${1}.bak'."
linux下編譯c++程序遇到 error: ‘thread’ is not a member of ‘std’的錯誤 原因:因爲GCC/G++默認的-std(即C++語言標準)不是C++11,在這裏默認的是C++98。 解決:需要顯式地
一、read/write 函數 read函數從打開的設備或文件中讀取數據。 #include <unistd.h> ssize_t read(int fd, void *buf, size_t count); 返回值:成功返回讀
先來看看C標準I/O庫函數是如何用系統調用實現的。 fopen(3) 調用open(2)打開指定的文件,返回一個文件描述符(就是一個int 類型的編號),分配一 個FILE 結構體, 通常裏面包含了: 文件fd緩衝區指針緩衝區長度當
(setq load-path (cons "~/.sawfish/lisp" load-path)) (setq default-font (get-font "-dejavu-dejavu sans mono-mediu
來源:http://www.xxlinux.com/linux/article/development/soft/20071214/13352.html GNU binutils 是一組二進制工具集。包括: addr2line a
bash如何讀文本並保存到變量 對於‘讀文本並保存到變量’這一問題,bash提供了很多辦法。 假設有文件名爲file1,內容爲: line 1 line 2 line 3 1.利用管道將cat的輸出轉化爲read的輸入 LINE="tes
Linux內核驅動加載過程 驅動加載分爲兩種情況:靜態加載和動態加載。 1. 靜態加載 靜態加載的方法是把驅動程序直接編譯進內核,然後內核在啓動過程中由do_initcall()函數加載。 do_initcalls()函數路徑在/init
內核啓動前需要滿足的條件(寄存器,CPU,Cache、MMU): 1. CPU寄存器的設置: ①R0 = 0 ②R1爲機器碼 ③R2爲啓動參數,標記列表在RAM中的起始地址 2.CPU工作模式 ①必須禁止中
公司有個任務需要編譯60個c語言小程序,工程目錄結構爲: src:放所有小程序源文件.c drv:所有小程序編譯後都爲對應.drv 其它頭文件、庫目錄省略。 makefile不太熟,也很菜,我第一想法
今天在看《UNIX網絡編程》的時候,看到了守護進程的創建,代碼中fork了兩次,並且第一次fork後對子進程調用setsid(),有些懵。當時搜了下setsid也是看得有點雲裏霧裏。後來折騰了一下午,纔算有點明白,這裏把自己的一點
Linux編程之IO多路複用(I/O Multiplexing) 程序設計過程中有時候會對多個輸入進行操作,例如標準輸入或者多個socket。那麼如果在對某個進行處理的時候阻塞住的話,另外的輸入進來的話會得不到及時的處理。(比如客
1、使用linux的mout函數掛載 #include <stdio.h> #include <sys/mount.h> #include <errno.h> #include <unistd.h> #include <sys/s
1、查看進程打開的描述符 ll /proc/$PID/fd 2、C語言獲取當前進程打開的fd並設置FD_CLOEXEC #include <stdio.h> #include <errno.h> #include <unist
KVM是一個基於linux內核的虛擬機解決方案。本文介紹KVM的使用方法,以及注意要點。 參考資料: KVM虛擬機和QEMU linux brctl 先決條件 硬件環境 CPU硬件虛擬化 32位與64位 安裝K
我大部分時間使用Linux操作系統(Debian Lenny),不過很多時間還是要Windows的(比方說網上銀行、看doc文檔、看Windows專用的網站、war3),雙系統是一個解決方案,不 過老切來切去真累。今天終於爆發了,跑到太平