📄 common.c
字号:
/*************************************************************************** common.c - description ------------------- begin : Thu Sep 27 08:08:03 EET 2001 copyright : (C) 2001-2002 by Petri Turunen email : petri.turunen@pete.fi.eu.org ***************************************************************************//*************************************************************************** * * * 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. * * * ***************************************************************************/#ifdef HAVE_CONFIG_H#include <config.h>#endif#include "lparser.h"#include<stdio.h>#include <sys/types.h> //open#include <sys/stat.h> //open#include <fcntl.h> //open#include <stdlib.h> //atof#include <stdarg.h> //va_endchar *rm_first_spaces(char *k){ int lenght,tmp = 0; lenght = strlen(k); while(*k==' ' || *k=='\t'){ k++; if(tmp >= lenght) break; tmp++; } return(k);}int is_comment(char *c){if(*c=='#' || *c=='\0'){ return 0;} else { return 1;}}int slog(int k, char *fmt, ...){//1=no pid & 2= with pidchar message[1024];va_list ap;va_start (ap, fmt);vsnprintf(message, 1024, fmt, ap);if (k==1) { openlog("lparser",LOG_PID,LOG_USER); syslog(LOG_INFO, message); closelog(); return 0; }if (k==2) { openlog("lparser",LOG_PID,LOG_USER); syslog(LOG_ERR, message); closelog(); return 0; }va_end(ap);return 0;}//Writes stuff to socketint send_tcp(unsigned char *buf, int buf_len, int sockfd){ int len; while( buf_len > 0) { len = write(sockfd, buf, buf_len); buf_len -= len; buf += buf_len; } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -