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

📄 misc.c

📁 GNOME下的短信息发送中心
💻 C
字号:
/* * libsms misc - some useful functions * * Authors:     Michael Jochum <e9725005@stud3.tuwien.ac.at> * * TODO:         * * Fixes: * * For license terms, see the file COPYING in the project directory. */#include <string.h>#include <glib.h>#include "misc.h"/* strip trailing CR and LF from the string */void gsms_str_strip_crlf(gchar * str){	gint i;	i = strlen(str) - 1;	if ((i >= 0) && (str[i] == '\n')) {		str[i--] = '\0';		if ((i >= 0) && (str[i] == '\r'))			str[i] = '\0';	}	return;}/* Returns a new allocated string which is a copy of str up to the next   CR or LF if. If thre are no CRLF's this acts like g_strdup.   If next != NULL then a pointer to the beginning of the next line is   returned. If the last line has been reached NULL is returned. */gchar *gsms_str_get_line(const gchar * str, gchar ** next){	gchar *p1, *p2, *end;	p1 = strchr(str, '\n');	p2 = strchr(str, '\r');	if (p2 == NULL)		end = p1;	else if (p1 == NULL)		end = p2;	else		end = p1 > p2 ? p2 : p1;	if (end == NULL) {		if (next != NULL)			*next = NULL;		return g_strdup(str);	}	if (next != NULL) {		*next = end + 1;		if (end[1] == '\n' || end[1] == '\r')			*next += 1;	}	return g_strndup(str, end - str);}

⌨️ 快捷键说明

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