?? sms_address.c
字號:
/* -------------------------------------------------------------------- *//* SMS Client, send messages to mobile phones and pagers *//* *//* sms_address.c *//* *//* Copyright (C) 1997,1998 Angelo Masci *//* *//* This library is free software; you can redistribute it and/or *//* modify it under the terms of the GNU Library General Public *//* License as published by the Free Software Foundation; either *//* version 2 of the License, or (at your option) any later version. *//* *//* This library 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 *//* Library General Public License for more details. *//* *//* You should have received a copy of the GNU Library General Public *//* License along with this library; if not, write to the Free *//* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//* *//* You can contact the author at this e-mail address: *//* *//* angelo@styx.demon.co.uk *//* *//* -------------------------------------------------------------------- *//* $Id: sms_address.c,v 1.5 1998/01/17 22:49:15 root Exp $ -------------------------------------------------------------------- */#include <stdio.h>#include <errno.h>#include <unistd.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#if defined(LINUX)#include <getopt.h>#endif#if defined(NEXT)#include <libc.h>#endif#include "sms_list.h"#include "parserc.h"#include "common.h"/* -------------------------------------------------------------------- */#if !defined(MVERSION)#error "MVERSION undefined"#else#define VERSION MVERSION#endif/* -------------------------------------------------------------------- */void usage(char *file);int main(int, char *[]);/* -------------------------------------------------------------------- *//* -------------------------------------------------------------------- */void usage(char *file){ printf("Usage: %s [-v]\n", file); printf(" %s [-l] [-d delimeter] name[,name]\n", file);}/* -------------------------------------------------------------------- *//* -------------------------------------------------------------------- */int main(int argc, char *argv[]){ int c, long_flag, delimeter; SMS_list *node, *numbers; FILE *fp[2]; char *sms_default_service = NULL; /* ---------------------------- */ delimeter = ':'; long_flag = FALSE; while ((c = getopt (argc, argv, "vld:")) != -1) { switch (c) { case 'v': printf("%s %s\n", argv[0], VERSION); exit(0); case 'l': long_flag = TRUE; break; case 'd': if (sms_strlen(optarg) > 1) { fprintf(stderr, "Invalid delimeter `%s'\n", optarg); usage(argv[0]); exit(-1); } delimeter = optarg[0]; break; case '?':#if !defined(NEXT) fprintf(stderr, "Unknown option `-%c'\n", optopt);#endif usage(argv[0]); exit(-1); default: abort (); } } /* ---------------------------- */ /* Get Default SERVICE */ SMS_dual_openrc(fp); if (sms_default_service == NULL) { sms_default_service = SMS_dual_get_smsrc_value(fp, "SMS_default_service"); if (sms_default_service == NULL) { fprintf(stderr, "Could not find SMS_default_service\n"); exit(-1); } } SMS_dual_closerc(fp); /* ---------------------------- */ /* Get and expand NAMES|NUMBERS */ SMS_dual_openrc(fp); numbers = SMS_expandnumber(fp, "<NULL>", argv[optind], sms_default_service); SMS_dual_closerc(fp); /* ---------------------------- */ /* Check NAMES|NUMBERS */ if (validate_expanded_numbers(numbers)) { fprintf(stderr, "ERROR: Expanding names\n"); exit(-1); } /* ---------------------------- */ node = get_first(numbers); while (node != NULL) { printf("%s%c%s%c%s\n", node->name, delimeter, node->service, delimeter, node->number); node = get_next(node); } free_list(numbers); return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -