📄 strings.c
字号:
/*************************************************************************** * Copyright (C) 2003 by zhong * * zhongz@163.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/#include <stdio.h>#include <sys/types.h>//#include <errno.h>#include <stdlib.h>#include <string.h>#include <gtk/gtk.h>#include "interface.h"#include "strings.h"// 此函数是为了一些不带“.hhc”文件的CHM文件而生。// 函数读取#strings文件,取得第一个HTML文件后返回。// 这个函数还在测试,结果可能不正确!gchar *get_topurl (ChmSee *window){ int c; gchar *get_name_c = NULL; gchar *get_name = NULL; gchar *s; gchar *strings_file; FILE *strings; strings_file = g_strdup_printf("%s/#strings", window->tmpdir); strings = fopen( strings_file, "rb" ); if (strings) { while(!feof(strings)) { c = fgetc(strings); if (c) { get_name_c = g_strdup_printf ("%c", c); if (get_name) { get_name = g_strdup_printf("%s%s", get_name, get_name_c); } else { get_name = g_strdup_printf("%s", get_name_c); } } else { if (get_name_c) { if ((s = g_strrstr(g_strdown(get_name) , "."))) { if (g_strcasecmp(".htm", s) == 0 || g_strcasecmp(".html", s) == 0) { fclose(strings); g_free(strings_file); g_free(get_name_c); return (get_name); } } get_name = NULL; get_name_c = NULL; } } } g_free(get_name_c); g_free(get_name); fclose(strings); } g_free(strings_file); return (NULL);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -