/* Copyright (C) 2001-2002 Kenichi Suto
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "defs.h"
#include "global.h"
void beep(){
FILE *fp;
if(!bbeep_on_nohit)
return;
fp = fopen("/dev/console", "w");
if(fp == NULL){
g_print("fp == NULL\n");
return;
}
fprintf(fp, "\a");
fclose(fp);
}
void remove_space(gchar *f){
char *p;
int i;
p = f;
// 前の不要な部分を削除
for(i=0;;i++){
if((f[i] == ' ') || (f[i] == '\t') || (f[i] == '\n') ||
(f[i] == ',') || (f[i] == '.') || (f[i] == '!') ||
(f[i] == ':') || (f[i] == ';') || (f[i] == '*') ||
(f[i] == '(') || (f[i] == ')') )
p++;
else
break;
}
strcpy(f,p);
// 後ろの不要な部分を削除
for(i=(strlen(p) -1);;i--){
if((f[i] == ' ') || (f[i] == '\t') || (f[i] == '\n') ||
(f[i] == ',') || (f[i] == '.') || (f[i] == '!') ||
(f[i] == ':') || (f[i] == ';') || (f[i] == '*') ||
(f[i] == '(') || (f[i] == ')') )
f[i] = '\0';
else
break;
}
/*
if((p = (char *)index(p, '\n')) != NULL)
*p = '\0';
*/
}
void alloc_colors()
{
int i;
for(i=0 ; i < NUM_COLORS ; i++){
gdk_color_alloc(gdk_colormap_get_system(), &colors[i]);
}
return;
}
gboolean find_file(gchar *filename)
{
struct stat buf;
gint rc;
rc = stat(filename, &buf);
if(rc != 0)
return(FALSE);
return(TRUE);
}
syntax highlighted by Code2HTML, v. 0.9.1