⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 partname.c

📁 Util-linux 软件包包含许多工具。其中比较重要的是加载、卸载、格式化、分区和管理硬盘驱动器
💻 C
字号:
#include <ctype.h>#include <stdio.h>#include <string.h>#include "common.h"/* * return partition name - uses static storage unless buf is supplied */static char *partnamebf(char *dev, int pno, int lth, int bufsiz, char *bufp) {	static char buffer[80];	char *p;	int w, wp;	if (!bufp) {		bufp = buffer;		bufsiz = sizeof(buffer);	}	w = strlen(dev);	p = "";	if (isdigit(dev[w-1]))		p = "p";	/* devfs kludge - note: fdisk partition names are not supposed	   to equal kernel names, so there is no reason to do this */	if (strcmp (dev + w - 4, "disc") == 0) {		w -= 4;		p = "part";	}	wp = strlen(p);			if (lth) {		snprintf(bufp, bufsiz, "%*.*s%s%-2u",			 lth-wp-2, w, dev, p, pno);	} else {		snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno);	}	return bufp;}char *partname(char *dev, int pno, int lth) {	return partnamebf(dev, pno, lth, 0, NULL);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -