关于unp.h
来源:互联网 发布:angular.min.js.map 编辑:程序博客网 时间:2024/06/08 14:49
最近在学UNIX下的网络编程,所以就找来一本UNIX网络编程看了看。结果刚看到第一章的第一个例子的时候傻眼了。unp.h,貌似没见过,百度百科后知道是要自己下载的,
所以就试试了。我分为3步。
1,先从网上下载一个叫unpv.13e.tar.gz的东东。
2,解压后make。(解压后在终端下进入解压后的目录下。执行下面的命令行)
(1) ./configure
(2)cd lib
(3)make
完成后即在在根目录中生成libunp.a文件。然后打开子目录lib下的unp.h文件。将里面的unp.h中将#include "../config.h"改成#include "config.h" ,如果已经是。则不用改。
3,拷贝文件。(需要有拷贝的权限,所以我是切换到root用户下去做的)
(1)将刚生成的libunp.a文件复制这个静态库到/usr/lib/和/usr/lib64/中,
(2)将刚改过的unp.h文件和主目录的config.h文件拷贝到/usr/include中。
这三个做完后。就已经接近尾声了。当你把例子完完整整的敲上后,编译发现还是有问题。没有err_为前缀的函数,那是因为少了一个库文件(apueerror.h),在网上找到后。将文件拷贝到/usr/include 中后。编译ok。
下面将apueerror.h的代码复制出来。
- #include <errno.h> /* for definition of errno */
- #include <stdarg.h> /* ISO C variable aruments */
- static void err_doit(int, int, const char *, va_list);
- /*
- * Nonfatal error related to a system call.
- * Print a message and return.
- */
- void
- err_ret(const char *fmt, ...)
- {
- va_list ap;
- va_start(ap, fmt);
- err_doit(1, errno, fmt, ap);
- va_end(ap);
- }
- /*
- * Fatal error related to a system call.
- * Print a message and terminate.
- */
- void
- err_sys(const char *fmt, ...)
- {
- va_list ap;
- va_start(ap, fmt);
- err_doit(1, errno, fmt, ap);
- va_end(ap);
- exit(1);
- }
- /*
- * Fatal error unrelated to a system call.
- * Error code passed as explict parameter.
- * Print a message and terminate.
- */
- void
- err_exit(int error, const char *fmt, ...)
- {
- va_list ap;
- va_start(ap, fmt);
- err_doit(1, error, fmt, ap);
- va_end(ap);
- exit(1);
- }
- /*
- * Fatal error related to a system call.
- * Print a message, dump core, and terminate.
- */
- void
- err_dump(const char *fmt, ...)
- {
- va_list ap;
- va_start(ap, fmt);
- err_doit(1, errno, fmt, ap);
- va_end(ap);
- abort(); /* dump core and terminate */
- exit(1); /* shouldn't get here */
- }
- /*
- * Nonfatal error unrelated to a system call.
- * Print a message and return.
- */
- void
- err_msg(const char *fmt, ...)
- {
- va_list ap;
- va_start(ap, fmt);
- err_doit(0, 0, fmt, ap);
- va_end(ap);
- }
- /*
- * Fatal error unrelated to a system call.
- * Print a message and terminate.
- */
- void
- err_quit(const char *fmt, ...)
- {
- va_list ap;
- va_start(ap, fmt);
- err_doit(0, 0, fmt, ap);
- va_end(ap);
- exit(1);
- }
- /*
- * Print a message and return to caller.
- * Caller specifies "errnoflag".
- */
- static void
- err_doit(int errnoflag, int error, const char *fmt, va_list ap)
- {
- char buf[MAXLINE];
- vsnprintf(buf, MAXLINE, fmt, ap);
- if (errnoflag)
- snprintf(buf+strlen(buf), MAXLINE-strlen(buf), ": %s",
- strerror(error));
- strcat(buf, "/n");
- fflush(stdout); /* in case stdout and stderr are the same */
- fputs(buf, stderr);
- fflush(NULL); /* flushes all stdio output streams */
- }
- 关于unp.h
- unp.h文件内容
- unp.h的使用
- unp.h的使用
- unp.h的使用
- unp.h的使用
- unp.h怎么使用
- unp.h的使用
- unix网络编程(UNP),unp.h生成config.h
- 《网络编程》关于 UNIX网络编程 卷1 的 unp.h 和源码编译问题
- 《网络编程》关于 UNIX网络编程 卷1 的 unp.h 和源码编译问题
- 《网络编程》关于 UNIX网络编程 卷1 的 unp.h 和源码编译问题
- unp.h及网络编程UNP所有代码的下载
- 《Unix 网络编程》 unp.h头文件
- 配置unp.h头文件环境
- unix网络编程 unp.h解决方法
- unp.h头文件的安装
- unp.h undefined reference to `Socket'
- fatal error LNK1104: 无法打开文件“libExtensions.obj”
- 编码20年的老程序员分享所积累的20条编程经验
- DOS中断/BIOS中断
- Generic Access Profile (GAP)
- struts标签:<s:action> Action标签
- 关于unp.h
- Xenstore and Xenbus
- 8088 汇编速查手册(转集)
- USTCOJ 1382 毛毛虫
- Launch error: Failed to connect to remote VM
- 基于X86平台装有Linux的中找出vmlinux
- 控制寄存器和系统地址寄存器
- [Tree]树与中序遍历
- cuda by example 调试时候的若干问题的解决方案