return 0;
}
+
+int libsys_parse_cmdline_scanf(const char *format, ...)
+{
+ FILE *fp = NULL;
+ char *token = NULL;
+ size_t len = 0;
+ va_list ap;
+ int ret = 0;
+
+ fp = fopen("/proc/cmdline", "r");
+ if (!fp)
+ return 0;
+
+ va_start(ap, format);
+
+ while (getdelim(&token, &len, ' ', fp) != EOF) {
+ ret = vsscanf(token, format, ap);
+ if (ret > 0)
+ break;
+ }
+
+ free(token);
+ va_end(ap);
+ fclose(fp);
+
+ return ret;
+}
#ifndef __LIBCOMMON_FILE_H__
#define __LIBCOMMON_FILE_H__
+#include <stdarg.h>
+
int sys_read_buf(char *file, char *buf, int len);
int sys_write_buf(char *file, char *buf);
int sys_get_int(char *fname, int *val);
int sys_get_str(char *fname, char *str, int len);
int sys_set_int(char *fname, int val);
int sys_set_str(char *fname, char *val);
+int libsys_parse_cmdline_scanf(const char *format, ...);
#endif /* __LIBCOMMON_FILE_H__ */