贴吧用户_5M5MeAS 传说狂妄之人
关注数: 9 粉丝数: 8 发帖数: 1,116 关注贴吧数: 15
有人看得懂这段shell么 来自Debian_installer的apt-install脚本想着可以离线注入软件包来急救,就翻了翻,但却看不懂,求指教 #!/bin/sh set -e . /usr/share/debconf/confmodule . /lib/chroot-setup.sh NO_RECOMMENDS= WITH_RECOMMENDS= ALLOW_REMOVE= OPTS= while :; do case $1 in --no-recommends) NO_RECOMMENDS=1 OPTS="$OPTS $1" ;; --with-recommends) WITH_RECOMMENDS=1 OPTS="$OPTS $1" ;; --allow-remove) ALLOW_REMOVE=1 OPTS="$OPTS $1" ;; -*) logger -t apt-install "Ignored unrecognized option '$1'" ;; *) break ;; esac shift done packages=$@ queue=/var/lib/apt-install/queue # If we don't have a working mirror yet, only queue the package; # it will be installed later by the postinst in base-installer if [ ! -e /target/etc/apt/sources.list ]; then # Add to list of extra packages to be installed into /target/. mkdir -p /var/lib/apt-install touch $queue for pkg in $packages; do if ! grep -Eq "^$pkg([[:space:]]|$)" $queue; then logger -t apt-install "Queueing package $pkg for later installation" echo "$pkg$OPTS" >> $queue fi done exit 1 # Return error as the package is not ready to be used yet. fi REMOUNT_CD="" if [ -e /var/lib/install-cd.id ] && \ grep -q " /cdrom " /proc/mounts; then REMOUNT_CD=1 log-output -t apt-install umount /cdrom || true fi apt_opts="-q -y" if [ -z "$ALLOW_REMOVE" ]; then apt_opts="$apt_opts --no-remove" fi if [ "$WITH_RECOMMENDS" ]; then apt_opts="$apt_opts -o APT::Install-Recommends=true" elif [ "$NO_RECOMMENDS" ]; then apt_opts="$apt_opts -o APT::Install-Recommends=false" fi ERRCODE=0 in-target sh -c "debconf-apt-progress --no-progress --logstderr -- \ apt-get $apt_opts install $packages" || ERRCODE=$? if [ "$REMOUNT_CD" ]; then load-install-cd "/target" || true fi if [ "$ERRCODE" != 0 ]; then exit $ERRCODE else exit 0 fi
小白在线求问,为什么编译会有这么多警告,且编译通过后无法运行 虚拟机windows7使用TDM-GCC 64位最新版本,代码: #include <stdio.h> #include <stdlib.h> int a,b; int *p1,*p2; int main(){ scanf('%d,%d',&a,&b); p1=&a; p2=&b; printf("%d,%d",*p1,*p2); free(*p1); free(*p2); return 0; } 想要学一下指针,结果编译报警告 C:\a.c: In function 'main': C:\a.c:8:11: warning: character constant too long for its type scanf('%d,%d',&a,&b); ^ C:\a.c:8:11: warning: passing argument 1 of 'scanf' makes pointer from integer w ithout a cast [-Wint-conversion] In file included from C:\a.c:1:0: C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdio.h:386:15: note: expected 'const c har * restrict' but argument is of type 'int' int __cdecl scanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRE CATED_SEC_WARN; ^ C:\a.c:12:10: warning: passing argument 1 of 'free' makes pointer from integer w ithout a cast [-Wint-conversion] free(*p1); ^ In file included from C:\a.c:2:0: C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdlib.h:447:16: note: expected 'void * ' but argument is of type 'int' void __cdecl free(void *_Memory); ^ C:\a.c:13:10: warning: passing argument 1 of 'free' makes pointer from integer w ithout a cast [-Wint-conversion] free(*p2); ^ In file included from C:\a.c:2:0: C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdlib.h:447:16: note: expected 'void * ' but argument is of type 'int' void __cdecl free(void *_Memory); ^ C:\Users\Administrator>gcc C:\a.c >> C:/a.txt C:\a.c: In function 'main': C:\a.c:8:11: warning: character constant too long for its type scanf('%d,%d',&a,&b); ^ C:\a.c:8:11: warning: passing argument 1 of 'scanf' makes pointer from integer w ithout a cast [-Wint-conversion] In file included from C:\a.c:1:0: C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdio.h:386:15: note: expected 'const c har * restrict' but argument is of type 'int' int __cdecl scanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRE CATED_SEC_WARN; ^ C:\a.c:12:10: warning: passing argument 1 of 'free' makes pointer from integer w ithout a cast [-Wint-conversion] free(*p1); ^ In file included from C:\a.c:2:0: C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdlib.h:447:16: note: expected 'void * ' but argument is of type 'int' void __cdecl free(void *_Memory); ^ C:\a.c:13:10: warning: passing argument 1 of 'free' makes pointer from integer w ithout a cast [-Wint-conversion] free(*p2); ^ In file included from C:\a.c:2:0: C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdlib.h:447:16: note: expected 'void * ' but argument is of type 'int' void __cdecl free(void *_Memory); 怎么办啊
1 下一页